161 int * tmpcoo, * tmpcoord;
164 if (fread (& view -> ring_max[rid],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
165 if (view -> ring_max[rid])
167 view -> num_rings[rid] =
allocdint (steps, size);
168 view -> show_rpoly[rid] = g_malloc0 (steps*
sizeof*view -> show_rpoly[rid]);
169 view -> all_rings[rid] = g_malloc0 (steps*
sizeof*view -> all_rings[rid]);
171 for (i=0; i<steps; i++)
173 if (fread (view -> num_rings[rid][i],
sizeof(
int), size,
fp) != size)
return ERROR_RW;
174 view -> all_rings[rid][i] = g_malloc0 (size*
sizeof*view -> all_rings[rid][i]);
175 view -> show_rpoly[rid][i] = g_malloc0 (size*
sizeof*view -> show_rpoly[rid][i]);
176 for (j=0; j<size; j++)
178 tmpcoo[j] += view -> num_rings[rid][i][j];
179 if (view -> num_rings[rid][i][j])
181 view -> all_rings[rid][i][j] =
allocdint (view -> num_rings[rid][i][j], j+1);
182 view -> show_rpoly[rid][i][j] =
allocbool (view -> num_rings[rid][i][j]);
183 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;
184 for (k=0; k<view -> num_rings[rid][i][j]; k++)
186 if (fread (view -> all_rings[rid][i][j][k],
sizeof(
int), j+1,
fp) != j+1)
return ERROR_RW;
192 for (j=0; j<size; j++)
199 for (j=0; j<size; j++)
208 gboolean * show_rings =
duplicate_bool(i, view -> anim -> last ->
img -> show_coord[j]);
220 if (fread (& view -> chain_max,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
221 if (view -> chain_max)
223 view -> num_chains =
allocdint (steps, size);
224 view -> all_chains = g_malloc0 (steps*
sizeof*view -> all_rings[rid]);
226 for (i=0; i<steps; i++)
228 if (fread (view -> num_chains[i],
sizeof(
int), size,
fp) != size)
return ERROR_RW;
229 view -> all_chains[i] = g_malloc0 (size*
sizeof*view -> all_chains[i]);
230 for (j=0; j<size; j++)
232 tmpcoo[j] += view -> num_chains[i][j];
233 if (view -> num_chains[i][j])
235 view -> all_chains[i][j] =
allocdint (view -> num_chains[i][j], j+1);
236 for (k=0; k<view -> num_chains[i][j]; k++)
238 if (fread (view -> all_chains[i][j][k],
sizeof(
int), j+1,
fp) != j+1)
return ERROR_RW;
244 for (j=0; j<size; j++)
250 for (j=0; j<size; j++)
260 gboolean * show_chains =
duplicate_bool(i, view -> anim -> last ->
img -> show_coord[j]);
266 g_free (show_chains);
284 int i, j, k, l, m, n;
287 if (fread (
img -> color_map,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
290 img -> color_map[0] -= 10;
291 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
293 this_proj -> modelgl -> custom_map -> points = j;
294 if (fread (& this_proj -> modelgl -> custom_map -> cmax,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
295 if (fread (& this_proj -> modelgl -> custom_map -> cmin,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
296 this_proj -> modelgl -> custom_map -> positions =
allocfloat (j);
297 this_proj -> modelgl -> custom_map -> values = g_malloc (j*
sizeof*this_proj -> modelgl -> custom_map -> values);
298 if (fread (this_proj -> modelgl -> custom_map -> positions,
sizeof(
float), j,
fp) != j)
return ERROR_RW;
299 if (fread (this_proj -> modelgl -> custom_map -> values,
sizeof(
ColRGBA), j,
fp) != j)
return ERROR_RW;
300 j = this_proj -> steps*this_proj -> natomes;
301 for (i=0; i<this_proj -> steps; i++)
303 if (fread (this_proj -> modelgl -> custom_map -> data[i],
sizeof(
float), this_proj -> natomes,
fp) != this_proj -> natomes)
return ERROR_RW;
311 if (fread (
img -> sphererad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
312 if (fread (
img -> pointrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
313 if (fread (
img -> atomicrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
315 for (i=0; i<sid*2; i++)
317 if (fread (
img -> bondrad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
318 if (fread (
img -> linerad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
320 if (fread (
img -> radall,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
321 if (fread (&
img -> draw_clones,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
322 if (fread (
img -> labels_position,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
323 if (fread (
img -> labels_render,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
324 if (fread (
img -> labels_scale,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
325 if (fread (
img -> labels_format,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
328 if (fread (
img -> labels_shift[i],
sizeof(
double), 3,
fp) != 3)
return ERROR_RW;
329 if (fread (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
344 img -> labels_color[i] = g_malloc (j*
sizeof*
img -> labels_color[i]);
351 if (
img -> labels_font[i] == NULL)
return ERROR_RW;
355 if (fread (&
img -> mtilt,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
356 if (fread (&
img -> mpattern,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
357 if (fread (&
img -> mfactor,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
358 if (fread (&
img -> mwidth,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
359 if (fread (&
img -> m_is_pressed,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
362 if (fread (
img -> box_axis,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
363 if (fread (
img -> box_axis_rad,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
364 if (fread (
img -> box_axis_line,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
366 if (fread (
img -> extra_cell,
sizeof(
int), 3,
fp) != 3)
return ERROR_RW;
369 if (fread (&
img -> axispos,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
370 if (fread (&
img -> axis_length,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
371 if (fread (
img -> axis_pos,
sizeof(
double), 3,
fp) != 3)
return ERROR_RW;
373 if (fread (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
376 img -> axis_color = g_malloc (3*
sizeof*
img -> axis_color);
382 if (fread (&
img -> axis_labels,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
389 if (fread (&
img -> p_depth,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
390 if (fread (&
img -> gnear,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
391 if (fread (&
img -> gfar,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
392 if (fread (&
img -> gleft,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
393 if (fread (&
img -> gright,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
394 if (fread (&
img -> gtop,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
395 if (fread (&
img -> gbottom,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
397 if (fread (&
img -> rotation_mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
399 if (fread (
img -> c_shift,
sizeof(GLdouble), 2,
fp) != 2)
return ERROR_RW;
400 if (fread (&
img -> style,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
401 if (fread (&
img -> quality,
sizeof(GLint), 1,
fp) != 1)
return ERROR_RW;
403 if (fread (&
img -> lights,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
404 if (
img -> l_ght != NULL)
406 g_free (
img -> l_ght);
409 img -> l_ght = g_malloc0 (
img -> lights*
sizeof*
img -> l_ght);
410 for (i=0; i<
img -> lights; i++)
412 if (fread (&
img -> l_ght[i].type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
413 if (fread (&
img -> l_ght[i].fix,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
414 if (fread (&
img -> l_ght[i].show,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
421 if (fread (&
img -> m_terial.predefine,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
423 if (fread (
img -> m_terial.param,
sizeof(GLfloat), 6,
fp) != 6)
return ERROR_RW;
424 if (fread (&
img -> f_g.mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
425 if (fread (&
img -> f_g.based,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
426 if (fread (&
img -> f_g.density,
sizeof(
float), 1,
fp) != 1)
return ERROR_RW;
427 if (fread (&
img -> f_g.depth,
sizeof(
float), 2,
fp) != 2)
return ERROR_RW;
430 if (fread (&
img -> filled_type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
438 for (j=0; j<sid; j++)
440 if (fread (
img -> spcolor[i][j],
sizeof(
ColRGBA), this_proj -> coord -> ntg[i][j],
fp) != this_proj -> coord -> ntg[i][j])
return ERROR_RW;
445 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
448 if (j != this_proj -> coord -> totcoord[i])
450 g_warning (
"READING OPENGL:: this should not happen !\n i= %d, totcoord[i]= %d, j= %d", i, this_proj -> coord -> totcoord[i], j);
453 if (fread (
img -> spcolor[i][0],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[i],
fp) != this_proj -> coord -> totcoord[i])
return ERROR_RW;
460 if (fread (& this_proj -> modelgl -> rings,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
461 if (this_proj -> modelgl -> rings)
468 if (fread (& this_proj -> modelgl ->
chains,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
469 if (this_proj -> modelgl ->
chains)
474 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
477 this_proj -> modelgl -> create_shaders[
VOLMS] = TRUE;
478 this_proj -> modelgl ->
volumes = TRUE;
481 this_proj -> modelgl -> atoms_volume[i] =
allocdouble (this_proj -> steps);
482 this_proj -> modelgl -> atoms_ppvolume[i] =
allocdouble (this_proj -> steps);
483 if (fread (this_proj -> modelgl -> atoms_volume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
484 if (fread (this_proj -> modelgl -> atoms_ppvolume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
485 this_proj -> modelgl -> volume_box[i] =
allocddouble (this_proj -> steps, 9);
486 for (j=0; j<this_proj -> steps; j++)
488 if (fread (this_proj -> modelgl -> volume_box[i][j],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
494 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
499 if (fread (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
502 this_proj -> modelgl -> frag_mol_volume[0][j] =
allocddouble (this_proj -> steps, i);
503 this_proj -> modelgl -> frag_mol_ppvolume[0][j] =
allocddouble (this_proj -> steps, i);
504 this_proj -> modelgl -> fm_comp_vol[0][j] =
allocdbool (this_proj -> steps, i);
506 this_proj -> modelgl -> frag_box[j] =
alloctdouble (this_proj -> steps, i, 9);
509 if (fread (& m,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
510 if (fread (& n,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
511 if (fread (& this_proj -> modelgl -> frag_mol_ppvolume[0][j][m][n],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
512 if (fread (this_proj -> modelgl -> frag_box[j][m][n],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
513 this_proj -> modelgl -> fm_comp_vol[0][j][m][n] = TRUE;
520 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
525 if (fread (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
528 this_proj -> modelgl -> frag_mol_volume[1][j] =
allocddouble (this_proj -> steps, i);
529 this_proj -> modelgl -> frag_mol_ppvolume[1][j] =
allocddouble (this_proj -> steps, i);
530 this_proj -> modelgl -> fm_comp_vol[1][j] =
allocdbool (this_proj -> steps, i);
534 if (fread (& m,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
535 if (fread (& n,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
536 if (fread (& this_proj -> modelgl -> frag_mol_ppvolume[1][j][m][n],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
537 this_proj -> modelgl -> fm_comp_vol[1][j][m][n] = TRUE;
548 for (i=0; i<this_proj -> steps; i++)
550 for (j=0; j< this_proj -> natomes; j++)
558 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
563 if (fread (& l,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
567 if (
img -> selected[i] -> selected >= 2 &&
img -> selected[i] -> selected <= 20)
570 if (fread (
img -> selected[i] -> selected_bonds,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
571 if (
img -> selected[i] -> selected >= 3)
574 if (fread (
img -> selected[i] -> selected_angles,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
575 if (
img -> selected[i] -> selected >= 4 &&
img -> selected[i] -> selected <= 10)
578 if (fread (
img -> selected[i] -> selected_dihedrals,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
589 for (j=0; j<sid; j++)
591 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_spec[i][j]))
593 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j]) !=
img -> show_atom[i][j])
595 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j],
img -> show_atom[i][j]);
602 if (this_proj -> modelgl -> ogl_poly[0][i] != NULL)
604 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
606 if (i < 2 || (i > 3 && i < 9))
608 if (this_proj -> modelgl -> ogl_poly[0][i][j] != NULL)
610 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_poly[0][i][j]))
612 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j]) !=
img -> show_poly[i][j])
614 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j],
img -> show_poly[i][j]);
621 if (this_proj -> modelgl -> ogl_geom[0][i] != NULL)
623 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
625 if (this_proj -> modelgl -> ogl_geom[0][i][j] != NULL)
627 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_geom[0][i][j]))
629 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j]) !=
img -> show_coord[i][j])
631 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j],
img -> show_coord[i][j]);
645 for (j=0; j<sid; j++)
647 if (!
img -> show_atom[i][j])
655 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
657 if (i < 2 || (i > 3 && i < 9))
659 if (
img -> show_poly[i][j])
661 show_hide_poly (NULL, NULL, & this_proj -> modelgl -> gcid[i][j][i]);
665 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
667 if (!
img -> show_coord[i][j])
673 update_menu_bar (this_proj -> modelgl);