226 if (fwrite (&
img -> back -> gradient,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
227 if (
img -> back -> gradient)
229 if (fwrite (&
img -> back -> direction,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
237 if (this_proj -> modelgl -> custom_map != NULL)
img -> color_map[0] += 10;
238 if (fwrite (
img -> color_map,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
239 if (this_proj -> modelgl -> custom_map != NULL)
241 img -> color_map[0] -= 10;
242 colormap * map = this_proj -> modelgl -> custom_map;
243 if (fwrite (& map -> points,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
244 if (fwrite (& map -> cmax,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
245 if (fwrite (& map -> cmin,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
246 if (fwrite (map -> positions,
sizeof(
float), map -> points,
fp) != map -> points)
return ERROR_RW;
247 if (fwrite (map -> values,
sizeof(
ColRGBA), map -> points,
fp) != map -> points)
return ERROR_RW;
248 for (i=0; i<this_proj -> steps; i++)
250 if (fwrite (map -> data[i],
sizeof(
float), this_proj -> natomes,
fp) != this_proj -> natomes)
return ERROR_RW;
256 if (fwrite (
img -> sphererad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
257 if (fwrite (
img -> pointrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
258 if (fwrite (
img -> atomicrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
260 for (i=0; i<sid*2; i++)
262 if (fwrite (
img -> bondrad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
263 if (fwrite (
img -> linerad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
265 if (fwrite (
img -> radall,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
266 if (fwrite (&
img -> draw_clones,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
272 if (fwrite (
img -> acl_format,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
274 if (fwrite (
img -> mtilt,
sizeof(gboolean), 2,
fp) != 2)
return ERROR_RW;
275 if (fwrite (
img -> mpattern,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
276 if (fwrite (
img -> mfactor,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
277 if (fwrite (
img -> mwidth,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
278 if (fwrite (&
img -> m_is_pressed,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
286 if (fwrite (&
img -> p_depth,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
287 if (fwrite (&
img -> gnear,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
288 if (fwrite (&
img -> gfar,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
289 if (fwrite (&
img -> gleft,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
290 if (fwrite (&
img -> gright,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
291 if (fwrite (&
img -> gtop,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
292 if (fwrite (&
img -> gbottom,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
294 if (fwrite (&
img -> rotation_mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
296 if (fwrite (
img -> c_shift,
sizeof(GLdouble), 2,
fp) != 2)
return ERROR_RW;
297 if (fwrite (&
img -> style,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
298 if (fwrite (&
img -> quality,
sizeof(GLint), 1,
fp) != 1)
return ERROR_RW;
300 if (fwrite (&
img -> l_ghtning.lights,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
301 for (i=0; i<
img -> l_ghtning.lights; i++)
303 if (fwrite (&
img -> l_ghtning.spot[i].type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
304 if (fwrite (&
img -> l_ghtning.spot[i].fix,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
305 if (fwrite (&
img -> l_ghtning.spot[i].show,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
306 if (fwrite (&
img -> l_ghtning.spot[i].position,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
307 if (fwrite (&
img -> l_ghtning.spot[i].direction,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
308 if (fwrite (&
img -> l_ghtning.spot[i].intensity,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
309 if (fwrite (&
img -> l_ghtning.spot[i].attenuation,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
310 if (fwrite (&
img -> l_ghtning.spot[i].spot_data,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
312 if (fwrite (&
img -> m_terial.predefine,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
314 if (fwrite (
img -> m_terial.param,
sizeof(GLfloat), 6,
fp) != 6)
return ERROR_RW;
315 if (fwrite (&
img -> f_g.mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
316 if (fwrite (&
img -> f_g.based,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
317 if (fwrite (&
img -> f_g.density,
sizeof(
float), 1,
fp) != 1)
return ERROR_RW;
318 if (fwrite (
img -> f_g.depth,
sizeof(
float), 2,
fp) != 2)
return ERROR_RW;
321 if (fwrite (&
img -> filled_type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
328 for (j=0; j<sid; j++)
330 if (fwrite (
img -> spcolor[i][j],
sizeof(
ColRGBA), this_proj -> coord -> ntg[i][j],
fp) != this_proj -> coord -> ntg[i][j])
return ERROR_RW;
335 j = (this_proj -> modelgl -> adv_bonding[i-2] && this_proj -> coord -> totcoord[i]) ? this_proj -> coord -> totcoord[i] : 0;
336 if (fwrite (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
339 if (fwrite (
img -> spcolor[i][0],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[i],
fp) != this_proj -> coord -> totcoord[i])
return ERROR_RW;
343 if (fwrite (& this_proj -> modelgl -> rings,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
344 if (this_proj -> modelgl -> rings)
349 this_proj -> modelgl -> ring_max[i],
350 this_proj -> modelgl -> num_rings[i],
351 this_proj -> modelgl -> show_rpoly[i],
352 this_proj -> modelgl -> all_rings[i]) !=
OK)
return ERROR_RINGS;
355 if (fwrite (& this_proj -> modelgl ->
chains,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
356 if (this_proj -> modelgl ->
chains)
359 this_proj -> modelgl -> chain_max,
360 this_proj -> modelgl -> num_chains,
364 if (this_proj -> modelgl ->
volumes)
367 if (fwrite (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
370 if (fwrite (this_proj -> modelgl -> atoms_volume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
371 if (fwrite (this_proj -> modelgl -> atoms_ppvolume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
372 for (j=0; j<this_proj -> steps; j++)
374 if (fwrite (this_proj -> modelgl -> volume_box[i][j],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
380 if (this_proj -> modelgl -> adv_bonding[0])
382 if (fwrite (& this_proj -> coord -> totcoord[2],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
386 for (k=0; k<this_proj -> steps; k++)
388 for (l=0; l<this_proj -> coord -> totcoord[2]; l++)
390 if (this_proj -> modelgl -> fm_comp_vol[0][i][k][l]) j++;
393 if (fwrite (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
396 for (k=0; k<this_proj -> steps; k++)
398 for (l=0; l<this_proj -> coord -> totcoord[2]; l++)
400 if (this_proj -> modelgl -> fm_comp_vol[0][i][k][l])
402 if (fwrite (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
403 if (fwrite (& l,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
404 if (fwrite (& this_proj -> modelgl -> frag_mol_ppvolume[0][i][k][l],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
405 if (fwrite (this_proj -> modelgl -> frag_box[i][k][l],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
409 if (fwrite (
img -> fm_show_vol[0][i],
sizeof(gboolean), this_proj -> coord -> totcoord[2],
fp) != this_proj -> coord -> totcoord[2])
return ERROR_RW;
410 if (fwrite (
img -> fm_vol_col[0][i],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[2],
fp) != this_proj -> coord -> totcoord[2])
return ERROR_RW;
413 if (this_proj -> modelgl -> adv_bonding[1])
415 if (fwrite (& this_proj -> coord -> totcoord[3],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
419 for (k=0; k<this_proj -> steps; k++)
421 for (l=0; l<this_proj -> coord -> totcoord[3]; l++)
423 if (this_proj -> modelgl -> fm_comp_vol[1][i][k][l]) j++;
426 if (fwrite (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
429 for (k=0; k<this_proj -> steps; k++)
431 for (l=0; l<this_proj -> coord -> totcoord[3]; l++)
433 if (this_proj -> modelgl -> fm_comp_vol[1][i][k][l])
435 if (fwrite (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
436 if (fwrite (& l,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
437 if (fwrite (& this_proj -> modelgl -> frag_mol_ppvolume[1][i][k][l],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
441 if (fwrite (
img -> fm_show_vol[1][i],
sizeof(gboolean), this_proj -> coord -> totcoord[3],
fp) != this_proj -> coord -> totcoord[3])
return ERROR_RW;
442 if (fwrite (
img -> fm_vol_col[1][i],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[3],
fp) != this_proj -> coord -> totcoord[3])
return ERROR_RW;
449 if (fwrite (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
455 if (fwrite (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
461 if (fwrite (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
464 for (i=0; i<this_proj -> steps; i++)
466 for (j=0; j< this_proj -> natomes; j++)
475 if (fwrite (&
img -> selected[i] -> selected,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
476 if (
img -> selected[i] -> selected)
479 for (j=0; j<
img -> selected[i] -> selected; j++)
481 if (fwrite (& at ->
id,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
482 if (at -> next) at = at -> next;
484 if (
img -> selected[i] -> selected >= 2 &&
img -> selected[i] -> selected <= 20)
487 if (fwrite (
img -> selected[i] -> selected_bonds,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
488 if (
img -> selected[i] -> selected >= 3)
491 if (fwrite (
img -> selected[i] -> selected_angles,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
492 if (
img -> selected[i] -> selected >= 4 &&
img -> selected[i] -> selected <= 10)
495 if (fwrite (
img -> selected[i] -> selected_dihedrals,
sizeof(
int), j,
fp) != j)
return ERROR_RW;