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);
582 g_print (
"proc_dir= %s\n", proc_dir);
583 g_print (
"proc_path= %s\n", proc_path);
585 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
588 GSubprocessLauncher * proc_launch = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
589 g_subprocess_launcher_set_cwd (proc_launch, proc_dir);
590 GSubprocess * proc = g_subprocess_launcher_spawn (proc_launch, & error, proc_path, NULL);
592 GSubprocess * proc = g_subprocess_new (G_SUBPROCESS_FLAGS_NONE, & error, proc_path, NULL);
595 g_print (
"subprocess: %p\n", proc);
598 g_print (
"error: %s\n", error -> message);
599 g_clear_error (& error);
601 g_subprocess_wait (proc, NULL, & error);
602 int res = g_subprocess_get_exit_status (proc);
603 g_clear_object (& proc);
606 g_clear_object (& proc_launch);
611 gchar * ogl_info = NULL;
615 ogl_info = g_strdup_printf (
"Fatal error on OpenGL initialization: trying to adjust environment !");
618 ogl_info = g_strdup_printf (
"Impossible to initialize the OpenGL 3D rendering !");
621 ogl_info = g_strdup_printf (
"GDK visual must be modified to initialize the OpenGL context !");
628 g_print (
"%s\n", ogl_info);
643int main (
int argc,
char *argv[])
645 gboolean RUNC = FALSE;
648 PACKAGE_PREFIX = g_win32_get_package_installation_directory_of_module (NULL);
652 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/import.png", NULL);
653 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/import.png", NULL);
654 PACKAGE_CON = g_build_filename (PACKAGE_PREFIX,
"pixmaps/convert.png", NULL);
655 PACKAGE_IMG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/image.png", NULL);
656 PACKAGE_PDF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/pdf.png", NULL);
657 PACKAGE_SVG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/svg.png", NULL);
658 PACKAGE_EPS = g_build_filename (PACKAGE_PREFIX,
"pixmaps/eps.png", NULL);
659 PACKAGE_PNG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/png.png", NULL);
660 PACKAGE_JPG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/jpg.png", NULL);
661 PACKAGE_BMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bmp.png", NULL);
662 PACKAGE_TIFF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/tiff.png", NULL);
663 PACKAGE_VOID = g_build_filename (PACKAGE_PREFIX,
"pixmaps/void.png", NULL);
664 PACKAGE_GR = g_build_filename (PACKAGE_PREFIX,
"pixmaps/gr.png", NULL);
665 PACKAGE_SQ = g_build_filename (PACKAGE_PREFIX,
"pixmaps/sq.png", NULL);
666 PACKAGE_BD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bd.png", NULL);
667 PACKAGE_AN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/an.png", NULL);
668 PACKAGE_RI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ri.png", NULL);
669 PACKAGE_CH = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ch.png", NULL);
670 PACKAGE_SP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/sp.png", NULL);
671 PACKAGE_MS = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ms.png", NULL);
672 PACKAGE_TD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/td.png", NULL);
673 PACKAGE_MOL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/molecule.png", NULL);
674 PACKAGE_OGL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/opengl.png", NULL);
675 PACKAGE_OGLM = g_build_filename (PACKAGE_PREFIX,
"pixmaps/mol.png", NULL);
676 PACKAGE_OGLC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/mol.png", NULL);
677 PACKAGE_PRO = g_build_filename (PACKAGE_PREFIX,
"pixmaps/prop.png", NULL);
678 PACKAGE_SET = g_build_filename (PACKAGE_PREFIX,
"pixmaps/settings.png", NULL);
679 PACKAGE_LOGO = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo.png", NULL);
680 PACKAGE_LAGPL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo-agpl.png", NULL);
681 PACKAGE_LABOUT = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo-about.png", NULL);
682 PACKAGE_DOTA = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-a.png", NULL);
683 PACKAGE_DOTB = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-b.png", NULL);
684 PACKAGE_DOTC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-c.png", NULL);
685 PACKAGE_DOTD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-d.png", NULL);
686 PACKAGE_DOTE = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-e.png", NULL);
687 PACKAGE_DOTF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-f.png", NULL);
688 PACKAGE_DOTG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-g.png", NULL);
689 PACKAGE_DOTH = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-h.png", NULL);
690 PACKAGE_DFBD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/bd.png", NULL);
691 PACKAGE_DFAN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/an.png", NULL);
692 PACKAGE_DFDI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/di.png", NULL);
693 PACKAGE_DFTD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/td.png", NULL);
694 PACKAGE_DFIN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/in.png", NULL);
695 PACKAGE_SGCP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-P.png", NULL);
696 PACKAGE_SGCI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-I.png", NULL);
697 PACKAGE_SGCF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-F.png", NULL);
698 PACKAGE_SGHP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Hexagonal.png", NULL);
699 PACKAGE_SGTR = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Trigonal-R.png", NULL);
700 PACKAGE_SGTI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Tetragonal-I.png", NULL);
701 PACKAGE_SGTP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Tetragonal-P.png", NULL);
702 PACKAGE_SGOP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-P.png", NULL);
703 PACKAGE_SGOI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-I.png", NULL);
704 PACKAGE_SGOC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-C.png", NULL);
705 PACKAGE_SGOF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-F.png", NULL);
706 PACKAGE_SGMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Monoclinic-P.png", NULL);
707 PACKAGE_SGMI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Monoclinic-I.png", NULL);
708 PACKAGE_SGTC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Triclinic.png", NULL);
724 if (g_strcmp0 (argv[1],
"-h") == 0 || g_strcmp0 (argv[1],
"--help") == 0)
729 else if (g_strcmp0 (argv[1],
"-v") == 0 || g_strcmp0 (argv[1],
"--version") == 0)
741 flist -> file_name = g_strdup_printf (
"%s", argv[1]);
742 flist -> file_type = -i;
750 for (j=1; j<argc; j++)
755 if (k > 0 && j < argc-1)
764 ftmp -> next = g_malloc0(
sizeof*
ftmp -> next);
767 ftmp -> file_name = g_strdup_printf (
"%s", argv[j+1]);
768 ftmp -> file_type = k;
780 ftmp -> next = g_malloc0(
sizeof*
ftmp -> next);
783 ftmp -> file_name = g_strdup_printf (
"%s", argv[j]);
784 ftmp -> file_type = -k;
807 g_setenv (
"GSK_RENDERER",
"gl", TRUE);
808 g_setenv (
"GDK_DEBUG",
"gl-prefer-gl", TRUE);
817 g_setenv (
"GSK_RENDERER",
"gl", TRUE);
822 gtk_disable_setlocale ();
823#if GLIB_MINOR_VERSION < 74
824 AtomesApp = gtk_application_new (g_strdup_printf (
"fr.ipcms.atomes.prog-%d", (
int)clock()), G_APPLICATION_FLAGS_NONE);
826 AtomesApp = gtk_application_new (g_strdup_printf (
"fr.ipcms.atomes.prog-%d", (
int)clock()), G_APPLICATION_DEFAULT_FLAGS);
828 GError * error = NULL;
829 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