165void rings_set_visible (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
171 j = (this_proj -> steps > 1) ? 1: 0;
172 gtk_tree_model_get (mod, iter, j, & k, -1);
175 gtk_tree_model_get (mod, iter, 0, & k, -1);
180 gtk_cell_renderer_set_visible (renderer, 1);
184 gtk_cell_renderer_set_visible (renderer, 0);
189 gtk_cell_renderer_set_visible (renderer, 0);
193 gtk_tree_model_get (mod, iter, j, & k, -1);
198 gtk_cell_renderer_set_visible (renderer, 1);
202 gtk_cell_renderer_set_visible (renderer, 0);
209 gtk_cell_renderer_set_visible (renderer, 0);
213 gtk_cell_renderer_set_visible (renderer, 1);
224 gtk_cell_renderer_set_visible (renderer, 1);
228 gtk_cell_renderer_set_visible (renderer, 0);
235 gtk_cell_renderer_set_visible (renderer, 0);
239 gtk_cell_renderer_set_visible (renderer, 1);
256 GtkTreeIter step_level, size_level, ring_level;
258 if (this_proj -> coord -> totcoord[rid+4])
260 for (h=0; h < this_proj -> steps; h++)
262 if (this_proj -> steps > 1)
264 gtk_tree_store_append (store, & step_level, NULL);
265 gtk_tree_store_set (store, & step_level, 0, h+1,
273 for (i=0; i < this_proj -> coord -> totcoord[rid+4]; i++)
275 j = this_proj -> coord -> geolist[rid+4][0][i];
276 k = this_proj -> modelgl -> num_rings[rid][h][j-1];
277 if (this_proj -> steps > 1 && k > 0)
279 gtk_tree_store_append (store, & size_level, & step_level);
280 gtk_tree_store_set (store, & size_level, 0, 0,
288 else if (this_proj -> steps == 1)
290 gtk_tree_store_append (store, & size_level, NULL);
291 gtk_tree_store_set (store, & size_level, 0, j,
300 gtk_tree_store_append (store, & ring_level, & size_level);
301 if (this_proj -> steps > 1)
303 gtk_tree_store_set (store, & ring_level, 0, -(h+1),
307 4, this_proj -> modelgl -> show_rpoly[rid][h][j-1][l],
313 gtk_tree_store_set (store, & ring_level, 0, -j,
316 3, this_proj -> modelgl -> show_rpoly[rid][h][j-1][l],
338 GtkTreeViewColumn * rings_col[7];
339 GtkCellRenderer * rings_cell[7];
340 gchar *
ctitle[7]={
"MD. step",
"Ring(s) size",
"Id.",
"Show",
"Poly.",
"Label",
"Pick"};
341 gchar * ctype[7]={
"text",
"text",
"text",
"active",
"active",
"active",
"active"};
342 GType
col_type[7]={G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN};
344 j = (this_proj -> steps > 1) ? 1: 0;
345 k = (this_proj -> steps > 1) ? 0: 1;
346 coord -> rings_model[rid] = gtk_tree_store_newv (6+j,
col_type);
347 if (fill_this)
fill_rings_model (coord -> rings_model[rid], this_proj, rid);
348 GtkWidget * rings_tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL(coord -> rings_model[rid]));
349 for (i=0; i<6+j; i++)
353 rings_cell[i] = gtk_cell_renderer_text_new ();
357 rings_cell[i] = gtk_cell_renderer_toggle_new ();
358 g_signal_connect (G_OBJECT(rings_cell[i]),
"toggled", G_CALLBACK(
on_select_rings), & this_proj -> modelgl ->
colorp[rid*10+i][0]);
360 gtk_cell_renderer_set_fixed_size (rings_cell[i], -1, 25);
361 rings_col[i] = gtk_tree_view_column_new_with_attributes (
ctitle[i+k], rings_cell[i], ctype[i+k], i, NULL);
362 gtk_tree_view_append_column(GTK_TREE_VIEW(rings_tree), rings_col[i]);
363 gtk_tree_view_column_set_alignment (rings_col[i], 0.5);
364 gtk_tree_view_column_set_cell_data_func (rings_col[i], rings_cell[i],
rings_set_visible, & this_proj -> modelgl ->
colorp[i][0], NULL);
379 GtkTreeIter step_level, size_level, ring_level;
380 GtkTreeIter new_level;
382 GtkTreeStore * store = (GtkTreeStore *) coord -> rings_model[rid];
383 GtkTreeModel * mod = GTK_TREE_MODEL(coord -> rings_model[rid]);
385 gboolean insert = TRUE;
386 int f, h, i, j, k, l, m;
388 if (this_proj -> steps > 1)
390 valid = gtk_tree_model_get_iter_first(mod, & step_level);
393 gtk_tree_model_get (mod, & step_level, 0, & f, -1);
394 if (f > coord -> rst[rid])
399 else if (f == coord -> rst[rid])
401 if (gtk_tree_model_iter_has_child (mod, &step_level))
403 h = gtk_tree_model_iter_n_children (mod, &step_level);
406 if (gtk_tree_model_iter_nth_child (mod, &size_level, &step_level, i))
408 gtk_tree_model_get (mod, &size_level, 1, & j, -1);
409 if (j > coord -> rsz[rid])
415 else if (j == coord -> rsz[rid])
417 if (gtk_tree_model_iter_has_child (mod, &size_level))
419 k = gtk_tree_model_iter_n_children (mod, &size_level);
422 if (gtk_tree_model_iter_nth_child (mod, &ring_level, &size_level, l))
424 gtk_tree_model_get (mod, &ring_level, 2, & m, -1);
425 if (m > coord -> ri[rid])
431 else if (m == coord -> ri[rid])
433 insert = valid = FALSE;
457 valid = gtk_tree_model_iter_next(mod, & step_level);
465 gtk_tree_store_append (store, & step_level, NULL);
466 gtk_tree_store_set (store, & step_level, 0, coord -> rst[rid],
473 gtk_tree_store_append (store, & size_level, & step_level);
474 gtk_tree_store_set (store, & size_level, 0, 0,
475 1, coord -> rsz[rid],
481 gtk_tree_store_append (store, & ring_level, & size_level);
482 gtk_tree_store_set (store, & ring_level, 0, -coord -> rst[rid],
483 1, -coord -> rsz[rid],
486 4, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
491 gtk_tree_store_insert_before (store, & new_level, NULL, & step_level);
492 gtk_tree_store_set (store, & new_level, 0, coord -> rst[rid],
499 gtk_tree_store_append (store, & size_level, & new_level);
500 gtk_tree_store_set (store, & size_level, 0, 0,
501 1, coord -> rsz[rid],
507 gtk_tree_store_append (store, & ring_level, & size_level);
508 gtk_tree_store_set (store, & ring_level, 0, -coord -> rst[rid],
509 1, -coord -> rsz[rid],
512 4, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
517 gtk_tree_store_insert_after (store, & new_level, & step_level, & size_level);
518 gtk_tree_store_set (store, & new_level, 0, 0,
519 1, coord -> rsz[rid],
525 gtk_tree_store_append (store, & ring_level, & new_level);
526 gtk_tree_store_set (store, & ring_level, 0, -coord -> rst[rid],
527 1, -coord -> rsz[rid],
530 4, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
535 gtk_tree_store_insert_before (store, & new_level, & step_level, & size_level);
536 gtk_tree_store_set (store, & new_level, 0, 0,
537 1, coord -> rsz[rid],
543 gtk_tree_store_append (store, & ring_level, & new_level);
544 gtk_tree_store_set (store, & ring_level, 0, -coord -> rst[rid],
545 1, -coord -> rsz[rid],
548 4, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
553 gtk_tree_store_insert_after (store, & new_level, & size_level, & ring_level);
554 gtk_tree_store_set (store, & new_level, 0, -coord -> rst[rid],
555 1, -coord -> rsz[rid],
558 4, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
563 gtk_tree_store_insert_before (store, & new_level, & size_level, & ring_level);
564 gtk_tree_store_set (store, & new_level, 0, -coord -> rst[rid],
565 1, -coord -> rsz[rid],
568 4, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
577 valid = gtk_tree_model_get_iter_first(mod, & size_level);
580 gtk_tree_model_get (mod, & size_level, 0, & i, -1);
581 if (i > coord -> rsz[rid])
586 else if (i == coord -> rsz[rid])
588 if (gtk_tree_model_iter_has_child (mod, &size_level))
590 j = gtk_tree_model_iter_n_children (mod, &size_level);
593 if (gtk_tree_model_iter_nth_child (mod, &ring_level, &size_level, k))
595 gtk_tree_model_get (mod, &ring_level, 1, & l, -1);
596 if (l > coord -> ri[rid])
602 else if (l == coord -> ri[rid])
604 insert = valid = FALSE;
618 valid = gtk_tree_model_iter_next(mod, & step_level);
626 gtk_tree_store_append (store, & size_level, NULL);
627 gtk_tree_store_set (store, & size_level, 0, coord -> rsz[rid],
633 gtk_tree_store_append (store, & ring_level, & size_level);
634 gtk_tree_store_set (store, & ring_level, 0, -coord -> rsz[rid],
637 3, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
642 gtk_tree_store_insert_before (store, & new_level, NULL, & size_level);
643 gtk_tree_store_set (store, & new_level, 0, coord -> rsz[rid],
649 gtk_tree_store_append (store, & ring_level, & new_level);
650 gtk_tree_store_set (store, & ring_level, 0, -coord -> rsz[rid],
653 3, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
658 gtk_tree_store_insert_before (store, & new_level, & size_level, & ring_level);
659 gtk_tree_store_set (store, & new_level, 0, -coord -> rsz[rid],
662 3, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
667 gtk_tree_store_insert_after (store, & new_level, & size_level, & ring_level);
668 gtk_tree_store_set (store, & new_level, 0, -coord -> rsz[rid],
671 3, this_proj -> modelgl -> show_rpoly[rid][coord -> rst[rid]-1][coord -> rsz[rid]-1][coord -> ri[rid]-1],
856 gchar * str = g_strdup_printf (
"Too many <b>%s</b> rings in your model !\n"
857 " It is impossible to display the entire list ...\n"
858 "... instead you can look for ring(s) 'manually':\n",
rings_type[rid]);
861 gchar * search_item[3]={
"MD step:",
"Ring size:",
"Ring ID:"};
865 j = (this_proj -> steps) > 1 ? 0 : 1;
867 coord -> rst[rid] = 1;
877 str = g_strdup_printf (
"in [1 - %d]", this_proj -> steps);
878 coord -> rilab[rid][i] =
markup_label(str, 50, -1, 0.0, 0.5);
883 str = g_strdup_printf (
"in [%d - %d]",
get_rmin(this_proj, rid, coord -> rst[rid]),
get_rmax(this_proj, rid, coord -> rst[rid]));
884 coord -> rilab[rid][i] =
markup_label(str, 50, -1, 0.0, 0.5);
889 coord -> rilab[rid][i] =
markup_label(
"", 50, -1, 0.0, 0.5);