275 gtk_window_set_decorated (GTK_WINDOW (splash_window), FALSE);
279 gchar * backcol = g_strdup_printf (
"window#splash {\n"
281 " background-color: rgba(255, 255, 255, 0);}");
283 gtk_widget_set_name (splash_window,
"splash");
286 gtk_window_set_type_hint (GTK_WINDOW (splash_window), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
287 gtk_window_set_position (GTK_WINDOW (splash_window), GTK_WIN_POS_CENTER_ALWAYS);
288 gtk_widget_set_app_paintable (splash_window, TRUE);
289 GdkScreen * screen = gtk_widget_get_screen (splash_window);
290 GdkVisual * visual = gdk_screen_get_rgba_visual (screen);
291 gtk_widget_set_visual (splash_window, visual);
293 g_signal_connect(G_OBJECT(splash_window),
"draw", G_CALLBACK(splashdraw), NULL);
297 gtk_window_set_transient_for ((GtkWindow *)splash_window, (GtkWindow *)
MainWindow);
299 return splash_window;
358 end = g_strdup_printf (
"%c", file_name[strlen(file_name)-1]);
359 if (g_strcmp0 (file_name,
"*") == 0 || g_strcmp0 (end,
"*") == 0)
361 if (g_strcmp0 (file_name,
"*") == 0)
363 filedir = g_strdup_printf (
"./");
367 filedir = g_strdup_printf (
"%c", file_name[0]);
368 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf (
"%s%c", filedir, file_name[i]);
371 hFind = FindFirstFile (filedir, & ffd);
372 if (hFind != INVALID_HANDLE_VALUE)
374 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
376 str = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
380 while (FindNextFile(hFind, &ffd) != 0)
382 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
384 str = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
392 d = opendir (filedir);
395 while ((dir = readdir(
d)) != NULL)
397 if (dir -> d_type == DT_REG)
399 str = g_strdup_printf (
"%s/%s", filedir, dir -> d_name);
419 end = g_strdup_printf (
"%c", file_name[strlen(file_name)-1]);
420 if (g_strcmp0 (file_name,
"*") == 0 || g_strcmp0 (end,
"*") == 0)
422 if (g_strcmp0 (file_name,
"*") == 0)
424 filedir = g_strdup_printf (
"./");
428 filedir = g_strdup_printf (
"%c", file_name[0]);
429 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf (
"%s%c", filedir, file_name[i]);
432 hFind = FindFirstFile (filedir, & ffd);
433 if (hFind != INVALID_HANDLE_VALUE)
435 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
438 active_project -> coordfile = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
441 while (FindNextFile(hFind, &ffd) != 0)
443 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
446 active_project -> coordfile = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
453 d = opendir (filedir);
456 while ((dir = readdir(
d)) != NULL)
458 if (dir -> d_type == DT_REG)
461 active_project -> coordfile = g_strdup_printf (
"%s/%s", filedir, dir -> d_name);
569 GError * error = NULL;
570 gchar * proc_dir = NULL;
571 gchar * proc_path = NULL;
572 const char * proc_name;
574 proc_dir = g_build_filename (PACKAGE_PREFIX,
"bin", NULL);
575 proc_name =
"atomes_startup_testing.exe";
576 proc_path = g_build_filename (proc_dir, proc_name, NULL);
578 proc_dir = g_build_filename (PACKAGE_LIBEXEC, NULL);
579 proc_name =
"atomes_startup_testing";
580 proc_path = g_build_filename (PACKAGE_LIBEXEC, proc_name, NULL);
584 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
587 GSubprocessLauncher * proc_launch = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
588 g_subprocess_launcher_set_cwd (proc_launch, proc_dir);
589 GSubprocess * proc = g_subprocess_launcher_spawn (proc_launch, & error, proc_path, NULL);
591 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
597 g_print (
"error: %s\n", error -> message);
598 g_clear_error (& error);
600 g_subprocess_wait (proc, NULL, & error);
601 int res = g_subprocess_get_exit_status (proc);
602 g_clear_object (& proc);
605 g_clear_object (& proc_launch);
610 gchar * ogl_info = NULL;
614 ogl_info = g_strdup_printf (
"Fatal error on OpenGL initialization: trying to adjust environment !");
617 ogl_info = g_strdup_printf (
"Impossible to initialize the OpenGL 3D rendering !");
620 ogl_info = g_strdup_printf (
"GDK visual must be modified to initialize the OpenGL context !");
627 g_print (
"%s\n", ogl_info);
642int main (
int argc,
char *argv[])
644 gboolean RUNC = FALSE;
647 PACKAGE_PREFIX = g_win32_get_package_installation_directory_of_module (NULL);
651 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/import.png", NULL);
652 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/import.png", NULL);
653 PACKAGE_CON = g_build_filename (PACKAGE_PREFIX,
"pixmaps/convert.png", NULL);
654 PACKAGE_IMG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/image.png", NULL);
655 PACKAGE_PDF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/pdf.png", NULL);
656 PACKAGE_SVG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/svg.png", NULL);
657 PACKAGE_EPS = g_build_filename (PACKAGE_PREFIX,
"pixmaps/eps.png", NULL);
658 PACKAGE_PNG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/png.png", NULL);
659 PACKAGE_JPG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/jpg.png", NULL);
660 PACKAGE_BMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bmp.png", NULL);
661 PACKAGE_TIFF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/tiff.png", NULL);
662 PACKAGE_VOID = g_build_filename (PACKAGE_PREFIX,
"pixmaps/void.png", NULL);
663 PACKAGE_GR = g_build_filename (PACKAGE_PREFIX,
"pixmaps/gr.png", NULL);
664 PACKAGE_SQ = g_build_filename (PACKAGE_PREFIX,
"pixmaps/sq.png", NULL);
665 PACKAGE_BD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bd.png", NULL);
666 PACKAGE_AN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/an.png", NULL);
667 PACKAGE_RI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ri.png", NULL);
668 PACKAGE_CH = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ch.png", NULL);
669 PACKAGE_SP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/sp.png", NULL);
670 PACKAGE_MS = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ms.png", NULL);
671 PACKAGE_TD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/td.png", NULL);
672 PACKAGE_MOL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/molecule.png", NULL);
673 PACKAGE_OGL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/opengl.png", NULL);
674 PACKAGE_OGLM = g_build_filename (PACKAGE_PREFIX,
"pixmaps/mol.png", NULL);
675 PACKAGE_OGLC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/mol.png", NULL);
676 PACKAGE_PRO = g_build_filename (PACKAGE_PREFIX,
"pixmaps/prop.png", NULL);
677 PACKAGE_SET = g_build_filename (PACKAGE_PREFIX,
"pixmaps/settings.png", NULL);
678 PACKAGE_LOGO = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo.png", NULL);
679 PACKAGE_LAGPL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo-agpl.png", NULL);
680 PACKAGE_LABOUT = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo-about.png", NULL);
681 PACKAGE_DOTA = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-a.png", NULL);
682 PACKAGE_DOTB = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-b.png", NULL);
683 PACKAGE_DOTC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-c.png", NULL);
684 PACKAGE_DOTD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-d.png", NULL);
685 PACKAGE_DOTE = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-e.png", NULL);
686 PACKAGE_DOTF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-f.png", NULL);
687 PACKAGE_DOTG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-g.png", NULL);
688 PACKAGE_DOTH = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-h.png", NULL);
689 PACKAGE_DFBD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/bd.png", NULL);
690 PACKAGE_DFAN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/an.png", NULL);
691 PACKAGE_DFDI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/di.png", NULL);
692 PACKAGE_DFTD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/td.png", NULL);
693 PACKAGE_DFIN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/in.png", NULL);
694 PACKAGE_SGCP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-P.png", NULL);
695 PACKAGE_SGCI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-I.png", NULL);
696 PACKAGE_SGCF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-F.png", NULL);
697 PACKAGE_SGHP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Hexagonal.png", NULL);
698 PACKAGE_SGTR = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Trigonal-R.png", NULL);
699 PACKAGE_SGTI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Tetragonal-I.png", NULL);
700 PACKAGE_SGTP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Tetragonal-P.png", NULL);
701 PACKAGE_SGOP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-P.png", NULL);
702 PACKAGE_SGOI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-I.png", NULL);
703 PACKAGE_SGOC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-C.png", NULL);
704 PACKAGE_SGOF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-F.png", NULL);
705 PACKAGE_SGMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Monoclinic-P.png", NULL);
706 PACKAGE_SGMI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Monoclinic-I.png", NULL);
707 PACKAGE_SGTC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Triclinic.png", NULL);
723 if (g_strcmp0 (argv[1],
"-h") == 0 || g_strcmp0 (argv[1],
"--help") == 0)
728 else if (g_strcmp0 (argv[1],
"-v") == 0 || g_strcmp0 (argv[1],
"--version") == 0)
740 flist -> file_name = g_strdup_printf (
"%s", argv[1]);
741 flist -> file_type = -i;
749 for (j=1; j<argc; j++)
754 if (k > 0 && j < argc-1)
763 ftmp -> next = g_malloc0(
sizeof*
ftmp -> next);
766 ftmp -> file_name = g_strdup_printf (
"%s", argv[j+1]);
767 ftmp -> file_type = k;
779 ftmp -> next = g_malloc0(
sizeof*
ftmp -> next);
782 ftmp -> file_name = g_strdup_printf (
"%s", argv[j]);
783 ftmp -> file_type = -k;
806 g_setenv (
"GSK_RENDERER",
"gl", TRUE);
807 g_setenv (
"GDK_DEBUG",
"gl-prefer-gl", TRUE);
816 g_setenv (
"GSK_RENDERER",
"gl", TRUE);
821 gtk_disable_setlocale ();
822#if GLIB_MINOR_VERSION < 74
823 AtomesApp = gtk_application_new (g_strdup_printf (
"fr.ipcms.atomes.prog-%d", (
int)clock()), G_APPLICATION_FLAGS_NONE);
825 AtomesApp = gtk_application_new (g_strdup_printf (
"fr.ipcms.atomes.prog-%d", (
int)clock()), G_APPLICATION_DEFAULT_FLAGS);
827 GError * error = NULL;
828 g_application_register (G_APPLICATION(
AtomesApp), NULL, & error);
int main(int argc, char *argv[])
initialization of the atomes program
int check_opengl_rendering()
check the initialization parameters for an OpenGL context
int test_this_arg(gchar *arg)
test an argument from the command line
void printversion()
print version information
GtkWidget * create_splash_window()
create splash screen window
GtkWidget * create_main_window(GApplication *app)
create the main application window
gboolean destroy_func(gpointer user_data)
destroy splash screen
G_MODULE_EXPORT void run_program(GApplication *app, gpointer data)
run the program
void open_this_data_file(int file_type, gchar *file_name)
open data file from the command line
void read_this_file(int file_type, gchar *this_file)
read file from the command line