276 gtk_window_set_decorated (GTK_WINDOW (splash_window), FALSE);
279 image = gtk_picture_new_for_filename (PACKAGE_LOGO);
280 gchar * backcol = g_strdup_printf (
"window#background {\n"
281 " background-color: rgba(255, 255, 255, 0.0);}");
283 gtk_widget_set_name (splash_window,
"background");
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);
294 image = gtk_image_new_from_file (PACKAGE_LOGO);
299 gtk_window_set_transient_for ((GtkWindow *)splash_window, (GtkWindow *)
MainWindow);
300 return splash_window;
359 end = g_strdup_printf (
"%c", file_name[strlen(file_name)-1]);
360 if (g_strcmp0 (file_name,
"*") == 0 || g_strcmp0 (end,
"*") == 0)
362 if (g_strcmp0 (file_name,
"*") == 0)
364 filedir = g_strdup_printf (
"./");
368 filedir = g_strdup_printf (
"%c", file_name[0]);
369 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf (
"%s%c", filedir, file_name[i]);
373 hFind = FindFirstFile (filedir, & ffd);
374 if (hFind != INVALID_HANDLE_VALUE)
376 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
378 str = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
382 while (FindNextFile(hFind, &ffd) != 0)
384 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
386 str = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
394 d = opendir (filedir);
397 while ((dir = readdir(
d)) != NULL)
399 if (dir -> d_type == DT_REG)
401 str = g_strdup_printf (
"%s/%s", filedir, dir -> d_name);
421 end = g_strdup_printf (
"%c", file_name[strlen(file_name)-1]);
422 if (g_strcmp0 (file_name,
"*") == 0 || g_strcmp0 (end,
"*") == 0)
424 if (g_strcmp0 (file_name,
"*") == 0)
426 filedir = g_strdup_printf (
"./");
430 filedir = g_strdup_printf (
"%c", file_name[0]);
431 for (i=1; i<strlen(file_name)-1; i++) filedir = g_strdup_printf (
"%s%c", filedir, file_name[i]);
435 hFind = FindFirstFile (filedir, & ffd);
436 if (hFind != INVALID_HANDLE_VALUE)
438 if (ffd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
441 active_project -> coordfile = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
444 while (FindNextFile(hFind, &ffd) != 0)
446 if (ffd.dwFileAttributes & ! FILE_ATTRIBUTE_DIRECTORY)
449 active_project -> coordfile = g_strdup_printf (
"%s\\%s", filedir, (gchar *)ffd.cFileName);
456 d = opendir (filedir);
459 while ((dir = readdir(
d)) != NULL)
461 if (dir -> d_type == DT_REG)
464 active_project -> coordfile = g_strdup_printf (
"%s/%s", filedir, dir -> d_name);
570int main (
int argc,
char *argv[])
572 gboolean RUNC = FALSE;
576 PACKAGE_PREFIX = g_win32_get_package_installation_directory_of_module (NULL);
578 PACKAGE_LIB_DIR = g_build_filename (PACKAGE_PREFIX,
"library", NULL);
579 PACKAGE_DATA_DIR = g_build_filename (PACKAGE_PREFIX,
"pixmaps", NULL);
580 PACKAGE_LOCALE_DIR = g_build_filename (PACKAGE_PREFIX,
"locale", NULL);
581 PACKAGE_IMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/import.png", NULL);
582 PACKAGE_CON = g_build_filename (PACKAGE_PREFIX,
"pixmaps/convert.png", NULL);
583 PACKAGE_IMG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/image.png", NULL);
584 PACKAGE_PDF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/pdf.png", NULL);
585 PACKAGE_SVG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/svg.png", NULL);
586 PACKAGE_EPS = g_build_filename (PACKAGE_PREFIX,
"pixmaps/eps.png", NULL);
587 PACKAGE_PNG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/png.png", NULL);
588 PACKAGE_JPG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/jpg.png", NULL);
589 PACKAGE_BMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bmp.png", NULL);
590 PACKAGE_TIFF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/tiff.png", NULL);
591 PACKAGE_VOID = g_build_filename (PACKAGE_PREFIX,
"pixmaps/void.png", NULL);
592 PACKAGE_GR = g_build_filename (PACKAGE_PREFIX,
"pixmaps/gr.png", NULL);
593 PACKAGE_SQ = g_build_filename (PACKAGE_PREFIX,
"pixmaps/sq.png", NULL);
594 PACKAGE_BD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bd.png", NULL);
595 PACKAGE_AN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/an.png", NULL);
596 PACKAGE_RI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ri.png", NULL);
597 PACKAGE_CH = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ch.png", NULL);
598 PACKAGE_SP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/sp.png", NULL);
599 PACKAGE_MS = g_build_filename (PACKAGE_PREFIX,
"pixmaps/ms.png", NULL);
600 PACKAGE_TD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/td.png", NULL);
601 PACKAGE_MOL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/molecule.png", NULL);
602 PACKAGE_OGL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/opengl.png", NULL);
603 PACKAGE_OGLM = g_build_filename (PACKAGE_PREFIX,
"pixmaps/mol.png", NULL);
604 PACKAGE_OGLC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/mol.png", NULL);
605 PACKAGE_PRO = g_build_filename (PACKAGE_PREFIX,
"pixmaps/prop.png", NULL);
606 PACKAGE_SET = g_build_filename (PACKAGE_PREFIX,
"pixmaps/settings.png", NULL);
607 PACKAGE_LOGO = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo.png", NULL);
608 PACKAGE_LAGPL = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo-agpl.png", NULL);
609 PACKAGE_LABOUT = g_build_filename (PACKAGE_PREFIX,
"pixmaps/logo-about.png", NULL);
610 PACKAGE_DOTA = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-a.png", NULL);
611 PACKAGE_DOTB = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-b.png", NULL);
612 PACKAGE_DOTC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-c.png", NULL);
613 PACKAGE_DOTD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-d.png", NULL);
614 PACKAGE_DOTE = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-e.png", NULL);
615 PACKAGE_DOTF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-f.png", NULL);
616 PACKAGE_DOTG = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-g.png", NULL);
617 PACKAGE_DOTH = g_build_filename (PACKAGE_PREFIX,
"pixmaps/dots/dots-h.png", NULL);
618 PACKAGE_DFBD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/bd.png", NULL);
619 PACKAGE_DFAN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/an.png", NULL);
620 PACKAGE_DFDI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/di.png", NULL);
621 PACKAGE_DFTD = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/td.png", NULL);
622 PACKAGE_DFIN = g_build_filename (PACKAGE_PREFIX,
"pixmaps/field/in.png", NULL);
623 PACKAGE_SGCP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-P.png", NULL);
624 PACKAGE_SGCI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-I.png", NULL);
625 PACKAGE_SGCF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Cubic-F.png", NULL);
626 PACKAGE_SGHP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Hexagonal.png", NULL);
627 PACKAGE_SGTR = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Trigonal-R.png", NULL);
628 PACKAGE_SGTI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Tetragonal-I.png", NULL);
629 PACKAGE_SGTP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Tetragonal-P.png", NULL);
630 PACKAGE_SGOP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-P.png", NULL);
631 PACKAGE_SGOI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-I.png", NULL);
632 PACKAGE_SGOC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-C.png", NULL);
633 PACKAGE_SGOF = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Orthorhombic-F.png", NULL);
634 PACKAGE_SGMP = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Monoclinic-P.png", NULL);
635 PACKAGE_SGMI = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Monoclinic-I.png", NULL);
636 PACKAGE_SGTC = g_build_filename (PACKAGE_PREFIX,
"pixmaps/bravais/Triclinic.png", NULL);
637 ATOMES_CONFIG = g_build_filename (PACKAGE_PREFIX,
"atomes.cfg", NULL);
640 struct passwd * pw = getpwuid(getuid());
641 ATOMES_CONFIG = g_strdup_printf (
"%s/.atomes.cfg", pw -> pw_dir);
650 if (g_strcmp0 (argv[1],
"-h") == 0 || g_strcmp0 (argv[1],
"--help") == 0)
655 else if (g_strcmp0 (argv[1],
"-v") == 0 || g_strcmp0 (argv[1],
"--version") == 0)
667 flist -> file_name = g_strdup_printf (
"%s", argv[1]);
668 flist -> file_type = -i;
676 for (j=1; j<argc; j++)
681 if (k > 0 && j < argc-1)
690 ftmp -> next = g_malloc0(
sizeof*
ftmp -> next);
693 ftmp -> file_name = g_strdup_printf (
"%s", argv[j+1]);
694 ftmp -> file_type = k;
706 ftmp -> next = g_malloc0(
sizeof*
ftmp -> next);
709 ftmp -> file_name = g_strdup_printf (
"%s", argv[j]);
710 ftmp -> file_type = -k;
725 gtk_disable_setlocale ();
726#if GLIB_MINOR_VERSION < 74
727 AtomesApp = gtk_application_new (g_strdup_printf (
"atomes.prog-%d", (
int)clock()), G_APPLICATION_FLAGS_NONE);
729 AtomesApp = gtk_application_new (g_strdup_printf (
"atomes.prog-%d", (
int)clock()), G_APPLICATION_DEFAULT_FLAGS);
int main(int argc, char *argv[])
initalization of the atomes program
int test_this_arg(gchar *arg)
test an argument from the command line
GtkWidget * create_main_window(GApplication *app)
create the main application window
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