atomes 1.1.14
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
w_chains.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2024 by CNRS and University of Strasbourg */
15
22/*
23* This file: 'w_chains.c'
24*
25* Contains:
26*
27
28 - The functions to create the chain(s) tab for the advanced environments window
29
30*
31* List of functions:
32
33 int get_cmin (project * this_proj, int step);
34 int get_cmax (project * this_proj, int step);
35
36 void fill_chains_model (GtkTreeStore * store, project * this_proj);
37 void add_this_chain_to_search_tree (project * this_proj);
38
39 G_MODULE_EXPORT void on_select_chains (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data);
40 G_MODULE_EXPORT void update_chains_search (GtkEntry * res, gpointer data);
41
42 GtkWidget * create_chains_tree (project * this_proj, gboolean fill_this);
43 GtkWidget * create_chains_search (project * this_proj);
44 GtkWidget * chains_tab (glwin * view);
45
46*/
47
48#include "global.h"
49#include "interface.h"
50#include "glview.h"
51#include "glwindow.h"
52
53extern void rings_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
54
64G_MODULE_EXPORT void on_select_chains (GtkCellRendererToggle * cell_renderer, gchar * string_path, gpointer data)
65{
66 tint * dat = (tint * )data;
67 gboolean saved_label[2];
68 int i, j, c, s, v, u, a, b;
70 coord_edition * coord = opengl_project -> modelgl -> coord_win;
71 b = (opengl_project -> steps > 1) ? 1: 0;
72 c = dat -> b;
73 if (gtk_cell_renderer_toggle_get_active(cell_renderer))
74 {
75 v = 0;
76 }
77 else
78 {
79 v = 1;
80 }
81 GtkTreeIter iter;
82 GtkTreePath * path = gtk_tree_path_new_from_string (string_path);
83 gtk_tree_model_get_iter (GTK_TREE_MODEL(coord -> chains_model), & iter, path);
84 gtk_tree_store_set (coord -> chains_model, & iter, c, v, -1);
85 if (b)
86 {
87 gtk_tree_model_get (GTK_TREE_MODEL(coord -> chains_model), & iter, 0, & s, -1);
88 s = - s - 1;
89 }
90 else
91 {
92 s = 0;
93 }
94 gtk_tree_model_get (GTK_TREE_MODEL(coord -> chains_model), & iter, b, & i, -1);
95 i = -i;
96 gtk_tree_model_get (GTK_TREE_MODEL(coord -> chains_model), & iter, b+1, & j, -1);
97 switch (c-b)
98 {
99 case 2:
100 // Viz
101 for (u=0; u<i; u++)
102 {
103 a = opengl_project -> modelgl -> all_chains[s][i-1][j-1][u];
104#ifdef GTK4
105 if (opengl_project -> atoms[s][a].show[0] != v) show_hide_this_atom (NULL, NULL, GINT_TO_POINTER(a));
106#else
107 if (opengl_project -> atoms[s][a].show[0] != v) show_hide_this_atom (NULL, GINT_TO_POINTER(a));
108#endif // GTK4
109 }
110 break;
111 case 3:
112 // Label
113 for (u=0; u<i; u++)
114 {
115 a = opengl_project -> modelgl -> all_chains[s][i-1][j-1][u];
116 opengl_project -> atoms[s][a].label[0] = opengl_project -> atoms[s][a].label[1] = v;
117 }
118 opengl_project -> modelgl -> create_shaders[LABEL] = TRUE;
119 break;
120 case 4:
121 // Pick
122 for (u=0; u<i; u++)
123 {
124 a = opengl_project -> modelgl -> all_chains[s][i-1][j-1][u];
125 saved_label[0] = opengl_project -> atoms[s][a].label[0];
126 saved_label[1] = opengl_project -> atoms[s][a].label[1];
127#ifdef GTK4
128 if (opengl_project -> atoms[s][a].pick[0] != v) select_unselect_this_atom (NULL, NULL, GINT_TO_POINTER(a));
129#else
130 if (opengl_project -> atoms[s][a].pick[0] != v) select_unselect_this_atom (NULL, GINT_TO_POINTER(a));
131#endif // GTK4
132 opengl_project -> atoms[s][a].label[0] = saved_label[0];
133 opengl_project -> atoms[s][a].label[1] = saved_label[1];
134 }
135 break;
136 }
137 update (opengl_project -> modelgl);
138}
139
148void fill_chains_model (GtkTreeStore * store, project * this_proj)
149{
150 GtkTreeIter step_level, size_level, chain_level;
151 int h, i, j, k, l;
152 if (this_proj -> coord -> totcoord[9])
153 {
154 for (h=0; h < this_proj -> steps; h++)
155 {
156 if (this_proj -> steps > 1)
157 {
158 gtk_tree_store_append (store, & step_level, NULL);
159 gtk_tree_store_set (store, & step_level, 0, h+1,
160 1, 0,
161 2, 0,
162 3, 0,
163 4, 0,
164 5, 0, -1);
165 }
166 for (i=0; i < this_proj -> coord -> totcoord[9]; i++)
167 {
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)
171 {
172 gtk_tree_store_append (store, & size_level, & step_level);
173 gtk_tree_store_set (store, & size_level, 0, 0,
174 1, j,
175 2, 0,
176 3, 0,
177 4, 0,
178 5, 0, -1);
179 }
180 else if (this_proj -> steps == 1)
181 {
182 gtk_tree_store_append (store, & size_level, NULL);
183 gtk_tree_store_set (store, & size_level, 0, j,
184 1, 0,
185 2, 0,
186 3, 0,
187 4, 0, -1);
188 }
189 for (l=0; l<k; l++)
190 {
191 gtk_tree_store_append (store, & chain_level, & size_level);
192 if (this_proj -> steps > 1)
193 {
194 gtk_tree_store_set (store, & chain_level, 0, -(h+1),
195 1, -j,
196 2, l+1,
197 3, FALSE,
198 4, FALSE,
199 5, FALSE, -1);
200 }
201 else
202 {
203 gtk_tree_store_set (store, & chain_level, 0, -j,
204 1, l+1,
205 2, FALSE,
206 3, FALSE,
207 4, FALSE, -1);
208 }
209 }
210 }
211 }
212 }
213}
214
223GtkWidget * create_chains_tree (project * this_proj, gboolean fill_this)
224{
225 int i, j, k;
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};
231 coord_edition * coord = this_proj -> modelgl -> coord_win;
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);
235 if (fill_this) fill_chains_model (coord -> chains_model, this_proj);
236 GtkWidget * chains_tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL(coord -> chains_model));
237 for (i=0; i<5+j; i++)
238 {
239 if (i < 2+j)
240 {
241 chains_cell[i] = gtk_cell_renderer_text_new ();
242 }
243 else
244 {
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]);
247 }
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);
253 }
254 return chains_tree;
255}
256
265{
266 GtkTreeIter step_level, size_level, chain_level;
267 GtkTreeIter new_level;
268 coord_edition * coord = this_proj -> modelgl -> coord_win;
269 GtkTreeStore * store = (GtkTreeStore *) coord -> chains_model;
270 GtkTreeModel * mod = GTK_TREE_MODEL(coord -> chains_model);
271 gboolean valid;
272 gboolean insert = TRUE;
273 int g, h, i, j, k, l, m;
274 int prepend = 0;
275 if (this_proj -> steps > 1)
276 {
277 valid = gtk_tree_model_get_iter_first(mod, & step_level);
278 while (valid)
279 {
280 gtk_tree_model_get (mod, & step_level, 0, & g, -1);
281 if (g > coord -> cst)
282 {
283 prepend = 1;
284 valid = FALSE;
285 }
286 else if (g == coord -> cst)
287 {
288 if (gtk_tree_model_iter_has_child (mod, &step_level))
289 {
290 h = gtk_tree_model_iter_n_children (mod, &step_level);
291 for (i=0; i<h; i++)
292 {
293 if (gtk_tree_model_iter_nth_child (mod, &size_level, &step_level, i))
294 {
295 gtk_tree_model_get (mod, &size_level, 1, & j, -1);
296 if (j > coord -> csz)
297 {
298 prepend = 3;
299 valid = FALSE;
300 break;
301 }
302 else if (j == coord -> csz)
303 {
304 if (gtk_tree_model_iter_has_child (mod, &size_level))
305 {
306 k = gtk_tree_model_iter_n_children (mod, &size_level);
307 for (l=0; l<k; l++)
308 {
309 if (gtk_tree_model_iter_nth_child (mod, &chain_level, &size_level, l))
310 {
311 gtk_tree_model_get (mod, &chain_level, 2, & m, -1);
312 if (m > coord -> ch)
313 {
314 prepend = 5;
315 valid = FALSE;
316 break;
317 }
318 else if (m == coord -> ch)
319 {
320 insert = valid = FALSE;
321 break;
322 }
323 }
324 }
325 if (valid)
326 {
327 prepend = 4;
328 valid = FALSE;
329 break;
330 }
331 }
332 }
333 }
334 }
335 if (valid)
336 {
337 prepend = 2;
338 valid = FALSE;
339 }
340 }
341 }
342 else
343 {
344 valid = gtk_tree_model_iter_next(mod, & step_level);
345 }
346 }
347 if (insert)
348 {
349 switch (prepend)
350 {
351 case 0:
352 gtk_tree_store_append (store, & step_level, NULL);
353 gtk_tree_store_set (store, & step_level, 0, coord -> cst,
354 1, 0,
355 2, 0,
356 3, 0,
357 4, 0,
358 5, 0, -1);
359 gtk_tree_store_append (store, & size_level, & step_level);
360 gtk_tree_store_set (store, & size_level, 0, 0,
361 1, coord -> csz,
362 2, 0,
363 3, 0,
364 4, 0,
365 5, 0, -1);
366 gtk_tree_store_append (store, & chain_level, & size_level);
367 gtk_tree_store_set (store, & chain_level, 0, -coord -> cst,
368 1, -coord -> csz,
369 2, coord -> ch,
370 3, FALSE,
371 4, FALSE,
372 5, FALSE, -1);
373 break;
374 case 1:
375 gtk_tree_store_insert_before (store, & new_level, NULL, & step_level);
376 gtk_tree_store_set (store, & new_level, 0, coord -> cst,
377 1, 0,
378 2, 0,
379 3, 0,
380 4, 0,
381 5, 0, -1);
382 gtk_tree_store_append (store, & size_level, & new_level);
383 gtk_tree_store_set (store, & size_level, 0, 0,
384 1, coord -> csz,
385 2, 0,
386 3, 0,
387 4, 0,
388 5, 0, -1);
389 gtk_tree_store_append (store, & chain_level, & size_level);
390 gtk_tree_store_set (store, & chain_level, 0, -coord -> cst,
391 1, -coord -> csz,
392 2, coord -> ch,
393 3, FALSE,
394 4, FALSE,
395 5, FALSE, -1);
396 break;
397 case 2:
398 gtk_tree_store_insert_after (store, & new_level, & step_level, & size_level);
399 gtk_tree_store_set (store, & new_level, 0, 0,
400 1, coord -> csz,
401 2, 0,
402 3, 0,
403 4, 0,
404 5, 0, -1);
405 gtk_tree_store_append (store, & chain_level, & new_level);
406 gtk_tree_store_set (store, & chain_level, 0, -coord -> cst,
407 1, -coord -> csz,
408 2, coord -> ch,
409 3, FALSE,
410 4, FALSE,
411 5, FALSE, -1);
412 break;
413 case 3:
414 gtk_tree_store_insert_before (store, & new_level, & step_level, & size_level);
415 gtk_tree_store_set (store, & new_level, 0, 0,
416 1, coord -> csz,
417 2, 0,
418 3, 0,
419 4, 0,
420 5, 0, -1);
421 gtk_tree_store_append (store, & chain_level, & new_level);
422 gtk_tree_store_set (store, & chain_level, 0, -coord -> cst,
423 1, -coord -> csz,
424 2, coord -> ch,
425 3, FALSE,
426 4, FALSE,
427 5, FALSE, -1);
428 break;
429 case 4:
430 gtk_tree_store_insert_after (store, & new_level, & size_level, & chain_level);
431 gtk_tree_store_set (store, & new_level, 0, -coord -> cst,
432 1, -coord -> csz,
433 2, coord -> ch,
434 3, FALSE,
435 4, FALSE,
436 5, FALSE, -1);
437 break;
438 case 5:
439 gtk_tree_store_insert_before (store, & new_level, & size_level, & chain_level);
440 gtk_tree_store_set (store, & new_level, 0, -coord -> cst,
441 1, -coord -> csz,
442 2, coord -> ch,
443 3, FALSE,
444 4, FALSE,
445 5, FALSE, -1);
446 break;
447 }
448 }
449 }
450 else
451 {
452 valid = gtk_tree_model_get_iter_first(mod, & size_level);
453 while (valid)
454 {
455 gtk_tree_model_get (mod, & size_level, 0, & i, -1);
456 if (i > coord -> csz)
457 {
458 prepend = 1;
459 valid = FALSE;
460 }
461 else if (i == coord -> csz)
462 {
463 if (gtk_tree_model_iter_has_child (mod, &size_level))
464 {
465 j = gtk_tree_model_iter_n_children (mod, &size_level);
466 for (k=0; k<j; k++)
467 {
468 if (gtk_tree_model_iter_nth_child (mod, &chain_level, &size_level, k))
469 {
470 gtk_tree_model_get (mod, &chain_level, 1, & l, -1);
471 if (l > coord -> ch)
472 {
473 prepend = 2;
474 valid = FALSE;
475 break;
476 }
477 else if (l == coord -> ch)
478 {
479 insert = valid = FALSE;
480 break;
481 }
482 }
483 }
484 if (valid)
485 {
486 prepend = 3;
487 valid = FALSE;
488 }
489 }
490 }
491 else
492 {
493 valid = gtk_tree_model_iter_next(mod, & step_level);
494 }
495 }
496 if (insert)
497 {
498 switch (prepend)
499 {
500 case 0:
501 gtk_tree_store_append (store, & size_level, NULL);
502 gtk_tree_store_set (store, & size_level, 0, coord -> csz,
503 1, 0,
504 2, 0,
505 3, 0,
506 4, 0, -1);
507 gtk_tree_store_append (store, & chain_level, & size_level);
508 gtk_tree_store_set (store, & chain_level, 0, -coord -> csz,
509 1, coord -> ch,
510 2, FALSE,
511 3, FALSE,
512 4, FALSE, -1);
513 break;
514 case 1:
515 gtk_tree_store_insert_before (store, & new_level, NULL, & size_level);
516 gtk_tree_store_set (store, & new_level, 0, coord -> csz,
517 1, 0,
518 2, 0,
519 3, 0,
520 4, 0, -1);
521 gtk_tree_store_append (store, & chain_level, & new_level);
522 gtk_tree_store_set (store, & chain_level, 0, -coord -> csz,
523 1, coord -> ch,
524 2, FALSE,
525 3, FALSE,
526 4, FALSE, -1);
527 break;
528 case 2:
529 gtk_tree_store_insert_before (store, & new_level, & size_level, & chain_level);
530 gtk_tree_store_set (store, & new_level, 0, -coord -> csz,
531 1, coord -> ch,
532 2, FALSE,
533 3, FALSE,
534 4, FALSE, -1);
535 break;
536 case 3:
537 gtk_tree_store_insert_after (store, & new_level, & size_level, & chain_level);
538 gtk_tree_store_set (store, & new_level, 0, -coord -> csz,
539 1, coord -> ch,
540 2, FALSE,
541 3, FALSE,
542 4, FALSE, -1);
543 break;
544 }
545 }
546 }
547}
548
557int get_cmin (project * this_proj, int step)
558{
559 int i, j;
560 for (i=0; i<this_proj -> coord -> totcoord[9]; i++)
561 {
562 j = this_proj -> coord -> geolist[9][0][i];
563 if (this_proj -> modelgl -> num_chains[step-1][j-1]) break;
564 }
565 return j;
566}
567
576int get_cmax (project * this_proj, int step)
577{
578 int i, j;
579 for (i=this_proj -> coord -> totcoord[9]-1; i>-1; i--)
580 {
581 j = this_proj -> coord -> geolist[9][0][i];
582 if (this_proj -> modelgl -> num_chains[step-1][j-1]) break;
583 }
584 return j;
585}
586
616G_MODULE_EXPORT void update_chains_search (GtkEntry * res, gpointer data)
617{
618 tint * dat = (tint * )data;
619 gchar * str;
620 const gchar * m = entry_get_text (res);
621 int i, j;
622 int v = (int)atof(m);
623 project * this_proj = get_project_by_id(dat -> a);
624 coord_edition * coord = this_proj -> modelgl -> coord_win;
625 switch (dat -> b)
626 {
627 case 0:
628 if (v > 0 && v < this_proj -> steps+1)
629 {
630 if (v != coord -> cst)
631 {
632 coord -> cst = v;
633 coord -> csz = coord -> ch = -1;
634 for (j=1; j<3; j++) gtk_label_set_text (GTK_LABEL(coord -> chlab[j]), "");
635 }
636 }
637 else
638 {
639 coord -> cst = coord -> csz = coord -> ch = -1;
640 }
641 if (coord -> cst > 0)
642 {
643 update_entry_int(res, coord -> cst);
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);
646 g_free (str);
647 }
648 else
649 {
651 for (j=1; j<3; j++) gtk_label_set_text (GTK_LABEL(coord -> chlab[j]), "");
652 }
653 break;
654 case 1:
655 if (coord -> cst > -1)
656 {
657 i = get_cmin(this_proj, coord -> cst);
658 j = get_cmax(this_proj, coord -> cst);
659 if (v >= i && v <= j)
660 {
661 if (v != coord -> csz)
662 {
663 if (this_proj -> modelgl -> num_chains[coord -> cst-1][coord -> csz-1])
664 {
665 coord -> csz = v;
666 coord -> ch = -1;
667 gtk_label_set_text (GTK_LABEL(coord -> chlab[2]), "");
668 }
669 else
670 {
671 coord -> csz = coord -> ch = -1;
672 }
673 }
674 }
675 }
676 else
677 {
678 coord -> csz = coord -> ch = -1;
679 }
680 if (coord -> csz > 0)
681 {
682 update_entry_int(res, coord -> csz);
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);
685 g_free (str);
686 }
687 else
688 {
690 gtk_label_set_text (GTK_LABEL(coord -> chlab[2]), "");
691 }
692 break;
693 case 2:
694 if (coord -> cst > -1 && coord -> csz > -1)
695 {
696 if (v > 0 && v < this_proj -> modelgl -> num_chains[coord -> cst-1][coord -> csz-1]+1)
697 {
698 coord -> ch = v;
699 }
700 else
701 {
702 coord -> ch = -1;
703 }
704 }
705 else
706 {
707 coord -> ch = -1;
708 }
709 if (coord -> ch > 0)
710 {
711 update_entry_int(res, coord -> ch);
712 }
713 else
714 {
716 }
717 break;
718 }
719 if (coord -> cst > 0 && coord -> csz > 0 && coord -> ch > 0)
720 {
722 }
723}
724
732GtkWidget * create_chains_search (project * this_proj)
733{
734 GtkWidget * chains_search = create_vbox (BSEP);
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");
738 add_box_child_start (GTK_ORIENTATION_VERTICAL, chains_search, markup_label(str, 200, -1, 0.5, 0.5), FALSE, FALSE, 10);
739 g_free (str);
740 gchar * search_item[3]={"MD step:", "Chain size:", "Chain ID:"};
741 int i, j;
742 GtkWidget * hbox;
743 GtkWidget * entry;
744 j = (this_proj -> steps) > 1 ? 0 : 1;
745 coord_edition * coord = this_proj -> modelgl -> coord_win;
746 coord -> cst = 1;
747 for (i=j; i<3; i++)
748 {
749 hbox = create_hbox (0);
750 add_box_child_start (GTK_ORIENTATION_VERTICAL, chains_search, hbox, FALSE, FALSE, 0);
751 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(search_item[i], 100, -1, 0.0, 0.5), FALSE, FALSE, 20);
752 entry = create_entry (G_CALLBACK(update_chains_search), 100, 15, FALSE, & this_proj -> modelgl -> colorp[i][0]);
753 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox,entry, FALSE, FALSE, 0);
754 if (i==0)
755 {
756 str = g_strdup_printf ("in [1 - %d]", this_proj -> steps);
757 coord -> chlab[i] = markup_label(str, 50, -1, 0.0, 0.5);
758 g_free (str);
759 }
760 else if (i == 1)
761 {
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);
764 g_free (str);
765 }
766 else
767 {
768 coord -> chlab[i] = markup_label("", 50, -1, 0.0, 0.5);
769 }
770 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, coord -> chlab[i], FALSE, FALSE, 5);
771 }
772 add_box_child_start (GTK_ORIENTATION_VERTICAL, chains_search, markup_label("<b>Search result(s)</b>", 200, -1, 0.5, 0.5), FALSE, FALSE, 10);
773 add_box_child_start (GTK_ORIENTATION_VERTICAL, chains_search, create_chains_tree (this_proj, FALSE), FALSE, FALSE, 0);
774 return chains_search;
775}
776
784GtkWidget * chains_tab (glwin * view)
785{
786 GtkWidget * chains = create_scroll(NULL, -1, -1, GTK_SHADOW_NONE);
787 gtk_widget_set_hexpand (chains, TRUE);
788 gtk_widget_set_vexpand (chains, TRUE);
789 int h, i, j, k;
790 project * this_proj = get_project_by_id(view -> proj);
791 k = 0;
792 for (h=0; h < this_proj -> steps; h++)
793 {
794 for (i=0; i < this_proj -> coord -> totcoord[9]; i++)
795 {
796 j = this_proj -> coord -> geolist[9][0][i];
797 k += this_proj -> modelgl -> num_chains[h][j-1];
798 }
799 }
800 if (k < 10000)
801 {
803 }
804 else
805 {
807 }
808 return chains;
809}
integer function chains()
Definition chains.F90:54
color colorp[64]
ColRGBA col
Definition d_measures.c:77
int atoms[NUM_STYLES][2]
GtkTreePath * path
Definition datab.c:103
gchar * ctitle[MAXDATA][12]
Definition dlp_field.c:834
GType col_type[MAXDATA][12]
Definition dlp_field.c:856
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1294
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:1940
project * proj
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
Definition gtk-misc.c:577
#define BSEP
Definition global.h:217
void opengl_project_changed(int id)
change the OpenGL project
Definition update_p.c:245
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
Definition gtk-misc.c:594
G_MODULE_EXPORT void select_unselect_this_atom(GtkWidget *widg, gpointer data)
select / unselect this atom callback GTK3
Definition popup.c:1176
@ CONTAINER_SCR
Definition global.h:223
G_MODULE_EXPORT void show_hide_this_atom(GtkWidget *widg, gpointer data)
show / hide this atom callback GTK3
Definition popup.c:1018
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
Definition gtk-misc.c:1565
project * opengl_project
Definition project.c:54
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
Definition gtk-misc.c:279
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:793
void update_entry_text(GtkEntry *entry, gchar *text)
update the content of a GtkEntry as string
Definition gtk-misc.c:651
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:206
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:781
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
void update(glwin *view)
update the rendering of the OpenGL window
Definition glview.c:439
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
gboolean pick
int step
Definition ogl_draw.c:70
@ LABEL
Definition glwin.h:98
Function declarations for the creation of the OpenGL window.
Messaging function declarations.
Definition glwin.h:875
Definition global.h:98
int b
Definition tab-1.c:95
int c
Definition tab-1.c:95
int a
Definition tab-1.c:95
GtkWidget * create_chains_search(project *this_proj)
create the chain(s) search widget
Definition w_chains.c:732
G_MODULE_EXPORT void update_chains_search(GtkEntry *res, gpointer data)
update the chain(s) search widget
Definition w_chains.c:616
GtkWidget * create_chains_tree(project *this_proj, gboolean fill_this)
create the chain(s) search tree store
Definition w_chains.c:223
void add_this_chain_to_search_tree(project *this_proj)
add chain in the search tree based on chain length and id
Definition w_chains.c:264
G_MODULE_EXPORT void on_select_chains(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on select chain toggle callback
Definition w_chains.c:64
void fill_chains_model(GtkTreeStore *store, project *this_proj)
fill the entire chain(s) tree store
Definition w_chains.c:148
GtkWidget * chains_tab(glwin *view)
create the chain(s) tab for the advanced environments window
Definition w_chains.c:784
void rings_set_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
show / hide cell renderer in the ring search tree store
Definition w_rings.c:165
int get_cmax(project *this_proj, int step)
get chain(s) max size for the MD step
Definition w_chains.c:576
int get_cmin(project *this_proj, int step)
get chain(s) min size for the MD step
Definition w_chains.c:557
GtkWidget * res[2]
Definition w_encode.c:212
GtkWidget * hbox
Definition workspace.c:71