163 int * tmpcoo, * tmpcoord;
166 if (fread (& view -> ring_max[rid],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
167 if (view -> ring_max[rid])
169 view -> num_rings[rid] =
allocdint (steps, size);
170 view -> show_rpoly[rid] = g_malloc0 (steps*
sizeof*view -> show_rpoly[rid]);
171 view -> all_rings[rid] = g_malloc0 (steps*
sizeof*view -> all_rings[rid]);
173 for (i=0; i<steps; i++)
175 if (fread (view -> num_rings[rid][i],
sizeof(
int), size,
fp) != size)
return ERROR_RW;
176 view -> all_rings[rid][i] = g_malloc0 (size*
sizeof*view -> all_rings[rid][i]);
177 view -> show_rpoly[rid][i] = g_malloc0 (size*
sizeof*view -> show_rpoly[rid][i]);
178 for (j=0; j<size; j++)
180 tmpcoo[j] += view -> num_rings[rid][i][j];
181 if (view -> num_rings[rid][i][j])
183 view -> all_rings[rid][i][j] =
allocdint (view -> num_rings[rid][i][j], j+1);
184 view -> show_rpoly[rid][i][j] =
allocbool (view -> num_rings[rid][i][j]);
185 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;
186 for (k=0; k<view -> num_rings[rid][i][j]; k++)
188 if (fread (view -> all_rings[rid][i][j][k],
sizeof(
int), j+1,
fp) != j+1)
return ERROR_RW;
194 for (j=0; j<size; j++)
201 for (j=0; j<size; j++)
210 gboolean * show_rings =
duplicate_bool(i, view -> anim -> last ->
img -> show_coord[j]);
222 if (fread (& view -> chain_max,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
223 if (view -> chain_max)
225 view -> num_chains =
allocdint (steps, size);
226 view -> all_chains = g_malloc0 (steps*
sizeof*view -> all_rings[rid]);
228 for (i=0; i<steps; i++)
230 if (fread (view -> num_chains[i],
sizeof(
int), size,
fp) != size)
return ERROR_RW;
231 view -> all_chains[i] = g_malloc0 (size*
sizeof*view -> all_chains[i]);
232 for (j=0; j<size; j++)
234 tmpcoo[j] += view -> num_chains[i][j];
235 if (view -> num_chains[i][j])
237 view -> all_chains[i][j] =
allocdint (view -> num_chains[i][j], j+1);
238 for (k=0; k<view -> num_chains[i][j]; k++)
240 if (fread (view -> all_chains[i][j][k],
sizeof(
int), j+1,
fp) != j+1)
return ERROR_RW;
246 for (j=0; j<size; j++)
252 for (j=0; j<size; j++)
262 gboolean * show_chains =
duplicate_bool(i, view -> anim -> last ->
img -> show_coord[j]);
268 g_free (show_chains);
286 int i, j, k, l, m, n;
289 if (fread (
img -> color_map,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
292 img -> color_map[0] -= 10;
293 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
295 this_proj -> modelgl -> custom_map -> points = j;
296 if (fread (& this_proj -> modelgl -> custom_map -> cmax,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
297 if (fread (& this_proj -> modelgl -> custom_map -> cmin,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
298 this_proj -> modelgl -> custom_map -> positions =
allocfloat (j);
299 this_proj -> modelgl -> custom_map -> values = g_malloc (j*
sizeof*this_proj -> modelgl -> custom_map -> values);
300 if (fread (this_proj -> modelgl -> custom_map -> positions,
sizeof(
float), j,
fp) != j)
return ERROR_RW;
301 if (fread (this_proj -> modelgl -> custom_map -> values,
sizeof(
ColRGBA), j,
fp) != j)
return ERROR_RW;
302 j = this_proj -> steps*this_proj -> natomes;
303 for (i=0; i<this_proj -> steps; i++)
305 if (fread (this_proj -> modelgl -> custom_map -> data[i],
sizeof(
float), this_proj -> natomes,
fp) != this_proj -> natomes)
return ERROR_RW;
313 if (fread (
img -> sphererad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
314 if (fread (
img -> pointrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
315 if (fread (
img -> atomicrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
317 for (i=0; i<sid*2; i++)
319 if (fread (
img -> bondrad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
320 if (fread (
img -> linerad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
322 if (fread (
img -> radall,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
323 if (fread (&
img -> draw_clones,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
324 if (fread (
img -> labels_position,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
325 if (fread (
img -> labels_render,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
326 if (fread (
img -> labels_scale,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
327 if (fread (
img -> labels_format,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
330 if (fread (
img -> labels_shift[i],
sizeof(
double), 3,
fp) != 3)
return ERROR_RW;
331 if (fread (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
346 img -> labels_color[i] = g_malloc (j*
sizeof*
img -> labels_color[i]);
353 if (
img -> labels_font[i] == NULL)
return ERROR_RW;
357 if (fread (&
img -> mtilt,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
358 if (fread (&
img -> mpattern,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
359 if (fread (&
img -> mfactor,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
360 if (fread (&
img -> mwidth,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
361 if (fread (&
img -> m_is_pressed,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
364 if (fread (
img -> box_axis,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
365 if (fread (
img -> box_axis_rad,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
366 if (fread (
img -> box_axis_line,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
368 if (fread (
img -> extra_cell,
sizeof(
int), 3,
fp) != 3)
return ERROR_RW;
371 if (fread (&
img -> axispos,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
372 if (fread (&
img -> axis_length,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
373 if (fread (
img -> axis_pos,
sizeof(
double), 3,
fp) != 3)
return ERROR_RW;
375 if (fread (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
378 img -> axis_color = g_malloc (3*
sizeof*
img -> axis_color);
384 if (fread (&
img -> axis_labels,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
391 if (fread (&
img -> p_depth,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
392 if (fread (&
img -> gnear,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
393 if (fread (&
img -> gfar,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
394 if (fread (&
img -> gleft,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
395 if (fread (&
img -> gright,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
396 if (fread (&
img -> gtop,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
397 if (fread (&
img -> gbottom,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
399 if (fread (&
img -> rotation_mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
401 if (fread (
img -> c_shift,
sizeof(GLdouble), 2,
fp) != 2)
return ERROR_RW;
402 if (fread (&
img -> style,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
403 if (fread (&
img -> quality,
sizeof(GLint), 1,
fp) != 1)
return ERROR_RW;
405 if (fread (&
img -> lights,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
406 if (
img -> l_ght != NULL)
408 g_free (
img -> l_ght);
411 img -> l_ght = g_malloc0 (
img -> lights*
sizeof*
img -> l_ght);
412 for (i=0; i<
img -> lights; i++)
414 if (fread (&
img -> l_ght[i].type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
415 if (fread (&
img -> l_ght[i].fix,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
416 if (fread (&
img -> l_ght[i].show,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
423 if (fread (&
img -> m_terial.predefine,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
425 if (fread (
img -> m_terial.param,
sizeof(GLfloat), 6,
fp) != 6)
return ERROR_RW;
426 if (fread (&
img -> f_g.mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
427 if (fread (&
img -> f_g.based,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
428 if (fread (&
img -> f_g.density,
sizeof(
float), 1,
fp) != 1)
return ERROR_RW;
429 if (fread (&
img -> f_g.depth,
sizeof(
float), 2,
fp) != 2)
return ERROR_RW;
432 if (fread (&
img -> filled_type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
440 for (j=0; j<sid; j++)
442 if (fread (
img -> spcolor[i][j],
sizeof(
ColRGBA), this_proj -> coord -> ntg[i][j],
fp) != this_proj -> coord -> ntg[i][j])
return ERROR_RW;
447 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
450 if (j != this_proj -> coord -> totcoord[i])
452 g_warning (
"READING OPENGL:: this should not happen !\n i= %d, totcoord[i]= %d, j= %d", i, this_proj -> coord -> totcoord[i], j);
455 if (fread (
img -> spcolor[i][0],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[i],
fp) != this_proj -> coord -> totcoord[i])
return ERROR_RW;
462 if (fread (& this_proj -> modelgl -> rings,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
463 if (this_proj -> modelgl -> rings)
470 if (fread (& this_proj -> modelgl ->
chains,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
471 if (this_proj -> modelgl ->
chains)
476 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
479 this_proj -> modelgl -> create_shaders[
VOLMS] = TRUE;
480 this_proj -> modelgl ->
volumes = TRUE;
483 this_proj -> modelgl -> atoms_volume[i] =
allocdouble (this_proj -> steps);
484 this_proj -> modelgl -> atoms_ppvolume[i] =
allocdouble (this_proj -> steps);
485 if (fread (this_proj -> modelgl -> atoms_volume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
486 if (fread (this_proj -> modelgl -> atoms_ppvolume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
487 this_proj -> modelgl -> volume_box[i] =
allocddouble (this_proj -> steps, 9);
488 for (j=0; j<this_proj -> steps; j++)
490 if (fread (this_proj -> modelgl -> volume_box[i][j],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
496 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
501 if (fread (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
504 this_proj -> modelgl -> frag_mol_volume[0][j] =
allocddouble (this_proj -> steps, i);
505 this_proj -> modelgl -> frag_mol_ppvolume[0][j] =
allocddouble (this_proj -> steps, i);
506 this_proj -> modelgl -> fm_comp_vol[0][j] =
allocdbool (this_proj -> steps, i);
508 this_proj -> modelgl -> frag_box[j] =
alloctdouble (this_proj -> steps, i, 9);
511 if (fread (& m,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
512 if (fread (& n,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
513 if (fread (& this_proj -> modelgl -> frag_mol_ppvolume[0][j][m][n],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
514 if (fread (this_proj -> modelgl -> frag_box[j][m][n],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
515 this_proj -> modelgl -> fm_comp_vol[0][j][m][n] = TRUE;
522 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
527 if (fread (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
530 this_proj -> modelgl -> frag_mol_volume[1][j] =
allocddouble (this_proj -> steps, i);
531 this_proj -> modelgl -> frag_mol_ppvolume[1][j] =
allocddouble (this_proj -> steps, i);
532 this_proj -> modelgl -> fm_comp_vol[1][j] =
allocdbool (this_proj -> steps, i);
536 if (fread (& m,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
537 if (fread (& n,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
538 if (fread (& this_proj -> modelgl -> frag_mol_ppvolume[1][j][m][n],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
539 this_proj -> modelgl -> fm_comp_vol[1][j][m][n] = TRUE;
550 for (i=0; i<this_proj -> steps; i++)
552 for (j=0; j< this_proj -> natomes; j++)
560 if (fread (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
565 if (fread (& l,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
569 if (
img -> selected[i] -> selected >= 2 &&
img -> selected[i] -> selected <= 20)
572 if (fread (
img -> selected[i] -> selected_bonds,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
573 if (
img -> selected[i] -> selected >= 3)
576 if (fread (
img -> selected[i] -> selected_angles,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
577 if (
img -> selected[i] -> selected >= 4 &&
img -> selected[i] -> selected <= 10)
580 if (fread (
img -> selected[i] -> selected_dihedrals,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
591 for (j=0; j<sid; j++)
593 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_spec[i][j]))
595 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j]) !=
img -> show_atom[i][j])
597 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j],
img -> show_atom[i][j]);
604 if (this_proj -> modelgl -> ogl_poly[0][i] != NULL)
606 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
608 if (i < 2 || (i > 3 && i < 9))
610 if (this_proj -> modelgl -> ogl_poly[0][i][j] != NULL)
612 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_poly[0][i][j]))
614 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j]) !=
img -> show_poly[i][j])
616 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[0][i][j],
img -> show_poly[i][j]);
623 if (this_proj -> modelgl -> ogl_geom[0][i] != NULL)
625 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
627 if (this_proj -> modelgl -> ogl_geom[0][i][j] != NULL)
629 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_geom[0][i][j]))
631 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j]) !=
img -> show_coord[i][j])
633 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[0][i][j],
img -> show_coord[i][j]);
645 update_menu_bar (this_proj -> modelgl);
648 for (j=0; j<sid; j++)
650 if (!
img -> show_atom[i][j])
658 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
660 if (i < 2 || (i > 3 && i < 9))
662 if (
img -> show_poly[i][j])
664 show_hide_poly (NULL, NULL, & this_proj -> modelgl -> gcid[i][j][i]);
668 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
670 if (!
img -> show_coord[i][j])