Commit 87724e6c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

plug-ins/common/CML_explorer.c use g_ascii_dtostr() to serialize floats.

2002-12-16  Michael Natterer  <mitch@gimp.org>

	* plug-ins/common/CML_explorer.c
	* plug-ins/common/spheredesigner.c: use g_ascii_dtostr() to
	serialize floats.
parent 2f46b758
2002-12-16 Michael Natterer <mitch@gimp.org>
* plug-ins/common/CML_explorer.c
* plug-ins/common/spheredesigner.c: use g_ascii_dtostr() to
serialize floats.
2002-12-16 Michael Natterer <mitch@gimp.org>
 
* plug-ins/common/ps.c (save_ps_setup): applied a patch from
......
......@@ -2170,6 +2170,8 @@ CML_execute_save_to_file (GtkWidget *widget,
fprintf (file, ";\n");
for (channel_id = 0; channel_id < 3; channel_id++)
{
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
CML_PARAM param = *(CML_PARAM *)(channel_params[channel_id]);
fprintf (file, "\t%s\n", channel_names[channel_id]);
......@@ -2181,17 +2183,26 @@ CML_execute_save_to_file (GtkWidget *widget,
param.arrange, arrange_names[param.arrange]);
fprintf (file, "Cyclic_range : %d (%s)\n",
param.cyclic_range, (param.cyclic_range ? "TRUE" : "FALSE"));
fprintf (file, "Mod. rate : %f\n", param.mod_rate);
fprintf (file, "Env_sensitivtiy : %f\n", param.env_sensitivity);
fprintf (file, "Mod. rate : %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.mod_rate));
fprintf (file, "Env_sensitivtiy : %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.env_sensitivity));
fprintf (file, "Diffusion dist. : %d\n", param.diffusion_dist);
fprintf (file, "Ch. sensitivity : %f\n", param.ch_sensitivity);
fprintf (file, "Ch. sensitivity : %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.ch_sensitivity));
fprintf (file, "Num. of Subranges: %d\n", param.range_num);
fprintf (file, "Power_factor : %f\n", param.power);
fprintf (file, "Parameter_k : %f\n", param.parameter_k);
fprintf (file, "Range_low : %f\n", param.range_l);
fprintf (file, "Range_high : %f\n", param.range_h);
fprintf (file, "Mutation_rate : %f\n", param.mutation_rate);
fprintf (file, "Mutation_distance: %f\n", param.mutation_dist);
fprintf (file, "Power_factor : %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.power));
fprintf (file, "Parameter_k : %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.parameter_k));
fprintf (file, "Range_low : %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.range_l));
fprintf (file, "Range_high : %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.range_h));
fprintf (file, "Mutation_rate : %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.mutation_rate));
fprintf (file, "Mutation_distance: %s\n",
g_ascii_dtostr (buf, sizeof (buf), param.mutation_dist));
}
fprintf (file, "\n");
fprintf (file, "Initial value : %d (%s)\n",
......
......@@ -1778,24 +1778,45 @@ void loadpreset_ok(GtkWidget *w, GtkFileSelection *fs)
void saveit(char *fn)
{
int i;
gint i;
FILE *f;
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
f = fopen(fn, "wt");
for(i = 0; i < s.com.numtexture; i++) {
texture *t = &s.com.texture[i];
if(t->majtype < 0) continue;
fprintf(f, "%d %d %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\n",
t->majtype, t->type,
t->color1.x,t->color1.y,t->color1.z,t->color1.w,
t->color2.x,t->color2.y,t->color2.z,t->color2.w,
t->oscale, t->turbulence.x, t->amount, t->exp,
t->scale.x,t->scale.y,t->scale.z,
t->rotate.x,t->rotate.y,t->rotate.z,
t->translate.x,t->translate.y,t->translate.z);
}
fclose(f);
f = fopen (fn, "wt");
for (i = 0; i < s.com.numtexture; i++)
{
texture *t = &s.com.texture[i];
if (t->majtype < 0)
continue;
fprintf (f, "%d %d", t->majtype, t->type);
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->color1.x));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->color1.y));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->color1.z));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->color1.w));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->color2.x));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->color2.y));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->color2.z));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->color2.w));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->oscale));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->turbulence.x));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->amount));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->exp));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->scale.x));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->scale.y));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->scale.z));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->rotate.x));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->rotate.y));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->rotate.z));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->translate.x));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->translate.y));
fprintf (f, " %s", g_ascii_dtostr (buf, sizeof (buf), t->translate.z));
fprintf (f, "\n");
}
fclose (f);
}
void savepreset_ok(GtkWidget *w, GtkFileSelection *fs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment