128#include <libxml/encoding.h>
129#include <libxml/xmlwriter.h>
130#include <libxml/xmlreader.h>
131#include <libxml/parser.h>
133#include <sys/types.h>
142extern xmlNodePtr
findnode (xmlNodePtr startnode,
char * nname);
148extern gchar *
substitute_string (gchar * init, gchar * o_motif, gchar * n_motif);
149extern G_MODULE_EXPORT gboolean
scroll_scale_quality (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data);
156extern G_MODULE_EXPORT
void box_advanced (GtkWidget * widg, gpointer data);
157extern G_MODULE_EXPORT
void axis_advanced (GtkWidget * widg, gpointer data);
161extern G_MODULE_EXPORT
void scale_quality (GtkRange * range, gpointer data);
168extern GtkWidget *
adv_box (GtkWidget *
box,
char *
lab,
int vspace,
int size,
float xalign);
303gchar *
xml_style_leg[6] = {
"ball_and_stick",
"wireframes",
"spacefilled",
"spheres",
"cylinders",
"dots"};
305gchar *
xml_atom_leg[3] = {
"atoms_radius",
"dot_size",
"sphere_radius"};
306gchar *
xml_bond_leg[3] = {
"bond_radius",
"wireframe_width",
"cylinder_radius"};
322 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
323 if (rc < 0)
return 0;
324 rc = xmlTextWriterWriteAttribute(writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST legend);
325 if (rc < 0)
return 0;
326 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"key", BAD_CAST key);
327 if (rc < 0)
return 0;
330 str = g_strdup_printf (
"%d", did);
331 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST str);
333 if (rc < 0)
return 0;
335 str = g_strdup_printf (
"%f",
col.red);
336 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"red", BAD_CAST str);
338 if (rc < 0)
return 0;
339 str = g_strdup_printf (
"%f",
col.green);
340 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"green", BAD_CAST str);
342 if (rc < 0)
return 0;
343 str = g_strdup_printf (
"%f",
col.blue);
344 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"blue", BAD_CAST str);
346 if (rc < 0)
return 0;
347 str = g_strdup_printf (
"%f",
col.alpha);
348 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"alpha", BAD_CAST str);
350 if (rc < 0)
return 0;
351 rc = xmlTextWriterEndElement (writer);
352 if (rc < 0)
return 0;
370 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
371 if (rc < 0)
return 0;
372 rc = xmlTextWriterWriteAttribute(writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST legend);
373 if (rc < 0)
return 0;
374 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"key", BAD_CAST key);
375 if (rc < 0)
return 0;
378 str = g_strdup_printf (
"%d", did);
379 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST str);
381 if (rc < 0)
return 0;
383 str = g_strdup_printf (
"%f", data.
x);
384 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"x", BAD_CAST str);
386 if (rc < 0)
return 0;
387 str = g_strdup_printf (
"%f", data.
y);
388 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"y", BAD_CAST str);
390 if (rc < 0)
return 0;
391 str = g_strdup_printf (
"%f", data.
z);
392 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"z", BAD_CAST str);
394 if (rc < 0)
return 0;
395 rc = xmlTextWriterEndElement (writer);
396 if (rc < 0)
return 0;
415 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
416 if (rc < 0)
return 0;
417 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST xml_leg);
418 if (rc < 0)
return 0;
419 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"key", BAD_CAST xml_key);
420 if (rc < 0)
return 0;
424 str = g_strdup_printf (
"%d", xml_id);
425 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST (
const xmlChar *)str);
427 if (rc < 0)
return 0;
429 rc = xmlTextWriterWriteFormatString (writer,
"%s", value);
430 if (rc < 0)
return 0;
431 rc = xmlTextWriterEndElement (writer);
432 if (rc < 0)
return 0;
448 if (! CreateDirectory(
ATOMES_CONFIG_DIR, NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
461 xmlTextWriterPtr writer;
463 gchar * xml_delta_num_leg[
NUM_DELTA] = {
i18n(
"g(r): number of δr"),
i18n(
"s(q): number of δq"),
i18n(
"s(k): number of δk"),
i18n(
"g(r) FFT: number of δr"),
464 i18n(
"Dij: number of δr [min(Dij)-max(Dij)]"),
i18n(
"Angles distribution: number of δθ [0-180°]"),
465 i18n(
"Spherical harmonics: l(max) in [2-40]"),
i18n(
"MSD: steps between configurations"),
466 i18n(
"F(k,t): number of δk")};
467 gchar * xml_delta_t_leg[2] = {
i18n(
"MSD: time steps δt"),
i18n(
"MSD: time unit")};
468 gchar * xml_rings_leg[7] = {
i18n(
"Default search"),
469 i18n(
"Atom(s) to initiate the search from"),
470 i18n(
"Maximum size for a ring"),
471 i18n(
"Maximum number of rings of size n per MD step"),
472 i18n(
"Only search for ABAB rings"),
473 i18n(
"No homopolar bonds in the rings (A-A, B-B ...)"),
474 i18n(
"No homopolar bonds in the connectivity matrix")};
475 gchar * xml_chain_leg[7] = {
i18n(
"Atom(s) to initiate the search from"),
476 i18n(
"Maximum size for a ring"),
477 i18n(
"Maximum number of rings of size n per MD step"),
478 i18n(
"Only search for AAAA chains"),
479 i18n(
"Only search for ABAB chains"),
480 i18n(
"No homopolar bonds in the chains (A-A, B-B ...)"),
481 i18n(
"Only search for 1-(2)n-1 chains")};
482 gchar * xml_skt_leg[4] = {
i18n(
"Analyze all correlated δt steps"),
483 i18n(
"Number of analyzed δt steps"),
484 i18n(
"Number of analyzed q points"),
485 i18n(
"Number of frequency points")};
486 gchar * xml_opengl_leg[5] = {
i18n(
"Default style"),
487 i18n(
"Atom(s) color map"),
488 i18n(
"Polyhedra color map"),
490 i18n(
"Ray Tracing")};
491 gchar * xml_material_leg[8] = {
i18n(
"Predefine material"),
492 i18n(
"Lightning model"),
495 i18n(
"Back lightning"),
499 gchar * xml_lightning_leg[7] = {
i18n(
"Type"),
505 i18n(
"Spot specifics")};
506 gchar * xml_fog_leg[5] = {
i18n(
"Mode"),
511 gchar * xml_model_leg[2] = {
i18n(
"Show clones"),
513 gchar * xml_label_leg[6] = {
i18n(
"Position"),
519 gchar * xml_axis_leg[3] = {
i18n(
"Legend on x"),
521 i18n(
"Legend on z")};
525 if (writer == NULL)
return 0;
526 rc = xmlTextWriterSetIndent(writer, 1);
527 if (rc < 0)
return 0;
531 rc = xmlTextWriterStartDocument (writer, NULL,
MY_ENCODING, NULL);
532 if (rc < 0)
return 0;
534 rc = xmlTextWriterWriteComment (writer, (
const xmlChar *)_(
"atomes preferences XML file"));
535 if (rc < 0)
return 0;
537 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"atomes_preferences-xml");
538 if (rc < 0)
return 0;
539 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"general");
540 if (rc < 0)
return 0;
543 rc = xmlTextWriterEndElement (writer);
544 if (rc < 0)
return 0;
546 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"analysis");
547 if (rc < 0)
return 0;
548 int i, j, k, l, m, n, o;
553 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"cutoffs");
554 if (rc < 0)
return 0;
564 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"partials");
565 if (rc < 0)
return 0;
569 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
570 if (rc < 0)
return 0;
572 rc = xmlTextWriterWriteAttribute(writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST str);
574 if (rc < 0)
return 0;
575 str = g_strdup_printf (
"%d", tmp_cut -> Z[0]);
576 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"α", BAD_CAST str);
578 if (rc < 0)
return 0;
579 str = g_strdup_printf (
"%d", tmp_cut -> Z[1]);
580 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"β", BAD_CAST str);
582 if (rc < 0)
return 0;
583 str = g_strdup_printf (
"%lf", tmp_cut -> cutoff);
584 rc = xmlTextWriterWriteFormatString (writer,
"%s", str);
586 if (rc < 0)
return 0;
587 rc = xmlTextWriterEndElement (writer);
588 if (rc < 0)
return 0;
589 tmp_cut = tmp_cut -> next;
591 rc = xmlTextWriterEndElement (writer);
592 if (rc < 0)
return 0;
594 rc = xmlTextWriterEndElement (writer);
595 if (rc < 0)
return 0;
649 rc = xmlTextWriterEndElement (writer);
650 if (rc < 0)
return 0;
652 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"opengl");
653 if (rc < 0)
return 0;
663 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"material");
664 if (rc < 0)
return 0;
683 rc = xmlTextWriterEndElement (writer);
684 if (rc < 0)
return 0;
686 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"lightning");
687 if (rc < 0)
return 0;
696 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"light");
697 if (rc < 0)
return 0;
698 str = g_strdup_printf (
"%d", i);
699 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST (
const xmlChar *)str);
701 if (rc < 0)
return 0;
731 rc = xmlTextWriterEndElement (writer);
732 if (rc < 0)
return 0;
736 rc = xmlTextWriterEndElement (writer);
737 if (rc < 0)
return 0;
739 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"fog");
740 if (rc < 0)
return 0;
757 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
758 if (rc < 0)
return 0;
759 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST xml_fog_leg[3]);
760 if (rc < 0)
return 0;
761 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"key", BAD_CAST
"fog.depth");
762 if (rc < 0)
return 0;
763 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST
"3");
764 if (rc < 0)
return 0;
765 str = g_strdup_printf (
"%f",
default_fog.depth[0]);
766 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"start", BAD_CAST str);
768 if (rc < 0)
return 0;
769 str = g_strdup_printf (
"%f",
default_fog.depth[1]);
770 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"end", BAD_CAST str);
772 if (rc < 0)
return 0;
773 rc = xmlTextWriterEndElement (writer);
774 if (rc < 0)
return 0;
779 rc = xmlTextWriterEndElement (writer);
780 if (rc < 0)
return 0;
783 rc = xmlTextWriterEndElement (writer);
784 if (rc < 0)
return 0;
787 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"model");
788 if (rc < 0)
return 0;
804 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"atoms_and_bonds");
805 if (rc < 0)
return 0;
810 gchar * str_a, * str_b;
813 do_atoms = do_bonds = FALSE;
830 if (i != 2 && i != 3 && i != 5)
836 if (do_atoms || do_bonds)
838 rc = xmlTextWriterStartElement (writer, BAD_CAST
xml_style_leg[i]);
839 if (rc < 0)
return 0;
843 k = (j == 0 || j == 2) ? 0 : (j == 1 || j == 4) ? 1 : 2;
856 l = (j == 2) ? 4 : 1;
857 for (m=0; m < l; m++)
862 n = (o && m) ? 5 : n;
866 rc = xmlTextWriterStartElement (writer, BAD_CAST str_a);
868 if (rc < 0)
return 0;
872 str = g_strdup_printf (
"%f", tmp_rad -> rad);
876 tmp_rad = tmp_rad -> next;
878 rc = xmlTextWriterEndElement (writer);
879 if (rc < 0)
return 0;
901 rc = xmlTextWriterStartElement (writer, BAD_CAST str_a);
903 if (rc < 0)
return 0;
907 str = g_strdup_printf (
"%f", tmp_rad -> rad);
911 tmp_rad = tmp_rad -> next;
913 rc = xmlTextWriterEndElement (writer);
914 if (rc < 0)
return 0;
918 rc = xmlTextWriterEndElement (writer);
919 if (rc < 0)
return 0;
924 rc = xmlTextWriterEndElement (writer);
925 if (rc < 0)
return 0;
929 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"labels");
930 if (rc < 0)
return 0;
931 gchar * obj[2]={
"atoms",
"clones"};
934 rc = xmlTextWriterStartElement (writer, BAD_CAST obj[i]);
935 if (rc < 0)
return 0;
959 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"colors");
960 if (rc < 0)
return 0;
972 tmp_col = tmp_col -> next;
975 rc = xmlTextWriterEndElement (writer);
976 if (rc < 0)
return 0;
979 rc = xmlTextWriterEndElement (writer);
980 if (rc < 0)
return 0;
984 rc = xmlTextWriterEndElement (writer);
985 if (rc < 0)
return 0;
991 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"colors");
992 if (rc < 0)
return 0;
997 rc = xmlTextWriterStartElement (writer, BAD_CAST obj[i]);
998 if (rc < 0)
return 0;
1004 tmp_col = tmp_col -> next;
1006 rc = xmlTextWriterEndElement (writer);
1007 if (rc < 0)
return 0;
1014 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"box");
1015 if (rc < 0)
return 0;
1023 rc = xmlTextWriterEndElement (writer);
1024 if (rc < 0)
return 0;
1028 rc = xmlTextWriterEndElement (writer);
1029 if (rc < 0)
return 0;
1032 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"view");
1033 if (rc < 0)
return 0;
1036 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"background");
1063 rc = xmlTextWriterEndElement (writer);
1064 if (rc < 0)
return 0;
1068 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"representation");
1069 if (rc < 0)
return 0;
1082 str = g_strdup_printf (
"%lf", 1.0 - 0.5*
default_rep.zoom);
1088 str = g_strdup_printf (
"%lf", -
default_rep.c_angle[i]);
1095 str = g_strdup_printf (
"%lf",
default_rep.c_shift[i]);
1101 rc = xmlTextWriterEndElement (writer);
1102 if (rc < 0)
return 0;
1107 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"axis");
1108 if (rc < 0)
return 0;
1131 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"labels");
1132 if (rc < 0)
return 0;
1148 rc = xmlTextWriterEndElement (writer);
1149 if (rc < 0)
return 0;
1160 rc = xmlTextWriterEndElement (writer);
1161 if (rc < 0)
return 0;
1164 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"measures");
1165 if (rc < 0)
return 0;
1166 gchar * m_key[2]={
"standard",
"selection"};
1169 rc = xmlTextWriterStartElement (writer, BAD_CAST m_key[i]);
1170 if (rc < 0)
return 0;
1171 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"labels");
1172 if (rc < 0)
return 0;
1190 rc = xmlTextWriterEndElement (writer);
1191 if (rc < 0)
return 0;
1213 rc = xmlTextWriterEndElement (writer);
1214 if (rc < 0)
return 0;
1217 rc = xmlTextWriterEndElement (writer);
1218 if (rc < 0)
return 0;
1220 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"atom-selections");
1221 if (rc < 0)
return 0;
1227 rc = xmlTextWriterEndElement (writer);
1228 if (rc < 0)
return 0;
1231 rc = xmlTextWriterEndElement (writer);
1232 if (rc < 0)
return 0;
1234 rc = xmlTextWriterEndElement (writer);
1235 if (rc < 0)
return 0;
1237 rc = xmlTextWriterEndDocument (writer);
1238 if (rc < 0)
return 0;
1240 xmlFreeTextWriter (writer);
1255 return (g_strcmp0((
const char *)content,
"") == 0) ? 0.0 :
string_to_double ((gpointer)content);
1286 cut -> next = g_malloc0(
sizeof*cut);
1294 cut -> Z[0] = bond -> a;
1295 cut -> Z[1] = bond -> b;
1299 else if (g_strcmp0(key,
"default_instance") == 0)
1301 default_instance = (g_strcmp0((gchar *)content,
"single") == 0) ? TRUE : FALSE;
1303 else if (g_strcmp0(key,
"default_totcut") == 0)
1307 else if (g_strcmp0(key,
"default_num_delta") == 0)
1311 else if (g_strcmp0(key,
"default_delta_t") == 0)
1315 else if (g_strcmp0(key,
"default_rsparam") == 0)
1319 else if (g_strcmp0(key,
"default_csparam") == 0)
1323 else if (g_strcmp0(key,
"default_skt_sets") == 0)
1327 else if (g_strcmp0(key,
"default_skt_n_sets") == 0)
1331 else if (g_strcmp0(key,
"default_sqw_n_sets") == 0)
1335 else if (g_strcmp0(key,
"default_sqw_freq") == 0)
1339 else if (g_strcmp0(key,
"default_opengl") == 0)
1343 else if (g_strcmp0(key,
"default_material") == 0)
1349 else if (vid == 6 && vect)
1358 else if (g_strcmp0(key,
"default_lightning") == 0)
1377 else if (g_strcmp0(key,
"light.type") == 0)
1381 else if (g_strcmp0(key,
"light.fix") == 0)
1385 else if (g_strcmp0(key,
"light.direction") == 0 && vect)
1389 else if (g_strcmp0(key,
"light.position") == 0 && vect)
1393 else if (g_strcmp0(key,
"light.intensity") == 0 && vect)
1397 else if (g_strcmp0(key,
"light.attenuation") == 0 && vect)
1401 else if (g_strcmp0(key,
"light.spot") == 0 && vect)
1405 else if (g_strcmp0(key,
"fog.mode") == 0)
1409 else if (g_strcmp0(key,
"fog.type") == 0)
1413 else if (g_strcmp0(key,
"fog.density") == 0)
1417 else if (g_strcmp0(key,
"fog.depth") == 0)
1422 else if (g_strcmp0(key,
"fog.color") == 0 && vect)
1426 else if (g_strcmp0(key,
"default_cell") == 0)
1430 else if (g_strcmp0(key,
"default_clones") == 0)
1434 else if (g_strcmp0(key,
"default_at_rs") == 0)
1439 else if (g_strcmp0(key,
"default_bd_rw") == 0)
1444 else if (g_strcmp0(key,
"default_atomic_rad") == 0)
1449 while (tmp_rad -> next)
1451 tmp_rad = tmp_rad -> next;
1453 tmp_rad -> next = g_malloc0(
sizeof*tmp_rad);
1454 tmp_rad = tmp_rad -> next;
1464 else if (g_strcmp0(key,
"default_bond_rad") == 0)
1469 while (tmp_rad -> next)
1471 tmp_rad = tmp_rad -> next;
1473 tmp_rad -> next = g_malloc0(
sizeof*tmp_rad);
1474 tmp_rad = tmp_rad -> next;
1484 else if (g_strcmp0(key,
"default_label") == 0)
1510 else if (g_strcmp0(key,
"default_label_color") == 0)
1522 while (tmp_col -> next)
1524 tmp_col = tmp_col -> next;
1526 tmp_col -> next = g_malloc0(
sizeof*tmp_col);
1527 tmp_col = tmp_col -> next;
1538 else if (g_strcmp0(key,
"default_font_color") == 0)
1543 else if (g_strcmp0(key,
"default_atom_color") == 0)
1548 while (tmp_col -> next)
1550 tmp_col = tmp_col -> next;
1552 tmp_col -> next = g_malloc0(
sizeof*tmp_col);
1553 tmp_col = tmp_col -> next;
1563 else if (g_strcmp0(key,
"only_label_color") == 0)
1569 else if (g_strcmp0(key,
"default_box") == 0)
1588 else if (g_strcmp0(key,
"default_background") == 0)
1609 else if (g_strcmp0(key,
"default_rep") == 0)
1634 else if (g_strcmp0(key,
"default_axis") == 0)
1649 if (vid == 1 || vid == 4)
1665 else if (g_strcmp0(key,
"axis_legend") == 0)
1667 default_axis.title[vid] = g_strdup_printf (
"%s", content);
1669 else if (g_strcmp0(key,
"default_mtilt") == 0)
1673 else if (g_strcmp0(key,
"default_mpattern") == 0)
1677 else if (g_strcmp0(key,
"default_mfactor") == 0)
1681 else if (g_strcmp0(key,
"default_mwidth") == 0)
1685 else if (g_strcmp0(key,
"default_sel_color") == 0)
1704 xmlAttrPtr p_details;
1705 gboolean set_codevar,
set_id;
1706 gboolean set_x, set_y, set_z;
1707 gboolean set_r, set_g, set_b, set_a;
1708 gboolean set_alpha, set_beta;
1711 xmlChar * content, * p_cont;
1716 while (parameter_node)
1718 content = xmlNodeGetContent(parameter_node);
1719 p_details = parameter_node -> properties;
1720 set_codevar =
set_id = FALSE;
1721 set_x = set_y = set_z = FALSE;
1722 set_r = set_g = set_b = set_a = FALSE;
1723 set_alpha = set_beta = FALSE;
1728 p_node = p_details -> children;
1731 p_cont = xmlNodeGetContent(p_node);
1732 if (g_strcmp0(
"key",(
char *)p_details -> name) == 0)
1734 key = g_strdup_printf (
"%s", p_cont);
1737 else if (g_strcmp0(
"id",(
char *)p_details -> name) == 0)
1742 else if (g_strcmp0(
"α",(
char *)p_details -> name) == 0)
1747 else if (g_strcmp0(
"β",(
char *)p_details -> name) == 0)
1752 else if (g_strcmp0(
"x",(
char *)p_details -> name) == 0)
1757 else if (g_strcmp0(
"y",(
char *)p_details -> name) == 0)
1762 else if (g_strcmp0(
"z",(
char *)p_details -> name) == 0)
1767 else if (g_strcmp0(
"start",(
char *)p_details -> name) == 0)
1771 else if (g_strcmp0(
"end",(
char *)p_details -> name) == 0)
1775 else if (g_strcmp0(
"red",(
char *)p_details -> name) == 0)
1780 else if (g_strcmp0(
"green",(
char *)p_details -> name) == 0)
1785 else if (g_strcmp0(
"blue",(
char *)p_details -> name) == 0)
1790 else if (g_strcmp0(
"alpha",(
char *)p_details -> name) == 0)
1797 p_details = p_details -> next;
1800 if ((set_codevar && (
set_id || (set_r && set_g && set_b && set_a))) || (set_alpha && set_beta))
1803 set_parameter (content, key,
id, (set_alpha && set_beta) ? & bond : NULL, (set_x && set_y && set_z) ? & vec : NULL, start, end, (set_r && set_g && set_b && set_a) ? &
col : NULL);
1805 if (key) g_free (key);
1807 parameter_node = parameter_node -> next;
1808 parameter_node =
findnode (parameter_node,
"parameter");
1821 xmlNodePtr l_node, p_node;
1822 xmlNodePtr parameter_node;
1823 xmlAttrPtr l_details, p_details;
1826 gboolean set_codevar;
1827 gboolean set_lid = FALSE;
1828 gboolean set_x, set_y, set_z;
1829 xmlChar * content, * p_cont;
1831 l_details = light_node -> properties;
1834 l_node = l_details -> children;
1837 if (g_strcmp0(
"id",(
char *)l_details -> name) == 0)
1839 content = xmlNodeGetContent(l_node);
1845 l_details = l_details -> next;
1849 parameter_node =
findnode (light_node -> children,
"parameter");
1850 set_codevar = FALSE;
1851 set_x = set_y = set_z = FALSE;
1852 while (parameter_node)
1854 content = xmlNodeGetContent(parameter_node);
1855 p_details = parameter_node -> properties;
1858 p_node = p_details -> children;
1861 p_cont = xmlNodeGetContent(p_node);
1862 if (g_strcmp0(
"key",(
char *)p_details -> name) == 0)
1864 key = g_strdup_printf (
"%s", p_cont);
1867 else if (g_strcmp0(
"x",(
char *)p_details -> name) == 0)
1872 else if (g_strcmp0(
"y",(
char *)p_details -> name) == 0)
1877 else if (g_strcmp0(
"z",(
char *)p_details -> name) == 0)
1884 p_details = p_details -> next;
1888 set_parameter (content, key, lid, NULL, (set_x && set_y && set_z) ? & vec : NULL, -1.0, -1.0, NULL);
1890 if (key) g_free (key);
1892 parameter_node = parameter_node -> next;
1893 parameter_node =
findnode (parameter_node,
"parameter");
1908 node =
findnode (preference_node -> children,
"parameter");
1925 i = (style == 0 || style == 2) ? 0 : (style == 1 || style == 4) ? 1 : 2;
1928 k = (style == 2) ? 4 : 1;
1947 i = (style < 2) ? style : 2;
1965 xmlTextReaderPtr reader;
1967 xmlNodePtr node, p_node, l_node, c_node;
1975 racine = xmlDocGetRootElement (doc);
1978 if (g_strcmp0 ((
char *)(racine -> name),
"atomes_preferences-xml") == 0)
1980 node =
findnode(racine -> children,
"general");
1985 node =
findnode(racine -> children,
"analysis");
1988 p_node =
findnode (node -> children,
"cutoffs");
1992 l_node =
findnode(p_node -> children,
"partials");
2000 node =
findnode(racine -> children,
"opengl");
2003 p_node =
findnode (node -> children,
"material");
2008 p_node =
findnode (node -> children,
"lightning");
2012 l_node =
findnode (p_node -> children,
"light");
2016 l_node = l_node -> next;
2017 l_node =
findnode (l_node,
"light");
2020 p_node =
findnode (node -> children,
"fog");
2027 node =
findnode(racine -> children,
"model");
2031 p_node =
findnode(node -> children,
"atoms_and_bonds");
2043 p_node =
findnode(node -> children,
"labels");
2048 l_node =
findnode (p_node -> children, (i) ?
"clones" :
"atoms");
2053 c_node =
findnode(l_node -> children,
"colors");
2061 c_node =
findnode(node -> children,
"colors");
2066 l_node =
findnode (c_node -> children, (i) ?
"clones" :
"atoms");
2074 p_node =
findnode(node -> children,
"box");
2080 node =
findnode(racine -> children,
"view");
2084 p_node =
findnode(node -> children,
"background");
2089 p_node =
findnode(node -> children,
"representation");
2094 p_node =
findnode(node -> children,
"axis");
2098 l_node =
findnode(p_node -> children,
"labels");
2105 c_node =
findnode(p_node -> children,
"colors");
2111 p_node =
findnode(node -> children,
"measures");
2114 l_node =
findnode(p_node -> children,
"standard");
2117 c_node =
findnode(l_node -> children,
"labels");
2125 l_node =
findnode(p_node -> children,
"selection");
2128 c_node =
findnode(l_node -> children,
"labels");
2137 p_node =
findnode(node -> children,
"atom-selections");
2147 xmlFreeTextReader(reader);
2251 for (i=0; i<16; i++)
2300 default_label[i].font = (i > 2) ? g_strdup_printf (
"FreeMono Bold 18") : g_strdup_printf (
"Sans Bold 12");
2405GtkWidget *
pref_list (gchar * mess[2],
int nelem, gchar * mlist[nelem][2], gchar * end)
2415 for (i=0; i<nelem; i++)
2419 str = g_strdup_printf (
"<b>%s</b>", _(mlist[i][0]));
2444 i = GPOINTER_TO_INT (data);
2468 int i = GPOINTER_TO_INT (data);
2479 GtkWidget * notebook = gtk_notebook_new ();
2480 gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE);
2481 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
2483 gchar * info[2] = {
i18n(
"The <b>View</b> tab regroups representation options"),
2484 i18n(
"which effect apply to the general aspect of the model:")};
2485 gchar * m_list[3][2] = {{
i18n(
"Representation"),
i18n(
"scene set-up and orientation")},
2486 {
i18n(
"Axis"),
i18n(
"axis options")},
2487 {
i18n(
"Tools"),
i18n(
"measures and selections option")}};
2495 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"General")));
2500 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
pref_rep_win -> win, gtk_label_new (_(
"Representation")));
2505 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
pref_axis_win -> win, gtk_label_new (_(
"Axis")));
2527 hbox =
adv_box (
vbox, _(
"<b>Select selection type</b>"), 15, 120, 0.0);
2534 GtkWidget * hhbox, * vvbox;
2541 hhbox =
abox (vvbox, _(
"Color"), 0);
2542 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hhbox,
color_button(
tmp_sel_color[i], TRUE, 100, -1, G_CALLBACK(
set_selection_color), GINT_TO_POINTER(i)), FALSE, FALSE, 0);
2547 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"Tools")));
2586 int object = GPOINTER_TO_INT(data);
2602 else if (
object < 100)
2624 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(
edit_colob), & rgb_col);
2640 int i = GPOINTER_TO_INT(data);
2664 if (! old_list)
return NULL;
2671 tmp_rbd -> Z = tmp_rad -> Z;
2672 tmp_rbd -> rad = tmp_rad -> rad;
2673 if (tmp_rad -> next)
2675 tmp_rbd -> next = g_malloc0(
sizeof*tmp_rbd -> next);
2676 tmp_rbd -> next -> prev = tmp_rbd;
2677 tmp_rbd = tmp_rbd -> next;
2679 tmp_rad = tmp_rad -> next;
2700 if (tmp_rad -> Z ==
z)
2703 return tmp_rad -> rad;
2705 tmp_rad = tmp_rad -> next;
2709 object = -
object - 2;
2711 if (
object == 0 ||
object == 3)
2727 if (
object == 2 ||
object == 7 ||
col)
2735 else if (
object == 1 ||
object == 4 ||
object == 6 ||
object == 9)
2740 else if (
object == 0 ||
object == 3 ||
object == 5 ||
object == 8)
2758 if (! old_list)
return NULL;
2765 tmp_rbd -> Z = tmp_rad -> Z;
2766 tmp_rbd ->
col = tmp_rad ->
col;
2767 if (tmp_rad -> next)
2769 tmp_rbd -> next = g_malloc0(
sizeof*tmp_rbd -> next);
2770 tmp_rbd -> next -> prev = tmp_rbd;
2771 tmp_rbd = tmp_rbd -> next;
2773 tmp_rad = tmp_rad -> next;
2791 if (tmp_col -> Z ==
z)
2794 return tmp_col ->
col;
2796 tmp_col = tmp_col -> next;
2811G_MODULE_EXPORT
void edit_pref (GtkCellRendererText * cell, gchar * path_string, gchar * new_text, gpointer user_data)
2813 int col = GPOINTER_TO_INT(user_data);
2814 GtkTreeModel * pref_model = gtk_tree_view_get_model(GTK_TREE_VIEW(
pref_tree));
2816 gtk_tree_model_get_iter_from_string (pref_model, &
row, path_string);
2819 gtk_tree_model_get (pref_model, &
row, 3, &
z, -1);
2820 gtk_list_store_set (GTK_LIST_STORE(pref_model), &
row,
col+4,
val, -1);
2821 gboolean add_elem = FALSE;
2822 gboolean remove_elem = FALSE;
2824 int col_val[4] = {1, 3, 5, 10};
2832 if (tmp_list -> Z ==
z)
2834 tmp_list -> rad =
val;
2838 if (tmp_list -> next)
2840 if (tmp_list -> prev)
2842 tmp_list -> prev -> next = tmp_list -> next;
2843 tmp_list -> next -> prev = tmp_list -> prev;
2851 else if (tmp_list -> prev)
2869 tmp_list = tmp_list -> next;
2884 if (! tmp_list -> next)
break;
2885 tmp_list = tmp_list -> next;
2887 tmp_list -> next = g_malloc0(
sizeof*tmp_list -> next);
2888 tmp_list -> next -> prev = tmp_list;
2889 tmp_list = tmp_list -> next;
2897 tmp_list -> rad =
val;
2898 gtk_tree_model_get (pref_model, &
row, 0, &
z, -1);
2907 b = (
z - a * 10) / 5;
2908 c = (
z - a * 10 - b * 5) / 3;
2909 d =
z - a * 10 - b * 5 - c * 3;
2911 if (a ||
col == 3)
z += 10;
2912 if (b ||
col == 2)
z += 5;
2913 if (c ||
col == 1)
z += 3;
2914 if (d ||
col == 0)
z += 1;
2916 gtk_list_store_set (GTK_LIST_STORE(pref_model), &
row, 0,
z, -1);
2918 else if (remove_elem)
2920 gtk_tree_model_get (pref_model, &
row, 0, &
z, -1);
2922 gtk_list_store_set (GTK_LIST_STORE(pref_model), &
row, 0,
z, -1);
2938 int object = GPOINTER_TO_INT (data);
2939 gboolean do_style = (
object < 100) ? TRUE : FALSE;
2940 gboolean do_label = (
object == 1000 ||
object == 1001) ? TRUE : FALSE;
2941 switch (response_id)
2943 case GTK_RESPONSE_APPLY:
2948 object = -
object - 2;
2954 j = (
object == 4 ||
object == 9) ? 4 : 1;
2955 k = (
object < 5) ? 7 : 5;
2956 object =
object - 2;
2987 j = (
object < 0) ? 1 : (
object == 4 ||
object == 9) ? 4 : 1;
3022void color_set_color (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3025 gtk_tree_model_get (mod, iter, 3, &
z, -1);
3028 g_object_set (renderer,
"background-rgba", & colo,
"background-set", TRUE, NULL);
3044 int cid = GPOINTER_TO_INT (data);
3046 gtk_tree_model_get (mod, iter, 0, & vid, -1);
3047 gboolean docol = FALSE;
3051 docol = (cid == 0) ? TRUE : FALSE;
3054 docol = (cid == 1) ? TRUE : FALSE;
3057 docol = (cid == 2) ? TRUE : FALSE;
3060 docol = (cid == 3) ? TRUE : FALSE;
3063 docol = (cid == 0 || cid == 1) ? TRUE : FALSE;
3066 docol = (cid == 0 || cid == 2) ? TRUE : FALSE;
3069 docol = (cid == 1 || cid == 2) ? TRUE : FALSE;
3072 docol = (cid == 0 || cid == 3) ? TRUE : FALSE;
3075 docol = (cid == 1 || cid == 3) ? TRUE : FALSE;
3078 docol = (cid == 2 || cid == 3) ? TRUE : FALSE;
3081 docol = (cid != 3) ? TRUE : FALSE;
3084 docol = (cid != 2) ? TRUE : FALSE;
3087 docol = (cid != 1) ? TRUE : FALSE;
3090 docol = (cid != 0) ? TRUE : FALSE;
3109 if (col_a.
red != col_b.
red)
return FALSE;
3110 if (col_a.
green != col_b.
green)
return FALSE;
3111 if (col_a.
blue != col_b.
blue)
return FALSE;
3112 if (col_a.
alpha != col_b.
alpha)
return FALSE;
3125G_MODULE_EXPORT
void run_ac_color (GtkDialog * win, gint response_id, gpointer data)
3127 if (response_id == GTK_RESPONSE_OK)
3130 int i = GPOINTER_TO_INT (data);
3140 if (tmp_list -> Z == i)
3142 tmp_list ->
col = colo;
3145 if (tmp_list -> next)
3147 if (tmp_list -> prev)
3149 tmp_list -> prev -> next = tmp_list -> next;
3150 tmp_list -> next -> prev = tmp_list -> prev;
3158 else if (tmp_list -> prev)
3176 tmp_list = tmp_list -> next;
3190 if (! tmp_list -> next)
break;
3191 tmp_list = tmp_list -> next;
3193 tmp_list -> next = g_malloc0(
sizeof*tmp_list -> next);
3194 tmp_list -> next -> prev = tmp_list;
3195 tmp_list = tmp_list -> next;
3203 tmp_list ->
col = colo;
3220void color_button_event (GtkWidget * widget,
double event_x,
double event_y, guint event_button, gpointer data)
3222 if (event_button == 1)
3224 GtkTreeModel *
model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
3226 GtkTreeViewColumn * column;
3230 gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW(widget), event_x, event_y, & e_x, & e_y);
3231 if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(widget), e_x, e_y, &
path, & column, & i, & j))
3233 if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(widget), event_x, event_y, &
path, & column, & i, & j))
3236 if (g_strcmp0(_(
"Color"), gtk_tree_view_column_get_title (column)) == 0)
3241 i = GPOINTER_TO_INT(data);
3242 gchar * obj[2]={_(
"atom"), _(
"clone")};
3244 gtk_tree_model_get (
model, &
row, 3, &
z, -1);
3247 GtkWidget * win = gtk_color_chooser_dialog_new (str, GTK_WINDOW(
atomes_main_window));
3248 gtk_window_set_modal (GTK_WINDOW(win), TRUE);
3249 gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER(win), TRUE);
3250 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(win), &
col);
3271G_MODULE_EXPORT
void pref_color_button_pressed (GtkGesture * gesture,
int n_press,
double x,
double y, gpointer data)
3274 gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture), data);
3288 if (event -> type == GDK_BUTTON_PRESS)
3290 GdkEventButton * bevent = (GdkEventButton*)event;
3320 gchar * ats[3]={_(
"atom(s)"), _(
"dot(s)"), _(
"sphere(s)")};
3321 gchar * dim[3]={_(
"radius"), _(
"size"), _(
"width")};
3322 gchar * bts[3]={_(
"bond(s)"), _(
"wireframe(s)"), _(
"cylinder(s)")};
3324 int i, j, k, l, n, m;
3328 gboolean do_style = (
the_object < 100) ? TRUE : FALSE;
3329 gboolean do_label = FALSE;
3336 aid = (aid) > 2 ? aid - 3 : aid;
3338 str = (
the_object < -4) ? g_strdup_printf (_(
"Edit cloned %s %s"), bts[aid], dim[bid]) : g_strdup_printf (_(
"Edit %s %s"), bts[aid], dim[bid]);
3345 aid = (aid == 0 || aid == 2 || aid == 5 || aid == 7) ? 0 : (aid == 1 || aid == 4 || aid == 6 || aid == 9) ? 1 : 2;
3347 str = (
the_object - 2 > 4) ? g_strdup_printf (_(
"Edit cloned %s %s"), ats[aid], dim[bid]) : g_strdup_printf (_(
"Edit %s %s"), ats[aid], dim[bid]);
3357 str = g_strdup_printf (_(
"Select %s color"), (aid) ? _(
"clone") : _(
"atom"));
3362 str = g_strdup_printf (_(
"Select %s label color"), (aid) ? _(
"clone") : _(
"atom"));
3372 gtk_window_set_default_size (GTK_WINDOW(win), (num_col == 8) ? 600 : 300, 600);
3374 GType s_type[8] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE};
3375 GType c_type[5] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING};
3376 GtkTreeViewColumn * pref_col[num_col];
3377 GtkCellRenderer * pref_cel[num_col];
3378 GtkTreeSelection * pref_select;
3379 GtkListStore * pref_model;
3383 pref_model = gtk_list_store_newv (num_col, s_type);
3385 j = (num_col == 8) ? 4 : 1;
3404 pref_model = gtk_list_store_newv (num_col, c_type);
3408 for (i=1; i<119; i++)
3411 gtk_list_store_append (pref_model, & elem);
3414 gtk_list_store_set (pref_model, & elem, 0,
user_defined,
3432 gtk_list_store_set (pref_model, & elem, 0, j, -1);
3437 gtk_list_store_set (pref_model, & elem, 0,
user_defined,
3445 pref_tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL(pref_model));
3446 gchar * name[3] = {_(
"Element"), _(
"Symbol"),
"Z"};
3447 gchar * g_name[3] = {_(
"Radius"), _(
"Size"), _(
"Width")};
3448 gchar * f_name[4] = {_(
"Covalent [1]"),_(
"Ionic [2]"),
"van der Waals [3]", _(
"Crystal [4,5]")};
3449 for (i=0; i<num_col; i++)
3451 pref_cel[i] = gtk_cell_renderer_text_new();
3456 g_object_set (pref_cel[i],
"editable", TRUE, NULL);
3457 gtk_cell_renderer_set_alignment (pref_cel[i], 0.5, 0.5);
3458 g_signal_connect (G_OBJECT(pref_cel[i]),
"edited", G_CALLBACK(
edit_pref), GINT_TO_POINTER(i-4));
3459 pref_col[i] = gtk_tree_view_column_new_with_attributes((num_col) == 8 ? f_name[i-4] : g_name[bid], pref_cel[i],
"text", i, NULL);
3464 gtk_cell_renderer_set_alignment (pref_cel[i], 0.5, 0.5);
3465 pref_col[i] = gtk_tree_view_column_new_with_attributes(_(
"Color"), pref_cel[i],
"text", i, NULL);
3466 gtk_tree_view_column_set_cell_data_func (pref_col[i], pref_cel[i],
color_set_color, NULL, NULL);
3471 pref_col[i] = gtk_tree_view_column_new_with_attributes(name[i-1], pref_cel[i],
"text", i, NULL);
3472 gtk_tree_view_column_set_alignment (pref_col[i], 0.5);
3473 gtk_tree_view_column_set_resizable (pref_col[i], TRUE);
3474 gtk_tree_view_column_set_min_width (pref_col[i], 50);
3478 pref_col[i] = gtk_tree_view_column_new_with_attributes(
"", pref_cel[i],
"text", i, NULL);
3479 gtk_tree_view_column_set_visible (pref_col[i], FALSE);
3481 gtk_tree_view_append_column(GTK_TREE_VIEW(
pref_tree), pref_col[i]);
3483 g_object_unref (pref_model);
3484 pref_select = gtk_tree_view_get_selection (GTK_TREE_VIEW(
pref_tree));
3485 gtk_tree_selection_set_mode (pref_select, GTK_SELECTION_SINGLE);
3486 gtk_tree_view_expand_all (GTK_TREE_VIEW(
pref_tree));
3491 add_widget_gesture_and_key_action (
pref_tree,
"pref-context-click", G_CALLBACK(pref_color_button_pressed), GINT_TO_POINTER(aid),
3492 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
3502 gchar * legend={_(
"\n<sub>[1] B. Cordero and al. <i>Dalton Trans</i>, <b>213</b>:1112 (2008).</sub>\n"
3503 "<sub>[2] Slater. <i>J. Chem. Phys.</i>, <b>41</b>:3199 (1964).</sub>\n"
3504 "<sub>[3] Bondi A. <i>J. Phys. Chem.</i>, <b>68</b>:441 (1964).</sub>\n"
3505 "<sub>[4] R.D. Shannon and C.T. Prewitt <i>Acta Cryst. B</i>, <b>25</b>:925-946 (1969).</sub>\n"
3506 "<sub>[5] R.D. Shannon <i>Acta Cryst. A</i>, <b>23</b>:751-767 (1976).</sub>")};
3515 gchar * info[3] = {_(
"By default label and species colors are similar,"), _(
"you can modify that using this dialog window."), _(
"You can also use a single color for all labels:")};
3527 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
check_button (_(
"Use single color"), -1, -1,
tmp_label[aid] -> n_colors, G_CALLBACK(
toggled_default_stuff), data), FALSE, FALSE, 30);
3556 int clone = ((
object && style > 2) || (!
object && style > 4)) ? 20 : 0;
3557 int mod = (object) ? -1 : 1;
3558 gboolean over = (! object) ? TRUE : (
object && (style != 2 && style != 5)) ? TRUE : FALSE;
3564 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
create_button (_(
"Edit species related parameters"),
IMG_NONE, NULL, -1, -1, GTK_RELIEF_NORMAL, G_CALLBACK(
edit_species_parameters), GINT_TO_POINTER(mod*(style+2))), FALSE, FALSE, 60);
3568 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
check_button (_(
"Override species based parameters"), -1, -1, (
object) ?
tmp_o_bd_rw[style] :
tmp_o_at_rs[style], G_CALLBACK(
toggled_default_stuff), GINT_TO_POINTER(mod*(style+2))), FALSE, FALSE, 10);
3581 leg = g_strdup_printf (
"%s", (style == 1 || style == 4) ?
"pts" :
"Å");
3589 leg = g_strdup_printf (
"%s", (style == 1 || style == 6 || style == 4 || style == 9) ?
"pts" :
"Å");
3607 gchar *
object[3]={
i18n(
"<b>Atom(s)</b>"),
i18n(
"<b>Bond(s)</b>"),
i18n(
"\t<u>Clone(s)</u>")};
3608 gchar * dim[3]={
i18n(
"Radius"),
i18n(
"Size"),
i18n(
"Width")};
3613 gboolean do_atoms = FALSE;
3614 gboolean do_bonds = FALSE;
3615 if (style == 0 || style == 1 || style == 2 || style == 3 || style == 5)
3619 if (style == 0 || style == 1 || style == 4)
3622 bsid = (style == 4) ? 2 : style;
3626 lid = (style == 3) ? 2 : (style == 1 || style == 5) ? 1 : 0;
3630 str = g_strdup_printf (
"\t%s", _(dim[(lid != 1) ? 0 : 1]));
3642 str = g_strdup_printf (
"\t%s", _(dim[(bsid != 1) ? 0 : 2]));
3659 GtkWidget * notebook = gtk_notebook_new ();
3660 gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE);
3661 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
3665 gchar * info[2] = {
i18n(
"The <b>Model</b> tab regroups atom(s), bond(s) and clone(s) options"),
3666 i18n(
"which effect apply when the corresponding <b>OpenGL</b> style is used:")};
3667 gchar * m_list[4][2] = {{
i18n(
"Balls and Sticks"),
i18n(
"atoms<sup>*</sup> and bonds radii")},
3668 {
i18n(
"Wireframes"),
i18n(
"dots<sup>**</sup> size and wireframes width")},
3669 {
i18n(
"Spacefilled"),
i18n(
"tabulated parameters")},
3670 {
i18n(
"Cylinders"),
i18n(
"bonds radii")}};
3673 gchar * other_info[2] = {
i18n(
"It also provides options to customize atomic label(s),"),
i18n(
"and, the model box, if any:")};
3674 gchar * o_list[2][2] = {{
i18n(
"Labels"),
i18n(
"atom labels")},
3675 {
i18n(
"Box"),
i18n(
"model box details")}};
3680 gchar * obj[2] = {
i18n(
"<b>Atoms</b>"),
i18n(
"<b>Clones</b>")};
3685 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
create_button (_(
"Edit species colors"),
IMG_NONE, NULL, -1, -1, GTK_RELIEF_NORMAL, G_CALLBACK(
edit_species_parameters), GINT_TO_POINTER(100+i)), FALSE, FALSE, 30);
3689 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
check_button (_(
"Always show clone(s), if any."), 250, -1,
tmp_clones, G_CALLBACK(
toggled_default_stuff), GINT_TO_POINTER(0)), FALSE, FALSE, 30);
3692 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
check_button (_(
"Always show box, if any."), 250, -1,
tmp_clones, G_CALLBACK(
toggled_default_stuff), GINT_TO_POINTER(1)), FALSE, FALSE, 30);
3696 append_comments (
vbox,
"<sup>*</sup>", _(
"the same parameters are also used for the <b>spheres</b> style"));
3697 append_comments (
vbox,
"<sup>**</sup>", _(
"the same parameters are also used for the <b>dots</b> style"));
3699 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"General")));
3703 if (i != 3 && i != 5) gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
style_tab (i), gtk_label_new (_(
text_styles[i])));
3718 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hhbox,
create_button (_(
"Adjust color(s)"),
IMG_NONE, NULL, 220, -1, GTK_RELIEF_NORMAL, G_CALLBACK(
edit_species_parameters), GINT_TO_POINTER(1000+i)), FALSE, FALSE, 15);
3722 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"Labels")));
3726 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
pref_box_win -> win, gtk_label_new (_(
"Box")));
3742 if (gtk_combo_box_get_active_iter (
box, & iter))
3744 GtkTreeModel *
model = gtk_combo_box_get_model (
box);
3746 gtk_tree_model_get (
model, & iter, 1, & i, -1);
3758 GtkTreeIter iter, iter2;
3759 GtkTreeStore * store;
3761 store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT);
3762 gtk_tree_store_append (store, & iter, NULL);
3763 gtk_tree_store_set (store, & iter, 0, _(
"f(atoms) <sup>*</sup>"), 1, 0, -1);
3766 gtk_tree_store_append (store, & iter, NULL);
3767 gtk_tree_store_set (store, & iter, 0, _(
text_styles[i]), 1, i+1, -1);
3772 gtk_tree_store_append (store, & iter2, & iter);
3773 gtk_tree_store_set (store, & iter2, 0, _(
text_filled[j]), 1, -j-1, -1);
3777 return GTK_TREE_MODEL (store);
3792 j = GPOINTER_TO_INT(data);
3810 g_signal_connect (G_OBJECT(combo),
"changed", G_CALLBACK(
set_default_map), GINT_TO_POINTER(obj));
3821 GtkWidget * notebook = gtk_notebook_new ();
3822 gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE);
3823 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
3837 gchar * info[2] = {
i18n(
"The <b>OpenGL</b> tab regroups rendering options"),
3838 i18n(
"use it to configure the OpenGL 3D scene:")};
3839 gchar * m_list[3][2] = {{
i18n(
"Material"),
i18n(
"aspect for atom(s) and bond(s)")},
3840 {
i18n(
"Lights"),
i18n(
"lightning of the scene")},
3841 {
i18n(
"Fog"),
i18n(
"atmosphere effects")}};
3842 gchar * end =
i18n(
"It also offers to adjust the main visualization style and the color maps");
3849 combo = gtk_combo_box_new_with_model (
model);
3850 g_object_unref (
model);
3851 GtkCellRenderer * renderer = gtk_cell_renderer_combo_new ();
3852 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
3853 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
"text", 0, NULL);
3856 g_signal_connect (G_OBJECT(combo),
"changed", G_CALLBACK(
set_default_style), NULL);
3859 append_comments (
vbox,
"<sup>*</sup>", _(
"if 10 000 atoms or more: <b>Wireframes</b>, otherwise: <b>Balls and sticks</b>"));
3876 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"General")));
3882 gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), 0);
3896 int i = GPOINTER_TO_INT(data);
3911 if (i == 7 || i == 8)
3937 int i = GPOINTER_TO_INT(data);
3988 cut -> cutoff = value;
4030 for (i=0; i<2; i++)
pcut_box[i] = NULL;
4039 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
markup_label(_(
"R<sub>cut</sub> (α, β)"), 100, -1, 0.5, 0.5), FALSE, FALSE, 10);
4054 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
check_button (NULL, 20, -1, tmp_cut -> use, G_CALLBACK(
toggled_use_cutoff), (gpointer)tmp_cut), FALSE, FALSE, 10);
4055 tmp_cut = tmp_cut -> next;
4077 if (tmp_cut -> Z[0] == z_a && tmp_cut -> Z[1] == z_b)
return FALSE;
4078 tmp_cut = tmp_cut -> next;
4111 while (tmp_cut -> next)
4113 tmp_cut = tmp_cut -> next;
4115 tmp_cut -> next = g_malloc0(
sizeof*tmp_cut -> next);
4116 tmp_cut -> next -> prev = tmp_cut;
4117 tmp_cut = tmp_cut -> next;
4119 tmp_cut -> Z[0] =
min(k, l);
4120 tmp_cut -> Z[1] =
max(k, l);
4121 tmp_cut -> use = FALSE;
4122 tmp_cut -> cutoff = 1.0;
4146 new_cutoff = g_malloc0(
sizeof*new_cutoff);
4151 cut_b -> next = g_malloc0(
sizeof*cut_b -> next);
4152 cut_b -> next -> prev = cut_b;
4153 cut_b = cut_b -> next;
4155 cut_b -> Z[0] = cut_a -> Z[0];
4156 cut_b -> Z[1] = cut_a -> Z[1];
4157 cut_b -> use = cut_a -> use;
4158 cut_b -> cutoff = cut_a -> cutoff;
4160 cut_a = cut_a -> next;
4174G_MODULE_EXPORT
void edit_cutoffs (GtkDialog * edit_cuts, gint response_id, gpointer data)
4176 switch (response_id)
4178 case GTK_RESPONSE_APPLY:
4223 for (j=1; j<119; j++)
4250 gchar * default_leg[2] = {
i18n(
"Step(s) between configurations"),
i18n(
"Step(s) between conf.")};
4251 int wid = (cid == 7) ? 0 : 1;
4254 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
markup_label (_(default_leg[(cid == 7) ? 0 : 1]), (cid == 7) ? 285 : 150, -1, 0.0, 0.5), FALSE, FALSE, (cid == 7) ? 30 : 5);
4283 GtkWidget * notebook = gtk_notebook_new ();
4286 gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE);
4287 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
4288 gchar * default_delta_num_leg[
NUM_DELTA] = {
i18n(
"<b>g(r)</b>: number of δr"),
i18n(
"<b>s(q)</b>: number of δq"),
i18n(
"<b>s(k)</b>: number of δk"),
i18n(
"<b>g(r) FFT</b>: number of δr"),
4289 i18n(
"<b>D<sub>ij</sub></b>: number of δr [D<sub>ij</sub>min-D<sub>ij</sub>max]"),
i18n(
"<b>Angles distribution</b>: number of δθ [0-180°]"),
4290 i18n(
"<b>Spherical harmonics</b>: l<sub>max</sub> ∈ [2-40]"),
i18n(
"Step(s) between configurations"),
i18n(
"<b>F(k,δt)</b>: number of δk")};
4291 gchar * info[2] = {
i18n(
"The <b>Analysis</b> tab regroups calculation options"),
4292 i18n(
"use it to setup your own default parameters:")};
4293 gchar * m_list[4][2] = {{
i18n(
"Calculations"),
i18n(
"most analysis options")},
4294 {
i18n(
"Rings"),
i18n(
"ring statistics options")},
4295 {
i18n(
"Chains"),
i18n(
"chain statistics options")},
4296 {
"S(q,ω)",
i18n(
"dynamic structure factor options")}};
4301 add_box_child_start (GTK_ORIENTATION_VERTICAL,
vbox,
markup_label(_(
"To determine the existence, or the absence, of a chemical bond"), -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
4302 add_box_child_start (GTK_ORIENTATION_VERTICAL,
vbox,
markup_label(_(
"between 2 atoms is a key feature in the <b>atomes</b> software"), -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
4305 add_box_child_start (GTK_ORIENTATION_VERTICAL, vvbox,
markup_label(_(
"It is used for analysis purposes, and, to draw bonds in the OpenGL window."), -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
4318 gtk_widget_set_size_request (combo, 180, -1);
4320 g_signal_connect(G_OBJECT(combo),
"changed", G_CALLBACK(
totcut_changed), NULL);
4335 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hhbox,
create_button (_(
"Set default cutoff(s)"),
IMG_NONE, NULL, 180, -1, GTK_RELIEF_NORMAL, G_CALLBACK(
set_cutoffs_default), NULL), FALSE, FALSE, 10);
4338 append_comments (
vbox,
"<sup>*</sup>", _(
"The highest this value is, the highest the number of neighbors around an atom."));
4340 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"General")));
4347 if (i != 7 && i != 8)
4360 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
markup_label (_(
"<b>Dynamical analysis: MSD, S(q,ω)</b>"), 310, -1, 0.0, 0.5), FALSE, FALSE, 15);
4364 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"Calculations")));
4371 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new ((i) ? _(
"Chains") : _(
"Rings")));
4444 for (i=0; i<16; i++)
4508 new_rep ->
rep = old_rep ->
rep;
4511 new_rep -> gnear = old_rep -> gnear;
4515 new_rep -> c_angle[i] = old_rep -> c_angle[i];
4516 new_rep -> c_shift[i] = old_rep -> c_shift[i];
4530 new_back -> gradient = old_back -> gradient;
4531 new_back -> direction = old_back -> direction;
4537 new_back -> gradient_color[i] = old_back -> gradient_color[i];
4551 new_box ->
box = old_box ->
box;
4553 new_box -> line = old_box -> line;
4554 new_box -> rad = old_box -> rad;
4567 new_axis ->
axis = old_axis ->
axis;
4568 new_axis -> length = old_axis -> length;
4570 new_axis -> line = old_axis -> line;
4571 new_axis -> rad = old_axis -> rad;
4572 new_axis -> t_pos = old_axis -> t_pos;
4577 new_axis -> c_pos[i] = old_axis -> c_pos[i];
4578 if (old_axis -> title[i]) new_axis -> title[i] = g_strdup_printf (
"%s", old_axis -> title[i]);
4580 if (old_axis ->
color)
4668G_MODULE_EXPORT
void update_projects (GtkDialog * proj_sel, gint response_id, gpointer data)
4672 gboolean update_bonds;
4673 switch (response_id)
4675 case GTK_RESPONSE_OK:
4684 update_bonds = FALSE;
4685 l = this_proj -> nspec * this_proj -> nspec;
4688 for (j=0; j<this_proj -> nspec; j++)
4690 for (k=0; k<this_proj -> nspec; k++, l++)
4703 for (j=0; j<this_proj -> nspec; j++)
4705 for (k=0; k<this_proj -> nspec; k++, l++)
4707 if (this_proj ->
chemistry -> cutoffs[j][k] !=
tmpcut[l]) update_bonds = TRUE;
4713 if (this_proj -> modelgl -> rings)
4715 this_proj -> modelgl -> rings = FALSE;
4724 if (this_proj -> modelgl ->
chains)
4734 this_proj -> runc[0] = FALSE;
4735 this_proj -> dmtx = FALSE;
4736 if (this_proj ->
id !=
activep)
4865 for (i=0; i<16; i++)
4903 if (
ask_yes_no(_(
"Apply to project(s) in workspace ?"), _(
"Preferences were saved for the active session !\n Do you want to apply preferences to the project(s) opened in the workspace ?"), GTK_MESSAGE_QUESTION,
pref_ogl_edit -> win))
4914 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
check_button (
get_project_by_id(i) -> name, 200, -1, FALSE, G_CALLBACK(
toggled_select_project), GINT_TO_POINTER(i)), FALSE, FALSE, 40);
4915 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
check_button (_(
"Including analysis parameters and cutoffs ..."), -1, -1, FALSE, G_CALLBACK(
toggled_select_project), GINT_TO_POINTER(i+
nprojects)), FALSE, FALSE, 20);
4949 i = (i < 0) ? 0 : i;
4953 i = (i < 0) ? 0 : i;
4999 switch (response_id)
5001 case GTK_RESPONSE_APPLY:
5005 gchar * str = g_strdup_printf (_(
"Do you want to save <b>atomes</b> preferences in:\n\n\t%s\n\nIf found this file is processed at every <b>atomes</b> startup.\n\n\t\t\t\t\t\tSave file ?"),
ATOMES_CONFIG);
5006 if (
ask_yes_no(_(
"Save atomes preferences to file ?"), str, GTK_MESSAGE_QUESTION, (GtkWidget *)edit_prefs))
5064 int i = GPOINTER_TO_INT(data);
5079 gtk_widget_set_size_request (win, 625, 645);
5080 gtk_window_set_resizable (GTK_WINDOW (win), FALSE);
5088 gchar * mess[2] = {
i18n(
"Browse the following to modify the default configuration of <b>atomes</b>"),
5089 i18n(
"by replacing internal parameters by user defined preferences.")};
5090 gchar * mlist[4][2]= {{
i18n(
"Analysis "),
i18n(
"calculation preferences")},
5091 {
"OpenGL",
i18n(
"rendering preferences")},
5092 {
i18n(
"Model"),
i18n(
"atom(s), bond(s) and box preferences")},
5093 {
i18n(
"View"),
i18n(
"representation and projection preferences")}};
5094 gchar * end =
i18n(
"Default parameters are used for any new project added to the workspace\n");
5110 gchar * but_text[2] = {
i18n(
"Single instance (1)"),
i18n(
"Multiple instance(s) (2)")};
5111 GtkWidget * beh_but[2];
5120 gtk_check_button_set_group ((GtkCheckButton *) beh_but[i], (GtkCheckButton *)beh_but[0]);
5129 beh_but[i] = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(beh_but[0]), _(but_text[i]));
5130 g_signal_connect (G_OBJECT (beh_but[i]),
"toggled", G_CALLBACK(
set_instance_mode), GINT_TO_POINTER(i));
5138 gtk_toggle_button_set_active ((GtkToggleButton *)beh_but[1], !
tmp_instance);
5140 gchar * instance_about[2] = {
i18n(
"(1) Each and every file is opened in a single <b>atomes</b> instance"),
5141 i18n(
"(2) When required files are opened in a separate, new, <b>atomes</b> instance")};
5151 GtkWidget * but_lab =
markup_label (_(
"Restore <b>atomes</b> default parameters"), -1, -1, 0.5, 0.5);
5156 gtk_notebook_append_page (GTK_NOTEBOOK(
preference_notebook), gbox, gtk_label_new (_(
"General")));
5178 gchar * pstring[5]={
i18n(
"rendering"),
i18n(
"box"),
i18n(
"axis"),
i18n(
"background"),
i18n(
"representation")};
5179 gchar * str = g_strdup_printf (_(
"Set %s preferences as default preferences ?"), _(pstring[oid -> b]));
5181 if (
ask_yes_no(_(
"Set model preferences as default ?"), str, GTK_MESSAGE_QUESTION, this_proj -> modelgl -> win))
5184 image *
img = this_proj -> modelgl -> anim -> last ->
img;
5221 str = g_strdup_printf (_(
"Do you want to save <b>atomes</b> preferences in:\n\n\t%s\n\nIf found this file is processed at every <b>atomes</b> startup.\n\n\t\t\t\t\t\tSave file ?"),
ATOMES_CONFIG);
5222 if (
ask_yes_no(_(
"Save atomes preferences to file ?"), str, GTK_MESSAGE_QUESTION, this_proj -> modelgl -> win))
Binding to the Fortran90 subroutines.
double set_radius_(int *, int *)
Callback declarations for main window.
integer function chains()
integer(kind=c_int) function chemistry()
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
double scale(double axe)
find appropriate major tick spacing based on axis length
int * duplicate_int(int num, int *old_val)
copy a list of int
gboolean * duplicate_bool(int num, gboolean *old_val)
copy a list of gboolean
double * duplicate_double(int num, double *old_val)
copy a list of double
GtkWidget * atomes_main_window
gboolean * allocbool(int val)
allocate a gboolean * pointer
double * allocdouble(int val)
allocate a double * pointer
int * allocint(int val)
allocate an int * pointer
gchar * ATOMES_CONFIG_DIR
float * allocfloat(int val)
allocate a float * pointer
double string_to_double(gpointer string)
convert string to double
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * dialog_cancel_apply(gchar *title, GtkWidget *parent, gboolean resiz)
create a dialog modal offering a choice to apply something or not
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
void set_renderer_color(int tocol, GtkCellRenderer *renderer, ColRGBA col)
set the color of a GtkCellRenderer
void append_comments(GtkWidget *vbox, gchar *symbol, gchar *legend)
append comments to a vertical box
void update_chains_menus(glwin *view)
#define ATOM_LIMIT
atom number limit to compute fragment(s) and molecule(s) analysis automatically
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
void combo_set_markup(GtkWidget *combo)
use pango markup in combo widget
element_data periodic_table_info[]
ColRGBA get_window_color(GtkWidget *color_win)
get the ColRGBA color from a color selection window
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
GdkRGBA colrgba_togtkrgba(ColRGBA col)
convert ColRGBA color to GdkRGBA color
void clean_rings_data(int rid, glwin *view)
clean a ring type data for a glview
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
GtkWidget * radio_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a radio button
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
G_MODULE_EXPORT void on_calc_bonds_released(GtkWidget *widg, gpointer data)
compute bonding properties
GtkWidget * create_button(gchar *text, int image_format, gchar *image, int dimx, int dimy, int relief, GCallback handler, gpointer data)
create a simple button
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
create a GtkLabel with pango markup
void clean_chains_data(glwin *view)
cleaning the OpenGL data related to chain statistics
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.
ColRGBA get_button_color(GtkColorChooser *colob)
get the ColRGBA color from a GtkColorChooser button
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
GtkWidget * color_button(ColRGBA col, gboolean alpha, int dimx, int dimy, GCallback handler, gpointer data)
create a color selection button
void add_box_child_end(GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the end position.
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
GtkWidget * message_dialogmodal(gchar *message, gchar *title, GtkMessageType mtype, GtkButtonsType buttons, GtkWidget *parent)
create a modal (cannot be ignored) message window
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
ColRGBA * duplicate_color(int num, ColRGBA *col)
duplicate a ColRGBA pointer
int button_get_status(GtkWidget *button)
get status of check / toggle button
GtkWidget * abox(GtkWidget *box, char *lab, int vspace)
box creating routine, to help design faster elements for the GUI
void update_rings_menus(glwin *view)
void show_the_widgets(GtkWidget *widg)
show GtkWidget
project * get_project_by_id(int p)
get project pointer using id number
void zoom(glwin *view, int delta)
zoom in or zoom out in the OpenGL window
ColRGBA set_default_color(int z)
pick the default color for an atom
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
#define DEFAULT_LIGHTNING
Default OpenGL material ligthning.
#define DEFAULT_AMBIANT_OCCLUSION
Default OpenGL material ambiant occlusion.
#define DEFAULT_GAMMA_CORRECTION
Default OpenGL material gamma correction.
#define CAMERA_ANGLE_X
Default value for the OpenGL camera pitch in °
#define DEFAULT_OPACITY
Default OpenGL opacity.
#define DEFAULT_ROUGHNESS
Default OpenGL material roughness.
#define DEFAULT_METALLIC
Default OpenGL material metallic.
#define ZOOM
Default value for the OpenGL zoom.
#define QUALITY
Default OpenGL quality (number of polygons).
#define CAMERA_ANGLE_Y
Default value for the OpenGL camera heading in °
Variable declarations related the OpenGL window Data structure declarations related the OpenGL wind...
char * text_filled[FILLED_STYLES]
char * text_styles[OGL_STYLES]
void show_error(char *error, int val, GtkWidget *win)
show error message
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
Messaging function declarations.
Light * init_light_source(int type, float size)
initialize a light source
GtkWidget * over_param(int object, int style)
create override check button and entry
element_color * tmp_label_color[2]
background default_background
void update_omega_max()
update omega max information string
gboolean are_identical_colors(ColRGBA col_a, ColRGBA col_b)
test if two colors are identicals
axis_edition * pref_axis_win
Lightning default_lightning
void create_user_preferences_dialog()
G_MODULE_EXPORT void set_cutoffs_default(GtkButton *but, gpointer data)
set default cutoff radii
opengl_edition * pref_ogl_edit
element_radius * tmp_atomic_rad[16]
element_color * duplicate_element_color(element_color *old_list)
duplicate an element color data structure
xmlNodePtr findnode(xmlNodePtr startnode, char *nname)
find XML node
void read_light(xmlNodePtr light_node)
read light preferences from XML configuration
gradient_edition * pref_gradient_win
G_MODULE_EXPORT void edit_pref(GtkCellRendererText *cell, gchar *path_string, gchar *new_text, gpointer user_data)
edit cell in the preferences tree model
void radius_set_color_and_markup(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set text font and color
GtkWidget * lights_tab(glwin *view, opengl_edition *ogl_edit, Lightning *the_light)
OpenGL light(s) parameters tab.
GtkWidget * combo_map(int obj)
create color map combo
void read_style_from_xml_file(xmlNodePtr style_node, int style)
read style preferences from XML file
GtkWidget * materials_tab(glwin *view, opengl_edition *ogl_edit, Material *the_mat)
OpenGL material parameters tab.
gchar * substitute_string(gchar *init, gchar *o_motif, gchar *n_motif)
substitute all patterns in string
GtkWidget * atom_entry_over[8]
G_MODULE_EXPORT void toggled_select_project(GtkToggleButton *but, gpointer data)
toggle select / unselect project to update callback GTK3
double xml_string_to_double(xmlChar *content)
convert XML string to double
ColRGBA default_sel_color[2]
void edit_bonds(GtkWidget *vbox)
creation of the edit bond cutoff widgets
G_MODULE_EXPORT void edit_cutoffs(GtkDialog *edit_cuts, gint response_id, gpointer data)
edit partial cutoffs - running the dialog
int default_acl_format[2]
ColRGBA get_spec_color(int z, element_color *clist)
retrieve the color of a chemical species
void setup_fog_dialogs(opengl_edition *ogl_edit, int fid)
update OpenGL fog tab based of fog type
void prepare_tmp_default()
prepare temporary parameters
box_edition * pref_box_win
bond_cutoff * duplicate_cutoffs(bond_cutoff *old_cutoff)
duplicate bond cutoff data structure
void duplicate_material(Material *new_mat, Material *old_mat)
duplicate material data
G_MODULE_EXPORT void set_default_map(GtkComboBox *box, gpointer data)
change default atom(s) or polyhedra color map
G_MODULE_EXPORT void set_default_style(GtkComboBox *box, gpointer data)
change default atom(s) and bond(s) style
G_MODULE_EXPORT void edit_preferences(GtkDialog *edit_prefs, gint response_id, gpointer data)
edit preferences - running the dialog
GtkWidget * opengl_preferences()
OpenGL preferences.
G_MODULE_EXPORT void set_default_options(GtkButton *but, gpointer data)
set options as default options
element_radius * tmp_bond_rad[6]
G_MODULE_EXPORT gboolean scroll_scale_quality(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data)
update OpenGL quality - scroll callback
void duplicate_screen_label(screen_label *new_lab, screen_label *old_lab)
copy screen_label data structure
G_MODULE_EXPORT void restore_defaults_parameters(GtkButton *but, gpointer data)
element_color * color_list
float get_radius(int object, int col, int z, element_radius *rad_list)
retrieve the radius/width of a species depending on style
G_MODULE_EXPORT void gradient_advanced(GtkWidget *widg, gpointer data)
Background configuration window.
GtkWidget * view_preferences()
view preferences
G_MODULE_EXPORT void set_measures(GtkComboBox *box, gpointer data)
change measure type
int xml_save_xyz_to_file(xmlTextWriterPtr writer, int did, gchar *legend, gchar *key, vec3_t data)
save vector data (x,y,z) to XML file
element_radius * duplicate_element_radius(element_radius *old_list)
duplicate an element radius data structure
void add_global_option(GtkWidget *vbox, tint *oid)
add a button to update global user preferences
G_MODULE_EXPORT void set_selection_color(GtkColorChooser *colob, gpointer data)
change selection color
element_color * default_atom_color[2]
GtkWidget * dyna_entry[2][2]
GtkWidget * bond_entry_over[6]
void duplicate_box_data(box *new_box, box *old_box)
duplicate box_data data structure
GtkWidget * style_tab(int style)
create preferences tab for a style
G_MODULE_EXPORT void toggled_default_stuff(GtkToggleButton *but, gpointer data)
toggle set / unset default callback GTK3
void read_parameter(xmlNodePtr parameter_node)
read preferences from XML configuration
G_MODULE_EXPORT void set_default_num_delta(GtkEntry *res, gpointer data)
update default number of delta preferences
GtkWidget * pref_list(gchar *mess[2], int nelem, gchar *mlist[nelem][2], gchar *end)
print information message with item list of elements
bond_cutoff * tmp_bond_cutoff
G_MODULE_EXPORT void totcut_changed(GtkComboBox *box, gpointer data)
change method to evaluate the total cutoff
GtkWidget * fog_tab(glwin *view, opengl_edition *ogl_edit, Fog *the_fog)
OpenGL fog parameters tab.
gboolean * default_o_at_rs
G_MODULE_EXPORT void set_default_stuff(GtkEntry *res, gpointer data)
update default number of delta preferences
int xml_save_parameter_to_file(xmlTextWriterPtr writer, gchar *xml_leg, gchar *xml_key, gboolean doid, int xml_id, gchar *value)
save single parameter to XML file
G_MODULE_EXPORT void axis_advanced(GtkWidget *widg, gpointer data)
create the axis advanced parameters window
void apply_default_parameters_to_project(project *this_proj, gboolean with_analysis)
apply default parameters to project
Material default_material
void color_set_color(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set background color
element_radius ** edit_list
element_color * tmp_atom_color[2]
element_radius * default_bond_rad[6]
G_MODULE_EXPORT void edit_chem_preferences(GtkDialog *edit_chem, gint response_id, gpointer data)
edit chem preferences - running the dialog
void read_preferences(xmlNodePtr preference_node)
read preferences from XML configuration
element_color * default_label_color[2]
void set_atomes_preferences()
set software default parameters
GtkTreeModel * style_combo_tree()
create opengl style combo model
G_MODULE_EXPORT void run_ac_color(GtkDialog *win, gint response_id, gpointer data)
window color chooser - running the dialog
rep_edition * pref_rep_win
void calc_sk_t(GtkWidget *vbox)
creation of the s(k,t) calculation widgets
gboolean default_mtilt[2]
void duplicate_background_data(background *new_back, background *old_back)
duplicate background data structure
void update_light_data(int li, opengl_edition *ogl_win)
update light data
void dyna_parameters(GtkWidget *vbox, int cid)
create time related configuration widgets
void set_parameter(xmlChar *content, gchar *key, int vid, dint *bond, vec3_t *vect, float start, float end, ColRGBA *col)
set default parameter
void set_atomes_defaults()
set atomes default parameters
G_MODULE_EXPORT gboolean pref_color_button_event(GtkWidget *widget, GdkEvent *event, gpointer data)
Light ** copy_light_sources(int dima, int dimb, Light **old_sp)
create a copy of a list of light sources
void duplicate_axis_data(axis *new_axis, axis *old_axis)
duplicate axis_data data structure
element_radius * default_atomic_rad[16]
GtkWidget * calc_preferences()
analysis preferences
G_MODULE_EXPORT void edit_pc_value(GtkEntry *res, gpointer data)
update partial cutoff value
void update_gradient_widgets(gradient_edition *gradient_win, background *back)
update the widgets of the gradient window
gchar * xml_filled_leg[4]
GtkWidget * lightning_fix(glwin *view, Material *this_material)
void save_preferences()
save user preferences
screen_label * tmp_label[5]
G_MODULE_EXPORT void tunit_changed(GtkComboBox *box, gpointer data)
change default time units
gboolean * default_o_bd_rw
G_MODULE_EXPORT void edit_species_parameters(GtkButton *but, gpointer data)
edit atoms and bonds species related parameters
void duplicate_fog(Fog *new_fog, Fog *old_fog)
duplicate fog data
gboolean default_skt_sets
bond_cutoff * default_bond_cutoff
GtkWidget * preference_notebook
G_MODULE_EXPORT void set_instance_mode(GtkToggleButton *but, gpointer data)
set default instance mode
G_MODULE_EXPORT void update_projects(GtkDialog *proj_sel, gint response_id, gpointer data)
update projects in the workspace using new preferences
G_MODULE_EXPORT void box_advanced(GtkWidget *widg, gpointer data)
create the box edition window
screen_label default_label[5]
GtkWidget * adv_box(GtkWidget *box, char *lab, int vspace, int size, float xalign)
create a box with markup label
background * tmp_background
G_MODULE_EXPORT void scale_quality(GtkRange *range, gpointer data)
update OpenGL quality - range callback
G_MODULE_EXPORT void cut_spec_changed(GtkComboBox *box, gpointer data)
partial cutoff chemical species
void calc_rings(GtkWidget *vbox)
creation of the rings statistics calculation widgets
gboolean not_in_cutoffs(int z_a, int z_b)
look in bond cutoff between species a and b is already defined
void color_button_event(GtkWidget *widget, double event_x, double event_y, guint event_button, gpointer data)
species color selection mouse button event
GtkWidget * model_preferences()
model preferences
void duplicate_rep_data(rep_data *new_rep, rep_data *old_rep)
duplicate rep_data data structure
void read_preferences_from_xml_file()
read software preferences from XML file
GtkWidget * dyna_combo[2]
G_MODULE_EXPORT void representation_advanced(GtkWidget *widg, gpointer data)
open advanced representation dialog
G_MODULE_EXPORT void set_stuff_color(GtkColorChooser *colob, gpointer data)
change stuff color
void clean_all_tmp()
free all temporary buffers
void add_cut_box()
update partial cutoffs widgets
void adjust_preferences_window()
adjust the widgets of the preferences window
GtkWidget * labels_tab(glwin *view, int lid)
create atomic label(s) tab for the atom(s) / clone(s) window
int xml_save_color_to_file(xmlTextWriterPtr writer, int did, gchar *legend, gchar *key, ColRGBA col)
save color data (red, green, blue, alpha) to XML file
G_MODULE_EXPORT void toggled_use_cutoff(GtkToggleButton *but, gpointer data)
int save_preferences_to_xml_file()
save software preferences to XML file
Preference variable declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...
void active_project_changed(int id)
change the active project
int update_project()
update project: send data to Fortran90, and update calculation interactors
G_MODULE_EXPORT void set_id(GtkEntry *entry, gpointer data)
set search id if >= 10 000 atoms
Function declarations for workspace managment.