atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2026 by CNRS and University of Strasbourg */
15
22
23/*
24* This file: 'main.c'
25*
26* Contains:
27*
28
29 - The initialization of the atomes program
30 - The functions required to read data from the command line
31
32*
33* List of functions:
34
35 int test_this_ext (int len, gchar * arg);
36 int test_this_arg (gchar * arg);
37 int get_style_from_string (gchar * style_string);
38 int get_rep_from_string (gchar * rep_string);
39 int get_box_axis_from_string (gchar * box_axis_string);
40 int get_color_map_from_string (gchar * col_string);
41 int get_gradient_from_string (gchar * grad_string);
42 int check_for_atomes_file_options (int start, int end, char *argv[]);
43 int parse_command_line (int argc, char *argv[])
44 int main (int argc, char *argv[]);
45
46 ColRGBA * get_color_from_hexa_string (gchar * color_string);
47
48 gboolean destroy_func (gpointer user_data);
49
50 G_MODULE_EXPORT gboolean splashdraw (GtkWidget * widget, cairo_t * cr, gpointer data);
51
52 void printhelp();
53 void printversion ();
54 void read_this_file (int file_type, gchar * this_file);
55 void open_this_data_file (int file_type, gchar * file_name);
56
57 G_MODULE_EXPORT void run_program (GApplication * app, gpointer data);
58
59 GtkWidget * create_splash_window ();
60
61*
62* Notes:
63*
64
65 LLM tools (Le Chat) were used at few occasions to prepare some sections of this file, including:
66 - To write of the function to convert hexadecimal chain to color
67
68*/
69
70#include <getopt.h>
71#include <ctype.h>
72#include "version.h"
73#include "global.h"
74#include "bind.h"
75#include "callbacks.h"
76#include "preferences.h"
77#include "interface.h"
78#include "project.h"
79#include "workspace.h"
80#include "glview.h"
81#include "movie.h"
82
83#ifdef G_OS_WIN32
84#define APP_EXTENSION ".exe"
85#include <shlobj.h>
86#else
87#include <pwd.h>
88#define APP_EXTENSION
89#endif
90
91extern GtkWidget * create_main_window (GApplication * app);
92
93const gchar * dfi[2];
94struct file_list {
95 gchar * file_name;
97 struct file_list * next;
98};
99
100struct file_list * flist = NULL;
101struct file_list * ftmp = NULL;
102gboolean with_workspace = FALSE;
103
104gchar * bs_styles[] = {"ball&stick", "balls&sticks", "balls&stick", "ball&sticks",
105 "ball_&_stick", "balls_&_sticks", "balls_&_stick", "ball_&_sticks",
106 "ball_and_sticks", "balls_and_sticks", "balls_and_stick", "ball_and_stick",
107 "ballsandsticks", "ballsandstick", "ballanddsticks", "ballandstick",
108 "b&s", "b_and_s", "bs", "b", NULL};
109gchar * wi_styles[] = {"wireframe", "wireframes", "wires", "wire", "wi", "w", NULL};
110gchar * co_styles[] = {"covalent_radius", "covalent", "cov_rad", "cov", "co", "cr", NULL};
111gchar * io_styles[] = {"ionic_radius", "ionic_rad", "ionic", "ion", "ir", NULL};
112gchar * vw_styles[] = {"vdw_radius", "van_der_waals_radius", "van_der_waals", "vdw_radius", "vdw_rad", "vdw", "vr", NULL};
113gchar * cr_styles[] = {"crystal", "crystal_radius", "in_crystal", "in_crystal_radius", "cryst", "crystal_rad", "cr", NULL};
114gchar * sp_styles[] = {"sphere", "spheres", "sph", "sp", "S", NULL};
115gchar * cy_styles[] = {"cylinder", "cylinders", "cyl", "cy", "c", NULL};
116gchar * do_styles[] = {"dot", "dots", "d", NULL};
117
124{
125 printf (_("\nUsage: atomes [OPTION]\n"
126 " atomes [FILE]\n"
127 " atomes [OPTION] [FILE]\n"
128 " atomes [FILE1] [FILE2] ...\n"
129 " atomes [OPTION1] [FILE1] [OPTION2] [FILE2] ...\n\n"
130 "3D atomic-scale models analysis, creation/edition and post-processing tool\n\n"
131 "options:\n"
132 " -v, --version version information\n"
133 " -h, --help display this help message\n\n"
134 "files, any number, in any order, in the following formats:\n\n"
135 " atomes workspace file : .awf\n"
136 " atomes project file : .apf\n"
137 " XYZ coordinates file : .xyz\n"
138 " Chem3D coordinates file : .c3d\n"
139 " CPMD trajectory : .trj\n"
140 " VASP trajectory : .xdatcar\n"
141 " PDB coordinates : .pdb, .ent\n"
142 " Crystallographic Information File : .cif\n"
143 " DL-POLY history file : .hist\n"
144 " ISAACS project file : .ipf\n\n"
145 " alternatively specify the file format using:\n\n"
146 " -awf [FILE]\n"
147 " -apf [FILE]\n"
148 " -xyz [FILE]\n"
149 " -c3d [FILE]\n"
150 " -trj [FILE]\n"
151 " -xdatcar [FILE]\n"
152 " -pdb [FILE], or, -ent [FILE]\n"
153 " -cif [FILE]\n"
154 " -hist [FILE]\n"
155 " -ipf [FILE]\n\n"
156 "ex:\n\n"
157 " atomes -pdb this.f file.awf -cif that.f *.xyz\n\n"
158 "Image rendering from the command line:\n\n"
159 "Usage: atomes [IMAGE_OPTIONS]\n"
160 " -p, --png, --render-png render image in PNG format\n"
161 " -j, --jpg, --render-jpg render image in JPEG format\n"
162 " -o, --output=[FILE] image file name\n"
163 " -W, --width=[XSIZE] image width\n"
164 " -H, --height=[YSIZE] image height\n"
165 " -s, --style=[STYLE] rendering style\n"
166 " -r, --rep=[REP] representation type\n"
167 " -b, --box=[STYLE] box style\n"
168 " -a, --axis=[STYLE] axis style\n"
169 " -e, --acolor=[MAP] atoms and bonds color map\n"
170 " -t, --pcolor=[MAP] ployhedra color map\n"
171 " -C, --box_color=[COLOR] box color\n"
172 " -G, --back_grad=[GRAD] background gradient type\n"
173 " -B, --back_color=[COLOR] background color\n"
174 " -D, --back_dir=[DIR] background gradient direction\n"
175 " -P, --back_pos=[POS] colors mixed position\n"
176 " -U, --grad_col_a=[COL] gradient initial color\n"
177 " -V, --grad_col_b=[COL] gradient final color\n\n"
178 "ex:\n\n"
179 " atomes --render-png --width=1920 -H 1024 --output=image.png project.apf -s ball_and_stick\n"
180 " atomes --jpg --style=vdw -r ortho -e pc -t pc\n\n"));
181 printf ("%s", _("\nReport a bug to <"));
182 printf ("%s>\n\n", PACKAGE_BUGREPORT);
183}
184
191{
192 printf ("%s", _("\n3D atomic scale model analysis, creation/edition and post-processing tool\n"));
193 printf ("\n%s version : %s\n", PACKAGE, VERSION);
194 printf ("\nGTK+ version : %1d.%1d.%1d\n",
195 GTK_MAJOR_VERSION,
196 GTK_MINOR_VERSION,
197 GTK_MICRO_VERSION);
198 printf ("Libavutil version : %2d.%2d.%3d\n",
199 LIBAVUTIL_VERSION_MAJOR,
200 LIBAVUTIL_VERSION_MINOR,
201 LIBAVUTIL_VERSION_MICRO);
202 printf ("Libavformat version : %2d.%2d.%3d\n",
203 LIBAVFORMAT_VERSION_MAJOR,
204 LIBAVFORMAT_VERSION_MINOR,
205 LIBAVFORMAT_VERSION_MICRO);
206 printf ("Libavcodec version : %2d.%2d.%3d\n",
207 LIBAVCODEC_VERSION_MAJOR,
208 LIBAVCODEC_VERSION_MINOR,
209 LIBAVCODEC_VERSION_MICRO);
210 printf ("Libswscale version : %2d.%2d.%3d\n",
211 LIBSWSCALE_VERSION_MAJOR,
212 LIBSWSCALE_VERSION_MINOR,
213 LIBSWSCALE_VERSION_MICRO);
214#ifdef OPENMP
215 float v = 0.0;
216 char * v_string;
217 switch (_OPENMP)
218 {
219 case 200505:
220 v = 2.5;
221 v_string = "2005-05";
222 break;
223 case 200805:
224 v = 3.0;
225 v_string = "2008-05";
226 break;
227 case 201107:
228 v = 3.1;
229 v_string = "2011-07";
230 break;
231 case 201307:
232 v = 4.0;
233 v_string = "2013-07";
234 break;
235 case 201511:
236 v = 4.5;
237 v_string = "2015-11";
238 break;
239 case 201811:
240 v = 5.0;
241 v_string = "2018-11";
242 break;
243 case 202011:
244 v = 5.1;
245 v_string = "2020-11";
246 break;
247 case 202111:
248 v = 5.2;
249 v_string = "2021-11";
250 break;
251 default:
252 v_string = "unknown";
253 break;
254 }
255 printf ("OpenMP version : %1.1f (%s)\n", v, v_string);
256#endif
257 printf ("FC Compiler : %s\n", FC);
258 printf ("FC Compiler flags : %s\n", FCFLAGS);
259 printf ("C Compiler : %s\n", CC);
260 printf ("C Compiler flags : %s\n", CFLAGS);
261
262 printf ("%s", _("\nReport a bug to <"));
263 printf ("%s>\n\n", PACKAGE_BUGREPORT);
264}
265
274int test_this_ext (int len, gchar * arg)
275{
276 int i;
277 gchar * aext = g_strdup_printf ("%c%c%c%c", arg[len-4], arg[len-3], arg[len-2], arg[len-1]);
278 char * eext[15]={".awf", ".apf", ".xyz", "NULL", ".c3d", ".trj", "NULL", "tcar", "NULL", ".pdb", ".ent", ".cif", "NULL", "hist", ".ipf"};
279 for (i=0; i<15; i++) if (g_strcmp0 (aext, eext[i]) == 0)
280 {
281 g_free (aext);
282 return -(i+1);
283 }
284 g_free (aext);
285 return 0;
286}
287
295int test_this_arg (gchar * arg)
296{
297 char * fext[15]={"-awf", "-apf", " -xyz", "NULL", "-c3d", "-trj", "NULL", "-xdatcar", "NULL", "-pdb", "-ent", "-cif", "NULL", "-hist", "-ipf"};
298 int i, j;
299 i = strlen(arg);
300 gchar * str = g_ascii_strdown (arg, i);
301 for (j=0; j<15; j++)
302 {
303 if (g_strcmp0 (str, fext[j]) == 0)
304 {
305 g_free (str);
306 return j+1;
307 }
308 }
309 j = test_this_ext (i, str);
310 g_free (str);
311 return (j) ? j : 0;
312}
313
322gboolean is_string_in_string_list (gchar * string, gchar ** list)
323{
324 if (string != NULL)
325 {
326 while (* list != NULL)
327 {
328 if (g_strcmp0(* list, string) == 0)
329 {
330 return TRUE;
331 }
332 list ++;
333 }
334 }
335 return FALSE;
336}
337
345int get_style_from_string (gchar * style_string)
346{
347 if (is_string_in_string_list(style_string, bs_styles)) return BALL_AND_STICK;
348 if (is_string_in_string_list(style_string, wi_styles)) return WIREFRAME;
349 if (is_string_in_string_list(style_string, co_styles)) return OGL_STYLES;
350 if (is_string_in_string_list(style_string, io_styles)) return OGL_STYLES+1;
351 if (is_string_in_string_list(style_string, vw_styles)) return OGL_STYLES+2;
352 if (is_string_in_string_list(style_string, cr_styles)) return OGL_STYLES+3;
353 if (is_string_in_string_list(style_string, sp_styles)) return SPHERES;
354 if (is_string_in_string_list(style_string, cy_styles)) return CYLINDERS;
355 if (is_string_in_string_list(style_string, do_styles)) return PUNT;
356 return NONE;
357}
358
366int get_rep_from_string (gchar * rep_string)
367{
368 gchar * ortho_keys[] = {"orthographic", "ortho", "o", "0", NULL};
369 gchar * persp_keys[] = {"perspective", "persp", "p", "1", NULL};
370 if (is_string_in_string_list(rep_string, ortho_keys)) return ORTHOGRAPHIC;
371 if (is_string_in_string_list(rep_string, persp_keys)) return PERSPECTIVE;
372 return NONE;
373}
374
382int get_box_axis_from_string (gchar * box_axis_string)
383{
384 if (is_string_in_string_list(box_axis_string, wi_styles)) return WIREFRAME;
385 if (is_string_in_string_list(box_axis_string, cy_styles)) return CYLINDERS;
386 return NONE;
387}
388
396int get_color_map_from_string (gchar * col_string)
397{
398 gchar * sp_keys[] = {"species", "spec", "sp", "0", NULL};
399 gchar * pt_keys[] = {"total_coordinations", "total_coordination", "total_coord", "total", "tc", "t", "1", NULL};
400 gchar * pc_keys[] = {"partial_coordinations", "partial_coordination", "partial_coord", "partial", "pc", "p", "2", NULL};
401 gchar * fg_keys[] = {"fragments", "fragment", "frag", "fg", "f", "3", NULL};
402 gchar * mo_keys[] = {"molecules", "molecule", "mol", "mo", "m", "4", NULL};
403 if (is_string_in_string_list(col_string, sp_keys)) return 0;
404 if (is_string_in_string_list(col_string, pt_keys)) return 1;
405 if (is_string_in_string_list(col_string, pc_keys)) return 2;
406 if (is_string_in_string_list(col_string, fg_keys)) return 3;
407 if (is_string_in_string_list(col_string, mo_keys)) return 4;
408 return NONE;
409}
410
418ColRGBA * get_color_from_hexa_string (gchar * color_string)
419{
420 ColRGBA * col = NULL;
421 const char * color = color_string;
422 // Ignorer le '#' si présent au début
423 if (color[0] == '#') color ++;
424
425 size_t len = strlen(color);
426 if (len != 3 && len != 4 && len != 6 && len != 8)
427 {
428 // longueur de chaîne incompatible
429 return NULL;
430 }
431 // Format long ?
432 int is_long = (len == 6 || len == 8) ? TRUE : FALSE;
433 float ratio = (is_long) ? 255.0 : 15.0;
434 int incr = (is_long) ? 2 : 1;
435 col = g_malloc0(sizeof*col);
436 col -> alpha = 1.0;
437 char buf[3] = {0}; // pour les caractères à examiner
438 // Format court (#RGB ou #RGBA)
439 buf[incr] = '\0';
440 buf[0] = color[0];
441 if (is_long) buf[1] = color[1];
442 col->red = strtol(buf, NULL, 16) / ratio;
443 buf[0] = color[incr];
444 if (is_long) buf[1] = color[incr+1];
445 col->green = strtol(buf, NULL, 16) / ratio;
446 buf[0] = color[2*incr];
447 if (is_long) buf[1] = color[2*incr+1];
448 col->blue = strtol(buf, NULL, 16) / ratio;
449 if (len == 4 || len == 8)
450 {
451 buf[0] = color[3*incr];
452 if (is_long) buf[1] = color[3*incr+1];
453 col->alpha = strtol(buf, NULL, 16) / ratio;
454 }
455
456 // Safety net
457 if (col -> red < 0.0 || col -> red > 1.0 ||
458 col -> green < 0.0 || col -> green > 1.0 ||
459 col -> blue < 0.0 || col -> blue > 1.0 ||
460 col -> alpha < 0.0 || col -> alpha > 1.0)
461 {
462 g_free(col);
463 return NULL;
464 }
465 return col;
466}
467
475int get_gradient_from_string (gchar * grad_string)
476{
477 gchar * no_keys[] = {"none", "no", "n", "0", NULL};
478 gchar * li_keys[] = {"linear", "lin", "li", "l", "1", NULL};
479 gchar * ci_keys[] = {"circular", "circ", "ci", "c", "2", NULL};
480 if (is_string_in_string_list(grad_string, no_keys)) return 0;
481 if (is_string_in_string_list(grad_string, li_keys)) return 1;
482 if (is_string_in_string_list(grad_string, ci_keys)) return 2;
483 return NONE;
484}
485
496int check_for_atomes_file_options (int start, int end, char *argv[])
497{
498 int i, j, k;
499 i=0;
500 for (j=start; j<end; j++)
501 {
502 k = test_this_arg (argv[j]);
503 if (k > 0 && j < end-1)
504 {
505 if (! (k == 1 && with_workspace))
506 {
507 if (! flist)
508 {
509 flist = g_malloc0(sizeof*flist);
510 ftmp = flist;
511 }
512 else
513 {
514 ftmp -> next = g_malloc0(sizeof*ftmp -> next);
515 ftmp = ftmp -> next;
516 }
517 ftmp -> file_name = g_strdup_printf ("%s", argv[j+1]);
518 ftmp -> file_type = k;
519 argv[j] = argv[j+1] = g_strdup_printf (" ");
520 j ++;
521 i ++;
522 if (k == 1) with_workspace = TRUE;
523 }
524 }
525 }
526 return i;
527}
528
537int parse_command_line (int argc, char *argv[])
538{
539 struct option atomes_options[] = {{"help", no_argument, 0, 'h'},
540 {"version", no_argument, 0, 'v'},
541 {"libreoffice", no_argument, 0, 'l'},
542 {"render-png", no_argument, 0, 'p'},
543 {"png", no_argument, 0, 'p'},
544 {"render-jpg", no_argument, 0, 'j'},
545 {"jpg", no_argument, 0, 'j'},
546 {"width", required_argument, 0, 'W'},
547 {"height", required_argument, 0, 'H'},
548 {"output", required_argument, 0, 'o'},
549 {"style", required_argument, 0, 's'},
550 {"atoms", required_argument, 0, 'e'},
551 {"poly", required_argument, 0, 't'},
552 {"axis", required_argument, 0, 'a'},
553 {"box", required_argument, 0, 'b'},
554 {"box_color", required_argument, 0, 'C'},
555 {"back_color", required_argument, 0, 'B'},
556 {"back_grad", required_argument, 0, 'G'},
557 {"back_dir", required_argument, 0, 'D'},
558 {"back_pos", required_argument, 0, 'P'},
559 {"grad_col_a", required_argument, 0, 'U'},
560 {"grad_col_b", required_argument, 0, 'V'},
561 {"rep", required_argument, 0, 'r'},
562 // {"debug", no_argument, 0, 'd'},
563 {0, 0, 0, 0}};
564 int opt;
565 int index = -1;
566 int i, j;
567 double v;
568 gchar * image_x = NULL;
569 gchar * image_y = NULL;
570 int img_opt = 0;
571
572 for (i=0; i<2; i++) render_image_grad_color[i] = NULL;
573 /* We want to parse the command line using GNU getopt, but then
574 some options that are atomes specific and not GNU getopt compatible
575 might disappear, to prevent that it is mandatory to prepare
576 the information to be given to GNU getopt */
577 int files_to_read = check_for_atomes_file_options (1, argc, argv);
578
579 /* Letter follow by : means that the command requires an argument
580 No letter if the option is only in long format, ex : --width
581 If the long name is empty the command is only in short format */
582 while ((opt = getopt_long(argc, argv, "hvlpjdW:H:o:s:a:b:r:e:t:B:C:G:D:P:U:V:", atomes_options, & index)) != -1)
583 {
584 switch (opt)
585 {
586 case 'h':
587 print_help();
588 return FALSE;
589 break;
590 case 'v':
592 return FALSE;
593 break;
594 case 'e':
595 render_image_acolor = get_color_map_from_string (g_ascii_strdown(optarg,strlen(optarg)));
596 trigger_fragment_analysis = (render_image_acolor > 2) ? TRUE : FALSE;
597 trigger_molecule_analysis = (render_image_acolor > 3) ? TRUE : FALSE;
598 img_opt ++;
599 img_opt += (index == -1) ? 1 : 0;
600 break;
601 case 't':
602 render_image_pcolor = get_color_map_from_string (g_ascii_strdown(optarg,strlen(optarg)));
603 trigger_fragment_analysis = (render_image_pcolor > 2) ? TRUE : FALSE;
604 trigger_molecule_analysis = (render_image_pcolor > 3) ? TRUE : FALSE;
605 img_opt ++;
606 img_opt += (index == -1) ? 1 : 0;
607 break;
608 case 'l':
611 break;
612 case 'p':
613 atomes_render_image = TRUE;
615 img_opt ++;
616 break;
617 case 'j':
618 atomes_render_image = TRUE;
620 img_opt ++;
621 break;
622 case 'o':
623 render_image_output = g_strdup_printf ("%s", optarg);
624 img_opt ++;
625 img_opt += (index == -1) ? 1 : 0;
626 break;
627 case 'W':
628 image_x = g_strdup_printf ("%s", optarg);
629 img_opt ++;
630 img_opt += (index == -1) ? 1 : 0;
631 break;
632 case 'H':
633 image_y = g_strdup_printf ("%s", optarg);
634 img_opt ++;
635 img_opt += (index == -1) ? 1 : 0;
636 break;
637 case 's':
638 render_image_style = get_style_from_string (g_ascii_strdown(optarg,strlen(optarg)));
639 img_opt ++;
640 img_opt += (index == -1) ? 1 : 0;
641 break;
642 case 'a':
643 render_image_axis = get_box_axis_from_string (g_ascii_strdown(optarg,strlen(optarg)));
644 img_opt ++;
645 img_opt += (index == -1) ? 1 : 0;
646 break;
647 case 'b':
648 render_image_box = get_box_axis_from_string (g_ascii_strdown(optarg,strlen(optarg)));
649 img_opt ++;
650 img_opt += (index == -1) ? 1 : 0;
651 break;
652 case 'r':
653 render_image_rep = get_rep_from_string (g_ascii_strdown(optarg,strlen(optarg)));
654 img_opt ++;
655 img_opt += (index == -1) ? 1 : 0;
656 break;
657 case 'C':
659 img_opt ++;
660 img_opt += (index == -1) ? 1 : 0;
661 break;
662 case 'B':
664 img_opt ++;
665 img_opt += (index == -1) ? 1 : 0;
666 break;
667 case 'G':
668 render_image_back_grad = get_gradient_from_string (g_ascii_strdown(optarg,strlen(optarg)));
669 img_opt ++;
670 img_opt += (index == -1) ? 1 : 0;
671 break;
672 case 'D':
673 if (isdigit(optarg[0]))
674 {
675 render_image_back_dir = ((optarg[0] - '0') < 9) ? optarg[0] - '0' : NONE;
676 }
677 img_opt ++;
678 img_opt += (index == -1) ? 1 : 0;
679 break;
680 case 'P':
681 v = string_to_double(optarg);
682 render_image_back_pos = (v >= 0.0 && v <= 1.0) ? v : NONE;
683 img_opt ++;
684 img_opt += (index == -1) ? 1 : 0;
685 break;
686 case 'U':
688 img_opt ++;
689 img_opt += (index == -1) ? 1 : 0;
690 break;
691 case 'V':
693 img_opt ++;
694 img_opt += (index == -1) ? 1 : 0;
695 break;
696 }
697 index = -1;
698 }
701 {
702 if (! render_image_output) render_image_output = g_strdup_printf ("%s", (render_image_format) ? "image.jpg" : "image.png");
703 if (argc == img_opt + 2)
704 {
705 if (image_x || image_y)
706 {
708 int pix;
709 if (image_x)
710 {
711 pix = (int) string_to_double(image_x);
712 if (pix > 0) render_image_pixels[0] = pix;
713 }
714 if (image_y)
715 {
716 pix = (int) string_to_double(image_y);
717 if (pix > 0) render_image_pixels[1] = pix;
718 }
719 }
720 }
721 else
722 {
723 return FALSE;
724 }
725 }
726
727 for (i=optind; i<argc; i++)
728 {
729 j = test_this_arg (argv[i]);
730 if (! (j == -1 && with_workspace))
731 {
732 if (j < 0)
733 {
734 if (! flist)
735 {
736 flist = g_malloc0(sizeof*flist);
737 ftmp = flist;
738 }
739 else
740 {
741 ftmp -> next = g_malloc0(sizeof*ftmp -> next);
742 ftmp = ftmp -> next;
743 }
744 ftmp -> file_name = g_strdup_printf ("%s", argv[i]);
745 ftmp -> file_type = -j;
746 files_to_read ++;
747 if (atomes_from_libreoffice) projfile = g_strdup_printf ("%s", argv[i]);
748 if (j == -1) with_workspace = TRUE;
749 }
750 }
751 }
752
753 return (atomes_render_image && files_to_read == 1) ? TRUE : (atomes_render_image) ? FALSE : TRUE;
754}
755
763gboolean destroy_func (gpointer user_data)
764{
765 GtkWidget * splashi = (GtkWidget*) user_data;
766 destroy_this_widget (splashi);
767 return FALSE;
768}
769
770#ifdef GTK3
780G_MODULE_EXPORT gboolean splashdraw (GtkWidget * widget, cairo_t * cr, gpointer data)
781{
782 cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); /* transparent */
783 cairo_paint (cr);
784 return FALSE;
785}
786#endif
787
794{
795 GtkWidget * splash_window = new_gtk_window ();
796 gtk_window_set_decorated (GTK_WINDOW (splash_window), FALSE);
797 GtkWidget * image;
798#ifdef GTK4
799 image = gtk_picture_new_for_filename (PACKAGE_LOGO);
800 gchar * backcol = g_strdup_printf ("window#splash {\n"
801 " background: none;"
802 " background-color: rgba(255, 255, 255, 0);}");
803 provide_gtk_css (backcol);
804 gtk_widget_set_name (splash_window, "splash");
805 g_free (backcol);
806#else
807 gtk_window_set_type_hint (GTK_WINDOW (splash_window), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
808 gtk_window_set_position (GTK_WINDOW (splash_window), GTK_WIN_POS_CENTER_ALWAYS);
809 gtk_widget_set_app_paintable (splash_window, TRUE);
810 GdkScreen * screen = gtk_widget_get_screen (splash_window);
811 GdkVisual * visual = gdk_screen_get_rgba_visual (screen);
812 gtk_widget_set_visual (splash_window, visual);
813 // Next line might be optional for total transparency
814 g_signal_connect(G_OBJECT(splash_window), "draw", G_CALLBACK(splashdraw), NULL);
815 image = gtk_image_new_from_file (PACKAGE_LOGO);
816#endif
817 add_container_child (CONTAINER_WIN, splash_window, image);
818 gtk_window_set_transient_for ((GtkWindow *)splash_window, (GtkWindow *)MainWindow);
819 show_the_widgets (splash_window);
820 return splash_window;
821}
822
831void read_this_file (int file_type, gchar * this_file)
832{
833 FILE * fp = fopen (this_file, dfi[0]);
834 if (file_type == 1)
835 {
836 int i = open_save_workspace (fp, 0);
837 if (i != 0)
838 {
839 gchar * err = g_strdup_printf (_("Error while reading workspace file\n%s\n"), this_file);
840 show_error (err, 0, MainWindow);
841 g_free (err);
842 }
843 }
844 else
845 {
846 init_project (FALSE);
847 reading_project = TRUE;
848 open_save (fp, 0, 0, activep, activep, this_file);
849 reading_project = FALSE;
850 }
851 fclose (fp);
852}
853
862void open_this_data_file (int file_type, gchar * file_name)
863{
864 gchar * end;
865 gchar * str;
866 gchar * filedir;
867 int i;
868#ifdef G_OS_WIN32
869 WIN32_FIND_DATA ffd;
870 HANDLE hFind;
871#else
872 DIR * d;
873 struct dirent * dir;
874#endif
875 switch (file_type)
876 {
877 case 1:
878 read_this_file (1, file_name);
879 break;
880 case 2:
881 end = g_strdup_printf ("%c", file_name[strlen(file_name)-1]);
882 if (g_strcmp0 (file_name, "*") == 0 || g_strcmp0 (end, "*") == 0)
883 {
884 if (g_strcmp0 (file_name, "*") == 0)
885 {
886 filedir = g_strdup_printf ("./");
887 }
888 else
889 {
890 filedir = g_strdup_printf ("%c", file_name[0]);
891 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf ("%s%c", filedir, file_name[i]);
892 }
893#ifdef G_OS_WIN32
894 hFind = FindFirstFile (filedir, & ffd);
895 if (hFind != INVALID_HANDLE_VALUE)
896 {
897 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
898 {
899 str = g_strdup_printf ("%s\\%s", filedir, (gchar *)ffd.cFileName);
900 read_this_file (2, str);
901 g_free (str);
902 }
903 while (FindNextFile(hFind, &ffd) != 0)
904 {
905 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
906 {
907 str = g_strdup_printf ("%s\\%s", filedir, (gchar *)ffd.cFileName);
908 read_this_file (2, str);
909 g_free (str);
910 }
911 }
912 }
913 FindClose(hFind);
914#else
915 d = opendir (filedir);
916 if (d)
917 {
918 while ((dir = readdir(d)) != NULL)
919 {
920 if (dir -> d_type == DT_REG)
921 {
922 str = g_strdup_printf ("%s/%s", filedir, dir -> d_name);
923 read_this_file (2, str);
924 g_free (str);
925 }
926 }
927 closedir(d);
928 }
929#endif
930 g_free (filedir);
931 }
932 else
933 {
934 read_this_file (2, file_name);
935 }
936 break;
937 case 15:
938 init_project (TRUE);
939 open_this_isaacs_xml_file (g_strdup_printf ("%s", file_name), activep, FALSE);
940 break;
941 default:
942 end = g_strdup_printf ("%c", file_name[strlen(file_name)-1]);
943 if (g_strcmp0 (file_name, "*") == 0 || g_strcmp0 (end, "*") == 0)
944 {
945 if (g_strcmp0 (file_name, "*") == 0)
946 {
947 filedir = g_strdup_printf ("./");
948 }
949 else
950 {
951 filedir = g_strdup_printf ("%c", file_name[0]);
952 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf ("%s%c", filedir, file_name[i]);
953 }
954#ifdef G_OS_WIN32
955 hFind = FindFirstFile (filedir, & ffd);
956 if (hFind != INVALID_HANDLE_VALUE)
957 {
958 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
959 {
960 init_project (TRUE);
961 active_project -> coordfile = g_strdup_printf ("%s\\%s", filedir, (gchar *)ffd.cFileName);
962 open_this_coordinate_file (file_type-3, NULL);
963 }
964 while (FindNextFile(hFind, &ffd) != 0)
965 {
966 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
967 {
968 init_project (TRUE);
969 active_project -> coordfile = g_strdup_printf ("%s\\%s", filedir, (gchar *)ffd.cFileName);
970 open_this_coordinate_file (file_type-3, NULL);
971 }
972 }
973 }
974 FindClose(hFind);
975#else
976 d = opendir (filedir);
977 if (d)
978 {
979 while ((dir = readdir(d)) != NULL)
980 {
981 if (dir -> d_type == DT_REG)
982 {
983 init_project (TRUE);
984 active_project -> coordfile = g_strdup_printf ("%s/%s", filedir, dir -> d_name);
985 open_this_coordinate_file (file_type-3, NULL);
986 }
987 }
988 closedir(d);
989 }
990#endif
991 g_free (filedir);
992 }
993 else
994 {
995 init_project (TRUE);
996 active_project -> coordfile = g_strdup_printf ("%s", file_name);
997 open_this_coordinate_file (file_type-3, NULL);
998 }
999 break;
1000 }
1001}
1002
1011G_MODULE_EXPORT void run_program (GApplication * app, gpointer data)
1012{
1013 /* GTK re-initializes the locale during startup (gtk_init calls setlocale(LC_ALL, "")),
1014 which overrides the LC_NUMERIC = "C" set in main(). We must enforce it again here
1015 to ensure floating-point parsing/formatting always uses the English (dot) convention. */
1016 setlocale (LC_NUMERIC, "C");
1017 GtkSettings * default_settings = gtk_settings_get_default ();
1018/*
1019#ifndef G_OS_WIN32
1020 g_object_set (default_settings, "gtk-application-prefer-dark-theme", TRUE, NULL);
1021#endif
1022*/
1023#ifdef GTK3
1024 g_object_set (default_settings, "gtk-button-images", TRUE, NULL);
1025#endif
1026#ifdef G_OS_WIN32
1027#ifdef GTK3
1028 g_object_set (default_settings, "gtk-key-theme-name", "win32", NULL);
1029#endif
1030 dfi[0]="rb";
1031 dfi[1]="wb";
1032#else
1033 dfi[0]="r";
1034 dfi[1]="w";
1035#endif
1036
1037#ifdef MAC_INTEGRATION
1038 GtkosxApplication * ProgOSX;
1039 ProgOSX = g_object_new (GTKOSX_TYPE_APPLICATION, NULL);
1040 gtkosx_application_set_use_quartz_accelerators (ProgOSX, FALSE);
1041 gtkosx_application_ready (ProgOSX);
1042#endif
1043#ifdef DEBUG
1044 print_version ();
1045#endif // DEBUG
1046
1047 if (! atomes_render_image)
1048 {
1050 GtkWidget * isplash = create_splash_window ();
1051 if (isplash == NULL)
1052 {
1053 g_warning (_("Impossible to load the splash screen\n"));
1054 }
1055 else
1056 {
1057 g_timeout_add_seconds (1, destroy_func, isplash);
1058 }
1059 }
1060 if (flist)
1061 {
1062 ftmp = flist;
1063 silent_input = TRUE;
1064 if (with_workspace)
1065 {
1066 while (ftmp)
1067 {
1068 if (ftmp -> file_type == 1)
1069 {
1070 // Open the workspace
1071 open_this_data_file (ftmp -> file_type, ftmp -> file_name);
1072 }
1073 ftmp = ftmp -> next;
1074 }
1075 }
1076 ftmp = flist;
1077 while (ftmp)
1078 {
1079 if (ftmp -> file_type != 1)
1080 {
1081 // Add project(s) to workspace
1082 open_this_data_file (ftmp -> file_type, ftmp -> file_name);
1083 }
1084 ftmp = ftmp -> next;
1085 }
1086 g_free (flist);
1087 flist = NULL;
1088 silent_input = FALSE;
1089 }
1090#ifdef MAC_INTEGRATION
1091 g_object_unref (ProgOSX);
1092#endif
1093}
1094
1101{
1102 GError * error = NULL;
1103 gchar * proc_dir = NULL;
1104 gchar * proc_path = NULL;
1105 const char * proc_name;
1106#ifdef G_OS_WIN32
1107 proc_dir = g_build_filename (PACKAGE_PREFIX, "bin", NULL);
1108 proc_name = "atomes_startup_testing.exe";
1109 proc_path = g_build_filename (proc_dir, proc_name, NULL);
1110#else
1111 proc_dir = g_build_filename (PACKAGE_LIBEXEC, NULL);
1112 proc_name = "atomes_startup_testing";
1113 proc_path = g_build_filename (PACKAGE_LIBEXEC, proc_name, NULL);
1114#endif
1115#ifdef DEBUG
1116 g_print ("proc_dir= %s\n", proc_dir);
1117 g_print ("proc_name= %s\n", proc_name);
1118 g_print ("proc_path= %s\n", proc_path);
1119#endif
1120
1121#ifdef CODEBLOCKS
1122 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
1123#else
1124#ifndef OSX
1125 GSubprocessLauncher * proc_launch = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
1126 g_subprocess_launcher_set_cwd (proc_launch, proc_dir);
1127 GSubprocess * proc = g_subprocess_launcher_spawn (proc_launch, & error, proc_path, NULL);
1128#else
1129 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
1130#endif
1131#endif
1132
1133 if (error)
1134 {
1135 g_print ("error: %s\n", error -> message);
1136 g_clear_error (& error);
1137 }
1138 g_subprocess_wait (proc, NULL, & error);
1139 int res = g_subprocess_get_exit_status (proc);
1140#ifdef DEBUG
1141 g_debug ("Exit status of atomes_startup_testing = %d", res);
1142#endif
1143 g_object_unref (proc);
1144#ifndef CODEBLOCKS
1145#ifndef OSX
1146 g_object_unref (proc_launch);
1147#endif
1148#endif
1149 g_free (proc_path);
1150 g_free (proc_dir);
1151 gchar * ogl_info = NULL;
1152 switch (res)
1153 {
1154 case 1:
1155 ogl_info = g_strdup_printf (_("Fatal error on OpenGL initialization: trying to adjust environment !"));
1156 break;
1157 case -2:
1158 ogl_info = g_strdup_printf (_("Impossible to initialize the OpenGL 3D rendering !"));
1159 break;
1160 case -1:
1161 ogl_info = g_strdup_printf (_("GDK visual must be modified to initialize the OpenGL context !"));
1162 break;
1163 default:
1164 break;
1165 }
1166 if (ogl_info)
1167 {
1168 g_print ("%s\n", ogl_info);
1169 g_free (ogl_info);
1170 ogl_info = NULL;
1171 }
1172 return res;
1173}
1174
1183int main (int argc, char *argv[])
1184{
1185 gboolean RUNC = FALSE;
1186
1187#ifdef G_OS_WIN32
1188 PACKAGE_PREFIX = g_win32_get_package_installation_directory_of_module (NULL);
1189 PACKAGE_LOCALE = g_build_filename (PACKAGE_PREFIX, "locale", NULL);
1190 // g_win32_get_package_installation_directory (NULL, NULL);
1191#endif
1192 PACKAGE_LIB_DIR = g_build_filename (PACKAGE_PREFIX, "library", NULL);
1193 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX, "pixmaps/import.png", NULL);
1194 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX, "pixmaps/import.png", NULL);
1195 PACKAGE_CON = g_build_filename (PACKAGE_PREFIX, "pixmaps/convert.png", NULL);
1196 PACKAGE_IMG = g_build_filename (PACKAGE_PREFIX, "pixmaps/image.png", NULL);
1197 PACKAGE_PDF = g_build_filename (PACKAGE_PREFIX, "pixmaps/pdf.png", NULL);
1198 PACKAGE_SVG = g_build_filename (PACKAGE_PREFIX, "pixmaps/svg.png", NULL);
1199 PACKAGE_EPS = g_build_filename (PACKAGE_PREFIX, "pixmaps/eps.png", NULL);
1200 PACKAGE_PNG = g_build_filename (PACKAGE_PREFIX, "pixmaps/png.png", NULL);
1201 PACKAGE_JPG = g_build_filename (PACKAGE_PREFIX, "pixmaps/jpg.png", NULL);
1202 PACKAGE_BMP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bmp.png", NULL);
1203 PACKAGE_TIFF = g_build_filename (PACKAGE_PREFIX, "pixmaps/tiff.png", NULL);
1204 PACKAGE_VOID = g_build_filename (PACKAGE_PREFIX, "pixmaps/void.png", NULL);
1205 PACKAGE_TD = g_build_filename (PACKAGE_PREFIX, "pixmaps/td.png", NULL);
1206 PACKAGE_MOL = g_build_filename (PACKAGE_PREFIX, "pixmaps/molecule.png", NULL);
1207 PACKAGE_OGL = g_build_filename (PACKAGE_PREFIX, "pixmaps/opengl.png", NULL);
1208 PACKAGE_OGLM = g_build_filename (PACKAGE_PREFIX, "pixmaps/mol.png", NULL);
1209 PACKAGE_OGLC = g_build_filename (PACKAGE_PREFIX, "pixmaps/mol.png", NULL);
1210 PACKAGE_PRO = g_build_filename (PACKAGE_PREFIX, "pixmaps/prop.png", NULL);
1211 PACKAGE_SET = g_build_filename (PACKAGE_PREFIX, "pixmaps/settings.png", NULL);
1212 PACKAGE_LOGO = g_build_filename (PACKAGE_PREFIX, "pixmaps/logo.png", NULL);
1213 PACKAGE_LAGPL = g_build_filename (PACKAGE_PREFIX, "pixmaps/logo-agpl.png", NULL);
1214 PACKAGE_LABOUT = g_build_filename (PACKAGE_PREFIX, "pixmaps/logo-about.png", NULL);
1215 PACKAGE_DOTA = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-a.png", NULL);
1216 PACKAGE_DOTB = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-b.png", NULL);
1217 PACKAGE_DOTC = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-c.png", NULL);
1218 PACKAGE_DOTD = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-d.png", NULL);
1219 PACKAGE_DOTE = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-e.png", NULL);
1220 PACKAGE_DOTF = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-f.png", NULL);
1221 PACKAGE_DOTG = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-g.png", NULL);
1222 PACKAGE_DOTH = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-h.png", NULL);
1223 PACKAGE_DFBD = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/bd.png", NULL);
1224 PACKAGE_DFAN = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/an.png", NULL);
1225 PACKAGE_DFDI = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/di.png", NULL);
1226 PACKAGE_DFTD = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/td.png", NULL);
1227 PACKAGE_DFIN = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/in.png", NULL);
1228 PACKAGE_SGCP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Cubic-P.png", NULL);
1229 PACKAGE_SGCI = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Cubic-I.png", NULL);
1230 PACKAGE_SGCF = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Cubic-F.png", NULL);
1231 PACKAGE_SGHP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Hexagonal.png", NULL);
1232 PACKAGE_SGTR = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Trigonal-R.png", NULL);
1233 PACKAGE_SGTI = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Tetragonal-I.png", NULL);
1234 PACKAGE_SGTP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Tetragonal-P.png", NULL);
1235 PACKAGE_SGOP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Orthorhombic-P.png", NULL);
1236 PACKAGE_SGOI = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Orthorhombic-I.png", NULL);
1237 PACKAGE_SGOC = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Orthorhombic-C.png", NULL);
1238 PACKAGE_SGOF = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Orthorhombic-F.png", NULL);
1239 PACKAGE_SGMP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Monoclinic-P.png", NULL);
1240 PACKAGE_SGMI = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Monoclinic-I.png", NULL);
1241 PACKAGE_SGTC = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Triclinic.png", NULL);
1242
1243 switch (argc)
1244 {
1245 case 1:
1246 RUNC = TRUE;
1247 break;
1248 default:
1249 RUNC = parse_command_line (argc, argv);
1250 break;
1251 }
1252
1253 if (RUNC)
1254 {
1255#ifdef G_OS_WIN32
1256#ifndef DEBUG
1257 FreeConsole ();
1258#endif
1259#endif
1261 if (atomes_visual == 1)
1262 {
1263 // OpenGL initialization error, try adapting environment
1264 g_setenv ("GSK_RENDERER", "gl", TRUE);
1265 g_setenv ("GDK_DEBUG", "gl-prefer-gl", TRUE);
1267 if (atomes_visual == 1)
1268 {
1269 // OpenGL initialization error, again try adapting environment
1270 g_setenv ("GDK_RENDERER", "ngl", TRUE);
1272 }
1273 }
1274 if (atomes_visual > 0 || atomes_visual == -2)
1275 {
1276 // No way to initialize an OpenGL context: must quit
1277 return 1;
1278 }
1279#ifdef OSX
1280 g_setenv ("GSK_RENDERER", "gl", TRUE);
1281#endif
1282 atomes_visual = ! (abs(atomes_visual));
1283
1284#ifdef G_OS_WIN32
1285 PWSTR localPath = NULL;
1286 HRESULT hr = SHGetKnownFolderPath (& FOLDERID_LocalAppData, 0, NULL, & localPath);
1287 if (FAILED(hr))
1288 {
1289 fprintf (stderr, _("Error impossible to obtain the AppData\\Roaming (code 0x%08lx)\n%s"), hr);
1290 ATOMES_CONFIG_DIR = NULL;
1291 ATOMES_CONFIG = NULL;
1292 }
1293 else
1294 {
1295 char appdata[MAX_PATH];
1296 wcstombs (appdata, localPath, MAX_PATH);
1297 CoTaskMemFree (localPath); // libérer mémoire retournée par SHGetKnownFolderPath
1298 // Build the folder path for atomes
1299 ATOMES_CONFIG_DIR = g_strdup_printf ("%s\\atomes", appdata);
1300 ATOMES_CONFIG = g_strdup_printf ("%s\\atomes.pml", ATOMES_CONFIG_DIR);
1301 }
1302#else
1303 struct passwd * pw = getpwuid(getuid());
1304 ATOMES_CONFIG_DIR = g_strdup_printf ("%s/.config/atomes", pw -> pw_dir);
1305 ATOMES_CONFIG = g_strdup_printf ("%s/atomes.pml", ATOMES_CONFIG_DIR);
1306#endif
1307
1308 bindtextdomain (PACKAGE, PACKAGE_LOCALE);
1309 textdomain (PACKAGE);
1310 bind_textdomain_codeset(PACKAGE, "UTF-8"); // Forcer UTF-8 pour gettext
1311
1313
1314#if GLIB_MINOR_VERSION < 74
1315 AtomesApp = gtk_application_new (g_strdup_printf ("fr.ipcms.atomes.prog-%d", (int)clock()), G_APPLICATION_FLAGS_NONE);
1316#else
1317 AtomesApp = gtk_application_new (g_strdup_printf ("fr.ipcms.atomes.prog-%d", (int)clock()), G_APPLICATION_DEFAULT_FLAGS);
1318#endif
1319 GError * error = NULL;
1320 g_application_register (G_APPLICATION(AtomesApp), NULL, & error);
1321 g_signal_connect (G_OBJECT(AtomesApp), "activate", G_CALLBACK(run_program), NULL);
1322 int status = g_application_run (G_APPLICATION (AtomesApp), 0, NULL);
1323 g_object_unref (AtomesApp);
1324 return status;
1325 }
1326 return 0;
1327}
Binding to the Fortran90 subroutines.
int open_save_workspace(FILE *fp, int act)
open or save the active workspace
Definition callbacks.c:361
void open_this_coordinate_file(int format, gchar *proj_name)
open coordinate file format, if successful add to workspace
Definition callbacks.c:1568
int open_save(FILE *fp, int act, int wid, int pid, int aid, gchar *pfile)
open or save project file
Definition callbacks.c:246
const gchar * dfi[2]
Definition main.c:93
void open_this_isaacs_xml_file(gchar *profile, int ptoc, gboolean visible)
open an ISAACS XML file
Definition callbacks.c:814
Callback declarations for main window.
#define VERSION
Definition config.h:67
#define PACKAGE_BUGREPORT
Definition config.h:49
#define PACKAGE
Definition config.h:46
ColRGBA col
Definition d_measures.c:77
FILE * fp
gchar * PACKAGE_BMP
Definition global.c:98
gchar * PACKAGE_SET
Definition global.c:107
gchar * ATOMES_CONFIG
Definition global.c:139
gchar * PACKAGE_SGTP
Definition global.c:130
gchar * PACKAGE_SGMI
Definition global.c:136
gchar * PACKAGE_SGTI
Definition global.c:129
gchar * PACKAGE_DOTG
Definition global.c:117
gchar * PACKAGE_TIFF
Definition global.c:99
gchar * PACKAGE_LAGPL
Definition global.c:109
gchar * PACKAGE_LOGO
Definition global.c:108
gchar * PACKAGE_DOTC
Definition global.c:113
gchar * PACKAGE_LIB_DIR
Definition global.c:89
gchar * PACKAGE_IMG
Definition global.c:92
gchar * PACKAGE_DFIN
Definition global.c:123
int activep
Definition global.c:162
gchar * PACKAGE_IMP
Definition global.c:90
gchar * PACKAGE_DOTE
Definition global.c:115
gchar * PACKAGE_DOTH
Definition global.c:118
gchar * PACKAGE_SGMP
Definition global.c:135
gchar * PACKAGE_DFAN
Definition global.c:120
gchar * PACKAGE_SGTR
Definition global.c:128
gchar * PACKAGE_DFDI
Definition global.c:121
gchar * PACKAGE_DFTD
Definition global.c:122
gboolean silent_input
Definition global.c:192
gchar * PACKAGE_SGCF
Definition global.c:126
GtkApplication * AtomesApp
Definition global.c:206
gchar * PACKAGE_DFBD
Definition global.c:119
gchar * PACKAGE_CON
Definition global.c:91
gchar * PACKAGE_SGHP
Definition global.c:127
gchar * PACKAGE_OGL
Definition global.c:103
GtkWidget * MainWindow
Definition global.c:207
gchar * PACKAGE_DOTF
Definition global.c:116
gchar * PACKAGE_EPS
Definition global.c:95
gchar * PACKAGE_DOTA
Definition global.c:111
gchar * PACKAGE_OGLM
Definition global.c:104
gchar * PACKAGE_SGOC
Definition global.c:133
gchar * projfile
Definition global.c:144
gchar * PACKAGE_SGOF
Definition global.c:134
gboolean atomes_render_image
Definition global.c:196
gchar * PACKAGE_SGOP
Definition global.c:131
gchar * PACKAGE_OGLC
Definition global.c:105
int * allocint(int val)
allocate an int * pointer
Definition global.c:301
gchar * PACKAGE_TD
Definition global.c:101
gchar * PACKAGE_SVG
Definition global.c:94
gchar * PACKAGE_SGTC
Definition global.c:137
gchar * PACKAGE_SGCP
Definition global.c:124
gchar * PACKAGE_PRO
Definition global.c:106
gchar * PACKAGE_LABOUT
Definition global.c:110
gchar * ATOMES_CONFIG_DIR
Definition global.c:138
int atomes_visual
Definition global.c:168
gchar * PACKAGE_MOL
Definition global.c:102
gchar * PACKAGE_VOID
Definition global.c:100
gchar * PACKAGE_DOTB
Definition global.c:112
gchar * PACKAGE_PDF
Definition global.c:93
double string_to_double(gpointer string)
convert string to double
Definition global.c:611
gchar * PACKAGE_SGOI
Definition global.c:132
gchar * PACKAGE_JPG
Definition global.c:97
gchar * PACKAGE_SGCI
Definition global.c:125
gchar * PACKAGE_DOTD
Definition global.c:114
gboolean atomes_from_libreoffice
Definition global.c:195
gchar * PACKAGE_PNG
Definition global.c:96
Global variable declarations Global convenience function declarations Global data structure defin...
@ CONTAINER_WIN
Definition global.h:266
GtkWidget * new_gtk_window()
create a new GtkWindow
Definition gtk-misc.c:389
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2213
void provide_gtk_css(gchar *css)
create a css provider based on the css data
Definition gtk-misc.c:2185
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:267
project * active_project
Definition project.c:47
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:202
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
@ PERSPECTIVE
Definition glview.h:161
@ ORTHOGRAPHIC
Definition glview.h:160
@ SPHERES
Definition glview.h:185
@ BALL_AND_STICK
Definition glview.h:182
@ CYLINDERS
Definition glview.h:186
@ WIREFRAME
Definition glview.h:183
@ NONE
Definition glview.h:181
@ PUNT
Definition glview.h:187
#define OGL_STYLES
Definition glwin.h:107
ColRGBA * render_image_grad_color[2]
Definition image.c:86
ColRGBA * render_image_box_color
Definition image.c:87
ColRGBA * render_image_back_color
Definition image.c:82
int render_image_rep
Definition image.c:77
int * render_image_pixels
Definition image.c:88
int render_image_pcolor
Definition image.c:79
int render_image_back_grad
Definition image.c:83
gboolean trigger_fragment_analysis
Definition image.c:80
int render_image_acolor
Definition image.c:78
float render_image_back_pos
Definition image.c:85
int render_image_axis
Definition image.c:75
int render_image_back_dir
Definition image.c:84
int render_image_format
Definition image.c:73
int render_image_box
Definition image.c:76
gchar * render_image_output
Definition image.c:89
gboolean trigger_molecule_analysis
Definition image.c:81
int render_image_style
Definition image.c:74
void init_project(gboolean alloc_box)
initialize a new project
Definition init_p.c:273
void show_error(char *error, int val, GtkWidget *win)
show error message
Definition interface.c:299
Messaging function declarations.
int get_color_map_from_string(gchar *col_string)
retrieve color map from command line string
Definition main.c:396
int get_rep_from_string(gchar *rep_string)
retrieve representation style from command line string
Definition main.c:366
int main(int argc, char *argv[])
initialization of the atomes program
Definition main.c:1183
int check_opengl_rendering()
check the initialization parameters for an OpenGL context
Definition main.c:1100
int test_this_arg(gchar *arg)
test an argument from the command line
Definition main.c:295
struct file_list * flist
Definition main.c:100
int get_box_axis_from_string(gchar *box_axis_string)
retrieve box or axis style from command line string
Definition main.c:382
struct file_list * ftmp
Definition main.c:101
GtkWidget * create_splash_window()
create splash screen window
Definition main.c:793
gchar * wi_styles[]
Definition main.c:109
gchar * sp_styles[]
Definition main.c:114
gchar * bs_styles[]
Definition main.c:104
void print_version()
print version information
Definition main.c:190
ColRGBA * get_color_from_hexa_string(gchar *color_string)
convert Hexadecimal string to ColRGBA
Definition main.c:418
gboolean is_string_in_string_list(gchar *string, gchar **list)
check if a string is in a list of strings
Definition main.c:322
int get_gradient_from_string(gchar *grad_string)
retrieve background gradient from command line string
Definition main.c:475
gchar * vw_styles[]
Definition main.c:112
void print_help()
print basic help
Definition main.c:123
GtkWidget * create_main_window(GApplication *app)
create the main application window
Definition gui.c:1087
gboolean destroy_func(gpointer user_data)
destroy splash screen
Definition main.c:763
gchar * cr_styles[]
Definition main.c:113
int parse_command_line(int argc, char *argv[])
test command line arguments
Definition main.c:537
gchar * cy_styles[]
Definition main.c:115
int test_this_ext(int len, gchar *arg)
test extension of an argument from the command line
Definition main.c:274
G_MODULE_EXPORT void run_program(GApplication *app, gpointer data)
run the program
Definition main.c:1011
void open_this_data_file(int file_type, gchar *file_name)
open data file from the command line
Definition main.c:862
gchar * do_styles[]
Definition main.c:116
gchar * co_styles[]
Definition main.c:110
int check_for_atomes_file_options(int start, int end, char *argv[])
retrieve the list of files to read from the command line leave out all other options
Definition main.c:496
void read_this_file(int file_type, gchar *this_file)
read file from the command line
Definition main.c:831
int get_style_from_string(gchar *style_string)
retrieve style from command line string
Definition main.c:345
gboolean with_workspace
Definition main.c:102
gchar * io_styles[]
Definition main.c:111
Data structure declarations for movie encoding Function declarations for movie encoding.
void set_atomes_preferences()
set software default parameters
Preference variable declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...
gboolean reading_project
Definition read_curve.c:43
struct file_list * next
Definition main.c:97
gchar * file_name
Definition main.c:95
int file_type
Definition main.c:96
Definition glwin.h:364
int status
Definition w_advance.c:173
GtkWidget * res[2]
Definition w_encode.c:342
GdkPixbuf * pix
Definition workspace.c:69
Function declarations for workspace managment.