167 int * tmpcoo, * tmpcoord;
170 if (fread (& view -> ring_max[rid],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
171 if (view -> ring_max[rid])
173 view -> num_rings[rid] =
allocdint (steps, size);
174 view -> show_rpoly[rid] = g_malloc0 (steps*
sizeof*view -> show_rpoly[rid]);
175 view -> all_rings[rid] = g_malloc0 (steps*
sizeof*view -> all_rings[rid]);
177 for (i=0; i<steps; i++)
179 if (fread (view -> num_rings[rid][i],
sizeof(
int), size,
fp) != size)
return ERROR_RW;
180 view -> all_rings[rid][i] = g_malloc0 (size*
sizeof*view -> all_rings[rid][i]);
181 view -> show_rpoly[rid][i] = g_malloc0 (size*
sizeof*view -> show_rpoly[rid][i]);
182 for (j=0; j<size; j++)
184 tmpcoo[j] += view -> num_rings[rid][i][j];
185 if (view -> num_rings[rid][i][j])
187 view -> all_rings[rid][i][j] =
allocdint (view -> num_rings[rid][i][j], j+1);
188 view -> show_rpoly[rid][i][j] =
allocbool (view -> num_rings[rid][i][j]);
189 if (fread (view -> show_rpoly[rid][i][j],
sizeof(
int), view -> num_rings[rid][i][j],
fp) != view -> num_rings[rid][i][j])
return ERROR_RW;
190 for (k=0; k<view -> num_rings[rid][i][j]; k++)
192 if (fread (view -> all_rings[rid][i][j][k],
sizeof(
int), j+1,
fp) != j+1)
return ERROR_RW;
198 for (j=0; j<size; j++)
205 for (j=0; j<size; j++)
214 gboolean * show_rings =
duplicate_bool(i, view -> anim -> last ->
img -> show_coord[j]);
226 if (fread (& view -> chain_max,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
227 if (view -> chain_max)
229 view -> num_chains =
allocdint (steps, size);
230 view -> all_chains = g_malloc0 (steps*
sizeof*view -> all_rings[rid]);
232 for (i=0; i<steps; i++)
234 if (fread (view -> num_chains[i],
sizeof(
int), size,
fp) != size)
return ERROR_RW;
235 view -> all_chains[i] = g_malloc0 (size*
sizeof*view -> all_chains[i]);
236 for (j=0; j<size; j++)
238 tmpcoo[j] += view -> num_chains[i][j];
239 if (view -> num_chains[i][j])
241 view -> all_chains[i][j] =
allocdint (view -> num_chains[i][j], j+1);
242 for (k=0; k<view -> num_chains[i][j]; k++)
244 if (fread (view -> all_chains[i][j][k],
sizeof(
int), j+1,
fp) != j+1)
return ERROR_RW;
250 for (j=0; j<size; j++)
256 for (j=0; j<size; j++)
266 gboolean * show_chains =
duplicate_bool(i, view -> anim -> last ->
img -> show_coord[j]);
272 g_free (show_chains);
376 int i, j, k, l, m, n;
382 if (fread (&
img -> back -> gradient,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
383 if (
img -> back -> gradient)
385 if (fread (&
img -> back -> direction,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
396 img -> back -> gradient = 0;
400 if (fread (
img -> color_map,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
403 img -> color_map[0] -= 10;
404 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
406 this_proj -> modelgl -> custom_map -> points = j;
407 if (fread (& this_proj -> modelgl -> custom_map -> cmax,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
408 if (fread (& this_proj -> modelgl -> custom_map -> cmin,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
409 this_proj -> modelgl -> custom_map -> positions =
allocfloat (j);
410 this_proj -> modelgl -> custom_map -> values = g_malloc (j*
sizeof*this_proj -> modelgl -> custom_map -> values);
411 if (fread (this_proj -> modelgl -> custom_map -> positions,
sizeof(
float), j,
fp) != j)
return ERROR_RW;
412 if (fread (this_proj -> modelgl -> custom_map -> values,
sizeof(
ColRGBA), j,
fp) != j)
return ERROR_RW;
413 j = this_proj -> steps*this_proj -> natomes;
414 for (i=0; i<this_proj -> steps; i++)
416 if (fread (this_proj -> modelgl -> custom_map -> data[i],
sizeof(
float), this_proj -> natomes,
fp) != this_proj -> natomes)
return ERROR_RW;
424 if (fread (
img -> sphererad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
425 if (fread (
img -> pointrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
426 if (fread (
img -> atomicrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
428 for (i=0; i<sid*2; i++)
430 if (fread (
img -> bondrad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
431 if (fread (
img -> linerad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
433 if (fread (
img -> radall,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
434 if (fread (&
img -> draw_clones,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
449 if (fread (
img -> acl_format,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
453 if (fread (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
488 if (fread (&
img -> mtilt[0],
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
489 img -> mtilt[1] =
img -> mtilt[0];
490 if (fread (&
img -> mpattern[0],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
491 img -> mpattern[1] =
img -> mpattern[0];
492 if (fread (&
img -> mfactor[0],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
493 img -> mfactor[1] =
img -> mfactor[0];
494 if (fread (&
img -> mwidth[0],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
495 img -> mwidth[1] =
img -> mwidth[0];
503 if (fread (
img -> acl_format,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
504 if (fread (
img -> mtilt,
sizeof(gboolean), 2,
fp) != 2)
return ERROR_RW;
505 if (fread (
img -> mpattern,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
506 if (fread (
img -> mfactor,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
507 if (fread (
img -> mwidth,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
510 if (fread (&
img -> m_is_pressed,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
517 if (fread (&
img -> abc -> rad,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
518 if (fread (&
img -> xyz -> rad,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
519 if (fread (&
img -> abc -> line,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
520 if (fread (&
img -> xyz -> line,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
522 if (fread (
img -> abc -> extra_cell,
sizeof(
int), 3,
fp) != 3)
return ERROR_RW;
524 if (fread (&
img -> xyz -> t_pos,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
525 if (fread (&
img -> xyz -> length,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
526 if (fread (
img -> xyz -> c_pos,
sizeof(
double), 3,
fp) != 3)
return ERROR_RW;
528 if (fread (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
541 if (
img -> xyz -> title[i] == NULL)
return ERROR_RW;
552 if (fread (&
img -> p_depth,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
553 if (fread (&
img -> gnear,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
554 if (fread (&
img -> gfar,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
555 if (fread (&
img -> gleft,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
556 if (fread (&
img -> gright,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
557 if (fread (&
img -> gtop,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
558 if (fread (&
img -> gbottom,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
560 if (fread (&
img -> rotation_mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
562 if (fread (
img -> c_shift,
sizeof(GLdouble), 2,
fp) != 2)
return ERROR_RW;
563 if (fread (&
img -> style,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
564 if (fread (&
img -> quality,
sizeof(GLint), 1,
fp) != 1)
return ERROR_RW;
566 if (fread (&
img -> l_ghtning.lights,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
567 if (
img -> l_ghtning.spot != NULL)
569 g_free (
img -> l_ghtning.spot);
570 img -> l_ghtning.spot = NULL;
572 img -> l_ghtning.spot = g_malloc0 (
img -> l_ghtning.lights*
sizeof*
img -> l_ghtning.spot);
573 for (i=0; i<
img -> l_ghtning.lights; i++)
575 if (fread (&
img -> l_ghtning.spot[i].type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
576 if (fread (&
img -> l_ghtning.spot[i].fix,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
577 if (fread (&
img -> l_ghtning.spot[i].show,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
578 if (fread (&
img -> l_ghtning.spot[i].position,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
579 if (fread (&
img -> l_ghtning.spot[i].direction,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
580 if (fread (&
img -> l_ghtning.spot[i].intensity,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
581 if (fread (&
img -> l_ghtning.spot[i].attenuation,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
582 if (fread (&
img -> l_ghtning.spot[i].spot_data,
sizeof(
vec3_t), 1,
fp) != 1)
return ERROR_RW;
584 if (fread (&
img -> m_terial.predefine,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
586 if (fread (
img -> m_terial.param,
sizeof(GLfloat), 6,
fp) != 6)
return ERROR_RW;
587 if (fread (&
img -> f_g.mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
588 if (fread (&
img -> f_g.based,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
589 if (fread (&
img -> f_g.density,
sizeof(
float), 1,
fp) != 1)
return ERROR_RW;
590 if (fread (&
img -> f_g.depth,
sizeof(
float), 2,
fp) != 2)
return ERROR_RW;
593 if (fread (&
img -> filled_type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
601 for (j=0; j<sid; j++)
603 if (fread (
img -> spcolor[i][j],
sizeof(
ColRGBA), this_proj -> coord -> ntg[i][j],
fp) != this_proj -> coord -> ntg[i][j])
return ERROR_RW;
608 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
611 if (j != this_proj -> coord -> totcoord[i])
613 g_warning (
"READING OPENGL:: this should not happen !\n i= %d, totcoord[i]= %d, j= %d", i, this_proj -> coord -> totcoord[i], j);
616 if (fread (
img -> spcolor[i][0],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[i],
fp) != this_proj -> coord -> totcoord[i])
return ERROR_RW;
623 if (fread (& this_proj -> modelgl -> rings,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
624 if (this_proj -> modelgl -> rings)
631 if (fread (& this_proj -> modelgl ->
chains,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
632 if (this_proj -> modelgl ->
chains)
637 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
640 this_proj -> modelgl -> create_shaders[
VOLMS] = TRUE;
641 this_proj -> modelgl ->
volumes = TRUE;
644 this_proj -> modelgl -> atoms_volume[i] =
allocdouble (this_proj -> steps);
645 this_proj -> modelgl -> atoms_ppvolume[i] =
allocdouble (this_proj -> steps);
646 if (fread (this_proj -> modelgl -> atoms_volume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
647 if (fread (this_proj -> modelgl -> atoms_ppvolume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
648 this_proj -> modelgl -> volume_box[i] =
allocddouble (this_proj -> steps, 9);
649 for (j=0; j<this_proj -> steps; j++)
651 if (fread (this_proj -> modelgl -> volume_box[i][j],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
657 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
662 if (fread (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
665 this_proj -> modelgl -> frag_mol_volume[0][j] =
allocddouble (this_proj -> steps, i);
666 this_proj -> modelgl -> frag_mol_ppvolume[0][j] =
allocddouble (this_proj -> steps, i);
667 this_proj -> modelgl -> fm_comp_vol[0][j] =
allocdbool (this_proj -> steps, i);
669 this_proj -> modelgl -> frag_box[j] =
alloctdouble (this_proj -> steps, i, 9);
672 if (fread (& m,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
673 if (fread (& n,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
674 if (fread (& this_proj -> modelgl -> frag_mol_ppvolume[0][j][m][n],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
675 if (fread (this_proj -> modelgl -> frag_box[j][m][n],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
676 this_proj -> modelgl -> fm_comp_vol[0][j][m][n] = TRUE;
683 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
688 if (fread (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
691 this_proj -> modelgl -> frag_mol_volume[1][j] =
allocddouble (this_proj -> steps, i);
692 this_proj -> modelgl -> frag_mol_ppvolume[1][j] =
allocddouble (this_proj -> steps, i);
693 this_proj -> modelgl -> fm_comp_vol[1][j] =
allocdbool (this_proj -> steps, i);
697 if (fread (& m,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
698 if (fread (& n,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
699 if (fread (& this_proj -> modelgl -> frag_mol_ppvolume[1][j][m][n],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
700 this_proj -> modelgl -> fm_comp_vol[1][j][m][n] = TRUE;
711 for (i=0; i<this_proj -> steps; i++)
713 for (j=0; j< this_proj -> natomes; j++)
721 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
726 if (fread (& l,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
730 if (
img -> selected[i] -> selected >= 2 &&
img -> selected[i] -> selected <= 20)
733 if (fread (
img -> selected[i] -> selected_bonds,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
734 if (
img -> selected[i] -> selected >= 3)
737 if (fread (
img -> selected[i] -> selected_angles,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
738 if (
img -> selected[i] -> selected >= 4 &&
img -> selected[i] -> selected <= 10)
741 if (fread (
img -> selected[i] -> selected_dihedrals,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
752 for (j=0; j<sid; j++)
754 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_spec[i][j]))
756 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j]) !=
img -> show_atom[i][j])
758 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j],
img -> show_atom[i][j]);
765 if (this_proj -> modelgl -> ogl_poly[0][i] != NULL)
767 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
769 if (i < 2 || (i > 3 && i < 9))
771 if (this_proj -> modelgl -> ogl_poly[0][i][j] != NULL)
773 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_poly[0][i][j]))
775 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j]) !=
img -> show_poly[i][j])
777 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j],
img -> show_poly[i][j]);
784 if (this_proj -> modelgl -> ogl_geom[0][i] != NULL)
786 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
788 if (this_proj -> modelgl -> ogl_geom[0][i][j] != NULL)
790 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_geom[0][i][j]))
792 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j]) !=
img -> show_coord[i][j])
794 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j],
img -> show_coord[i][j]);
808 for (j=0; j<sid; j++)
810 if (!
img -> show_atom[i][j])
818 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
820 if (i < 2 || (i > 3 && i < 9))
822 if (
img -> show_poly[i][j])
824 show_hide_poly (NULL, NULL, & this_proj -> modelgl -> gcid[i][j][i]);
828 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
830 if (!
img -> show_coord[i][j])
836 update_menu_bar (this_proj -> modelgl);