atomes 1.3.2
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 static gboolean handle_open_file (Instance * object, GDBusMethodInvocation * invocation, const gchar * arg_file, gpointer user_data);
51 static gboolean init_dbus_server ();
52 static gboolean check_existing_instance (void);
53
54 static gboolean win32_open_file_idle (gpointer user_data);
55 static gpointer win32_pipe_server_thread (gpointer user_data);
56 static gboolean init_win32_server ();
57 static gboolean check_existing_win32_instance ();
58
59 G_MODULE_EXPORT gboolean splashdraw (GtkWidget * widget, cairo_t * cr, gpointer data);
60
61 void printhelp();
62 void printversion ();
63 void set_atomes_locale ();
64 void read_this_file (int file_type, gchar * this_file);
65 void open_this_data_file (int file_type, gchar * file_name);
66 static void queue_open_file (const gchar * path);
67
68 G_MODULE_EXPORT void on_atomes_start (GApplication * app, gpointer data);
69 G_MODULE_EXPORT void on_atomes_open (GApplication * app, GFile ** files, gint n_files, const gchar * hint, gpointer user_data);
70
71 GtkWidget * create_splash_window ();
72
73*
74* Notes:
75*
76
77 LLM tools (Le Chat) were used at few occasions to prepare some sections of this file, including:
78 - To write of the function to convert hexadecimal chain to color
79 - To write parts of the d-bus, and Mutex instances management functions
80
81*/
82
83#include <getopt.h>
84#include <ctype.h>
85#include "version.h"
86#include "global.h"
87#include "bind.h"
88#include "callbacks.h"
89#include "preferences.h"
90#include "interface.h"
91#include "project.h"
92#include "workspace.h"
93#include "glview.h"
94#include "movie.h"
95
96#ifdef G_OS_WIN32
97#define APP_EXTENSION ".exe"
98#include <shlobj.h>
99#else
100#include <pwd.h>
101#define APP_EXTENSION
103#endif
104
105extern GtkWidget * create_main_window (GApplication * app);
106
107const gchar * dfi[2];
108struct file_list {
109 gchar * file_name;
111 struct file_list * next;
112};
113
114struct file_list * flist = NULL;
115struct file_list * ftmp = NULL;
116gboolean with_workspace = FALSE;
117
118gchar * bs_styles[] = {"ball&stick", "balls&sticks", "balls&stick", "ball&sticks",
119 "ball_&_stick", "balls_&_sticks", "balls_&_stick", "ball_&_sticks",
120 "ball_and_sticks", "balls_and_sticks", "balls_and_stick", "ball_and_stick",
121 "ballsandsticks", "ballsandstick", "ballanddsticks", "ballandstick",
122 "b&s", "b_and_s", "bs", "b", NULL};
123gchar * wi_styles[] = {"wireframe", "wireframes", "wires", "wire", "wi", "w", NULL};
124gchar * co_styles[] = {"covalent_radius", "covalent", "cov_rad", "cov", "co", "cr", NULL};
125gchar * io_styles[] = {"ionic_radius", "ionic_rad", "ionic", "ion", "ir", NULL};
126gchar * vw_styles[] = {"vdw_radius", "van_der_waals_radius", "van_der_waals", "vdw_radius", "vdw_rad", "vdw", "vr", NULL};
127gchar * cr_styles[] = {"crystal", "crystal_radius", "in_crystal", "in_crystal_radius", "cryst", "crystal_rad", "cr", NULL};
128gchar * sp_styles[] = {"sphere", "spheres", "sph", "sp", "S", NULL};
129gchar * cy_styles[] = {"cylinder", "cylinders", "cyl", "cy", "c", NULL};
130gchar * do_styles[] = {"dot", "dots", "d", NULL};
131gchar * xyz_files[] = {"xyz", NULL};
132gchar * c3d_files[] = {"c3d", "chemd3d", NULL};
133gchar * sml_files[] = {"sml", NULL};
134
141{
142 printf (_("\nUsage: atomes [OPTION]\n"
143 " atomes [FILE]\n"
144 " atomes [OPTION] [FILE]\n"
145 " atomes [FILE1] [FILE2] ...\n"
146 " atomes [OPTION1] [FILE1] [OPTION2] [FILE2] ...\n\n"
147 "3D atomic-scale models analysis, creation/edition and post-processing tool\n\n"
148 "options:\n"
149 " -v, --version version information\n"
150 " -h, --help display this help message\n\n"
151 "files, any number, in any order, in the following formats:\n\n"
152 " atomes workspace file : .awf\n"
153 " atomes project file : .apf\n"
154 " XYZ coordinates file : .xyz\n"
155 " Chem3D coordinates file : .c3d\n"
156 " CPMD trajectory : .trj\n"
157 " VASP trajectory : .xdatcar\n"
158 " PDB coordinates : .pdb, .ent\n"
159 " Crystallographic Information File : .cif\n"
160 " DL-POLY history file : .hist\n"
161 " atomes chemical library file (XML) : .sml\n"
162 " ISAACS project file : .ipf\n\n"
163 " alternatively specify the file format using:\n\n"
164 " -awf [FILE]\n"
165 " -apf [FILE]\n"
166 " -xyz [FILE]\n"
167 " -c3d [FILE]\n"
168 " -trj [FILE]\n"
169 " -xdatcar [FILE]\n"
170 " -pdb [FILE], or, -ent [FILE]\n"
171 " -cif [FILE]\n"
172 " -hist [FILE]\n"
173 " -sml [FILE]\n"
174 " -ipf [FILE]\n\n"
175 "ex:\n\n"
176 " atomes -pdb this.f file.awf -cif that.f *.xyz\n\n"
177 "Image rendering from the command line:\n\n"
178 "Usage: atomes [IMAGE_OPTIONS]\n"
179 " -p, --png, --render-png render image in PNG format\n"
180 " -j, --jpg, --render-jpg render image in JPEG format\n"
181 " -o, --output=[FILE] image file name\n"
182 " -W, --width=[XSIZE] image width\n"
183 " -H, --height=[YSIZE] image height\n"
184 " -s, --style=[STYLE] rendering style\n"
185 " -r, --rep=[REP] representation type\n"
186 " -b, --box=[STYLE] box style\n"
187 " -a, --axis=[STYLE] axis style\n"
188 " -e, --acolor=[MAP] atoms and bonds color map\n"
189 " -t, --pcolor=[MAP] ployhedra color map\n"
190 " -C, --box_color=[COLOR] box color\n"
191 " -G, --back_grad=[GRAD] background gradient type\n"
192 " -B, --back_color=[COLOR] background color\n"
193 " -D, --back_dir=[DIR] background gradient direction\n"
194 " -P, --back_pos=[POS] colors mixed position\n"
195 " -U, --grad_col_a=[COL] gradient initial color\n"
196 " -V, --grad_col_b=[COL] gradient final color\n\n"
197 "ex:\n\n"
198 " atomes --render-png --width=1920 -H 1024 --output=project.png project.apf -s ball_and_stick\n"
199 " atomes --jpg --style=vdw -r ortho -e pc -t pc file.xyz\n\n"
200 "Atomic coordinates conversion from the command line:\n\n"
201 "Usage: atomes [CONVERSION_OPTIONS]\n"
202 " -c, --convert=[FORMAT] conversion format\n\n"
203 "ex:\n\n"
204 " atomes --convert=xyz project.apf\n"
205 " atomes -c sml file.pdb\n\n"));
206 printf ("%s", _("\nReport a bug to <"));
207 printf ("%s>\n\n", PACKAGE_BUGREPORT);
208}
209
216{
217 printf ("%s", _("\n3D atomic scale model analysis, creation/edition and post-processing tool\n"));
218 printf ("\n%s version : %s\n", PACKAGE, VERSION);
219 printf ("\nGTK+ version : %1d.%1d.%1d\n",
220 GTK_MAJOR_VERSION,
221 GTK_MINOR_VERSION,
222 GTK_MICRO_VERSION);
223 printf ("Libavutil version : %2d.%2d.%3d\n",
224 LIBAVUTIL_VERSION_MAJOR,
225 LIBAVUTIL_VERSION_MINOR,
226 LIBAVUTIL_VERSION_MICRO);
227 printf ("Libavformat version : %2d.%2d.%3d\n",
228 LIBAVFORMAT_VERSION_MAJOR,
229 LIBAVFORMAT_VERSION_MINOR,
230 LIBAVFORMAT_VERSION_MICRO);
231 printf ("Libavcodec version : %2d.%2d.%3d\n",
232 LIBAVCODEC_VERSION_MAJOR,
233 LIBAVCODEC_VERSION_MINOR,
234 LIBAVCODEC_VERSION_MICRO);
235 printf ("Libswscale version : %2d.%2d.%3d\n",
236 LIBSWSCALE_VERSION_MAJOR,
237 LIBSWSCALE_VERSION_MINOR,
238 LIBSWSCALE_VERSION_MICRO);
239#ifdef OPENMP
240 float v = 0.0;
241 char * v_string;
242 switch (_OPENMP)
243 {
244 case 200505:
245 v = 2.5;
246 v_string = "2005-05";
247 break;
248 case 200805:
249 v = 3.0;
250 v_string = "2008-05";
251 break;
252 case 201107:
253 v = 3.1;
254 v_string = "2011-07";
255 break;
256 case 201307:
257 v = 4.0;
258 v_string = "2013-07";
259 break;
260 case 201511:
261 v = 4.5;
262 v_string = "2015-11";
263 break;
264 case 201811:
265 v = 5.0;
266 v_string = "2018-11";
267 break;
268 case 202011:
269 v = 5.1;
270 v_string = "2020-11";
271 break;
272 case 202111:
273 v = 5.2;
274 v_string = "2021-11";
275 break;
276 default:
277 v_string = "unknown";
278 break;
279 }
280 printf ("OpenMP version : %1.1f (%s)\n", v, v_string);
281#endif
282 printf ("FC Compiler : %s\n", FC);
283 printf ("FC Compiler flags : %s\n", FCFLAGS);
284 printf ("C Compiler : %s\n", CC);
285 printf ("C Compiler flags : %s\n", CFLAGS);
286
287 printf ("%s", _("\nReport a bug to <"));
288 printf ("%s>\n\n", PACKAGE_BUGREPORT);
289}
290
299int test_this_ext (int len, gchar * arg)
300{
301 int i;
302 gchar * aext = g_strdup_printf ("%c%c%c%c", arg[len-4], arg[len-3], arg[len-2], arg[len-1]);
303 char * eext[17]={".awf", ".apf", ".xyz", "NULL", ".c3d", ".trj", "NULL", ".car", "NULL", ".pdb", ".ent", ".cif", "NULL", "NULL", ".hist", ".sml", ".ipf"};
304 for (i=0; i<17; i++) if (g_strcmp0 (aext, eext[i]) == 0)
305 {
306 g_free (aext);
307 return -(i+1);
308 }
309 g_free (aext);
310 return 0;
311}
312
320int test_this_arg (gchar * arg)
321{
322 char * fext[17]={"-awf", "-apf", " -xyz", "NULL", "-c3d", "-trj", "NULL", "-xdatcar", "NULL", "-pdb", "-ent", "-cif", "NULL", "NULL", "-hist", "-sml", "-ipf"};
323 int i, j;
324 i = strlen(arg);
325 gchar * str = g_ascii_strdown (arg, i);
326 for (j=0; j<17; j++)
327 {
328 if (g_strcmp0 (str, fext[j]) == 0)
329 {
330 g_free (str);
331 return j+1;
332 }
333 }
334 j = test_this_ext (i, str);
335 g_free (str);
336 return (j) ? j : 0;
337}
338
347gboolean is_string_in_string_list (gchar * string, gchar ** list)
348{
349 if (string != NULL)
350 {
351 while (* list != NULL)
352 {
353 if (g_strcmp0(* list, string) == 0)
354 {
355 return TRUE;
356 }
357 list ++;
358 }
359 }
360 return FALSE;
361}
362
370int get_style_from_string (gchar * style_string)
371{
372 if (is_string_in_string_list(style_string, bs_styles)) return BALL_AND_STICK;
373 if (is_string_in_string_list(style_string, wi_styles)) return WIREFRAME;
374 if (is_string_in_string_list(style_string, co_styles)) return OGL_STYLES;
375 if (is_string_in_string_list(style_string, io_styles)) return OGL_STYLES+1;
376 if (is_string_in_string_list(style_string, vw_styles)) return OGL_STYLES+2;
377 if (is_string_in_string_list(style_string, cr_styles)) return OGL_STYLES+3;
378 if (is_string_in_string_list(style_string, sp_styles)) return SPHERES;
379 if (is_string_in_string_list(style_string, cy_styles)) return CYLINDERS;
380 if (is_string_in_string_list(style_string, do_styles)) return PUNT;
381 return NONE;
382}
383
391int get_rep_from_string (gchar * rep_string)
392{
393 gchar * ortho_keys[] = {"orthographic", "ortho", "o", "0", NULL};
394 gchar * persp_keys[] = {"perspective", "persp", "p", "1", NULL};
395 if (is_string_in_string_list(rep_string, ortho_keys)) return ORTHOGRAPHIC;
396 if (is_string_in_string_list(rep_string, persp_keys)) return PERSPECTIVE;
397 return NONE;
398}
399
407int get_box_axis_from_string (gchar * box_axis_string)
408{
409 if (is_string_in_string_list(box_axis_string, wi_styles)) return WIREFRAME;
410 if (is_string_in_string_list(box_axis_string, cy_styles)) return CYLINDERS;
411 return NONE;
412}
413
421int get_file_format_from_string (gchar * file_format_string)
422{
423 if (is_string_in_string_list(file_format_string, xyz_files)) return 0;
424 if (is_string_in_string_list(file_format_string, c3d_files)) return 1;
425 if (is_string_in_string_list(file_format_string, sml_files)) return 2;
426 return NONE;
427}
428
436int get_color_map_from_string (gchar * col_string)
437{
438 gchar * sp_keys[] = {"species", "spec", "sp", "0", NULL};
439 gchar * pt_keys[] = {"total_coordinations", "total_coordination", "total_coord", "total", "tc", "t", "1", NULL};
440 gchar * pc_keys[] = {"partial_coordinations", "partial_coordination", "partial_coord", "partial", "pc", "p", "2", NULL};
441 gchar * fg_keys[] = {"fragments", "fragment", "frag", "fg", "f", "3", NULL};
442 gchar * mo_keys[] = {"molecules", "molecule", "mol", "mo", "m", "4", NULL};
443 if (is_string_in_string_list(col_string, sp_keys)) return 0;
444 if (is_string_in_string_list(col_string, pt_keys)) return 1;
445 if (is_string_in_string_list(col_string, pc_keys)) return 2;
446 if (is_string_in_string_list(col_string, fg_keys)) return 3;
447 if (is_string_in_string_list(col_string, mo_keys)) return 4;
448 return NONE;
449}
450
458ColRGBA * get_color_from_hexa_string (gchar * color_string)
459{
460 ColRGBA * col = NULL;
461 const char * color = color_string;
462 // Ignorer le '#' si présent au début
463 if (color[0] == '#') color ++;
464
465 size_t len = strlen(color);
466 if (len != 3 && len != 4 && len != 6 && len != 8)
467 {
468 // longueur de chaîne incompatible
469 return NULL;
470 }
471 // Format long ?
472 int is_long = (len == 6 || len == 8) ? TRUE : FALSE;
473 float ratio = (is_long) ? 255.0 : 15.0;
474 int incr = (is_long) ? 2 : 1;
475 col = g_malloc0(sizeof*col);
476 col -> alpha = 1.0;
477 char buf[3] = {0}; // pour les caractères à examiner
478 // Format court (#RGB ou #RGBA)
479 buf[incr] = '\0';
480 buf[0] = color[0];
481 if (is_long) buf[1] = color[1];
482 col->red = strtol(buf, NULL, 16) / ratio;
483 buf[0] = color[incr];
484 if (is_long) buf[1] = color[incr+1];
485 col->green = strtol(buf, NULL, 16) / ratio;
486 buf[0] = color[2*incr];
487 if (is_long) buf[1] = color[2*incr+1];
488 col->blue = strtol(buf, NULL, 16) / ratio;
489 if (len == 4 || len == 8)
490 {
491 buf[0] = color[3*incr];
492 if (is_long) buf[1] = color[3*incr+1];
493 col->alpha = strtol(buf, NULL, 16) / ratio;
494 }
495
496 // Safety net
497 if (col -> red < 0.0 || col -> red > 1.0 ||
498 col -> green < 0.0 || col -> green > 1.0 ||
499 col -> blue < 0.0 || col -> blue > 1.0 ||
500 col -> alpha < 0.0 || col -> alpha > 1.0)
501 {
502 g_free(col);
503 return NULL;
504 }
505 return col;
506}
507
515int get_gradient_from_string (gchar * grad_string)
516{
517 gchar * no_keys[] = {"none", "no", "n", "0", NULL};
518 gchar * li_keys[] = {"linear", "lin", "li", "l", "1", NULL};
519 gchar * ci_keys[] = {"circular", "circ", "ci", "c", "2", NULL};
520 if (is_string_in_string_list(grad_string, no_keys)) return 0;
521 if (is_string_in_string_list(grad_string, li_keys)) return 1;
522 if (is_string_in_string_list(grad_string, ci_keys)) return 2;
523 return NONE;
524}
525
536int check_for_atomes_file_options (int start, int end, char *argv[])
537{
538 int i, j, k;
539 i=0;
540 for (j=start; j<end; j++)
541 {
542 k = test_this_arg (argv[j]);
543 if (k > 0 && j < end-1)
544 {
545 if (! (k == 1 && with_workspace))
546 {
547 if (! flist)
548 {
549 flist = g_malloc0(sizeof*flist);
550 ftmp = flist;
551 }
552 else
553 {
554 ftmp -> next = g_malloc0(sizeof*ftmp -> next);
555 ftmp = ftmp -> next;
556 }
557 ftmp -> file_name = g_strdup_printf ("%s", argv[j+1]);
558 ftmp -> file_type = k;
559 argv[j] = argv[j+1] = g_strdup_printf (" ");
560 j ++;
561 i ++;
562 if (k == 1) with_workspace = TRUE;
563 }
564 }
565 }
566 return i;
567}
568
575{
576 setlocale (LC_ALL, ""); /* Charge la locale système définie par l'utilisateur */
577 setlocale (LC_NUMERIC, "C"); /* Conserve le point comme séparateur décimal */
578 bindtextdomain (PACKAGE, PACKAGE_LOCALE);
579 textdomain (PACKAGE);
580 bind_textdomain_codeset (PACKAGE, "UTF-8"); // Forcer UTF-8 pour gettext
581}
582
591int parse_command_line (int argc, char *argv[])
592{
593 struct option atomes_options[] = {{"help", no_argument, 0, 'h'},
594 {"version", no_argument, 0, 'v'},
595 {"libreoffice", no_argument, 0, 'l'},
596 {"render-png", no_argument, 0, 'p'},
597 {"png", no_argument, 0, 'p'},
598 {"render-jpg", no_argument, 0, 'j'},
599 {"jpg", no_argument, 0, 'j'},
600 {"width", required_argument, 0, 'W'},
601 {"height", required_argument, 0, 'H'},
602 {"output", required_argument, 0, 'o'},
603 {"style", required_argument, 0, 's'},
604 {"atoms", required_argument, 0, 'e'},
605 {"poly", required_argument, 0, 't'},
606 {"axis", required_argument, 0, 'a'},
607 {"box", required_argument, 0, 'b'},
608 {"box_color", required_argument, 0, 'C'},
609 {"back_color", required_argument, 0, 'B'},
610 {"back_grad", required_argument, 0, 'G'},
611 {"back_dir", required_argument, 0, 'D'},
612 {"back_pos", required_argument, 0, 'P'},
613 {"grad_col_a", required_argument, 0, 'U'},
614 {"grad_col_b", required_argument, 0, 'V'},
615 {"rep", required_argument, 0, 'r'},
616 {"convert", required_argument, 0, 'c'},
617 // {"debug", no_argument, 0, 'd'},
618 {0, 0, 0, 0}};
619 int opt;
620 int index = -1;
621 int i, j;
622 double v;
623 gchar * image_x = NULL;
624 gchar * image_y = NULL;
625 int img_opt = 0;
626
627 for (i=0; i<2; i++) render_image_grad_color[i] = NULL;
628 /* We want to parse the command line using GNU getopt, but then
629 some options that are atomes specific and not GNU getopt compatible
630 might disappear, to prevent that it is mandatory to prepare
631 the information to be given to GNU getopt */
632 int files_to_read = check_for_atomes_file_options (1, argc, argv);
633
634 /* Letter follow by : means that the command requires an argument
635 No letter if the option is only in long format, ex : --width
636 If the long name is empty the command is only in short format */
637 while ((opt = getopt_long(argc, argv, "hvlpjdW:H:o:s:a:b:c:r:e:t:B:C:G:D:P:U:V:", atomes_options, & index)) != -1)
638 {
639 switch (opt)
640 {
641 case 'h':
643 print_help();
644 return FALSE;
645 break;
646 case 'v':
649 return FALSE;
650 break;
651 case 'e':
652 render_image_acolor = get_color_map_from_string (g_ascii_strdown(optarg,strlen(optarg)));
653 trigger_fragment_analysis = (render_image_acolor > 2) ? TRUE : FALSE;
654 trigger_molecule_analysis = (render_image_acolor > 3) ? TRUE : FALSE;
655 img_opt ++;
656 img_opt += (index == -1) ? 1 : 0;
657 break;
658 case 't':
659 render_image_pcolor = get_color_map_from_string (g_ascii_strdown(optarg,strlen(optarg)));
660 trigger_fragment_analysis = (render_image_pcolor > 2) ? TRUE : FALSE;
661 trigger_molecule_analysis = (render_image_pcolor > 3) ? TRUE : FALSE;
662 img_opt ++;
663 img_opt += (index == -1) ? 1 : 0;
664 break;
665 case 'l':
668 break;
669 case 'p':
670 atomes_render_image = TRUE;
672 img_opt ++;
673 break;
674 case 'j':
675 atomes_render_image = TRUE;
677 img_opt ++;
678 break;
679 case 'o':
680 render_image_output = g_strdup_printf ("%s", optarg);
681 img_opt ++;
682 img_opt += (index == -1) ? 1 : 0;
683 break;
684 case 'W':
685 image_x = g_strdup_printf ("%s", optarg);
686 img_opt ++;
687 img_opt += (index == -1) ? 1 : 0;
688 break;
689 case 'H':
690 image_y = g_strdup_printf ("%s", optarg);
691 img_opt ++;
692 img_opt += (index == -1) ? 1 : 0;
693 break;
694 case 's':
695 render_image_style = get_style_from_string (g_ascii_strdown(optarg,strlen(optarg)));
696 img_opt ++;
697 img_opt += (index == -1) ? 1 : 0;
698 break;
699 case 'a':
700 render_image_axis = get_box_axis_from_string (g_ascii_strdown(optarg,strlen(optarg)));
701 img_opt ++;
702 img_opt += (index == -1) ? 1 : 0;
703 break;
704 case 'b':
705 render_image_box = get_box_axis_from_string (g_ascii_strdown(optarg,strlen(optarg)));
706 img_opt ++;
707 img_opt += (index == -1) ? 1 : 0;
708 break;
709 case 'r':
710 render_image_rep = get_rep_from_string (g_ascii_strdown(optarg,strlen(optarg)));
711 img_opt ++;
712 img_opt += (index == -1) ? 1 : 0;
713 break;
714 case 'C':
716 img_opt ++;
717 img_opt += (index == -1) ? 1 : 0;
718 break;
719 case 'B':
721 img_opt ++;
722 img_opt += (index == -1) ? 1 : 0;
723 break;
724 case 'G':
725 render_image_back_grad = get_gradient_from_string (g_ascii_strdown(optarg,strlen(optarg)));
726 img_opt ++;
727 img_opt += (index == -1) ? 1 : 0;
728 break;
729 case 'D':
730 if (isdigit(optarg[0]))
731 {
732 render_image_back_dir = ((optarg[0] - '0') < 9) ? optarg[0] - '0' : NONE;
733 }
734 img_opt ++;
735 img_opt += (index == -1) ? 1 : 0;
736 break;
737 case 'P':
738 v = string_to_double(optarg);
739 render_image_back_pos = (v >= 0.0 && v <= 1.0) ? v : NONE;
740 img_opt ++;
741 img_opt += (index == -1) ? 1 : 0;
742 break;
743 case 'U':
745 img_opt ++;
746 img_opt += (index == -1) ? 1 : 0;
747 break;
748 case 'V':
750 img_opt ++;
751 img_opt += (index == -1) ? 1 : 0;
752 break;
753 case 'c':
754 atomes_convert_file = get_file_format_from_string (g_ascii_strdown(optarg,strlen(optarg)));
755 break;
756 }
757 index = -1;
758 }
761 {
762 if (! render_image_output) render_image_output = g_strdup_printf ("%s", (render_image_format) ? "image.jpg" : "image.png");
763 if (argc == img_opt + 2 + ((atomes_convert_file != NONE) ? 2 : 0))
764 {
765 if (image_x || image_y)
766 {
768 int pix;
769 if (image_x)
770 {
771 pix = (int) string_to_double(image_x);
772 if (pix > 0) render_image_pixels[0] = pix;
773 }
774 if (image_y)
775 {
776 pix = (int) string_to_double(image_y);
777 if (pix > 0) render_image_pixels[1] = pix;
778 }
779 }
780 }
781 else
782 {
783 return FALSE;
784 }
785 }
786
787 for (i=optind; i<argc; i++)
788 {
789 j = test_this_arg (argv[i]);
790 if (! (j == -1 && with_workspace))
791 {
792 if (j < 0)
793 {
794 if (! flist)
795 {
796 flist = g_malloc0(sizeof*flist);
797 ftmp = flist;
798 }
799 else
800 {
801 ftmp -> next = g_malloc0(sizeof*ftmp -> next);
802 ftmp = ftmp -> next;
803 }
804 ftmp -> file_name = g_strdup_printf ("%s", argv[i]);
805 ftmp -> file_type = -j;
806 files_to_read ++;
807 if (atomes_from_libreoffice) projfile = g_strdup_printf ("%s", argv[i]);
808 if (j == -1) with_workspace = TRUE;
809 }
810 }
811 }
812
813 return ((atomes_render_image || atomes_convert_file != NONE) && files_to_read == 1) ? TRUE : (atomes_render_image || atomes_convert_file != NONE) ? FALSE : TRUE;
814}
815
823gboolean destroy_func (gpointer user_data)
824{
825 GtkWidget * splashi = (GtkWidget*) user_data;
826 destroy_this_widget (splashi);
827 return FALSE;
828}
829
830#ifdef GTK3
840G_MODULE_EXPORT gboolean splashdraw (GtkWidget * widget, cairo_t * cr, gpointer data)
841{
842 cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); /* transparent */
843 cairo_paint (cr);
844 return FALSE;
845}
846#endif
847
854{
855 GtkWidget * splash_window = new_gtk_window ();
856 gtk_window_set_decorated (GTK_WINDOW (splash_window), FALSE);
857 GtkWidget * image;
858#ifdef GTK4
859 image = gtk_picture_new_for_filename (PACKAGE_LOGO);
860 gchar * backcol = g_strdup_printf ("window#splash {\n"
861 " background: none;"
862 " background-color: rgba(255, 255, 255, 0);}");
863 provide_gtk_css (backcol);
864 gtk_widget_set_name (splash_window, "splash");
865 g_free (backcol);
866#else
867 gtk_window_set_type_hint (GTK_WINDOW (splash_window), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
868 gtk_window_set_position (GTK_WINDOW (splash_window), GTK_WIN_POS_CENTER_ALWAYS);
869 gtk_widget_set_app_paintable (splash_window, TRUE);
870 GdkScreen * screen = gtk_widget_get_screen (splash_window);
871 GdkVisual * visual = gdk_screen_get_rgba_visual (screen);
872 gtk_widget_set_visual (splash_window, visual);
873 // Next line might be optional for total transparency
874 g_signal_connect(G_OBJECT(splash_window), "draw", G_CALLBACK(splashdraw), NULL);
875 image = gtk_image_new_from_file (PACKAGE_LOGO);
876#endif
877 add_container_child (CONTAINER_WIN, splash_window, image);
878 gtk_window_set_transient_for ((GtkWindow *)splash_window, (GtkWindow *)atomes_main_window);
879 show_the_widgets (splash_window);
880 return splash_window;
881}
882
891void read_this_file (int file_type, gchar * this_file)
892{
893 FILE * fp = fopen (this_file, dfi[0]);
894 if (file_type == 1)
895 {
896 int i = open_save_workspace (fp, 0);
897 if (i != 0)
898 {
899 gchar * err = g_strdup_printf (_("Error while reading workspace file\n%s\n"), this_file);
901 g_free (err);
902 }
903 }
904 else
905 {
906 init_project (FALSE);
907 reading_project = TRUE;
908 open_save (fp, 0, 0, activep, activep, this_file);
909 reading_project = FALSE;
910 }
911 fclose (fp);
912}
913
922void open_this_data_file (int file_type, gchar * file_name)
923{
924 gchar * end;
925 gchar * str;
926 gchar * filedir;
927 int i;
928#ifdef G_OS_WIN32
929 WIN32_FIND_DATA ffd;
930 HANDLE hFind;
931#else
932 DIR * d;
933 struct dirent * dir;
934#endif
935 switch (file_type)
936 {
937 case 1:
938 read_this_file (1, file_name);
939 break;
940 case 2:
941 end = g_strdup_printf ("%c", file_name[strlen(file_name)-1]);
942 if (g_strcmp0 (file_name, "*") == 0 || g_strcmp0 (end, "*") == 0)
943 {
944 if (g_strcmp0 (file_name, "*") == 0)
945 {
946 filedir = g_strdup_printf ("./");
947 }
948 else
949 {
950 filedir = g_strdup_printf ("%c", file_name[0]);
951 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf ("%s%c", filedir, file_name[i]);
952 }
953#ifdef G_OS_WIN32
954 hFind = FindFirstFile (filedir, & ffd);
955 if (hFind != INVALID_HANDLE_VALUE)
956 {
957 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
958 {
959 str = g_strdup_printf ("%s\\%s", filedir, (gchar *)ffd.cFileName);
960 read_this_file (2, str);
961 g_free (str);
962 }
963 while (FindNextFile(hFind, &ffd) != 0)
964 {
965 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
966 {
967 str = g_strdup_printf ("%s\\%s", filedir, (gchar *)ffd.cFileName);
968 read_this_file (2, str);
969 g_free (str);
970 }
971 }
972 }
973 FindClose(hFind);
974#else
975 d = opendir (filedir);
976 if (d)
977 {
978 while ((dir = readdir(d)) != NULL)
979 {
980 if (dir -> d_type == DT_REG)
981 {
982 str = g_strdup_printf ("%s/%s", filedir, dir -> d_name);
983 read_this_file (2, str);
984 g_free (str);
985 }
986 }
987 closedir(d);
988 }
989#endif
990 g_free (filedir);
991 }
992 else
993 {
994 read_this_file (2, file_name);
995 }
996 break;
997 case 17:
998 init_project (TRUE);
999 open_this_isaacs_xml_file (g_strdup_printf ("%s", file_name), activep, FALSE);
1000 break;
1001 default:
1002 end = g_strdup_printf ("%c", file_name[strlen(file_name)-1]);
1003 if (g_strcmp0 (file_name, "*") == 0 || g_strcmp0 (end, "*") == 0)
1004 {
1005 if (g_strcmp0 (file_name, "*") == 0)
1006 {
1007 filedir = g_strdup_printf ("./");
1008 }
1009 else
1010 {
1011 filedir = g_strdup_printf ("%c", file_name[0]);
1012 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf ("%s%c", filedir, file_name[i]);
1013 }
1014#ifdef G_OS_WIN32
1015 hFind = FindFirstFile (filedir, & ffd);
1016 if (hFind != INVALID_HANDLE_VALUE)
1017 {
1018 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
1019 {
1020 init_project (TRUE);
1021 active_project -> coordfile = g_strdup_printf ("%s\\%s", filedir, (gchar *)ffd.cFileName);
1022 open_this_coordinate_file (file_type-3, NULL, TRUE);
1023 }
1024 while (FindNextFile(hFind, &ffd) != 0)
1025 {
1026 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
1027 {
1028 init_project (TRUE);
1029 active_project -> coordfile = g_strdup_printf ("%s\\%s", filedir, (gchar *)ffd.cFileName);
1030 open_this_coordinate_file (file_type-3, NULL, TRUE);
1031 }
1032 }
1033 }
1034 FindClose(hFind);
1035#else
1036 d = opendir (filedir);
1037 if (d)
1038 {
1039 while ((dir = readdir(d)) != NULL)
1040 {
1041 if (dir -> d_type == DT_REG)
1042 {
1043 init_project (TRUE);
1044 active_project -> coordfile = g_strdup_printf ("%s/%s", filedir, dir -> d_name);
1045 open_this_coordinate_file (file_type-3, NULL, TRUE);
1046 }
1047 }
1048 closedir(d);
1049 }
1050#endif
1051 g_free (filedir);
1052 }
1053 else
1054 {
1055 init_project (TRUE);
1056 active_project -> coordfile = g_strdup_printf ("%s", file_name);
1057 open_this_coordinate_file (file_type-3, NULL, TRUE);
1058 }
1059 break;
1060 }
1061}
1062
1063#ifndef G_OS_WIN32
1074static gboolean handle_open_file (Instance * object, GDBusMethodInvocation * invocation, const gchar * arg_file, gpointer user_data)
1075{
1076 if (arg_file && strlen (arg_file) > 0)
1077 {
1078 int len = strlen (arg_file);
1079 int file_type = -test_this_ext (len, (gchar *) arg_file);
1080 if (file_type > 0)
1081 {
1082 open_this_data_file (file_type, (gchar *) arg_file);
1083 }
1084 }
1085 instance_complete_open_file (object, invocation);
1086 // Bring the main window on sight
1087
1089 {
1090 if (GTK_IS_WIDGET(atomes_main_window))
1091 {
1092 gtk_window_present (GTK_WINDOW(atomes_main_window));
1093 }
1094 }
1095 return TRUE;
1096}
1097
1103static gboolean init_dbus_server ()
1104{
1105 GError * error = NULL;
1106 GDBusConnection * connection; // D-Bus connection
1107 GDBusInterfaceSkeleton * skeleton; // D-Bus skeleton
1108
1109 // Connexion au bus de session
1110 connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, & error);
1111 if (error)
1112 {
1113 g_printerr ("D-Bus connection error : %s\n", error -> message);
1114 g_error_free (error);
1115 return FALSE;
1116 }
1117
1118 // Créer le skeleton généré par gdbus-codegen
1119 Instance * interface = instance_skeleton_new ();
1120 skeleton = G_DBUS_INTERFACE_SKELETON (interface);
1121
1122 // Connecter le gestionnaire de méthode OpenFile
1123 g_signal_connect (interface, "handle-open-file", G_CALLBACK (handle_open_file), NULL);
1124
1125 // Exporter le skeleton via son API propre (utilise sa vtable interne)
1126 if (! g_dbus_interface_skeleton_export (skeleton, connection, "/fr/ipcms/atomes/Instance", & error))
1127 {
1128 g_printerr ("D-Bus interface export error : %s\n", error -> message);
1129 g_error_free (error);
1130 return FALSE;
1131 }
1132
1133 // Réserver le nom bien connu sur le bus (appel synchrone pour garantir
1134 // que le nom est disponible avant le démarrage de la boucle principale)
1135 GVariant * name_result = g_dbus_connection_call_sync (connection,
1136 "org.freedesktop.DBus",
1137 "/org/freedesktop/DBus",
1138 "org.freedesktop.DBus",
1139 "RequestName",
1140 g_variant_new ("(su)", "fr.ipcms.atomes.Instance", 4u), /* 4 = DO_NOT_QUEUE */
1141 G_VARIANT_TYPE ("(u)"),
1142 G_DBUS_CALL_FLAGS_NONE,
1143 -1, NULL, & error);
1144
1145 if (error)
1146 {
1147 g_printerr ("D-Bus name reservation error : %s\n", error -> message);
1148 g_error_free (error);
1149 /* non fatal */
1150 }
1151 else if (name_result)
1152 {
1153 guint reply;
1154 g_variant_get (name_result, "(u)", & reply);
1155 g_variant_unref (name_result);
1156 if (reply != 1u) /* 1 = DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER */
1157 {
1158 g_printerr ("Impossible d'obtenir le nom D-Bus (code: %u)\n", reply);
1159 }
1160 }
1161
1162 return TRUE;
1163}
1164
1172static gboolean check_existing_instance ()
1173{
1174 gboolean sent = FALSE;
1175 if (! flist) return sent;
1176
1177 GError * error = NULL;
1178 GDBusConnection * connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, & error);
1179 if (error)
1180 {
1181 g_printerr ("D-Bus connection error : %s\n", error -> message);
1182 g_error_free (error);
1183 return sent;
1184 }
1185
1186 if (! flist) return sent;
1187
1188 struct file_list * tmp = flist;
1189 while (tmp)
1190 {
1191 error = NULL;
1192 GVariant * result = g_dbus_connection_call_sync (connection,
1193 "fr.ipcms.atomes.Instance",
1194 "/fr/ipcms/atomes/Instance",
1195 "fr.ipcms.atomes.Instance",
1196 "OpenFile",
1197 g_variant_new ("(s)", tmp -> file_name),
1198 NULL,
1199 G_DBUS_CALL_FLAGS_NONE,
1200 -1,
1201 NULL,
1202 & error);
1203 if (error)
1204 {
1205 /* Aucune instance ou erreur réseau : on arrête et on démarre normalement */
1206 g_printerr ("D-Bus OpenFile error: %s\n", error -> message);
1207 g_error_free (error);
1208 break;
1209 }
1210 if (result)
1211 {
1212 g_variant_unref (result);
1213 sent = TRUE;
1214 }
1215 tmp = tmp -> next;
1216 }
1217
1218 g_object_unref (connection);
1219 return sent;
1220}
1221#else
1222
1223#define ATOMES_MUTEX_NAME "fr.ipcms.atomes.mutex"
1224#define ATOMES_PIPE_NAME "\\\\.\\pipe\\fr.ipcms.atomes.pipe"
1225#define ATOMES_PIPE_BUFSIZE 4096
1226
1227HANDLE win32_mutex = NULL;
1228
1234typedef struct OpenFileData OpenFileData;
1235struct OpenFileData
1236{
1237 int file_type;
1238 gchar * file_name;
1239};
1240
1252static gboolean win32_open_file_idle (gpointer user_data)
1253{
1254 OpenFileData * ofd = (OpenFileData *) user_data;
1255 open_this_data_file (ofd -> file_type, ofd -> file_name);
1257 {
1258 gtk_window_present (GTK_WINDOW (atomes_main_window));
1259 }
1260 g_free (ofd -> file_name);
1261 g_free (ofd);
1262 return FALSE;
1263}
1264
1276static gpointer win32_pipe_server_thread (gpointer user_data)
1277{
1278 while (TRUE)
1279 {
1280 HANDLE pipe = CreateNamedPipe (ATOMES_PIPE_NAME,
1281 PIPE_ACCESS_INBOUND,
1282 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
1283 PIPE_UNLIMITED_INSTANCES,
1284 ATOMES_PIPE_BUFSIZE,
1285 ATOMES_PIPE_BUFSIZE,
1286 0, NULL);
1287 if (pipe == INVALID_HANDLE_VALUE)
1288 {
1289 g_printerr ("CreateNamedPipe failed: %lu\n", GetLastError ());
1290 break;
1291 }
1292
1293 BOOL connected = ConnectNamedPipe(pipe, NULL);
1294 if (! connected && GetLastError() != ERROR_PIPE_CONNECTED)
1295 {
1296 g_printerr ("ConnectNamedPipe failed: %lu", GetLastError());
1297 CloseHandle(pipe);
1298 break;
1299 }
1300 else if (connected || GetLastError () == ERROR_PIPE_CONNECTED)
1301 {
1302 char buf[ATOMES_PIPE_BUFSIZE];
1303 DWORD bytes_read = 0;
1304 BOOL ok = ReadFile (pipe, buf, sizeof (buf) - 1, & bytes_read, NULL);
1305 if (ok && bytes_read > 0)
1306 {
1307 buf[bytes_read] = '\0';
1308 int len = (int) strlen (buf);
1309 int file_type = -test_this_ext (len, buf);
1310 if (file_type > 0)
1311 {
1312 OpenFileData * ofd = g_malloc0 (sizeof * ofd);
1313 ofd -> file_type = file_type;
1314 ofd -> file_name = g_strdup (buf);
1315 g_idle_add (win32_open_file_idle, ofd);
1316 }
1317 }
1318 else
1319 {
1320 g_printerr ("ReadFile failed: %lu", GetLastError());
1321 }
1322 }
1323 DisconnectNamedPipe(pipe);
1324 CloseHandle (pipe);
1325 }
1326 return NULL;
1327}
1328
1337static gboolean init_win32_server ()
1338{
1339 win32_mutex = CreateMutex (NULL, TRUE, ATOMES_MUTEX_NAME);
1340 if (win32_mutex == NULL)
1341 {
1342 g_printerr ("CreateMutex failed: %lu\n", GetLastError ());
1343 return FALSE;
1344 }
1345
1346 if (GetLastError () == ERROR_ALREADY_EXISTS)
1347 {
1348 CloseHandle (win32_mutex);
1349 win32_mutex = NULL;
1350 return TRUE;
1351 }
1352
1353 HANDLE thread = g_thread_new ("atomes-pipe-server", win32_pipe_server_thread, NULL);
1354 if (thread == NULL)
1355 {
1356 CloseHandle (win32_mutex);
1357 win32_mutex = NULL;
1358 return FALSE;
1359 }
1360
1361 return TRUE;
1362}
1363
1375static gboolean check_existing_win32_instance ()
1376{
1377 if (! flist) return FALSE;
1378
1379 HANDLE mutex = OpenMutex (MUTEX_ALL_ACCESS, FALSE, ATOMES_MUTEX_NAME);
1380 if (mutex == NULL) return FALSE;
1381
1382 gboolean sent = FALSE;
1383 struct file_list * tmp = flist;
1384 while (tmp)
1385 {
1386 HANDLE pipe = CreateFile (ATOMES_PIPE_NAME,
1387 GENERIC_WRITE,
1388 0,
1389 NULL,
1390 OPEN_EXISTING,
1391 0,
1392 NULL);
1393
1394 if (pipe == INVALID_HANDLE_VALUE)
1395 {
1396 g_printerr ("CreateFile PIPE FAILED: %lu\n", GetLastError());
1397 }
1398
1399 DWORD len = (DWORD) strlen (tmp -> file_name);
1400 DWORD written = 0;
1401
1402 BOOL ok = WriteFile (pipe, tmp -> file_name, len, & written, NULL);
1403
1404 if (! ok)
1405 {
1406 g_printerr ("WriteFile FAILED: %lu\n", GetLastError());
1407 }
1408 else
1409 {
1410 g_printerr ("WriteFile OK: %lu/%lu bytes\n", written, len);
1411 if (written == len) sent = TRUE;
1412 }
1413
1414 CloseHandle (pipe);
1415 tmp = tmp->next;
1416 }
1417
1418 CloseHandle (mutex);
1419 mutex = NULL;
1420
1421 return sent;
1422}
1423#endif /* G_OS_WIN32 */
1424
1430static void process_pending_files ()
1431{
1432 ftmp = flist;
1433 silent_input = TRUE;
1434 if (with_workspace)
1435 {
1436 while (ftmp)
1437 {
1438 if (ftmp -> file_type == 1)
1439 {
1440 // Open the workspace file first
1442 g_free (ftmp -> file_name);
1443 }
1444 ftmp = ftmp -> next;
1445 }
1446 }
1447 ftmp = flist;
1448 while (ftmp)
1449 {
1450 if (ftmp -> file_type != 1)
1451 {
1452 // Add project(s) to workspace
1454 g_free (ftmp -> file_name);
1455 }
1456 ftmp = ftmp -> next;
1457 }
1458 g_free (flist);
1459 flist = NULL;
1460 silent_input = FALSE;
1461}
1462
1471G_MODULE_EXPORT void on_atomes_start (GApplication * app, gpointer data)
1472{
1473 /* GTK re-initializes the locale during startup (gtk_init calls setlocale(LC_ALL, "")),
1474 which overrides the LC_NUMERIC = "C" set in main(). We must enforce it again here
1475 to ensure floating-point parsing/formatting always uses the English (dot) convention. */
1476 setlocale (LC_NUMERIC, "C");
1477 GtkSettings * default_settings = gtk_settings_get_default ();
1478/*
1479#ifndef G_OS_WIN32
1480 g_object_set (default_settings, "gtk-application-prefer-dark-theme", TRUE, NULL);
1481#endif
1482*/
1483#ifdef GTK3
1484 g_object_set (default_settings, "gtk-button-images", TRUE, NULL);
1485#endif
1486#ifdef G_OS_WIN32
1487#ifdef GTK3
1488 g_object_set (default_settings, "gtk-key-theme-name", "win32", NULL);
1489#endif
1490 dfi[0]="rb";
1491 dfi[1]="wb";
1492#else
1493 dfi[0]="r";
1494 dfi[1]="w";
1495#endif
1496
1497#ifdef MAC_INTEGRATION
1498 GtkosxApplication * ProgOSX;
1499 ProgOSX = g_object_new (GTKOSX_TYPE_APPLICATION, NULL);
1500 gtkosx_application_set_use_quartz_accelerators (ProgOSX, FALSE);
1501 gtkosx_application_ready (ProgOSX);
1502#endif
1503#ifdef DEBUG
1504 print_version ();
1505#endif // DEBUG
1506
1508 {
1510 GtkWidget * isplash = create_splash_window ();
1511 if (isplash == NULL)
1512 {
1513 g_warning (_("Impossible to load the splash screen\n"));
1514 }
1515 else
1516 {
1517 g_timeout_add_seconds (1, destroy_func, isplash);
1518 }
1519 }
1520
1521 if (flist) process_pending_files ();
1522
1523#ifdef MAC_INTEGRATION
1524 g_object_unref (ProgOSX);
1525#endif
1526}
1527
1535static void queue_open_file (const gchar * path)
1536{
1537 if (path == NULL || * path == '\0') return;
1538
1539 gsize len = strlen(path);
1540 if (len < 4) return;
1541
1542 /* Même détection que dans handle_open_file(). */
1543 int file_type = - test_this_ext((int)len, (gchar *)path);
1544 if (file_type <= 0) return;
1545
1546 struct file_list * last;
1547 struct file_list * node = g_malloc0(sizeof*node);
1548 node -> file_name = g_strdup(path);
1549 node -> file_type = file_type;
1550
1551 if (flist == NULL)
1552 {
1553 flist = node;
1554 }
1555 else
1556 {
1557 last = flist;
1558 while (last -> next != NULL)
1559 {
1560 last = last -> next;
1561 }
1562 last -> next = node;
1563 }
1564
1565 ftmp = node;
1566
1567 if (file_type == 1) with_workspace = TRUE;
1568}
1569
1581G_MODULE_EXPORT void on_atomes_open (GApplication * app, GFile ** files, gint n_files, const gchar * hint, gpointer user_data)
1582{
1583 int i;
1584 for (i = 0; i < n_files; i++)
1585 {
1586 gchar * path = g_file_get_path(files[i]);
1587 if (path != NULL)
1588 {
1589 gchar * absolute_path = g_canonicalize_filename (path, NULL);
1590 queue_open_file (absolute_path);
1591 g_free (absolute_path);
1592 g_free (path);
1593 }
1594 }
1595
1596 if (! atomes_main_window) g_application_activate (app);
1597 process_pending_files ();
1598 gtk_window_present (GTK_WINDOW(atomes_main_window));
1599}
1600
1607{
1608 GError * error = NULL;
1609 gchar * proc_dir = NULL;
1610 gchar * proc_path = NULL;
1611 const char * proc_name;
1612#ifdef G_OS_WIN32
1613 proc_dir = g_build_filename (PACKAGE_PREFIX, "bin", NULL);
1614 proc_name = "atomes_startup_testing.exe";
1615 proc_path = g_build_filename (proc_dir, proc_name, NULL);
1616#else
1617 proc_dir = g_build_filename (PACKAGE_LIBEXEC, NULL);
1618 proc_name = "atomes_startup_testing";
1619 proc_path = g_build_filename (PACKAGE_LIBEXEC, proc_name, NULL);
1620#endif
1621#ifdef DEBUG
1622 g_print ("proc_dir= %s\n", proc_dir);
1623 g_print ("proc_name= %s\n", proc_name);
1624 g_print ("proc_path= %s\n", proc_path);
1625#endif
1626
1627#ifdef CODEBLOCKS
1628 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
1629#else
1630#ifndef OSX
1631 GSubprocessLauncher * proc_launch = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
1632 g_subprocess_launcher_set_cwd (proc_launch, proc_dir);
1633 GSubprocess * proc = g_subprocess_launcher_spawn (proc_launch, & error, proc_path, NULL);
1634#else
1635 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
1636#endif
1637#endif
1638
1639 if (error)
1640 {
1641 g_printerr ("error: %s\n", error -> message);
1642 g_clear_error (& error);
1643 }
1644 g_subprocess_wait (proc, NULL, & error);
1645 int res = g_subprocess_get_exit_status (proc);
1646#ifdef DEBUG
1647 g_debug ("Exit status of atomes_startup_testing = %d", res);
1648#endif
1649 g_object_unref (proc);
1650#ifndef CODEBLOCKS
1651#ifndef OSX
1652 g_object_unref (proc_launch);
1653#endif
1654#endif
1655 g_free (proc_path);
1656 g_free (proc_dir);
1657 gchar * ogl_info = NULL;
1658 switch (res)
1659 {
1660 case 1:
1661 ogl_info = g_strdup_printf (_("Fatal error on OpenGL initialization: trying to adjust environment !"));
1662 break;
1663 case -2:
1664 ogl_info = g_strdup_printf (_("Impossible to initialize the OpenGL 3D rendering !"));
1665 break;
1666 case -1:
1667 ogl_info = g_strdup_printf (_("GDK visual must be modified to initialize the OpenGL context !"));
1668 break;
1669 default:
1670 break;
1671 }
1672 if (ogl_info)
1673 {
1674 g_print ("%s\n", ogl_info);
1675 g_free (ogl_info);
1676 ogl_info = NULL;
1677 }
1678 return res;
1679}
1680
1689int main (int argc, char *argv[])
1690{
1691 gboolean RUNC = FALSE;
1692
1693 // Allocating application data structure, custom required for instance(s) managment
1694 atomes_app = g_malloc0 (sizeof *atomes_app);
1695
1696#ifdef G_OS_WIN32
1697 PACKAGE_PREFIX = g_win32_get_package_installation_directory_of_module (NULL);
1698 PACKAGE_LOCALE = g_build_filename (PACKAGE_PREFIX, "locale", NULL);
1699 // g_win32_get_package_installation_directory (NULL, NULL);
1700#endif
1701 PACKAGE_LIB_DIR = g_build_filename (PACKAGE_PREFIX, "library", NULL);
1702 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX, "pixmaps/import.png", NULL);
1703 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX, "pixmaps/import.png", NULL);
1704 PACKAGE_CON = g_build_filename (PACKAGE_PREFIX, "pixmaps/convert.png", NULL);
1705 PACKAGE_IMG = g_build_filename (PACKAGE_PREFIX, "pixmaps/image.png", NULL);
1706 PACKAGE_PDF = g_build_filename (PACKAGE_PREFIX, "pixmaps/pdf.png", NULL);
1707 PACKAGE_SVG = g_build_filename (PACKAGE_PREFIX, "pixmaps/svg.png", NULL);
1708 PACKAGE_EPS = g_build_filename (PACKAGE_PREFIX, "pixmaps/eps.png", NULL);
1709 PACKAGE_PNG = g_build_filename (PACKAGE_PREFIX, "pixmaps/png.png", NULL);
1710 PACKAGE_JPG = g_build_filename (PACKAGE_PREFIX, "pixmaps/jpg.png", NULL);
1711 PACKAGE_BMP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bmp.png", NULL);
1712 PACKAGE_TIFF = g_build_filename (PACKAGE_PREFIX, "pixmaps/tiff.png", NULL);
1713 PACKAGE_VOID = g_build_filename (PACKAGE_PREFIX, "pixmaps/void.png", NULL);
1714 PACKAGE_TD = g_build_filename (PACKAGE_PREFIX, "pixmaps/td.png", NULL);
1715 PACKAGE_MOL = g_build_filename (PACKAGE_PREFIX, "pixmaps/molecule.png", NULL);
1716 PACKAGE_OGL = g_build_filename (PACKAGE_PREFIX, "pixmaps/opengl.png", NULL);
1717 PACKAGE_OGLM = g_build_filename (PACKAGE_PREFIX, "pixmaps/mol.png", NULL);
1718 PACKAGE_OGLC = g_build_filename (PACKAGE_PREFIX, "pixmaps/mol.png", NULL);
1719 PACKAGE_PRO = g_build_filename (PACKAGE_PREFIX, "pixmaps/prop.png", NULL);
1720 PACKAGE_SET = g_build_filename (PACKAGE_PREFIX, "pixmaps/settings.png", NULL);
1721 PACKAGE_LOGO = g_build_filename (PACKAGE_PREFIX, "pixmaps/logo.png", NULL);
1722 PACKAGE_LAGPL = g_build_filename (PACKAGE_PREFIX, "pixmaps/logo-agpl.png", NULL);
1723 PACKAGE_LABOUT = g_build_filename (PACKAGE_PREFIX, "pixmaps/logo-about.png", NULL);
1724 PACKAGE_DOTA = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-a.png", NULL);
1725 PACKAGE_DOTB = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-b.png", NULL);
1726 PACKAGE_DOTC = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-c.png", NULL);
1727 PACKAGE_DOTD = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-d.png", NULL);
1728 PACKAGE_DOTE = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-e.png", NULL);
1729 PACKAGE_DOTF = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-f.png", NULL);
1730 PACKAGE_DOTG = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-g.png", NULL);
1731 PACKAGE_DOTH = g_build_filename (PACKAGE_PREFIX, "pixmaps/dots/dots-h.png", NULL);
1732 PACKAGE_DFBD = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/bd.png", NULL);
1733 PACKAGE_DFAN = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/an.png", NULL);
1734 PACKAGE_DFDI = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/di.png", NULL);
1735 PACKAGE_DFTD = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/td.png", NULL);
1736 PACKAGE_DFIN = g_build_filename (PACKAGE_PREFIX, "pixmaps/field/in.png", NULL);
1737 PACKAGE_SGCP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Cubic-P.png", NULL);
1738 PACKAGE_SGCI = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Cubic-I.png", NULL);
1739 PACKAGE_SGCF = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Cubic-F.png", NULL);
1740 PACKAGE_SGHP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Hexagonal.png", NULL);
1741 PACKAGE_SGTR = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Trigonal-R.png", NULL);
1742 PACKAGE_SGTI = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Tetragonal-I.png", NULL);
1743 PACKAGE_SGTP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Tetragonal-P.png", NULL);
1744 PACKAGE_SGOP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Orthorhombic-P.png", NULL);
1745 PACKAGE_SGOI = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Orthorhombic-I.png", NULL);
1746 PACKAGE_SGOC = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Orthorhombic-C.png", NULL);
1747 PACKAGE_SGOF = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Orthorhombic-F.png", NULL);
1748 PACKAGE_SGMP = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Monoclinic-P.png", NULL);
1749 PACKAGE_SGMI = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Monoclinic-I.png", NULL);
1750 PACKAGE_SGTC = g_build_filename (PACKAGE_PREFIX, "pixmaps/bravais/Triclinic.png", NULL);
1751
1752 switch (argc)
1753 {
1754 case 1:
1755 RUNC = TRUE;
1756 break;
1757 default:
1758 RUNC = parse_command_line (argc, argv);
1759 break;
1760 }
1761
1762 if (RUNC)
1763 {
1764#ifdef G_OS_WIN32
1765#ifndef DEBUG
1766 FreeConsole ();
1767#endif
1768#endif
1770 if (atomes_visual == 1)
1771 {
1772 // OpenGL initialization error, try adapting environment
1773 g_setenv ("GSK_RENDERER", "gl", TRUE);
1774 g_setenv ("GDK_DEBUG", "gl-prefer-gl", TRUE);
1776 if (atomes_visual == 1)
1777 {
1778 // OpenGL initialization error, again try adapting environment
1779 g_setenv ("GDK_RENDERER", "ngl", TRUE);
1781 }
1782 }
1783 if (atomes_visual > 0 || atomes_visual == -2)
1784 {
1785 // No way to initialize an OpenGL context: must quit
1786 return 1;
1787 }
1788#ifdef OSX
1789 g_setenv ("GSK_RENDERER", "gl", TRUE);
1790#endif
1791 atomes_visual = ! (abs(atomes_visual));
1792
1793#ifdef G_OS_WIN32
1794 PWSTR localPath = NULL;
1795 HRESULT hr = SHGetKnownFolderPath (& FOLDERID_LocalAppData, 0, NULL, & localPath);
1796 if (FAILED(hr))
1797 {
1798 fprintf (stderr, _("Error impossible to obtain the AppData\\Roaming (code 0x%08lx)\n%s"), hr);
1799 ATOMES_CONFIG_DIR = NULL;
1800 ATOMES_CONFIG = NULL;
1801 }
1802 else
1803 {
1804 char appdata[MAX_PATH];
1805 wcstombs (appdata, localPath, MAX_PATH);
1806 CoTaskMemFree (localPath); // libérer mémoire retournée par SHGetKnownFolderPath
1807 // Build the folder path for atomes
1808 ATOMES_CONFIG_DIR = g_strdup_printf ("%s\\atomes", appdata);
1809 ATOMES_CONFIG = g_strdup_printf ("%s\\atomes.pml", ATOMES_CONFIG_DIR);
1810 }
1811#else
1812 struct passwd * pw = getpwuid(getuid());
1813 ATOMES_CONFIG_DIR = g_strdup_printf ("%s/.config/atomes", pw -> pw_dir);
1814 ATOMES_CONFIG = g_strdup_printf ("%s/atomes.pml", ATOMES_CONFIG_DIR);
1815#endif
1816
1819
1820 // Now user preferences are known
1822 {
1823 if (default_instance)
1824 {
1825 // Check if there is already an existing atomes instance running
1826 // If yes then transmit the file(s) to open to this instance
1827#ifdef G_OS_WIN32
1828 /* Check for an existing atomes instance via Win32 Named Mutex/Pipe */
1829 if (argc > 1 && check_existing_win32_instance ())
1830 {
1831 return 0;
1832 }
1833 if (! init_win32_server ())
1834 {
1835 g_print ("Init Win32 pipe server failed\n");
1836 return 1;
1837 }
1838#else
1839 if (argc > 1 && check_existing_instance ())
1840 {
1841 // Another instance was found, quit.
1842 return 0;
1843 }
1844
1845 if (! init_dbus_server ())
1846 {
1847 g_print ("Init D-BUS failed\n");
1848 return 1;
1849 }
1850#endif // G_OS_WIN32
1851 }
1852 }
1853
1854#if GLIB_MINOR_VERSION < 74
1855 atomes_app = gtk_application_new (g_strdup_printf ("fr.ipcms.atomes.prog-%d", (int)clock()), G_APPLICATION_HANDLES_OPEN);
1856#else
1857 atomes_app = gtk_application_new (g_strdup_printf ("fr.ipcms.atomes.prog-%d", (int)clock()), G_APPLICATION_DEFAULT_FLAGS | G_APPLICATION_HANDLES_OPEN);
1858#endif
1859 g_signal_connect (G_OBJECT(atomes_app), "activate", G_CALLBACK(on_atomes_start), NULL);
1860 g_signal_connect (G_OBJECT(atomes_app), "open", G_CALLBACK(on_atomes_open), NULL);
1861
1862 GError * error = NULL;
1863 if (! g_application_register (G_APPLICATION(atomes_app), NULL, & error))
1864 {
1865 g_printerr ("Application registration failed: %s\n", error -> message);
1866 g_error_free (error);
1867 g_object_unref (atomes_app);
1868 return 1;
1869 }
1870
1871 int status = g_application_run (G_APPLICATION (atomes_app), 0, NULL);
1872 g_object_unref (atomes_app);
1873#ifdef G_OS_WIN32
1874 if (win32_mutex)
1875 {
1876 ReleaseMutex (win32_mutex);
1877 CloseHandle (win32_mutex);
1878 }
1879#endif
1880 return status;
1881 }
1882 return 0;
1883}
Binding to the Fortran90 subroutines.
int open_save_workspace(FILE *fp, int act)
open or save the active workspace
Definition callbacks.c:378
void open_this_coordinate_file(int format, gchar *proj_name, gboolean main_reader)
open coordinate file format, if successful add to workspace
Definition callbacks.c:1536
int open_save(FILE *fp, int act, int wid, int pid, int aid, gchar *pfile)
open or save project file
Definition callbacks.c:257
const gchar * dfi[2]
Definition main.c:107
void open_this_isaacs_xml_file(gchar *profile, int ptoc, gboolean visible)
open an ISAACS XML file
Definition callbacks.c:831
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
GtkTreePath * path
Definition datab.c:103
FILE * fp
Instance * instance_skeleton_new(void)
void instance_complete_open_file(Instance *object G_GNUC_UNUSED, GDBusMethodInvocation *invocation)
struct _Instance Instance
int atomes_convert_file
Definition global.c:197
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
GtkWidget * atomes_main_window
Definition global.c:208
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
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
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:302
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
GtkApplication * atomes_app
Definition global.c:207
gchar * PACKAGE_PDF
Definition global.c:93
double string_to_double(gpointer string)
convert string to double
Definition global.c:612
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...
#define NONE
Definition global.h:285
@ CONTAINER_WIN
Definition global.h:267
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:184
@ BALL_AND_STICK
Definition glview.h:181
@ CYLINDERS
Definition glview.h:185
@ WIREFRAME
Definition glview.h:182
@ PUNT
Definition glview.h:186
#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:436
int get_rep_from_string(gchar *rep_string)
retrieve representation style from command line string
Definition main.c:391
int main(int argc, char *argv[])
initialization of the atomes program
Definition main.c:1689
int check_opengl_rendering()
check the initialization parameters for an OpenGL context
Definition main.c:1606
int test_this_arg(gchar *arg)
test an argument from the command line
Definition main.c:320
struct file_list * flist
Definition main.c:114
int get_box_axis_from_string(gchar *box_axis_string)
retrieve box or axis style from command line string
Definition main.c:407
int get_file_format_from_string(gchar *file_format_string)
retrieve file format for convertion from command line string
Definition main.c:421
gchar * xyz_files[]
Definition main.c:131
struct file_list * ftmp
Definition main.c:115
G_MODULE_EXPORT void on_atomes_open(GApplication *app, GFile **files, gint n_files, const gchar *hint, gpointer user_data)
hanlde the open signal for the atomes application
Definition main.c:1581
GtkWidget * create_splash_window()
create splash screen window
Definition main.c:853
gchar * wi_styles[]
Definition main.c:123
gchar * sp_styles[]
Definition main.c:128
gchar * bs_styles[]
Definition main.c:118
void print_version()
print version information
Definition main.c:215
ColRGBA * get_color_from_hexa_string(gchar *color_string)
convert Hexadecimal string to ColRGBA
Definition main.c:458
void set_atomes_locale()
set locale
Definition main.c:574
gboolean is_string_in_string_list(gchar *string, gchar **list)
check if a string is in a list of strings
Definition main.c:347
gchar * sml_files[]
Definition main.c:133
int get_gradient_from_string(gchar *grad_string)
retrieve background gradient from command line string
Definition main.c:515
gchar * vw_styles[]
Definition main.c:126
void print_help()
print basic help
Definition main.c:140
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:823
gchar * cr_styles[]
Definition main.c:127
int parse_command_line(int argc, char *argv[])
test command line arguments
Definition main.c:591
gchar * cy_styles[]
Definition main.c:129
gchar * c3d_files[]
Definition main.c:132
int test_this_ext(int len, gchar *arg)
test extension of an argument from the command line
Definition main.c:299
void open_this_data_file(int file_type, gchar *file_name)
open data file from the command line
Definition main.c:922
gchar * do_styles[]
Definition main.c:130
G_MODULE_EXPORT void on_atomes_start(GApplication *app, gpointer data)
run the program
Definition main.c:1471
gchar * co_styles[]
Definition main.c:124
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:536
void read_this_file(int file_type, gchar *this_file)
read file from the command line
Definition main.c:891
int get_style_from_string(gchar *style_string)
retrieve style from command line string
Definition main.c:370
gboolean with_workspace
Definition main.c:116
gchar * io_styles[]
Definition main.c:125
Data structure declarations for movie encoding Function declarations for movie encoding.
void set_atomes_preferences()
set software default parameters
int default_instance
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:111
gchar * file_name
Definition main.c:109
int file_type
Definition main.c:110
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.