150 GtkTreeIter step_level, size_level, chain_level;
152 if (this_proj -> coord -> totcoord[9])
154 for (h=0; h < this_proj -> steps; h++)
156 if (this_proj -> steps > 1)
158 gtk_tree_store_append (store, & step_level, NULL);
159 gtk_tree_store_set (store, & step_level, 0, h+1,
166 for (i=0; i < this_proj -> coord -> totcoord[9]; i++)
168 j = this_proj -> coord -> geolist[9][0][i];
169 k = this_proj -> modelgl -> num_chains[h][j-1];
170 if (this_proj -> steps > 1 && k > 0)
172 gtk_tree_store_append (store, & size_level, & step_level);
173 gtk_tree_store_set (store, & size_level, 0, 0,
180 else if (this_proj -> steps == 1)
182 gtk_tree_store_append (store, & size_level, NULL);
183 gtk_tree_store_set (store, & size_level, 0, j,
191 gtk_tree_store_append (store, & chain_level, & size_level);
192 if (this_proj -> steps > 1)
194 gtk_tree_store_set (store, & chain_level, 0, -(h+1),
203 gtk_tree_store_set (store, & chain_level, 0, -j,
226 GtkTreeViewColumn * chains_col[7];
227 GtkCellRenderer * chains_cell[7];
228 gchar *
ctitle[6]={
"MD. step",
"Chain(s) size",
"Id.",
"Show",
"Label",
"Pick"};
229 gchar * ctype[6]={
"text",
"text",
"text",
"active",
"active",
"active"};
230 GType
col_type[6]={G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN};
232 j = (this_proj -> steps > 1) ? 1: 0;
233 k = (this_proj -> steps > 1) ? 0: 1;
234 coord -> chains_model = gtk_tree_store_newv (5+j,
col_type);
236 GtkWidget * chains_tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL(coord -> chains_model));
237 for (i=0; i<5+j; i++)
241 chains_cell[i] = gtk_cell_renderer_text_new ();
245 chains_cell[i] = gtk_cell_renderer_toggle_new ();
246 g_signal_connect (G_OBJECT(chains_cell[i]),
"toggled", G_CALLBACK(
on_select_chains), & this_proj -> modelgl ->
colorp[i][0]);
248 gtk_cell_renderer_set_fixed_size (chains_cell[i], -1, 25);
249 chains_col[i] = gtk_tree_view_column_new_with_attributes (
ctitle[i+k], chains_cell[i], ctype[i+k], i, NULL);
250 gtk_tree_view_append_column(GTK_TREE_VIEW(chains_tree), chains_col[i]);
251 gtk_tree_view_column_set_alignment (chains_col[i], 0.5);
252 gtk_tree_view_column_set_cell_data_func (chains_col[i], chains_cell[i],
rings_set_visible, & this_proj -> modelgl ->
colorp[i][0], NULL);
266 GtkTreeIter step_level, size_level, chain_level;
267 GtkTreeIter new_level;
269 GtkTreeStore * store = (GtkTreeStore *) coord -> chains_model;
270 GtkTreeModel * mod = GTK_TREE_MODEL(coord -> chains_model);
272 gboolean insert = TRUE;
273 int g, h, i, j, k, l, m;
275 if (this_proj -> steps > 1)
277 valid = gtk_tree_model_get_iter_first(mod, & step_level);
280 gtk_tree_model_get (mod, & step_level, 0, & g, -1);
281 if (g > coord -> cst)
286 else if (g == coord -> cst)
288 if (gtk_tree_model_iter_has_child (mod, &step_level))
290 h = gtk_tree_model_iter_n_children (mod, &step_level);
293 if (gtk_tree_model_iter_nth_child (mod, &size_level, &step_level, i))
295 gtk_tree_model_get (mod, &size_level, 1, & j, -1);
296 if (j > coord -> csz)
302 else if (j == coord -> csz)
304 if (gtk_tree_model_iter_has_child (mod, &size_level))
306 k = gtk_tree_model_iter_n_children (mod, &size_level);
309 if (gtk_tree_model_iter_nth_child (mod, &chain_level, &size_level, l))
311 gtk_tree_model_get (mod, &chain_level, 2, & m, -1);
318 else if (m == coord -> ch)
320 insert = valid = FALSE;
344 valid = gtk_tree_model_iter_next(mod, & step_level);
352 gtk_tree_store_append (store, & step_level, NULL);
353 gtk_tree_store_set (store, & step_level, 0, coord -> cst,
359 gtk_tree_store_append (store, & size_level, & step_level);
360 gtk_tree_store_set (store, & size_level, 0, 0,
366 gtk_tree_store_append (store, & chain_level, & size_level);
367 gtk_tree_store_set (store, & chain_level, 0, -coord -> cst,
375 gtk_tree_store_insert_before (store, & new_level, NULL, & step_level);
376 gtk_tree_store_set (store, & new_level, 0, coord -> cst,
382 gtk_tree_store_append (store, & size_level, & new_level);
383 gtk_tree_store_set (store, & size_level, 0, 0,
389 gtk_tree_store_append (store, & chain_level, & size_level);
390 gtk_tree_store_set (store, & chain_level, 0, -coord -> cst,
398 gtk_tree_store_insert_after (store, & new_level, & step_level, & size_level);
399 gtk_tree_store_set (store, & new_level, 0, 0,
405 gtk_tree_store_append (store, & chain_level, & new_level);
406 gtk_tree_store_set (store, & chain_level, 0, -coord -> cst,
414 gtk_tree_store_insert_before (store, & new_level, & step_level, & size_level);
415 gtk_tree_store_set (store, & new_level, 0, 0,
421 gtk_tree_store_append (store, & chain_level, & new_level);
422 gtk_tree_store_set (store, & chain_level, 0, -coord -> cst,
430 gtk_tree_store_insert_after (store, & new_level, & size_level, & chain_level);
431 gtk_tree_store_set (store, & new_level, 0, -coord -> cst,
439 gtk_tree_store_insert_before (store, & new_level, & size_level, & chain_level);
440 gtk_tree_store_set (store, & new_level, 0, -coord -> cst,
452 valid = gtk_tree_model_get_iter_first(mod, & size_level);
455 gtk_tree_model_get (mod, & size_level, 0, & i, -1);
456 if (i > coord -> csz)
461 else if (i == coord -> csz)
463 if (gtk_tree_model_iter_has_child (mod, &size_level))
465 j = gtk_tree_model_iter_n_children (mod, &size_level);
468 if (gtk_tree_model_iter_nth_child (mod, &chain_level, &size_level, k))
470 gtk_tree_model_get (mod, &chain_level, 1, & l, -1);
477 else if (l == coord -> ch)
479 insert = valid = FALSE;
493 valid = gtk_tree_model_iter_next(mod, & step_level);
501 gtk_tree_store_append (store, & size_level, NULL);
502 gtk_tree_store_set (store, & size_level, 0, coord -> csz,
507 gtk_tree_store_append (store, & chain_level, & size_level);
508 gtk_tree_store_set (store, & chain_level, 0, -coord -> csz,
515 gtk_tree_store_insert_before (store, & new_level, NULL, & size_level);
516 gtk_tree_store_set (store, & new_level, 0, coord -> csz,
521 gtk_tree_store_append (store, & chain_level, & new_level);
522 gtk_tree_store_set (store, & chain_level, 0, -coord -> csz,
529 gtk_tree_store_insert_before (store, & new_level, & size_level, & chain_level);
530 gtk_tree_store_set (store, & new_level, 0, -coord -> csz,
537 gtk_tree_store_insert_after (store, & new_level, & size_level, & chain_level);
538 gtk_tree_store_set (store, & new_level, 0, -coord -> csz,
622 int v = (int)atof(m);
628 if (v > 0 && v < this_proj -> steps+1)
630 if (v != coord -> cst)
633 coord -> csz = coord -> ch = -1;
634 for (j=1; j<3; j++) gtk_label_set_text (GTK_LABEL(coord -> chlab[j]),
"");
639 coord -> cst = coord -> csz = coord -> ch = -1;
641 if (coord -> cst > 0)
644 str = g_strdup_printf (
"in [%d - %d]",
get_cmin(this_proj, coord -> cst),
get_cmax(this_proj, coord -> cst));
645 gtk_label_set_text (GTK_LABEL(coord -> chlab[1]), str);
651 for (j=1; j<3; j++) gtk_label_set_text (GTK_LABEL(coord -> chlab[j]),
"");
655 if (coord -> cst > -1)
657 i =
get_cmin(this_proj, coord -> cst);
658 j =
get_cmax(this_proj, coord -> cst);
659 if (v >= i && v <= j)
661 if (v != coord -> csz)
663 if (this_proj -> modelgl -> num_chains[coord -> cst-1][coord -> csz-1])
667 gtk_label_set_text (GTK_LABEL(coord -> chlab[2]),
"");
671 coord -> csz = coord -> ch = -1;
678 coord -> csz = coord -> ch = -1;
680 if (coord -> csz > 0)
683 str = g_strdup_printf (
"in [1 - %d]", this_proj -> modelgl -> num_chains[coord -> cst-1][coord -> csz-1]);
684 gtk_label_set_text (GTK_LABEL(coord -> chlab[2]), str);
690 gtk_label_set_text (GTK_LABEL(coord -> chlab[2]),
"");
694 if (coord -> cst > -1 && coord -> csz > -1)
696 if (v > 0 && v < this_proj -> modelgl -> num_chains[coord -> cst-1][coord -> csz-1]+1)
719 if (coord -> cst > 0 && coord -> csz > 0 && coord -> ch > 0)
735 gchar * str = g_strdup_printf (
"Too many chains in your model !\n"
736 " It is impossible to display the entire list ...\n"
737 "... instead you can look for chain(s) 'manually':\n");
740 gchar * search_item[3]={
"MD step:",
"Chain size:",
"Chain ID:"};
744 j = (this_proj -> steps) > 1 ? 0 : 1;
756 str = g_strdup_printf (
"in [1 - %d]", this_proj -> steps);
757 coord -> chlab[i] =
markup_label(str, 50, -1, 0.0, 0.5);
762 str = g_strdup_printf (
"in [%d - %d]",
get_cmin(this_proj, coord -> cst),
get_cmax(this_proj, coord -> cst));
763 coord -> chlab[i] =
markup_label(str, 50, -1, 0.0, 0.5);
774 return chains_search;