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);
301gchar *
xml_style_leg[6] = {
"ball_and_stick",
"wireframes",
"spacefilled",
"spheres",
"cylinders",
"dots"};
303gchar *
xml_atom_leg[3] = {
"atoms_radius",
"dot_size",
"sphere_radius"};
304gchar *
xml_bond_leg[3] = {
"bond_radius",
"wireframe_width",
"cylinder_radius"};
320 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
321 if (rc < 0)
return 0;
322 rc = xmlTextWriterWriteAttribute(writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST legend);
323 if (rc < 0)
return 0;
324 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"key", BAD_CAST key);
325 if (rc < 0)
return 0;
328 str = g_strdup_printf (
"%d", did);
329 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST str);
331 if (rc < 0)
return 0;
333 str = g_strdup_printf (
"%f",
col.red);
334 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"red", BAD_CAST str);
336 if (rc < 0)
return 0;
337 str = g_strdup_printf (
"%f",
col.green);
338 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"green", BAD_CAST str);
340 if (rc < 0)
return 0;
341 str = g_strdup_printf (
"%f",
col.blue);
342 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"blue", BAD_CAST str);
344 if (rc < 0)
return 0;
345 str = g_strdup_printf (
"%f",
col.alpha);
346 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"alpha", BAD_CAST str);
348 if (rc < 0)
return 0;
349 rc = xmlTextWriterEndElement (writer);
350 if (rc < 0)
return 0;
368 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
369 if (rc < 0)
return 0;
370 rc = xmlTextWriterWriteAttribute(writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST legend);
371 if (rc < 0)
return 0;
372 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"key", BAD_CAST key);
373 if (rc < 0)
return 0;
376 str = g_strdup_printf (
"%d", did);
377 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST str);
379 if (rc < 0)
return 0;
381 str = g_strdup_printf (
"%f", data.
x);
382 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"x", BAD_CAST str);
384 if (rc < 0)
return 0;
385 str = g_strdup_printf (
"%f", data.
y);
386 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"y", BAD_CAST str);
388 if (rc < 0)
return 0;
389 str = g_strdup_printf (
"%f", data.
z);
390 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"z", BAD_CAST str);
392 if (rc < 0)
return 0;
393 rc = xmlTextWriterEndElement (writer);
394 if (rc < 0)
return 0;
413 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
414 if (rc < 0)
return 0;
415 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST xml_leg);
416 if (rc < 0)
return 0;
417 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"key", BAD_CAST xml_key);
418 if (rc < 0)
return 0;
422 str = g_strdup_printf (
"%d", xml_id);
423 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST (
const xmlChar *)str);
425 if (rc < 0)
return 0;
427 rc = xmlTextWriterWriteFormatString (writer,
"%s", value);
428 if (rc < 0)
return 0;
429 rc = xmlTextWriterEndElement (writer);
430 if (rc < 0)
return 0;
446 if (! CreateDirectory(
ATOMES_CONFIG_DIR, NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
459 xmlTextWriterPtr writer;
461 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"),
462 i18n(
"Dij: number of δr [min(Dij)-max(Dij)]"),
i18n(
"Angles distribution: number of δθ [0-180°]"),
463 i18n(
"Spherical harmonics: l(max) in [2-40]"),
i18n(
"MSD: steps between configurations"),
464 i18n(
"F(k,t): number of δk")};
465 gchar * xml_delta_t_leg[2] = {
i18n(
"MSD: time steps δt"),
i18n(
"MSD: time unit")};
466 gchar * xml_rings_leg[7] = {
i18n(
"Default search"),
467 i18n(
"Atom(s) to initiate the search from"),
468 i18n(
"Maximum size for a ring"),
469 i18n(
"Maximum number of rings of size n per MD step"),
470 i18n(
"Only search for ABAB rings"),
471 i18n(
"No homopolar bonds in the rings (A-A, B-B ...)"),
472 i18n(
"No homopolar bonds in the connectivity matrix")};
473 gchar * xml_chain_leg[7] = {
i18n(
"Atom(s) to initiate the search from"),
474 i18n(
"Maximum size for a ring"),
475 i18n(
"Maximum number of rings of size n per MD step"),
476 i18n(
"Only search for AAAA chains"),
477 i18n(
"Only search for ABAB chains"),
478 i18n(
"No homopolar bonds in the chains (A-A, B-B ...)"),
479 i18n(
"Only search for 1-(2)n-1 chains")};
480 gchar * xml_skt_leg[4] = {
i18n(
"Analyze all correlated δt steps"),
481 i18n(
"Number of analyzed δt steps"),
482 i18n(
"Number of analyzed q points"),
483 i18n(
"Number of frequency points")};
484 gchar * xml_opengl_leg[5] = {
i18n(
"Default style"),
485 i18n(
"Atom(s) color map"),
486 i18n(
"Polyhedra color map"),
488 i18n(
"Ray Tracing")};
489 gchar * xml_material_leg[8] = {
i18n(
"Predefine material"),
490 i18n(
"Lightning model"),
493 i18n(
"Back lightning"),
497 gchar * xml_lightning_leg[7] = {
i18n(
"Type"),
503 i18n(
"Spot specifics")};
504 gchar * xml_fog_leg[5] = {
i18n(
"Mode"),
509 gchar * xml_model_leg[2] = {
i18n(
"Show clones"),
511 gchar * xml_label_leg[6] = {
i18n(
"Position"),
517 gchar * xml_axis_leg[3] = {
i18n(
"Legend on x"),
519 i18n(
"Legend on z")};
523 if (writer == NULL)
return 0;
524 rc = xmlTextWriterSetIndent(writer, 1);
525 if (rc < 0)
return 0;
529 rc = xmlTextWriterStartDocument (writer, NULL,
MY_ENCODING, NULL);
530 if (rc < 0)
return 0;
532 rc = xmlTextWriterWriteComment (writer, (
const xmlChar *)_(
"atomes preferences XML file"));
533 if (rc < 0)
return 0;
535 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"atomes_preferences-xml");
536 if (rc < 0)
return 0;
538 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"analysis");
539 if (rc < 0)
return 0;
540 int i, j, k, l, m, n, o;
545 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"cutoffs");
546 if (rc < 0)
return 0;
556 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"partials");
557 if (rc < 0)
return 0;
561 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
562 if (rc < 0)
return 0;
564 rc = xmlTextWriterWriteAttribute(writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST str);
566 if (rc < 0)
return 0;
567 str = g_strdup_printf (
"%d", tmp_cut -> Z[0]);
568 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"α", BAD_CAST str);
570 if (rc < 0)
return 0;
571 str = g_strdup_printf (
"%d", tmp_cut -> Z[1]);
572 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"β", BAD_CAST str);
574 if (rc < 0)
return 0;
575 str = g_strdup_printf (
"%lf", tmp_cut -> cutoff);
576 rc = xmlTextWriterWriteFormatString (writer,
"%s", str);
578 if (rc < 0)
return 0;
579 rc = xmlTextWriterEndElement (writer);
580 if (rc < 0)
return 0;
581 tmp_cut = tmp_cut -> next;
583 rc = xmlTextWriterEndElement (writer);
584 if (rc < 0)
return 0;
586 rc = xmlTextWriterEndElement (writer);
587 if (rc < 0)
return 0;
641 rc = xmlTextWriterEndElement (writer);
642 if (rc < 0)
return 0;
644 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"opengl");
645 if (rc < 0)
return 0;
655 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"material");
656 if (rc < 0)
return 0;
675 rc = xmlTextWriterEndElement (writer);
676 if (rc < 0)
return 0;
678 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"lightning");
679 if (rc < 0)
return 0;
688 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"light");
689 if (rc < 0)
return 0;
690 str = g_strdup_printf (
"%d", i);
691 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST (
const xmlChar *)str);
693 if (rc < 0)
return 0;
723 rc = xmlTextWriterEndElement (writer);
724 if (rc < 0)
return 0;
728 rc = xmlTextWriterEndElement (writer);
729 if (rc < 0)
return 0;
731 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"fog");
732 if (rc < 0)
return 0;
749 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"parameter");
750 if (rc < 0)
return 0;
751 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"info", BAD_CAST xml_fog_leg[3]);
752 if (rc < 0)
return 0;
753 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"key", BAD_CAST
"fog.depth");
754 if (rc < 0)
return 0;
755 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"id", BAD_CAST
"3");
756 if (rc < 0)
return 0;
757 str = g_strdup_printf (
"%f",
default_fog.depth[0]);
758 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"start", BAD_CAST str);
760 if (rc < 0)
return 0;
761 str = g_strdup_printf (
"%f",
default_fog.depth[1]);
762 rc = xmlTextWriterWriteAttribute (writer, BAD_CAST (
const xmlChar *)
"end", BAD_CAST str);
764 if (rc < 0)
return 0;
765 rc = xmlTextWriterEndElement (writer);
766 if (rc < 0)
return 0;
771 rc = xmlTextWriterEndElement (writer);
772 if (rc < 0)
return 0;
775 rc = xmlTextWriterEndElement (writer);
776 if (rc < 0)
return 0;
779 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"model");
780 if (rc < 0)
return 0;
796 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"atoms_and_bonds");
797 if (rc < 0)
return 0;
802 gchar * str_a, * str_b;
805 do_atoms = do_bonds = FALSE;
822 if (i != 2 && i != 3 && i != 5)
828 if (do_atoms || do_bonds)
830 rc = xmlTextWriterStartElement (writer, BAD_CAST
xml_style_leg[i]);
831 if (rc < 0)
return 0;
835 k = (j == 0 || j == 2) ? 0 : (j == 1 || j == 4) ? 1 : 2;
848 l = (j == 2) ? 4 : 1;
849 for (m=0; m < l; m++)
854 n = (o && m) ? 5 : n;
858 rc = xmlTextWriterStartElement (writer, BAD_CAST str_a);
860 if (rc < 0)
return 0;
864 str = g_strdup_printf (
"%f", tmp_rad -> rad);
868 tmp_rad = tmp_rad -> next;
870 rc = xmlTextWriterEndElement (writer);
871 if (rc < 0)
return 0;
893 rc = xmlTextWriterStartElement (writer, BAD_CAST str_a);
895 if (rc < 0)
return 0;
899 str = g_strdup_printf (
"%f", tmp_rad -> rad);
903 tmp_rad = tmp_rad -> next;
905 rc = xmlTextWriterEndElement (writer);
906 if (rc < 0)
return 0;
910 rc = xmlTextWriterEndElement (writer);
911 if (rc < 0)
return 0;
916 rc = xmlTextWriterEndElement (writer);
917 if (rc < 0)
return 0;
921 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"labels");
922 if (rc < 0)
return 0;
923 gchar * obj[2]={
"atoms",
"clones"};
926 rc = xmlTextWriterStartElement (writer, BAD_CAST obj[i]);
927 if (rc < 0)
return 0;
951 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"colors");
952 if (rc < 0)
return 0;
964 tmp_col = tmp_col -> next;
967 rc = xmlTextWriterEndElement (writer);
968 if (rc < 0)
return 0;
971 rc = xmlTextWriterEndElement (writer);
972 if (rc < 0)
return 0;
976 rc = xmlTextWriterEndElement (writer);
977 if (rc < 0)
return 0;
983 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"colors");
984 if (rc < 0)
return 0;
989 rc = xmlTextWriterStartElement (writer, BAD_CAST obj[i]);
990 if (rc < 0)
return 0;
996 tmp_col = tmp_col -> next;
998 rc = xmlTextWriterEndElement (writer);
999 if (rc < 0)
return 0;
1006 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"box");
1007 if (rc < 0)
return 0;
1015 rc = xmlTextWriterEndElement (writer);
1016 if (rc < 0)
return 0;
1020 rc = xmlTextWriterEndElement (writer);
1021 if (rc < 0)
return 0;
1024 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"view");
1025 if (rc < 0)
return 0;
1028 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"background");
1055 rc = xmlTextWriterEndElement (writer);
1056 if (rc < 0)
return 0;
1060 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"representation");
1061 if (rc < 0)
return 0;
1074 str = g_strdup_printf (
"%lf", 1.0 - 0.5*
default_rep.zoom);
1080 str = g_strdup_printf (
"%lf", -
default_rep.c_angle[i]);
1087 str = g_strdup_printf (
"%lf",
default_rep.c_shift[i]);
1093 rc = xmlTextWriterEndElement (writer);
1094 if (rc < 0)
return 0;
1099 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"axis");
1100 if (rc < 0)
return 0;
1123 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"labels");
1124 if (rc < 0)
return 0;
1140 rc = xmlTextWriterEndElement (writer);
1141 if (rc < 0)
return 0;
1152 rc = xmlTextWriterEndElement (writer);
1153 if (rc < 0)
return 0;
1156 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"measures");
1157 if (rc < 0)
return 0;
1158 gchar * m_key[2]={
"standard",
"selection"};
1161 rc = xmlTextWriterStartElement (writer, BAD_CAST m_key[i]);
1162 if (rc < 0)
return 0;
1163 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"labels");
1164 if (rc < 0)
return 0;
1182 rc = xmlTextWriterEndElement (writer);
1183 if (rc < 0)
return 0;
1205 rc = xmlTextWriterEndElement (writer);
1206 if (rc < 0)
return 0;
1209 rc = xmlTextWriterEndElement (writer);
1210 if (rc < 0)
return 0;
1212 rc = xmlTextWriterStartElement (writer, BAD_CAST (
const xmlChar *)
"atom-selections");
1213 if (rc < 0)
return 0;
1219 rc = xmlTextWriterEndElement (writer);
1220 if (rc < 0)
return 0;
1223 rc = xmlTextWriterEndElement (writer);
1224 if (rc < 0)
return 0;
1226 rc = xmlTextWriterEndElement (writer);
1227 if (rc < 0)
return 0;
1229 rc = xmlTextWriterEndDocument (writer);
1230 if (rc < 0)
return 0;
1232 xmlFreeTextWriter (writer);
1247 return (g_strcmp0((
const char *)content,
"") == 0) ? 0.0 :
string_to_double ((gpointer)content);
1278 cut -> next = g_malloc0(
sizeof*cut);
1286 cut -> Z[0] = bond -> a;
1287 cut -> Z[1] = bond -> b;
1291 else if (g_strcmp0(key,
"default_totcut") == 0)
1295 else if (g_strcmp0(key,
"default_num_delta") == 0)
1299 else if (g_strcmp0(key,
"default_delta_t") == 0)
1303 else if (g_strcmp0(key,
"default_rsparam") == 0)
1307 else if (g_strcmp0(key,
"default_csparam") == 0)
1311 else if (g_strcmp0(key,
"default_skt_sets") == 0)
1315 else if (g_strcmp0(key,
"default_skt_n_sets") == 0)
1319 else if (g_strcmp0(key,
"default_sqw_n_sets") == 0)
1323 else if (g_strcmp0(key,
"default_sqw_freq") == 0)
1327 else if (g_strcmp0(key,
"default_opengl") == 0)
1331 else if (g_strcmp0(key,
"default_material") == 0)
1337 else if (vid == 6 && vect)
1346 else if (g_strcmp0(key,
"default_lightning") == 0)
1365 else if (g_strcmp0(key,
"light.type") == 0)
1369 else if (g_strcmp0(key,
"light.fix") == 0)
1373 else if (g_strcmp0(key,
"light.direction") == 0 && vect)
1377 else if (g_strcmp0(key,
"light.position") == 0 && vect)
1381 else if (g_strcmp0(key,
"light.intensity") == 0 && vect)
1385 else if (g_strcmp0(key,
"light.attenuation") == 0 && vect)
1389 else if (g_strcmp0(key,
"light.spot") == 0 && vect)
1393 else if (g_strcmp0(key,
"fog.mode") == 0)
1397 else if (g_strcmp0(key,
"fog.type") == 0)
1401 else if (g_strcmp0(key,
"fog.density") == 0)
1405 else if (g_strcmp0(key,
"fog.depth") == 0)
1410 else if (g_strcmp0(key,
"fog.color") == 0 && vect)
1414 else if (g_strcmp0(key,
"default_cell") == 0)
1418 else if (g_strcmp0(key,
"default_clones") == 0)
1422 else if (g_strcmp0(key,
"default_at_rs") == 0)
1427 else if (g_strcmp0(key,
"default_bd_rw") == 0)
1432 else if (g_strcmp0(key,
"default_atomic_rad") == 0)
1437 while (tmp_rad -> next)
1439 tmp_rad = tmp_rad -> next;
1441 tmp_rad -> next = g_malloc0(
sizeof*tmp_rad);
1442 tmp_rad = tmp_rad -> next;
1452 else if (g_strcmp0(key,
"default_bond_rad") == 0)
1457 while (tmp_rad -> next)
1459 tmp_rad = tmp_rad -> next;
1461 tmp_rad -> next = g_malloc0(
sizeof*tmp_rad);
1462 tmp_rad = tmp_rad -> next;
1472 else if (g_strcmp0(key,
"default_label") == 0)
1498 else if (g_strcmp0(key,
"default_label_color") == 0)
1510 while (tmp_col -> next)
1512 tmp_col = tmp_col -> next;
1514 tmp_col -> next = g_malloc0(
sizeof*tmp_col);
1515 tmp_col = tmp_col -> next;
1526 else if (g_strcmp0(key,
"default_font_color") == 0)
1531 else if (g_strcmp0(key,
"default_atom_color") == 0)
1536 while (tmp_col -> next)
1538 tmp_col = tmp_col -> next;
1540 tmp_col -> next = g_malloc0(
sizeof*tmp_col);
1541 tmp_col = tmp_col -> next;
1551 else if (g_strcmp0(key,
"only_label_color") == 0)
1557 else if (g_strcmp0(key,
"default_box") == 0)
1576 else if (g_strcmp0(key,
"default_background") == 0)
1597 else if (g_strcmp0(key,
"default_rep") == 0)
1622 else if (g_strcmp0(key,
"default_axis") == 0)
1637 if (vid == 1 || vid == 4)
1653 else if (g_strcmp0(key,
"axis_legend") == 0)
1655 default_axis.title[vid] = g_strdup_printf (
"%s", content);
1657 else if (g_strcmp0(key,
"default_mtilt") == 0)
1661 else if (g_strcmp0(key,
"default_mpattern") == 0)
1665 else if (g_strcmp0(key,
"default_mfactor") == 0)
1669 else if (g_strcmp0(key,
"default_mwidth") == 0)
1673 else if (g_strcmp0(key,
"default_sel_color") == 0)
1692 xmlAttrPtr p_details;
1693 gboolean set_codevar,
set_id;
1694 gboolean set_x, set_y, set_z;
1695 gboolean set_r, set_g, set_b, set_a;
1696 gboolean set_alpha, set_beta;
1699 xmlChar * content, * p_cont;
1704 while (parameter_node)
1706 content = xmlNodeGetContent(parameter_node);
1707 p_details = parameter_node -> properties;
1708 set_codevar =
set_id = FALSE;
1709 set_x = set_y = set_z = FALSE;
1710 set_r = set_g = set_b = set_a = FALSE;
1711 set_alpha = set_beta = FALSE;
1716 p_node = p_details -> children;
1719 p_cont = xmlNodeGetContent(p_node);
1720 if (g_strcmp0(
"key",(
char *)p_details -> name) == 0)
1722 key = g_strdup_printf (
"%s", p_cont);
1725 else if (g_strcmp0(
"id",(
char *)p_details -> name) == 0)
1730 else if (g_strcmp0(
"α",(
char *)p_details -> name) == 0)
1735 else if (g_strcmp0(
"β",(
char *)p_details -> name) == 0)
1740 else if (g_strcmp0(
"x",(
char *)p_details -> name) == 0)
1745 else if (g_strcmp0(
"y",(
char *)p_details -> name) == 0)
1750 else if (g_strcmp0(
"z",(
char *)p_details -> name) == 0)
1755 else if (g_strcmp0(
"start",(
char *)p_details -> name) == 0)
1759 else if (g_strcmp0(
"end",(
char *)p_details -> name) == 0)
1763 else if (g_strcmp0(
"red",(
char *)p_details -> name) == 0)
1768 else if (g_strcmp0(
"green",(
char *)p_details -> name) == 0)
1773 else if (g_strcmp0(
"blue",(
char *)p_details -> name) == 0)
1778 else if (g_strcmp0(
"alpha",(
char *)p_details -> name) == 0)
1785 p_details = p_details -> next;
1788 if ((set_codevar && (
set_id || (set_r && set_g && set_b && set_a))) || (set_alpha && set_beta))
1791 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);
1793 if (key) g_free (key);
1795 parameter_node = parameter_node -> next;
1796 parameter_node =
findnode (parameter_node,
"parameter");
1809 xmlNodePtr l_node, p_node;
1810 xmlNodePtr parameter_node;
1811 xmlAttrPtr l_details, p_details;
1814 gboolean set_codevar;
1815 gboolean set_lid = FALSE;
1816 gboolean set_x, set_y, set_z;
1817 xmlChar * content, * p_cont;
1819 l_details = light_node -> properties;
1822 l_node = l_details -> children;
1825 if (g_strcmp0(
"id",(
char *)l_details -> name) == 0)
1827 content = xmlNodeGetContent(l_node);
1833 l_details = l_details -> next;
1837 parameter_node =
findnode (light_node -> children,
"parameter");
1838 set_codevar = FALSE;
1839 set_x = set_y = set_z = FALSE;
1840 while (parameter_node)
1842 content = xmlNodeGetContent(parameter_node);
1843 p_details = parameter_node -> properties;
1846 p_node = p_details -> children;
1849 p_cont = xmlNodeGetContent(p_node);
1850 if (g_strcmp0(
"key",(
char *)p_details -> name) == 0)
1852 key = g_strdup_printf (
"%s", p_cont);
1855 else if (g_strcmp0(
"x",(
char *)p_details -> name) == 0)
1860 else if (g_strcmp0(
"y",(
char *)p_details -> name) == 0)
1865 else if (g_strcmp0(
"z",(
char *)p_details -> name) == 0)
1872 p_details = p_details -> next;
1876 set_parameter (content, key, lid, NULL, (set_x && set_y && set_z) ? & vec : NULL, -1.0, -1.0, NULL);
1878 if (key) g_free (key);
1880 parameter_node = parameter_node -> next;
1881 parameter_node =
findnode (parameter_node,
"parameter");
1896 node =
findnode (preference_node -> children,
"parameter");
1913 i = (style == 0 || style == 2) ? 0 : (style == 1 || style == 4) ? 1 : 2;
1916 k = (style == 2) ? 4 : 1;
1935 i = (style < 2) ? style : 2;
1953 xmlTextReaderPtr reader;
1955 xmlNodePtr node, p_node, l_node, c_node;
1963 racine = xmlDocGetRootElement (doc);
1966 if (g_strcmp0 ((
char *)(racine -> name),
"atomes_preferences-xml") == 0)
1968 node =
findnode(racine -> children,
"analysis");
1971 p_node =
findnode (node -> children,
"cutoffs");
1975 l_node =
findnode(p_node -> children,
"partials");
1983 node =
findnode(racine -> children,
"opengl");
1986 p_node =
findnode (node -> children,
"material");
1991 p_node =
findnode (node -> children,
"lightning");
1995 l_node =
findnode (p_node -> children,
"light");
1999 l_node = l_node -> next;
2000 l_node =
findnode (l_node,
"light");
2003 p_node =
findnode (node -> children,
"fog");
2010 node =
findnode(racine -> children,
"model");
2014 p_node =
findnode(node -> children,
"atoms_and_bonds");
2026 p_node =
findnode(node -> children,
"labels");
2031 l_node =
findnode (p_node -> children, (i) ?
"clones" :
"atoms");
2036 c_node =
findnode(l_node -> children,
"colors");
2044 c_node =
findnode(node -> children,
"colors");
2049 l_node =
findnode (c_node -> children, (i) ?
"clones" :
"atoms");
2057 p_node =
findnode(node -> children,
"box");
2063 node =
findnode(racine -> children,
"view");
2067 p_node =
findnode(node -> children,
"background");
2072 p_node =
findnode(node -> children,
"representation");
2077 p_node =
findnode(node -> children,
"axis");
2081 l_node =
findnode(p_node -> children,
"labels");
2088 c_node =
findnode(p_node -> children,
"colors");
2094 p_node =
findnode(node -> children,
"measures");
2097 l_node =
findnode(p_node -> children,
"standard");
2100 c_node =
findnode(l_node -> children,
"labels");
2108 l_node =
findnode(p_node -> children,
"selection");
2111 c_node =
findnode(l_node -> children,
"labels");
2120 p_node =
findnode(node -> children,
"atom-selections");
2130 xmlFreeTextReader(reader);
2230 for (i=0; i<16; i++)
2279 default_label[i].font = (i > 2) ? g_strdup_printf (
"FreeMono Bold 18") : g_strdup_printf (
"Sans Bold 12");
2384GtkWidget *
pref_list (gchar * mess[2],
int nelem, gchar * mlist[nelem][2], gchar * end)
2394 for (i=0; i<nelem; i++)
2398 str = g_strdup_printf (
"<b>%s</b>", _(mlist[i][0]));
2423 i = GPOINTER_TO_INT (data);
2447 int i = GPOINTER_TO_INT (data);
2458 GtkWidget * notebook = gtk_notebook_new ();
2459 gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE);
2460 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
2462 gchar * info[2] = {
i18n(
"The <b>View</b> tab regroups representation options"),
2463 i18n(
"which effect apply to the general aspect of the model:")};
2464 gchar * m_list[3][2] = {{
i18n(
"Representation"),
i18n(
"scene set-up and orientation")},
2465 {
i18n(
"Axis"),
i18n(
"axis options")},
2466 {
i18n(
"Tools"),
i18n(
"measures and selections option")}};
2474 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"General")));
2479 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
pref_rep_win -> win, gtk_label_new (_(
"Representation")));
2484 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
pref_axis_win -> win, gtk_label_new (_(
"Axis")));
2506 hbox =
adv_box (
vbox, _(
"<b>Select selection type</b>"), 15, 120, 0.0);
2513 GtkWidget * hhbox, * vvbox;
2520 hhbox =
abox (vvbox, _(
"Color"), 0);
2521 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);
2526 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"Tools")));
2565 int object = GPOINTER_TO_INT(data);
2581 else if (
object < 100)
2603 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(
edit_colob), & rgb_col);
2619 int i = GPOINTER_TO_INT(data);
2643 if (! old_list)
return NULL;
2650 tmp_rbd -> Z = tmp_rad -> Z;
2651 tmp_rbd -> rad = tmp_rad -> rad;
2652 if (tmp_rad -> next)
2654 tmp_rbd -> next = g_malloc0(
sizeof*tmp_rbd -> next);
2655 tmp_rbd -> next -> prev = tmp_rbd;
2656 tmp_rbd = tmp_rbd -> next;
2658 tmp_rad = tmp_rad -> next;
2679 if (tmp_rad -> Z ==
z)
2682 return tmp_rad -> rad;
2684 tmp_rad = tmp_rad -> next;
2688 object = -
object - 2;
2690 if (
object == 0 ||
object == 3)
2706 if (
object == 2 ||
object == 7 ||
col)
2714 else if (
object == 1 ||
object == 4 ||
object == 6 ||
object == 9)
2719 else if (
object == 0 ||
object == 3 ||
object == 5 ||
object == 8)
2737 if (! old_list)
return NULL;
2744 tmp_rbd -> Z = tmp_rad -> Z;
2745 tmp_rbd ->
col = tmp_rad ->
col;
2746 if (tmp_rad -> next)
2748 tmp_rbd -> next = g_malloc0(
sizeof*tmp_rbd -> next);
2749 tmp_rbd -> next -> prev = tmp_rbd;
2750 tmp_rbd = tmp_rbd -> next;
2752 tmp_rad = tmp_rad -> next;
2770 if (tmp_col -> Z ==
z)
2773 return tmp_col ->
col;
2775 tmp_col = tmp_col -> next;
2790G_MODULE_EXPORT
void edit_pref (GtkCellRendererText * cell, gchar * path_string, gchar * new_text, gpointer user_data)
2792 int col = GPOINTER_TO_INT(user_data);
2793 GtkTreeModel * pref_model = gtk_tree_view_get_model(GTK_TREE_VIEW(
pref_tree));
2795 gtk_tree_model_get_iter_from_string (pref_model, &
row, path_string);
2798 gtk_tree_model_get (pref_model, &
row, 3, &
z, -1);
2799 gtk_list_store_set (GTK_LIST_STORE(pref_model), &
row,
col+4,
val, -1);
2800 gboolean add_elem = FALSE;
2801 gboolean remove_elem = FALSE;
2803 int col_val[4] = {1, 3, 5, 10};
2811 if (tmp_list -> Z ==
z)
2813 tmp_list -> rad =
val;
2817 if (tmp_list -> next)
2819 if (tmp_list -> prev)
2821 tmp_list -> prev -> next = tmp_list -> next;
2822 tmp_list -> next -> prev = tmp_list -> prev;
2830 else if (tmp_list -> prev)
2848 tmp_list = tmp_list -> next;
2863 if (! tmp_list -> next)
break;
2864 tmp_list = tmp_list -> next;
2866 tmp_list -> next = g_malloc0(
sizeof*tmp_list -> next);
2867 tmp_list -> next -> prev = tmp_list;
2868 tmp_list = tmp_list -> next;
2876 tmp_list -> rad =
val;
2877 gtk_tree_model_get (pref_model, &
row, 0, &
z, -1);
2886 b = (
z - a * 10) / 5;
2887 c = (
z - a * 10 - b * 5) / 3;
2888 d =
z - a * 10 - b * 5 - c * 3;
2890 if (a ||
col == 3)
z += 10;
2891 if (b ||
col == 2)
z += 5;
2892 if (c ||
col == 1)
z += 3;
2893 if (d ||
col == 0)
z += 1;
2895 gtk_list_store_set (GTK_LIST_STORE(pref_model), &
row, 0,
z, -1);
2897 else if (remove_elem)
2899 gtk_tree_model_get (pref_model, &
row, 0, &
z, -1);
2901 gtk_list_store_set (GTK_LIST_STORE(pref_model), &
row, 0,
z, -1);
2917 int object = GPOINTER_TO_INT (data);
2918 gboolean do_style = (
object < 100) ? TRUE : FALSE;
2919 gboolean do_label = (
object == 1000 ||
object == 1001) ? TRUE : FALSE;
2920 switch (response_id)
2922 case GTK_RESPONSE_APPLY:
2927 object = -
object - 2;
2933 j = (
object == 4 ||
object == 9) ? 4 : 1;
2934 k = (
object < 5) ? 7 : 5;
2935 object =
object - 2;
2966 j = (
object < 0) ? 1 : (
object == 4 ||
object == 9) ? 4 : 1;
3001void color_set_color (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3004 gtk_tree_model_get (mod, iter, 3, &
z, -1);
3007 g_object_set (renderer,
"background-rgba", & colo,
"background-set", TRUE, NULL);
3023 int cid = GPOINTER_TO_INT (data);
3025 gtk_tree_model_get (mod, iter, 0, & vid, -1);
3026 gboolean docol = FALSE;
3030 docol = (cid == 0) ? TRUE : FALSE;
3033 docol = (cid == 1) ? TRUE : FALSE;
3036 docol = (cid == 2) ? TRUE : FALSE;
3039 docol = (cid == 3) ? TRUE : FALSE;
3042 docol = (cid == 0 || cid == 1) ? TRUE : FALSE;
3045 docol = (cid == 0 || cid == 2) ? TRUE : FALSE;
3048 docol = (cid == 1 || cid == 2) ? TRUE : FALSE;
3051 docol = (cid == 0 || cid == 3) ? TRUE : FALSE;
3054 docol = (cid == 1 || cid == 3) ? TRUE : FALSE;
3057 docol = (cid == 2 || cid == 3) ? TRUE : FALSE;
3060 docol = (cid != 3) ? TRUE : FALSE;
3063 docol = (cid != 2) ? TRUE : FALSE;
3066 docol = (cid != 1) ? TRUE : FALSE;
3069 docol = (cid != 0) ? TRUE : FALSE;
3088 if (col_a.
red != col_b.
red)
return FALSE;
3089 if (col_a.
green != col_b.
green)
return FALSE;
3090 if (col_a.
blue != col_b.
blue)
return FALSE;
3091 if (col_a.
alpha != col_b.
alpha)
return FALSE;
3104G_MODULE_EXPORT
void run_ac_color (GtkDialog * win, gint response_id, gpointer data)
3106 if (response_id == GTK_RESPONSE_OK)
3109 int i = GPOINTER_TO_INT (data);
3119 if (tmp_list -> Z == i)
3121 tmp_list ->
col = colo;
3124 if (tmp_list -> next)
3126 if (tmp_list -> prev)
3128 tmp_list -> prev -> next = tmp_list -> next;
3129 tmp_list -> next -> prev = tmp_list -> prev;
3137 else if (tmp_list -> prev)
3155 tmp_list = tmp_list -> next;
3169 if (! tmp_list -> next)
break;
3170 tmp_list = tmp_list -> next;
3172 tmp_list -> next = g_malloc0(
sizeof*tmp_list -> next);
3173 tmp_list -> next -> prev = tmp_list;
3174 tmp_list = tmp_list -> next;
3182 tmp_list ->
col = colo;
3199void color_button_event (GtkWidget * widget,
double event_x,
double event_y, guint event_button, gpointer data)
3201 if (event_button == 1)
3203 GtkTreeModel *
model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
3205 GtkTreeViewColumn * column;
3209 gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW(widget), event_x, event_y, & e_x, & e_y);
3210 if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(widget), e_x, e_y, &
path, & column, & i, & j))
3212 if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(widget), event_x, event_y, &
path, & column, & i, & j))
3215 if (g_strcmp0(_(
"Color"), gtk_tree_view_column_get_title (column)) == 0)
3220 i = GPOINTER_TO_INT(data);
3221 gchar * obj[2]={_(
"atom"), _(
"clone")};
3223 gtk_tree_model_get (
model, &
row, 3, &
z, -1);
3226 GtkWidget * win = gtk_color_chooser_dialog_new (str, GTK_WINDOW(
MainWindow));
3227 gtk_window_set_modal (GTK_WINDOW(win), TRUE);
3228 gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER(win), TRUE);
3229 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(win), &
col);
3250G_MODULE_EXPORT
void pref_color_button_pressed (GtkGesture * gesture,
int n_press,
double x,
double y, gpointer data)
3253 gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture), data);
3267 if (event -> type == GDK_BUTTON_PRESS)
3269 GdkEventButton * bevent = (GdkEventButton*)event;
3299 gchar * ats[3]={_(
"atom(s)"), _(
"dot(s)"), _(
"sphere(s)")};
3300 gchar * dim[3]={_(
"radius"), _(
"size"), _(
"width")};
3301 gchar * bts[3]={_(
"bond(s)"), _(
"wireframe(s)"), _(
"cylinder(s)")};
3303 int i, j, k, l, n, m;
3307 gboolean do_style = (
the_object < 100) ? TRUE : FALSE;
3308 gboolean do_label = FALSE;
3315 aid = (aid) > 2 ? aid - 3 : aid;
3317 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]);
3324 aid = (aid == 0 || aid == 2 || aid == 5 || aid == 7) ? 0 : (aid == 1 || aid == 4 || aid == 6 || aid == 9) ? 1 : 2;
3326 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]);
3336 str = g_strdup_printf (_(
"Select %s color"), (aid) ? _(
"clone") : _(
"atom"));
3341 str = g_strdup_printf (_(
"Select %s label color"), (aid) ? _(
"clone") : _(
"atom"));
3351 gtk_window_set_default_size (GTK_WINDOW(win), (num_col == 8) ? 600 : 300, 600);
3353 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};
3354 GType c_type[5] = {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING};
3355 GtkTreeViewColumn * pref_col[num_col];
3356 GtkCellRenderer * pref_cel[num_col];
3357 GtkTreeSelection * pref_select;
3358 GtkListStore * pref_model;
3362 pref_model = gtk_list_store_newv (num_col, s_type);
3364 j = (num_col == 8) ? 4 : 1;
3383 pref_model = gtk_list_store_newv (num_col, c_type);
3387 for (i=1; i<119; i++)
3390 gtk_list_store_append (pref_model, & elem);
3393 gtk_list_store_set (pref_model, & elem, 0,
user_defined,
3411 gtk_list_store_set (pref_model, & elem, 0, j, -1);
3416 gtk_list_store_set (pref_model, & elem, 0,
user_defined,
3424 pref_tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL(pref_model));
3425 gchar * name[3] = {_(
"Element"), _(
"Symbol"),
"Z"};
3426 gchar * g_name[3] = {_(
"Radius"), _(
"Size"), _(
"Width")};
3427 gchar * f_name[4] = {_(
"Covalent [1]"),_(
"Ionic [2]"),
"van der Waals [3]", _(
"Crystal [4,5]")};
3428 for (i=0; i<num_col; i++)
3430 pref_cel[i] = gtk_cell_renderer_text_new();
3435 g_object_set (pref_cel[i],
"editable", TRUE, NULL);
3436 gtk_cell_renderer_set_alignment (pref_cel[i], 0.5, 0.5);
3437 g_signal_connect (G_OBJECT(pref_cel[i]),
"edited", G_CALLBACK(
edit_pref), GINT_TO_POINTER(i-4));
3438 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);
3443 gtk_cell_renderer_set_alignment (pref_cel[i], 0.5, 0.5);
3444 pref_col[i] = gtk_tree_view_column_new_with_attributes(_(
"Color"), pref_cel[i],
"text", i, NULL);
3445 gtk_tree_view_column_set_cell_data_func (pref_col[i], pref_cel[i],
color_set_color, NULL, NULL);
3450 pref_col[i] = gtk_tree_view_column_new_with_attributes(name[i-1], pref_cel[i],
"text", i, NULL);
3451 gtk_tree_view_column_set_alignment (pref_col[i], 0.5);
3452 gtk_tree_view_column_set_resizable (pref_col[i], TRUE);
3453 gtk_tree_view_column_set_min_width (pref_col[i], 50);
3457 pref_col[i] = gtk_tree_view_column_new_with_attributes(
"", pref_cel[i],
"text", i, NULL);
3458 gtk_tree_view_column_set_visible (pref_col[i], FALSE);
3460 gtk_tree_view_append_column(GTK_TREE_VIEW(
pref_tree), pref_col[i]);
3462 g_object_unref (pref_model);
3463 pref_select = gtk_tree_view_get_selection (GTK_TREE_VIEW(
pref_tree));
3464 gtk_tree_selection_set_mode (pref_select, GTK_SELECTION_SINGLE);
3465 gtk_tree_view_expand_all (GTK_TREE_VIEW(
pref_tree));
3470 add_widget_gesture_and_key_action (
pref_tree,
"pref-context-click", G_CALLBACK(pref_color_button_pressed), GINT_TO_POINTER(aid),
3471 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
3481 gchar * legend={_(
"\n<sub>[1] B. Cordero and al. <i>Dalton Trans</i>, <b>213</b>:1112 (2008).</sub>\n"
3482 "<sub>[2] Slater. <i>J. Chem. Phys.</i>, <b>41</b>:3199 (1964).</sub>\n"
3483 "<sub>[3] Bondi A. <i>J. Phys. Chem.</i>, <b>68</b>:441 (1964).</sub>\n"
3484 "<sub>[4] R.D. Shannon and C.T. Prewitt <i>Acta Cryst. B</i>, <b>25</b>:925-946 (1969).</sub>\n"
3485 "<sub>[5] R.D. Shannon <i>Acta Cryst. A</i>, <b>23</b>:751-767 (1976).</sub>")};
3494 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:")};
3506 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);
3535 int clone = ((
object && style > 2) || (!
object && style > 4)) ? 20 : 0;
3536 int mod = (object) ? -1 : 1;
3537 gboolean over = (! object) ? TRUE : (
object && (style != 2 && style != 5)) ? TRUE : FALSE;
3543 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);
3547 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);
3560 leg = g_strdup_printf (
"%s", (style == 1 || style == 4) ?
"pts" :
"Å");
3568 leg = g_strdup_printf (
"%s", (style == 1 || style == 6 || style == 4 || style == 9) ?
"pts" :
"Å");
3586 gchar *
object[3]={
i18n(
"<b>Atom(s)</b>"),
i18n(
"<b>Bond(s)</b>"),
i18n(
"\t<u>Clone(s)</u>")};
3587 gchar * dim[3]={
i18n(
"Radius"),
i18n(
"Size"),
i18n(
"Width")};
3592 gboolean do_atoms = FALSE;
3593 gboolean do_bonds = FALSE;
3594 if (style == 0 || style == 1 || style == 2 || style == 3 || style == 5)
3598 if (style == 0 || style == 1 || style == 4)
3601 bsid = (style == 4) ? 2 : style;
3605 lid = (style == 3) ? 2 : (style == 1 || style == 5) ? 1 : 0;
3609 str = g_strdup_printf (
"\t%s", _(dim[(lid != 1) ? 0 : 1]));
3621 str = g_strdup_printf (
"\t%s", _(dim[(bsid != 1) ? 0 : 2]));
3638 GtkWidget * notebook = gtk_notebook_new ();
3639 gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE);
3640 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
3644 gchar * info[2] = {
i18n(
"The <b>Model</b> tab regroups atom(s), bond(s) and clone(s) options"),
3645 i18n(
"which effect apply when the corresponding <b>OpenGL</b> style is used:")};
3646 gchar * m_list[4][2] = {{
i18n(
"Balls and Sticks"),
i18n(
"atoms<sup>*</sup> and bonds radii")},
3647 {
i18n(
"Wireframes"),
i18n(
"dots<sup>**</sup> size and wireframes width")},
3648 {
i18n(
"Spacefilled"),
i18n(
"tabulated parameters")},
3649 {
i18n(
"Cylinders"),
i18n(
"bonds radii")}};
3652 gchar * other_info[2] = {
i18n(
"It also provides options to customize atomic label(s),"),
i18n(
"and, the model box, if any:")};
3653 gchar * o_list[2][2] = {{
i18n(
"Labels"),
i18n(
"atom labels")},
3654 {
i18n(
"Box"),
i18n(
"model box details")}};
3659 gchar * obj[2] = {
i18n(
"<b>Atoms</b>"),
i18n(
"<b>Clones</b>")};
3664 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);
3668 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);
3671 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);
3675 append_comments (
vbox,
"<sup>*</sup>", _(
"the same parameters are also used for the <b>spheres</b> style"));
3676 append_comments (
vbox,
"<sup>**</sup>", _(
"the same parameters are also used for the <b>dots</b> style"));
3678 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"General")));
3682 if (i != 3 && i != 5) gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
style_tab (i), gtk_label_new (_(
text_styles[i])));
3697 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);
3701 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"Labels")));
3705 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
pref_box_win -> win, gtk_label_new (_(
"Box")));
3721 if (gtk_combo_box_get_active_iter (
box, & iter))
3723 GtkTreeModel *
model = gtk_combo_box_get_model (
box);
3725 gtk_tree_model_get (
model, & iter, 1, & i, -1);
3737 GtkTreeIter iter, iter2;
3738 GtkTreeStore * store;
3740 store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT);
3741 gtk_tree_store_append (store, & iter, NULL);
3742 gtk_tree_store_set (store, & iter, 0, _(
"f(atoms) <sup>*</sup>"), 1, 0, -1);
3745 gtk_tree_store_append (store, & iter, NULL);
3746 gtk_tree_store_set (store, & iter, 0, _(
text_styles[i]), 1, i+1, -1);
3751 gtk_tree_store_append (store, & iter2, & iter);
3752 gtk_tree_store_set (store, & iter2, 0, _(
text_filled[j]), 1, -j-1, -1);
3756 return GTK_TREE_MODEL (store);
3771 j = GPOINTER_TO_INT(data);
3789 g_signal_connect (G_OBJECT(combo),
"changed", G_CALLBACK(
set_default_map), GINT_TO_POINTER(obj));
3800 GtkWidget * notebook = gtk_notebook_new ();
3801 gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE);
3802 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
3816 gchar * info[2] = {
i18n(
"The <b>OpenGL</b> tab regroups rendering options"),
3817 i18n(
"use it to configure the OpenGL 3D scene:")};
3818 gchar * m_list[3][2] = {{
i18n(
"Material"),
i18n(
"aspect for atom(s) and bond(s)")},
3819 {
i18n(
"Lights"),
i18n(
"lightning of the scene")},
3820 {
i18n(
"Fog"),
i18n(
"atmosphere effects")}};
3821 gchar * end =
i18n(
"It also offers to adjust the main visualization style and the color maps");
3828 combo = gtk_combo_box_new_with_model (
model);
3829 g_object_unref (
model);
3830 GtkCellRenderer * renderer = gtk_cell_renderer_combo_new ();
3831 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
3832 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
"text", 0, NULL);
3835 g_signal_connect (G_OBJECT(combo),
"changed", G_CALLBACK(
set_default_style), NULL);
3838 append_comments (
vbox,
"<sup>*</sup>", _(
"if 10 000 atoms or more: <b>Wireframes</b>, otherwise: <b>Balls and sticks</b>"));
3855 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"General")));
3861 gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), 0);
3875 int i = GPOINTER_TO_INT(data);
3890 if (i == 7 || i == 8)
3916 int i = GPOINTER_TO_INT(data);
3967 cut -> cutoff = value;
4009 for (i=0; i<2; i++)
pcut_box[i] = NULL;
4018 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
hbox,
markup_label(_(
"R<sub>cut</sub> (α, β)"), 100, -1, 0.5, 0.5), FALSE, FALSE, 10);
4033 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);
4034 tmp_cut = tmp_cut -> next;
4056 if (tmp_cut -> Z[0] == z_a && tmp_cut -> Z[1] == z_b)
return FALSE;
4057 tmp_cut = tmp_cut -> next;
4090 while (tmp_cut -> next)
4092 tmp_cut = tmp_cut -> next;
4094 tmp_cut -> next = g_malloc0(
sizeof*tmp_cut -> next);
4095 tmp_cut -> next -> prev = tmp_cut;
4096 tmp_cut = tmp_cut -> next;
4098 tmp_cut -> Z[0] =
min(k, l);
4099 tmp_cut -> Z[1] =
max(k, l);
4100 tmp_cut -> use = FALSE;
4101 tmp_cut -> cutoff = 1.0;
4125 new_cutoff = g_malloc0(
sizeof*new_cutoff);
4130 cut_b -> next = g_malloc0(
sizeof*cut_b -> next);
4131 cut_b -> next -> prev = cut_b;
4132 cut_b = cut_b -> next;
4134 cut_b -> Z[0] = cut_a -> Z[0];
4135 cut_b -> Z[1] = cut_a -> Z[1];
4136 cut_b -> use = cut_a -> use;
4137 cut_b -> cutoff = cut_a -> cutoff;
4139 cut_a = cut_a -> next;
4153G_MODULE_EXPORT
void edit_cutoffs (GtkDialog * edit_cuts, gint response_id, gpointer data)
4155 switch (response_id)
4157 case GTK_RESPONSE_APPLY:
4202 for (j=1; j<119; j++)
4229 gchar * default_leg[2] = {
i18n(
"Step(s) between configurations"),
i18n(
"Step(s) between conf.")};
4230 int wid = (cid == 7) ? 0 : 1;
4233 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);
4262 GtkWidget * notebook = gtk_notebook_new ();
4265 gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE);
4266 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
4267 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"),
4268 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°]"),
4269 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")};
4270 gchar * info[2] = {
i18n(
"The <b>Analysis</b> tab regroups calculation options"),
4271 i18n(
"use it to setup your own default parameters:")};
4272 gchar * m_list[4][2] = {{
i18n(
"Calculations"),
i18n(
"most analysis options")},
4273 {
i18n(
"Rings"),
i18n(
"ring statistics options")},
4274 {
i18n(
"Chains"),
i18n(
"chain statistics options")},
4275 {
"S(q,ω)",
i18n(
"dynamic structure factor options")}};
4280 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);
4281 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);
4284 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);
4297 gtk_widget_set_size_request (combo, 180, -1);
4299 g_signal_connect(G_OBJECT(combo),
"changed", G_CALLBACK(
totcut_changed), NULL);
4314 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);
4317 append_comments (
vbox,
"<sup>*</sup>", _(
"The highest this value is, the highest the number of neighbors around an atom."));
4319 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"General")));
4326 if (i != 7 && i != 8)
4339 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);
4343 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new (_(
"Calculations")));
4350 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
vbox, gtk_label_new ((i) ? _(
"Chains") : _(
"Rings")));
4423 for (i=0; i<16; i++)
4487 new_rep ->
rep = old_rep ->
rep;
4490 new_rep -> gnear = old_rep -> gnear;
4494 new_rep -> c_angle[i] = old_rep -> c_angle[i];
4495 new_rep -> c_shift[i] = old_rep -> c_shift[i];
4509 new_back -> gradient = old_back -> gradient;
4510 new_back -> direction = old_back -> direction;
4516 new_back -> gradient_color[i] = old_back -> gradient_color[i];
4530 new_box ->
box = old_box ->
box;
4532 new_box -> line = old_box -> line;
4533 new_box -> rad = old_box -> rad;
4546 new_axis ->
axis = old_axis ->
axis;
4547 new_axis -> length = old_axis -> length;
4549 new_axis -> line = old_axis -> line;
4550 new_axis -> rad = old_axis -> rad;
4551 new_axis -> t_pos = old_axis -> t_pos;
4556 new_axis -> c_pos[i] = old_axis -> c_pos[i];
4557 if (old_axis -> title[i]) new_axis -> title[i] = g_strdup_printf (
"%s", old_axis -> title[i]);
4559 if (old_axis ->
color)
4646G_MODULE_EXPORT
void update_projects (GtkDialog * proj_sel, gint response_id, gpointer data)
4650 gboolean update_bonds;
4651 switch (response_id)
4653 case GTK_RESPONSE_OK:
4662 update_bonds = FALSE;
4663 l = this_proj -> nspec * this_proj -> nspec;
4666 for (j=0; j<this_proj -> nspec; j++)
4668 for (k=0; k<this_proj -> nspec; k++, l++)
4681 for (j=0; j<this_proj -> nspec; j++)
4683 for (k=0; k<this_proj -> nspec; k++, l++)
4685 if (this_proj ->
chemistry -> cutoffs[j][k] !=
tmpcut[l]) update_bonds = TRUE;
4691 if (this_proj -> modelgl -> rings)
4693 this_proj -> modelgl -> rings = FALSE;
4702 if (this_proj -> modelgl ->
chains)
4712 this_proj -> runc[0] = FALSE;
4713 this_proj -> dmtx = FALSE;
4714 if (this_proj ->
id !=
activep)
4841 for (i=0; i<16; i++)
4879 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))
4882 GtkWidget * proj_sel =
message_dialogmodal (_(
"Project selection"), _(
"Select to apply preferences"), GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK,
MainWindow);
4890 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);
4891 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);
4925 i = (i < 0) ? 0 : i;
4929 i = (i < 0) ? 0 : i;
4945 if (
ask_yes_no(_(
"Restore default parameters"), _(
"Are you sure ?"), GTK_MESSAGE_QUESTION,
MainWindow))
4975 switch (response_id)
4977 case GTK_RESPONSE_APPLY:
4981 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);
4982 if (
ask_yes_no(_(
"Save atomes preferences to file ?"), str, GTK_MESSAGE_QUESTION, (GtkWidget *)edit_prefs))
5028 gtk_widget_set_size_request (win, 625, 645);
5029 gtk_window_set_resizable (GTK_WINDOW (win), FALSE);
5037 gchar * mess[2] = {
i18n(
"Browse the following to modify the default configuration of <b>atomes</b>"),
5038 i18n(
"by replacing internal parameters by user defined preferences.")};
5039 gchar * mlist[4][2]= {{
i18n(
"Analysis "),
i18n(
"calculation preferences")},
5040 {
"OpenGL",
i18n(
"rendering preferences")},
5041 {
i18n(
"Model"),
i18n(
"atom(s), bond(s) and box preferences")},
5042 {
i18n(
"View"),
i18n(
"representation and projection preferences")}};
5043 gchar * end =
i18n(
"Default parameters are used for any new project added to the workspace\n");
5058 GtkWidget * but_lab =
markup_label (_(
"Restore <b>atomes</b> default parameters"), -1, -1, 0.5, 0.5);
5062 gtk_notebook_append_page (GTK_NOTEBOOK(
preference_notebook), gbox, gtk_label_new (_(
"General")));
5084 gchar * pstring[5]={
i18n(
"rendering"),
i18n(
"box"),
i18n(
"axis"),
i18n(
"background"),
i18n(
"representation")};
5085 gchar * str = g_strdup_printf (_(
"Set %s preferences as default preferences ?"), _(pstring[oid -> b]));
5087 if (
ask_yes_no(_(
"Set model preferences as default ?"), str, GTK_MESSAGE_QUESTION, this_proj -> modelgl -> win))
5090 image *
img = this_proj -> modelgl -> anim -> last ->
img;
5127 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);
5128 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
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 * 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 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.