atomes 1.2.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
gui.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-2025 by CNRS and University of Strasbourg */
15
24/*
25* This file: 'gui.c'
26*
27* Contains:
28*
29
30 - The GUI of the main window
31 - The menu elements of the workspace menu
32 - Creation of menu items, actions, of menu items, actions, used in the entire atomes software
33
34*
35* List of functions:
36
37 G_MODULE_EXPORT gboolean pop_menu (GtkWidget * widget, GdkEventButton * event, gpointer data);
38
39 void clean_view ();
40 void view_buffer (GtkTextBuffer * buffer);
41 void atomes_key_pressed (guint keyval, GdkModifierType state);
42 void add_action (GSimpleAction * action);
43 void remove_action (gchar * action_name);
44 void remove_edition_actions ();
45 void remove_edition_and_analyze_actions ();
46 void widget_add_action (GSimpleActionGroup * action_group, const gchar * act, GCallback handler, gpointer data,
47 gboolean check, gboolean status, gboolean radio, const gchar * stat);
48 void append_submenu (GMenu * menu, const gchar * label, GMenu * submenu);
49 void append_menu_item (GMenu * menu, const gchar * label, const gchar * action, const gchar * accel,
50 const gchar * custom, int format, const gchar * icon,
51 gboolean check, gboolean status, gboolean radio, const gchar * rstatus);
52
53 G_MODULE_EXPORT void show_periodic_table (GtkWidget * widg, gpointer data);
54 G_MODULE_EXPORT void atomes_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data);
55 G_MODULE_EXPORT void atomes_popup_menu (GtkGesture * gesture, int n_press, double x, double y, gpointer data);
56
57 GtkWidget * create_main_window (GApplication * atomes);
58
59 GIcon * get_gicon_from_data (int format, const gchar * icon);
60
61 GMenuItem * create_gmenu_item (const gchar * label, const gchar * action, const gchar * accel,
62 const gchar * custom, int format, const gchar * icon,
63 gboolean check, gboolean status, gboolean radio, const gchar * rstatus);
64
65 GMenu * workspace_section (gchar * act, int pop);
66 GMenu * port_section (gchar * act, int pop, int port);
67 GMenu * project_section (gchar * act, int pop_up, int proj, int calc);
68 GMenu * import_section (gchar * act);
69 GMenu * quit_section (gchar * act);
70 GMenu * workspace_title ();
71 GMenu * project_title (int pop_up, int proj);
72 GMenu * create_workspace_menu (gchar * act, int pop_up, int proj, int calc);
73 GMenu * create_edit_menu ();
74 GMenu * tool_box_section ();
75 GMenu * create_analyze_menu ();
76 GMenu * create_help_menu ();
77 GMenu * atomes_menu_bar ();
78
79*/
80
81#include "global.h"
82#include "callbacks.h"
83#include "interface.h"
84#include "project.h"
85#include "workspace.h"
86
87extern int objects[3];
88extern int * object_was_selected[3];
89extern int ** tmp_object_id[3];
90extern GtkWidget * curvetbox ();
91extern GtkWidget * work_menu (int p, int c);
92
93extern G_MODULE_EXPORT void compute_this_prop (GtkWidget * widg, gpointer data);
94extern G_MODULE_EXPORT void on_create_new_project (GtkWidget * widg, gpointer data);
95extern int get_atom_id_from_periodic_table (atom_search * asearch);
96extern G_MODULE_EXPORT void leaving_from_menu (GtkWidget * widg, gpointer data);
97extern G_MODULE_EXPORT void on_edit_activate (GtkWidget * widg, gpointer data);
98extern G_MODULE_EXPORT void on_calc_activate (GtkWidget * widg, gpointer data);
100
101#ifdef GTK3
102GtkWidget * MainEvent;
103#endif
104
105gchar * dots[NDOTS];
106gchar * calc_img[NCALCS-2];
108
109atomes_action edition_acts[] = {{"edit.chemistry", GINT_TO_POINTER(0)},
110 {"edit.periodicity", GINT_TO_POINTER(1)},
111 {"edit.cutoffs", GINT_TO_POINTER(2)}};
112
113atomes_action analyze_acts[] = {{"analyze.gr", GINT_TO_POINTER(0)},
114 {"analyze.sq", GINT_TO_POINTER(1)},
115 {"analyze.sk", GINT_TO_POINTER(2)},
116 {"analyze.gk", GINT_TO_POINTER(3)},
117 {"analyze.bonds", GINT_TO_POINTER(4)},
118 {"analyze.rings", GINT_TO_POINTER(5)},
119 {"analyze.chains", GINT_TO_POINTER(6)},
120 {"analyze.sp", GINT_TO_POINTER(7)},
121 {"analyze.msd", GINT_TO_POINTER(8)}};
122
123char * calc_name[NCALCS-2] = {"g(r)/G(r)",
124 "S(q) from FFT[g(r)]",
125 "S(q) from Debye equation",
126 "g(r)/G(r) from FFT[S(q)]",
127 "Bonds and angles",
128 "Ring statistics",
129 "Chain statistics",
130 "Spherical harmonics",
131 "Mean Squared Displacement",
132 "Bond valence"};
133
134char * graph_name[NGRAPHS] = {"g(r)/G(r)",
135 "S(q) from FFT[g(r)]",
136 "S(q) from Debye equation",
137 "g(r)/G(r) from FFT[S(q)]",
138 "Bonds properties",
139 "Angle distributions",
140 "Ring statistics",
141 "Chain statistics",
142 "Spherical harmonics",
143 "Mean Squared Displacement"};
144
148
150 { "About", "open about dialog", GDK_KEY_a, "<Ctrl>a" },
151 { "Periodic table", "open periodic table", GDK_KEY_p, "<Ctrl>p" },
152 { "Quit", "quit atomes", GDK_KEY_q, "<Ctrl>q" },
153//};
154//{
155 { "Open workspace", "open atomes workspace", GDK_KEY_w, "<Ctrl>w" },
156 { "Save workspace", "save atomes workspace", GDK_KEY_s, "<Ctrl>s" },
157 { "Close workspace", "close atomes workspace", GDK_KEY_c, "<Ctrl>c" },
158//};
159//{
160 { "New project", "create new atomes project", GDK_KEY_n, "<Ctrl>n" },
161 { "Open project", "open atomes project", GDK_KEY_o, "<Ctrl>o" }
162};
163
164gchar * main_section_names[] = { "Main" };
166gchar * main_group_names[] = { "General", "Workspace", "Projects" };
167int main_shortcut_by_group[] = { 3, 3, 2 };
168
181GtkWidget * shortcuts_window (int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups],
182 gchar * section_names[sections], gchar * group_names[groups], shortcuts shortcs[])
183{
184 GtkShortcutsWindow * win = NULL;
185#ifdef G_OS_WIN32
186 win = g_object_new (GTK_TYPE_SHORTCUTS_WINDOW, "modal", FALSE, "resizable", TRUE, "deletable", TRUE, NULL);
187#else
188 win = g_object_new (GTK_TYPE_SHORTCUTS_WINDOW, "modal", FALSE, "resizable", TRUE, NULL);
189#endif
190 GtkShortcutsSection * shortcut_section[sections];
191 GtkShortcutsGroup * shortcut_group[groups];
192 GtkShortcutsShortcut * shortcut;
193#ifdef GTK4
194#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
195 GtkWidget * sections_book = gtk_notebook_new ();
196 gtk_notebook_set_scrollable (GTK_NOTEBOOK(sections_book), TRUE);
197 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(sections_book), GTK_POS_TOP);
198#endif
199#endif // GTK4
200 int i, j, k, l, m;
201 l = m = 0;
202 for (i=0; i<sections; i++)
203 {
204 shortcut_section[i] = g_object_new (GTK_TYPE_SHORTCUTS_SECTION, "visible", TRUE, "title", section_names[i], "section-name", section_names[i], NULL);
205#ifdef GTK4
206#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
207 gtk_orientable_set_orientation ((GtkOrientable *)shortcut_section[i], GTK_ORIENTATION_HORIZONTAL);
208#endif
209#endif
210 for (j=0; j<group_by_section[i]; j++, l++)
211 {
212 shortcut_group[l] = g_object_new (GTK_TYPE_SHORTCUTS_GROUP, "visible", TRUE, "title", group_names[l], NULL);
213 for (k=0; k<shortcut_by_group[l]; k++, m++)
214 {
215 shortcut = g_object_new (GTK_TYPE_SHORTCUTS_SHORTCUT,
216 "visible", TRUE,
217 "shortcut-type", GTK_SHORTCUT_ACCELERATOR,
218 "accelerator", shortcs[m].accelerator,
219 "title", shortcs[m].description,
220 NULL );
221#ifdef GTK4
222#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
223 gtk_shortcuts_group_add_shortcut (shortcut_group[l], shortcut);
224#else
225 add_box_child_start (GTK_ORIENTATION_VERTICAL, (GtkWidget *)shortcut_group[l], (GtkWidget *)shortcut, FALSE, FALSE, 0);
226#endif
227#else
228 gtk_container_add (GTK_CONTAINER((GtkWidget *)shortcut_group[l]), (GtkWidget *)shortcut);
229#endif
230 }
231#ifdef GTK4
232#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
233 gtk_shortcuts_section_add_group (shortcut_section[i], shortcut_group[l]);
234#else
235 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, (GtkWidget *)shortcut_section[i], (GtkWidget *)shortcut_group[l], FALSE, FALSE, 0);
236#endif
237#else
238 gtk_container_add (GTK_CONTAINER((GtkWidget *)shortcut_section[i]), (GtkWidget *)shortcut_group[l]);
239#endif
240 }
241#ifdef GTK4
242#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
243 gtk_shortcuts_window_add_section (GTK_SHORTCUTS_WINDOW(win), shortcut_section[i]);
244#else
245 gtk_notebook_append_page (GTK_NOTEBOOK(sections_book), (GtkWidget *)shortcut_section[i], gtk_label_new (section_names[i]));
246#endif
247#else
248 gtk_container_add (GTK_CONTAINER((GtkWidget *)win), (GtkWidget *)shortcut_section[i]);
249#endif
250 }
251#ifdef GTK4
252#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
253 gtk_window_set_child ((GtkWindow*) win, sections_book);
254#endif
255#endif
256 add_gtk_close_event ((GtkWidget *)win, G_CALLBACK(destroy_this_window), NULL);
257 show_the_widgets ((GtkWidget *)win);
258 return (GtkWidget *)win;
259}
260
261#ifdef GTK3
271G_MODULE_EXPORT gboolean pop_menu (GtkWidget * widget, GdkEventButton * event, gpointer data)
272{
273 if (event -> button == 3)
274 {
275 pop_menu_at_pointer (work_menu (-1, -1), (GdkEvent *)event);
276 }
277 return FALSE;
278}
279#endif
280
287{
290#ifdef GTK4
291 atomes_logo = gtk_picture_new_for_filename (PACKAGE_LOGO);
292 gtk_widget_set_size_request (atomes_logo, 550, -1);
294#else
295 atomes_logo = gtk_image_new_from_file (PACKAGE_LOGO);
297 gtk_container_add (GTK_CONTAINER(MainEvent), atomes_logo);
298 show_the_widgets (MainEvent);
299#endif
300}
301
309void view_buffer (GtkTextBuffer * buffer)
310{
311 if (atomes_logo)
312 {
314#ifdef GTK4
315 gtk_scrolled_window_set_child ((GtkScrolledWindow *)MainScrol[1], NULL);
316#endif
317 }
318 gboolean add = FALSE;
319 if (! MainView)
320 {
321 MainView = gtk_text_view_new ();
322 gtk_text_view_set_editable (GTK_TEXT_VIEW(MainView), 0);
324 add = TRUE;
325 }
326 gtk_text_view_set_buffer (GTK_TEXT_VIEW(MainView), buffer);
327#ifdef GTK3
328 if (! MainScrol[1])
329 {
330 MainScrol[1] = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
331 gtk_container_add (GTK_CONTAINER(MainEvent), MainScrol[1]);
332 add = TRUE;
333 }
334 if (add) gtk_container_add (GTK_CONTAINER(MainScrol[1]), MainView);
335#else
336 if (add)
337 {
339 }
340#endif
342}
343
352void atomes_key_pressed (guint keyval, GdkModifierType state)
353{
354 if (state & GDK_CONTROL_MASK)
355 {
356 switch (keyval)
357 {
358 case GDK_KEY_a:
359 create_about_dialog (NULL, NULL);
360 break;
361 case GDK_KEY_c:
362 on_close_workspace (NULL, GINT_TO_POINTER(1));
363 break;
364 case GDK_KEY_n:
365 on_create_new_project (NULL, NULL);
366 break;
367 case GDK_KEY_o:
368 on_open_save_activate (NULL, GINT_TO_POINTER(0));
369 break;
370 case GDK_KEY_p:
372 break;
373 case GDK_KEY_q:
374#ifdef GTK4
375 leaving_question (NULL, NULL);
376#else
377 leaving_question (NULL, NULL, NULL);
378#endif
379 break;
380 case GDK_KEY_s:
381 on_save_as_activate (NULL, GINT_TO_POINTER(3));
382 break;
383 case GDK_KEY_t:
384 on_show_curve_toolbox (NULL, NULL);
385 break;
386 case GDK_KEY_w:
387 on_open_save_activate (NULL, GINT_TO_POINTER(2));
388 break;
389 }
390 }
391}
392
400void add_action (GSimpleAction * action)
401{
402 g_action_map_add_action (G_ACTION_MAP(AtomesApp), G_ACTION(action));
403}
404
413{
414 g_action_map_remove_action (G_ACTION_MAP(AtomesApp), (const gchar *)action_name);
415}
416
423{
424 int i;
425 for (i=0; i<G_N_ELEMENTS(edition_acts); i++) remove_action (edition_acts[i].action_name);
426}
427
434{
436 int i;
437 for (i=0; i<G_N_ELEMENTS(analyze_acts); i++) remove_action (analyze_acts[i].action_name);
438}
439
448G_MODULE_EXPORT void show_periodic_table (GtkWidget * widg, gpointer data)
449{
451}
452
462G_MODULE_EXPORT void atomes_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data)
463{
464 gchar * name = g_strdup_printf ("%s", g_action_get_name(G_ACTION(action)));
465 if (g_strcmp0 (name, "workspace.open") == 0)
466 {
467 on_open_save_activate (NULL, data);
468 }
469 else if (g_strcmp0 (name, "workspace.save") == 0)
470 {
471 on_open_save_activate (NULL, data);
472 }
473 else if (g_strcmp0 (name, "workspace.save-as") == 0)
474 {
475 on_save_as_activate (NULL, data);
476 }
477 else if (g_strcmp0 (name, "workspace.close") == 0)
478 {
479 on_close_workspace (NULL, data);
480 }
481 else if (g_strcmp0 (name, "project.new") == 0)
482 {
483 on_create_new_project (NULL, data);
484 }
485 else if (g_strcmp0 (name, "project.edit") == 0)
486 {
487 change_project_name (NULL, data);
488 }
489 else if (g_strcmp0 (name, "project.active") == 0)
490 {
491 activate_project (NULL, data);
492 }
493 else if (g_strcmp0 (name, "project.compute") == 0)
494 {
495 compute_this_prop (NULL, data);
496 }
497 else if (g_strcmp0 (name, "project.open") == 0)
498 {
499 on_open_save_activate (NULL, data);
500 }
501 else if (g_strcmp0 (name, "project.save") == 0)
502 {
503 on_open_save_activate (NULL, data);
504 }
505 else if (g_strcmp0 (name, "project.save-as") == 0)
506 {
507 on_save_as_activate (NULL, data);
508 }
509 else if (g_strcmp0 (name, "project.close") == 0)
510 {
511 on_close_activate (NULL, data);
512 }
513 else if (g_strcmp0 (name, "export.isaacs") == 0)
514 {
515 on_isaacs_port (NULL, data);
516 }
517 else if (g_strcmp0 (name, "export.coordinates") == 0)
518 {
519 on_coord_port (NULL, data);
520 }
521 else if (g_strcmp0 (name, "import.isaacs") == 0)
522 {
523 on_isaacs_port (NULL, data);
524 }
525 else if (g_strcmp0 (name, "import.coordinates") == 0)
526 {
527 on_coord_port (NULL, data);
528 }
529 else if (g_strcmp0 (name, "program.quit") == 0)
530 {
531 leaving_from_menu (NULL, data);
532 }
533 else if (g_strcmp0 (name, "edit.chemistry") == 0)
534 {
535 on_edit_activate (NULL, data);
536 }
537 else if (g_strcmp0 (name, "edit.periodicity") == 0)
538 {
539 on_edit_activate (NULL, data);
540 }
541 else if (g_strcmp0 (name, "edit.cutoffs") == 0)
542 {
543 on_edit_activate (NULL, data);
544 }
545 else if (g_strcmp0 (name, "analyze.gr") == 0)
546 {
547 on_calc_activate (NULL, data);
548 }
549 else if (g_strcmp0 (name, "analyze.sq") == 0)
550 {
551 on_calc_activate (NULL, data);
552 }
553 else if (g_strcmp0 (name, "analyze.sk") == 0)
554 {
555 on_calc_activate (NULL, data);
556 }
557 else if (g_strcmp0 (name, "analyze.gk") == 0)
558 {
559 on_calc_activate (NULL, data);
560 }
561 else if (g_strcmp0 (name, "analyze.bonds") == 0)
562 {
563 on_calc_activate (NULL, data);
564 }
565 else if (g_strcmp0 (name, "analyze.rings") == 0)
566 {
567 on_calc_activate (NULL, data);
568 }
569 else if (g_strcmp0 (name, "analyze.chains") == 0)
570 {
571 on_calc_activate (NULL, data);
572 }
573 else if (g_strcmp0 (name, "analyze.sp") == 0)
574 {
575 on_calc_activate (NULL, data);
576 }
577 else if (g_strcmp0 (name, "analyze.msd") == 0)
578 {
579 on_calc_activate (NULL, data);
580 }
581 else if (g_strcmp0 (name, "analyze.tool-box") == 0)
582 {
583 on_show_curve_toolbox (NULL, data);
584 }
585 else if (g_strcmp0 (name, "help.periodic") == 0)
586 {
587 show_periodic_table (NULL, data);
588 }
589 else if (g_strcmp0 (name, "help.about") == 0)
590 {
591 create_about_dialog (NULL, data);
592 }
593 else if (g_strcmp0 (name, "help.shortcuts") == 0)
594 {
598 }
599 else if (g_strcmp0 (name, "help.preferences") == 0)
600 {
602 }
603 g_free (name);
604}
605
614GIcon * get_gicon_from_data (int format, const gchar * icon)
615{
616 switch (format)
617 {
618 case IMG_FILE:
619 return g_file_icon_new (g_file_new_for_path (icon));
620 break;
621 case IMG_STOCK:
622 return g_themed_icon_new (icon);
623 break;
624 default:
625 return NULL;
626 break;
627 }
628}
629
645void widget_add_action (GSimpleActionGroup * action_group, const gchar * act, GCallback handler, gpointer data,
646 gboolean check, gboolean status, gboolean radio, const gchar * stat)
647{
648 GSimpleAction * action;
649 GVariant * action_state;
650 if (radio)
651 {
652 action_state = g_variant_new_string (stat);
653 action = g_simple_action_new_stateful (act, G_VARIANT_TYPE_STRING, action_state);
654 }
655 else if (check)
656 {
657 action_state = g_variant_new_boolean (status);
658 action = g_simple_action_new_stateful (act, NULL, action_state);
659 }
660 else
661 {
662 action = g_simple_action_new (act, NULL);
663 }
664 g_signal_connect (action, "activate", handler, data);
665 g_action_map_add_action (G_ACTION_MAP(action_group), G_ACTION(action));
666}
667
686GMenuItem * create_gmenu_item (const gchar * label, const gchar * action, const gchar * accel,
687 const gchar * custom, int format, const gchar * icon,
688 gboolean check, gboolean status, gboolean radio, const gchar * rstatus)
689{
690 GMenuItem * item;
691 item = g_menu_item_new (label, action);
692 /* GKT4 bug, normally mark-up should be provided using boolean:
693 g_menu_item_set_attribute (item, "use-markup", "b", TRUE, NULL);
694 But it does not work, however it does using a string: */
695 g_menu_item_set_attribute (item, "use-markup", "s", "TRUE", NULL);
696 if (custom)
697 {
698 g_menu_item_set_attribute (item, "custom", "s", custom, NULL);
699 // g_menu_item_set_attribute_value (item, "custom", g_variant_new_string (custom));
700 GVariant * cust = g_menu_item_get_attribute_value (item, "custom", g_variant_type_new("s"));
701 if (cust) g_print ("item :: %s, custom :: %s\n", label, g_variant_get_string (cust, NULL));
702 }
703 else
704 {
705 if (accel) g_menu_item_set_attribute (item, "accel", "s", accel, NULL);
706 // if (check) g_menu_item_set_attribute (item, "target", "b", status, NULL);
707 if (radio) g_menu_item_set_attribute (item, "target", "s", rstatus, NULL);
708#ifdef MENU_ICONS
709 if (icon)
710 {
711 GIcon * gicon = get_gicon_from_data (format, icon);
712 if (gicon)
713 {
714 g_menu_item_set_icon (item, gicon);
715 g_object_unref (gicon);
716 }
717 }
718#endif
719 }
720 return item;
721}
722
732void append_submenu (GMenu * menu, const gchar * label, GMenu * submenu)
733{
734 GMenuItem * item = g_menu_item_new (label, NULL);
735 /* GKT4 bug, normally mark-up should be provided using boolean:
736 g_menu_item_set_attribute (item, "use-markup", "b", TRUE, NULL);
737 But it does not work, however it does using a string: */
738 g_menu_item_set_attribute (item, "use-markup", "s", "TRUE", NULL);
739 g_menu_item_set_submenu (item, (GMenuModel *)submenu);
740 g_menu_append_item (menu, item);
741}
742
762void append_menu_item (GMenu * menu, const gchar * label, const gchar * action, const gchar * accel,
763 const gchar * custom, int format, const gchar * icon,
764 gboolean check, gboolean status, gboolean radio, const gchar * rstatus)
765{
766 GMenuItem * item = create_gmenu_item (label, action, accel, custom, format, icon, check, status, radio, rstatus);
767 g_menu_append_item (menu, item);
768 g_object_unref (item);
769}
770
779GMenu * workspace_section (gchar * act, int pop)
780{
781 GMenu * menu = g_menu_new ();
782 gchar * str;
783 str = g_strdup_printf ("%s.workspace.open", act);
784 append_menu_item (menu, "Open", (const gchar *)str, "<CTRL>W", NULL, IMG_STOCK, FOPEN, FALSE, FALSE, FALSE, NULL);
785 g_free (str);
786 if (! pop || nprojects)
787 {
788 str = g_strdup_printf ("%s.workspace.save", act);
789 append_menu_item (menu, "Save", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVE, FALSE, FALSE, FALSE, NULL);
790 g_free (str);
791 str = g_strdup_printf ("%s.workspace.save-as", act);
792 append_menu_item (menu, "Save As", (const gchar *)str, "<CTRL>S", NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
793 g_free (str);
794 str = g_strdup_printf ("%s.workspace.close", act);
795 append_menu_item (menu, "Close", (const gchar *)str, "<CTRL>C", NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
796 g_free (str);
797 }
798 return menu;
799}
800
810GMenu * port_section (gchar * act, int pop, int port)
811{
812 gchar * port_action[2]={"export", "import"};
813 GMenu * menu = g_menu_new ();
814 gchar * str;
815 str = g_strdup_printf ("%s.%s.isaacs", act, port_action[port]);
816 append_menu_item (menu, "ISAACS Project File (*.ipf)", (const gchar *)str, NULL, NULL, IMG_FILE, PACKAGE_MOL, FALSE, FALSE, FALSE, NULL);
817 g_free (str);
818 str = g_strdup_printf ("%s.%s.coordinates", act, port_action[port]);
819 append_menu_item (menu, "Atomic Coordinates", (const gchar *)str, NULL, NULL, IMG_FILE, (port) ? PACKAGE_IMP : PACKAGE_CON, FALSE, FALSE, FALSE, NULL);
820 g_free (str);
821 return menu;
822}
823
834GMenu * project_section (gchar * act, int pop_up, int proj, int calc)
835{
836 GMenu * menu = g_menu_new ();
837 gchar * str, * str_n;
838 if (pop_up && nprojects && proj > -1)
839 {
840 if (activep != proj)
841 {
842 str = g_strdup_printf ("%s.project.active", act);
843 append_menu_item (menu, "Make Active", (const gchar *)str, NULL, NULL, IMG_STOCK, YES, FALSE, FALSE, FALSE, NULL);
844 g_free (str);
845 }
846 if (calc > -1)
847 {
848 str = g_strdup_printf ("%s.project.compute", act);
849 str_n = g_strdup_printf ("Analyze: %s", work_menu_items[calc+4]);
850 append_menu_item (menu, str_n, (get_project_by_id(proj) -> runok[calc]) ? (const gchar *)str : "None", NULL, NULL, IMG_FILE, graph_img[calc], FALSE, FALSE, FALSE, NULL);
851 g_free (str);
852 g_free (str_n);
853 }
854 str = g_strdup_printf ("%s.project.edit", act);
855 append_menu_item (menu, "Edit Name", (const gchar *)str, NULL, NULL, IMG_STOCK, EDITA, FALSE, FALSE, FALSE, NULL);
856 g_free (str);
857 }
858 str = g_strdup_printf ("%s.project.new", act);
859 append_menu_item (menu, "New", (const gchar *)str, "<CTRL>N", NULL, IMG_STOCK, FNEW, FALSE, FALSE, FALSE, NULL);
860 g_free (str);
861 str = g_strdup_printf ("%s.project.open", act);
862 append_menu_item (menu, "Open", (const gchar *)str, "<CTRL>O", NULL, IMG_STOCK, FOPEN, FALSE, FALSE, FALSE, NULL);
863 g_free (str);
864 if (! pop_up || proj > -1)
865 {
866 str = g_strdup_printf ("%s.project.save", act);
867 append_menu_item (menu, "Save", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVE, FALSE, FALSE, FALSE, NULL);
868 g_free (str);
869 str = g_strdup_printf ("%s.project.save-as", act);
870 append_menu_item (menu, "Save As", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
871 g_free (str);
872 str = g_strdup_printf ("%s.project.close", act);
873 append_menu_item (menu, "Close", (const gchar *)str, NULL, NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
874 g_free (str);
875 append_submenu (menu, "Export", port_section(act, pop_up, 0));
876 }
877 return menu;
878}
879
887GMenu * import_section (gchar * act)
888{
889 GMenu * menu = g_menu_new ();
890 append_submenu (menu, "Import", port_section(act, 0, 1));
891 return menu;
892}
893
901GMenu * quit_section (gchar * act)
902{
903 GMenu * menu = g_menu_new ();
904 gchar * str = g_strdup_printf ("%s.program.quit", act);
905 append_menu_item (menu, "Quit", (const gchar *)str, "<CTRL>Q", NULL, IMG_STOCK, FEXIT, FALSE, FALSE, FALSE, NULL);
906 g_free (str);
907 return menu;
908}
909
916{
917 GMenu * menu = g_menu_new ();
918 append_menu_item (menu, "Workspace", "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
919 return menu;
920}
921
930GMenu * project_title (int pop_up, int proj)
931{
932 GMenu * menu = g_menu_new ();
933 if (pop_up && nprojects && proj > -1)
934 {
935 gchar * str = g_strdup_printf ("<b>%s</b>", get_project_by_id(proj) -> name);
936 append_menu_item (menu, str, "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
937 g_free (str);
938 }
939 else
940 {
941 append_menu_item (menu, "Project(s)", "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
942 }
943 return menu;
944}
945
956GMenu * create_workspace_menu (gchar * act, int pop_up, int proj, int calc)
957{
958 GMenu * menu = g_menu_new ();
959 g_menu_append_section (menu, NULL, (GMenuModel*)workspace_title());
960 g_menu_append_section (menu, NULL, (GMenuModel*)workspace_section(act, pop_up));
961 g_menu_append_section (menu, NULL, (GMenuModel*)project_title(pop_up, proj));
962 g_menu_append_section (menu, NULL, (GMenuModel*)project_section(act, pop_up, proj, calc));
963 g_menu_append_section (menu, NULL, (GMenuModel*)import_section(act));
964 g_menu_append_section (menu, NULL, (GMenuModel*)quit_section(act));
965 return menu;
966}
967
974{
975 GMenu * menu = g_menu_new ();
976 append_menu_item (menu, "Chemistry and Physics", "app.edit.chemistry", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
977 append_menu_item (menu, "Box and Periodicity", "app.edit.periodicity", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
978 append_menu_item (menu, "Bond Cutoffs", "app.edit.cutoffs", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
979 return menu;
980}
981
988{
989 GMenu * menu = g_menu_new ();
990 append_menu_item (menu, "Toolboxes", "app.analyze.tool-box", "<CTRL>T", NULL, IMG_STOCK, PAGE_SETUP, FALSE, FALSE, FALSE, NULL);
991 return menu;
992}
993
1000{
1001 GMenu * menu = g_menu_new ();
1002 append_menu_item (menu, "g(r) / G(r)", "app.analyze.gr", NULL, NULL, IMG_FILE, PACKAGE_GR, FALSE, FALSE, FALSE, NULL);
1003 append_menu_item (menu, "S(q) from FFT[g(r)]", "app.analyze.sq", NULL, NULL, IMG_FILE, PACKAGE_SQ, FALSE, FALSE, FALSE, NULL);
1004 append_menu_item (menu, "S(q) from Debye Eq.", "app.analyze.sk", NULL, NULL, IMG_FILE, PACKAGE_SQ, FALSE, FALSE, FALSE, NULL);
1005 append_menu_item (menu, "g(r) / G(r) from FFT[S(q)]", "app.analyze.gk", NULL, NULL, IMG_FILE, PACKAGE_GR, FALSE, FALSE, FALSE, NULL);
1006 append_menu_item (menu, "Bonds and Angles", "app.analyze.bonds", NULL, NULL, IMG_FILE, PACKAGE_BD, FALSE, FALSE, FALSE, NULL);
1007 append_menu_item (menu, "Ring statistics", "app.analyze.rings", NULL, NULL, IMG_FILE, PACKAGE_RI, FALSE, FALSE, FALSE, NULL);
1008 append_menu_item (menu, "Chain statistics", "app.analyze.chains", NULL, NULL, IMG_FILE, PACKAGE_CH, FALSE, FALSE, FALSE, NULL);
1009 append_menu_item (menu, "Spherical Harmonics", "app.analyze.sp", NULL, NULL, IMG_FILE, PACKAGE_SP, FALSE, FALSE, FALSE, NULL);
1010 append_menu_item (menu, "Mean Squared Displacement", "app.analyze.msd", NULL, NULL, IMG_FILE, PACKAGE_MS, FALSE, FALSE, FALSE, NULL);
1011 g_menu_append_section (menu, NULL, (GMenuModel*)tool_box_section());
1012 return menu;
1013}
1014
1021{
1022 GMenu * menu = g_menu_new ();
1023 append_menu_item (menu, "Periodic Table", "app.help.periodic", "<CTRL>P", NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1024 append_menu_item (menu, "Preferences", "app.help.preferences", NULL, NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1025 append_menu_item (menu, "Shortcuts", "app.help.shortcuts", NULL, NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1026 append_menu_item (menu, "About", "app.help.about", "<CTRL>A", NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1027 return menu;
1028}
1029
1036{
1037 GMenu * menu = g_menu_new ();
1038 append_submenu (menu, "Workspace", create_workspace_menu("app", 0, -1, -1));
1039 append_submenu (menu, "Edit", create_edit_menu());
1040 append_submenu (menu, "Analyze", create_analyze_menu());
1041 append_submenu (menu, "Help", create_help_menu());
1042 return menu;
1043}
1044
1045#ifdef GTK4
1057G_MODULE_EXPORT void atomes_popup_menu (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
1058{
1059 if (gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture) == GDK_BUTTON_SECONDARY)
1060 {
1061 GtkWidget * popover = work_menu (-1, -1);
1062 gtk_widget_set_parent (popover, MainWindow);
1063 pop_menu_at_pointer (popover, x, y);
1064 }
1065}
1066
1078G_MODULE_EXPORT gboolean on_atomes_pressed (GtkEventControllerKey * self, guint keyval, guint keycode, GdkModifierType state, gpointer data)
1079{
1080 atomes_key_pressed (keyval, state);
1081 return TRUE;
1082}
1083#endif
1084
1092GtkWidget * create_main_window (GApplication * atomes)
1093{
1094 int i;
1095 THETD = gdk_pixbuf_new_from_file (PACKAGE_TD, NULL);
1096#ifdef GTK3
1097 gtk_window_set_default_icon (THETD);
1098#endif
1099 THEMO = gdk_pixbuf_new_from_file (PACKAGE_MOL, NULL);
1100 THEBD = gdk_pixbuf_new_from_file (PACKAGE_BD, NULL);
1101 SETTING = gdk_pixbuf_new_from_file (PACKAGE_PRO, NULL);
1102 SETTINGS = gdk_pixbuf_new_from_file (PACKAGE_SET, NULL);
1103 OGL = gdk_pixbuf_new_from_file (PACKAGE_OGL, NULL);
1104 OGLM = gdk_pixbuf_new_from_file (PACKAGE_OGLM, NULL);
1105 OGLC = gdk_pixbuf_new_from_file (PACKAGE_OGLC, NULL);
1106
1107 GtkWidget * window = gtk_application_window_new (GTK_APPLICATION(atomes));
1108 gtk_window_set_title (GTK_WINDOW(window), PACKAGE);
1109 gtk_window_set_resizable (GTK_WINDOW(window), TRUE);
1110 gtk_widget_set_size_request (window, 900, 450);
1111
1112 atomes_action main_actions[] = {{ "workspace.open", GINT_TO_POINTER(2)},
1113 { "workspace.save", GINT_TO_POINTER(3)},
1114 { "workspace.save-as", GINT_TO_POINTER(3)},
1115 { "workspace.close", GINT_TO_POINTER(1)},
1116 { "project.new", NULL},
1117 { "project.open", GINT_TO_POINTER(0)},
1118 { "project.save", GINT_TO_POINTER(1) },
1119 { "project.save-as", GINT_TO_POINTER(1)},
1120 { "project.close", NULL},
1121 { "export.isaacs", GINT_TO_POINTER(1)},
1122 { "export.coordinates", GINT_TO_POINTER(1)},
1123 { "import.isaacs", GINT_TO_POINTER(0)},
1124 { "import.coordinates", GINT_TO_POINTER(0)},
1125 { "program.quit", NULL},
1126 { "analyze.tool-box", NULL},
1127 { "help.periodic", NULL},
1128 { "help.about", NULL},
1129 { "help.shortcuts", NULL},
1130 { "help.preferences", NULL}};
1131
1132 GSimpleAction ** main_act = g_malloc0 (G_N_ELEMENTS(main_actions)*sizeof*main_act);
1133 for (i=0; i<G_N_ELEMENTS(main_actions); i++)
1134 {
1135 main_act[i] = g_simple_action_new (main_actions[i].action_name, NULL);
1136 add_action (main_act[i]);
1137 g_signal_connect (main_act[i], "activate", G_CALLBACK(atomes_menu_bar_action), main_actions[i].action_data);
1138 }
1139 for (i=0; i<G_N_ELEMENTS(edition_acts); i++)
1140 {
1141 edition_actions[i] = g_simple_action_new (edition_acts[i].action_name, NULL);
1142 g_signal_connect (edition_actions[i], "activate", G_CALLBACK(atomes_menu_bar_action), edition_acts[i].action_data);
1143 }
1144 for (i=0; i<G_N_ELEMENTS(analyze_acts); i++)
1145 {
1146 analyze_actions[i] = g_simple_action_new (analyze_acts[i].action_name, NULL);
1147 g_signal_connect (analyze_actions[i], "activate", G_CALLBACK(atomes_menu_bar_action), analyze_acts[i].action_data);
1148 }
1149
1150 /*GtkBuilder * builder = gtk_builder_new_from_file ("menus/main.ui");
1151 GMenuModel * model = G_MENU_MODEL (gtk_builder_get_object (builder, "atomes_menu_bar"));
1152 gtk_application_set_menubar (GTK_APPLICATION(atomes), G_MENU_MODEL(model));
1153 g_object_unref (model);*/
1154 gtk_application_set_menubar (GTK_APPLICATION(atomes), G_MENU_MODEL(atomes_menu_bar()));
1155 gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW(window), TRUE);
1156
1157#ifdef GTK3
1158 MainEvent = gtk_event_box_new ();
1159 gtk_widget_add_events (MainEvent,
1160 GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK |
1161 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
1162 g_signal_connect(G_OBJECT(MainEvent), "button_press_event", G_CALLBACK(pop_menu), NULL);
1163 g_signal_connect(G_OBJECT(MainEvent), "button_release_event", G_CALLBACK(pop_menu), NULL);
1164#else
1165 add_widget_gesture_and_key_action (window, "atomes-context-click", G_CALLBACK(atomes_popup_menu), NULL,
1166 NULL, NULL, NULL,
1167 "atomes-key-pressed", G_CALLBACK(on_atomes_pressed), NULL,
1168 NULL, NULL, NULL, NULL, NULL, NULL);
1169#endif
1170 add_gtk_close_event (window, G_CALLBACK(leaving_question), NULL);
1171 GtkWidget * hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
1172 int frame_size[2]={200, 550};
1173 for (i=0; i<2; i++)
1174 {
1175 MainFrame[i] = gtk_frame_new (NULL);
1176 gtk_widget_set_size_request (MainFrame[i], frame_size[i], -1);
1177 MainScrol[i] = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
1178#ifdef GTK3
1179 if (! i)
1180 {
1182 }
1183 else
1184 {
1186 gtk_container_add (GTK_CONTAINER(MainEvent), MainScrol[i]);
1187 }
1188#else
1189 gtk_scrolled_window_set_propagate_natural_height ((GtkScrolledWindow *)MainScrol[i], TRUE);
1190 gtk_scrolled_window_set_propagate_natural_width ((GtkScrolledWindow *)MainScrol[i], TRUE);
1192#endif
1193 }
1194#ifdef GTK4
1195 gtk_paned_set_start_child (GTK_PANED (hpaned), MainFrame[0]);
1196 gtk_paned_set_resize_start_child (GTK_PANED (hpaned), FALSE);
1197 gtk_paned_set_shrink_start_child (GTK_PANED (hpaned), FALSE);
1198 gtk_paned_set_end_child (GTK_PANED (hpaned), MainFrame[1]);
1199 gtk_paned_set_resize_end_child (GTK_PANED (hpaned), TRUE);
1200 gtk_paned_set_shrink_end_child (GTK_PANED (hpaned), FALSE);
1201#else
1202 gtk_paned_pack1 (GTK_PANED (hpaned), MainFrame[0], FALSE, FALSE);
1203 gtk_paned_pack2 (GTK_PANED (hpaned), MainFrame[1], FALSE, FALSE);
1204#endif
1207 add_container_child (CONTAINER_WIN, window, hpaned);
1208 clean_view ();
1209 show_the_widgets (window);
1210
1211 for (i=0; i<9; i++)
1212 {
1213 davect[i].a = i/3;
1214 davect[i].b = i-3*davect[i].a;
1215 }
1216
1217 calc_img[0] = g_strdup_printf ("%s", PACKAGE_GR);
1218 calc_img[1] = g_strdup_printf ("%s", PACKAGE_SQ);
1219 calc_img[2] = g_strdup_printf ("%s", PACKAGE_SQ);
1220 calc_img[3] = g_strdup_printf ("%s", PACKAGE_GR);
1221 calc_img[4] = g_strdup_printf ("%s", PACKAGE_AN);
1222 calc_img[5] = g_strdup_printf ("%s", PACKAGE_RI);
1223 calc_img[6] = g_strdup_printf ("%s", PACKAGE_CH);
1224 calc_img[7] = g_strdup_printf ("%s", PACKAGE_SP);
1225 calc_img[8] = g_strdup_printf ("%s", PACKAGE_MS);
1226 calc_img[9] = g_strdup_printf ("%s", PACKAGE_BD);
1227
1228 dots[0] = g_strdup_printf ("%s", PACKAGE_DOTA);
1229 dots[1] = g_strdup_printf ("%s", PACKAGE_DOTB);
1230 dots[2] = g_strdup_printf ("%s", PACKAGE_DOTC);
1231 dots[3] = g_strdup_printf ("%s", PACKAGE_DOTD);
1232 dots[4] = g_strdup_printf ("%s", PACKAGE_DOTE);
1233 dots[5] = g_strdup_printf ("%s", PACKAGE_DOTF);
1234 dots[6] = g_strdup_printf ("%s", PACKAGE_DOTG);
1235 dots[7] = g_strdup_printf ("%s", PACKAGE_DOTH);
1236
1237 ifield[0] = g_strdup_printf ("%s", PACKAGE_DFBD);
1238 ifield[1] = g_strdup_printf ("%s", PACKAGE_DFBD);
1239 ifield[2] = g_strdup_printf ("%s", PACKAGE_DFAN);
1240 ifield[3] = g_strdup_printf ("%s", PACKAGE_DFAN);
1241 ifield[4] = g_strdup_printf ("%s", PACKAGE_DFDI);
1242 ifield[5] = g_strdup_printf ("%s", PACKAGE_DFDI);
1243 ifield[6] = g_strdup_printf ("%s", PACKAGE_DFTD);
1244 ifield[7] = g_strdup_printf ("%s", PACKAGE_DFIN);
1245
1246 bravais_img[0] = g_strdup_printf ("%s", PACKAGE_SGTC);
1247 bravais_img[1] = g_strdup_printf ("%s", PACKAGE_SGMP);
1248 bravais_img[2] = g_strdup_printf ("%s", PACKAGE_SGMI);
1249 bravais_img[3] = g_strdup_printf ("%s", PACKAGE_SGOP);
1250 bravais_img[4] = g_strdup_printf ("%s", PACKAGE_SGOI);
1251 bravais_img[5] = g_strdup_printf ("%s", PACKAGE_SGOC);
1252 bravais_img[6] = g_strdup_printf ("%s", PACKAGE_SGOF);
1253 bravais_img[7] = g_strdup_printf ("%s", PACKAGE_SGTP);
1254 bravais_img[8] = g_strdup_printf ("%s", PACKAGE_SGTI);
1255 bravais_img[9] = g_strdup_printf ("%s", PACKAGE_SGTR);
1256 bravais_img[10] = g_strdup_printf ("%s", PACKAGE_SGHP);
1257 bravais_img[11] = g_strdup_printf ("%s", PACKAGE_SGCP);
1258 bravais_img[12] = g_strdup_printf ("%s", PACKAGE_SGCI);
1259 bravais_img[13] = g_strdup_printf ("%s", PACKAGE_SGCF);
1260
1261 // Rouge
1262 std[0].red = 1.0;
1263 std[0].green = 0.0;
1264 std[0].blue = 0.0;
1265 // Jaune
1266 std[1].red = 1.0;
1267 std[1].green = 1.0;
1268 std[1].blue = 0.0;
1269 // Vert
1270 std[2].red = 0.0;
1271 std[2].green = 1.0;
1272 std[2].blue = 0.0;
1273 // Cyan
1274 std[3].red = 0.0;
1275 std[3].green = 1.0;
1276 std[3].blue = 1.0;
1277 // Bleu
1278 std[4].red = 0.0;
1279 std[4].green = 0.0;
1280 std[4].blue = 1.0;
1281 // Rose
1282 std[5].red = 1.0;
1283 std[5].green = 0.0;
1284 std[5].blue = 1.0;
1285
1286 for (i=0; i<3; i++)
1287 {
1288 objects[i] = 0;
1289 object_was_selected[i] = NULL;
1290 tmp_object_id[i] = NULL;
1291 }
1292 cut_sel.a = cut_sel.b = 0;
1293 cut_sel.c = 1;
1294
1295 return window;
1296}
gchar * action_name[5]
Definition atom_edit.c:60
G_MODULE_EXPORT void on_show_curve_toolbox(GtkWidget *widg, gpointer data)
show the curve toolboxes
Definition calc_menu.c:1095
G_MODULE_EXPORT void on_close_workspace(GtkWidget *widg, gpointer data)
close the active workspace
Definition callbacks.c:134
G_MODULE_EXPORT void on_open_save_activate(GtkWidget *widg, gpointer data)
open or save an atomes file - prepare the dialog
Definition callbacks.c:421
G_MODULE_EXPORT void on_isaacs_port(GtkWidget *widg, gpointer data)
open or write ISAACS XML file - prepare the dialog
Definition callbacks.c:773
G_MODULE_EXPORT void on_coord_port(GtkWidget *widg, gpointer data)
export or import atomic coordinates: prepare dialog
Definition callbacks.c:1615
G_MODULE_EXPORT void on_save_as_activate(GtkWidget *widg, gpointer data)
open or save, choosing a file name
Definition callbacks.c:619
Callback declarations for main window.
gchar * groups[230]
Definition cbuild_sg.c:43
G_MODULE_EXPORT void on_close_activate(GtkWidget *widg, gpointer cdata)
signal to close a project
Definition close_p.c:355
#define PACKAGE
Definition config.h:46
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Definition labels.c:56
gchar * PACKAGE_SET
Definition global.c:104
gchar * PACKAGE_SGTP
Definition global.c:127
gchar * PACKAGE_SGMI
Definition global.c:133
gchar * PACKAGE_SGTI
Definition global.c:126
gchar * PACKAGE_AN
Definition global.c:93
gchar * PACKAGE_DOTG
Definition global.c:114
gchar * PACKAGE_LOGO
Definition global.c:105
gchar * PACKAGE_DOTC
Definition global.c:110
gchar * PACKAGE_DFIN
Definition global.c:120
gchar * PACKAGE_SP
Definition global.c:96
GtkWidget * MainScrol[2]
Definition global.c:207
int activep
Definition global.c:159
gchar * PACKAGE_IMP
Definition global.c:79
GSimpleAction * edition_actions[3]
Definition global.c:197
gchar * PACKAGE_DOTE
Definition global.c:112
gchar * PACKAGE_DOTH
Definition global.c:115
gchar * PACKAGE_SGMP
Definition global.c:132
gchar * PACKAGE_DFAN
Definition global.c:117
gchar * PACKAGE_SGTR
Definition global.c:125
GdkPixbuf * OGLC
Definition global.c:223
gchar * PACKAGE_DFDI
Definition global.c:118
gchar * PACKAGE_DFTD
Definition global.c:119
gchar * PACKAGE_SGCF
Definition global.c:123
GtkApplication * AtomesApp
Definition global.c:200
gchar * PACKAGE_DFBD
Definition global.c:116
gchar * PACKAGE_CON
Definition global.c:80
gchar * PACKAGE_BD
Definition global.c:92
gchar * PACKAGE_SGHP
Definition global.c:124
int nprojects
Definition global.c:158
GtkWidget * MainFrame[2]
Definition global.c:203
gchar * PACKAGE_RI
Definition global.c:94
GtkWidget * atomes_shortcuts
Definition global.c:209
gchar * PACKAGE_OGL
Definition global.c:100
GtkWidget * MainWindow
Definition global.c:201
gchar * PACKAGE_DOTF
Definition global.c:113
gchar * PACKAGE_GR
Definition global.c:90
GdkPixbuf * OGLM
Definition global.c:222
gchar * PACKAGE_DOTA
Definition global.c:108
gchar * PACKAGE_OGLM
Definition global.c:101
gchar * PACKAGE_MS
Definition global.c:97
gchar * PACKAGE_SGOC
Definition global.c:130
gchar * PACKAGE_SGOF
Definition global.c:131
gchar * PACKAGE_CH
Definition global.c:95
gchar * PACKAGE_SGOP
Definition global.c:128
GdkPixbuf * SETTINGS
Definition global.c:220
gchar * PACKAGE_OGLC
Definition global.c:102
gchar * PACKAGE_TD
Definition global.c:98
GdkPixbuf * THEBD
Definition global.c:218
gchar * PACKAGE_SGTC
Definition global.c:134
gchar * PACKAGE_SGCP
Definition global.c:121
GdkPixbuf * OGL
Definition global.c:221
GdkPixbuf * THETD
Definition global.c:216
GtkWidget * atomes_logo
Definition global.c:208
gchar * PACKAGE_PRO
Definition global.c:103
GdkPixbuf * SETTING
Definition global.c:219
gchar * bravais_img[14]
Definition global.c:139
gchar * PACKAGE_MOL
Definition global.c:99
GSimpleAction * analyze_actions[9]
Definition global.c:198
gchar * PACKAGE_DOTB
Definition global.c:109
GtkWidget * curvetoolbox
Definition global.c:205
GdkPixbuf * THEMO
Definition global.c:217
GtkWidget * pop
Definition global.c:204
gchar * ifield[8]
Definition global.c:140
gchar * PACKAGE_SGOI
Definition global.c:129
gchar * PACKAGE_SGCI
Definition global.c:122
gchar * PACKAGE_DOTD
Definition global.c:111
gchar * PACKAGE_SQ
Definition global.c:91
GtkWidget * MainView
Definition global.c:202
Global variable declarations Global convenience function declarations Global data structure defin...
@ IMG_STOCK
Definition global.h:266
@ IMG_FILE
Definition global.h:265
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:2095
project * proj
void pop_menu_at_pointer(GtkWidget *widg, GdkEvent *event)
popup a menu at pointer location
Definition gtk-misc.c:2436
#define EDITA
Definition global.h:204
G_MODULE_EXPORT gboolean destroy_this_window(GtkWidget *win, GdkEvent *event, gpointer data)
destroy a GtkWindow
Definition gtk-misc.c:2479
void add_gtk_close_event(GtkWidget *widg, GCallback handler, gpointer data)
add a close event signal and callback to a GtkWidget
Definition gtk-misc.c:2522
#define NGRAPHS
#define FEXIT
Definition global.h:214
#define FOPEN
Definition global.h:210
#define YES
Definition global.h:203
@ CONTAINER_WIN
Definition global.h:252
@ CONTAINER_FRA
Definition global.h:256
@ CONTAINER_SCR
Definition global.h:253
#define DPROPERTIES
Definition global.h:208
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
Definition gtk-misc.c:308
#define FNEW
Definition global.h:209
void text_view_set_monospace(GtkWidget *view)
set the font of a GtkTextView as monospace
Definition gtk-misc.c:697
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2169
#define FSAVE
Definition global.h:211
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:235
#define FCLOSE
Definition global.h:213
#define PAGE_SETUP
Definition global.h:199
#define NCALCS
#define FSAVEAS
Definition global.h:212
#define NDOTS
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:182
#define ABOUT
Definition global.h:227
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
action
Definition glview.h:198
GMenu * workspace_section(gchar *act, int pop)
create the workspace section
Definition gui.c:779
GMenu * quit_section(gchar *act)
create the 'Quit' menu item
Definition gui.c:901
void create_user_preferences_dialog()
dint davect[9]
Definition gui.c:146
G_MODULE_EXPORT void compute_this_prop(GtkWidget *widg, gpointer data)
to compute the 'calc_to_compute'
Definition work_menu.c:105
G_MODULE_EXPORT void on_edit_activate(GtkWidget *widg, gpointer data)
create an edition dialog - prepare the dialog
Definition edit_menu.c:845
GMenu * create_analyze_menu()
create atomes 'analyze' menu
Definition gui.c:999
gchar * main_group_names[]
Definition gui.c:166
GMenu * port_section(gchar *act, int pop, int port)
create the import/export menu items
Definition gui.c:810
int objects[3]
Definition selection.c:212
atomes_action edition_acts[]
Definition gui.c:109
void remove_edition_actions()
remove all edition actions
Definition gui.c:422
GIcon * get_gicon_from_data(int format, const gchar *icon)
create a new icon using data
Definition gui.c:614
GMenu * create_workspace_menu(gchar *act, int pop_up, int proj, int calc)
create atomes 'workspace' menu
Definition gui.c:956
gchar * graph_img[NGRAPHS]
Definition gui.c:107
void widget_add_action(GSimpleActionGroup *action_group, const gchar *act, GCallback handler, gpointer data, gboolean check, gboolean status, gboolean radio, const gchar *stat)
add an action to an action group
Definition gui.c:645
GtkWidget * curvetbox()
create the curve tool box window
Definition tools.c:321
void append_submenu(GMenu *menu, const gchar *label, GMenu *submenu)
append a GMenuItem with a subenu to a GMenu, and use markup for the GMenuItem
Definition gui.c:732
atomes_action analyze_acts[]
Definition gui.c:113
ColRGBA std[6]
Definition gui.c:147
GMenu * create_help_menu()
create atomes 'help' menu
Definition gui.c:1020
shortcuts main_shortcuts[]
Definition gui.c:149
gchar * calc_img[NCALCS-2]
Definition gui.c:106
int ** tmp_object_id[3]
Definition selection.c:214
void atomes_key_pressed(guint keyval, GdkModifierType state)
main window key actions callbacks
Definition gui.c:352
GtkWidget * shortcuts_window(int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups], gchar *section_names[sections], gchar *group_names[groups], shortcuts shortcs[])
Create the shortcuts information window.
Definition gui.c:181
GMenu * workspace_title()
create the 'Workspace' menu item
Definition gui.c:915
G_MODULE_EXPORT void leaving_from_menu(GtkWidget *widg, gpointer data)
leaving atomes ?
Definition work_menu.c:86
GMenu * project_title(int pop_up, int proj)
create project title menu item
Definition gui.c:930
GMenu * atomes_menu_bar()
create atomes menu bar
Definition gui.c:1035
GtkWidget * create_main_window(GApplication *atomes)
create the main application window
Definition gui.c:1092
void remove_edition_and_analyze_actions()
remove all edition and analysis action
Definition gui.c:433
void clean_view()
clean the main window
Definition gui.c:286
G_MODULE_EXPORT void on_calc_activate(GtkWidget *widg, gpointer data)
create a calculation dialog - prepare the dialog
Definition calc_menu.c:1463
GtkWidget * work_menu(int p, int c)
create the workspace popup menu
Definition work_menu.c:202
void add_action(GSimpleAction *action)
add action to the main window action map
Definition gui.c:400
GMenu * create_edit_menu()
create atomes 'edit' menu
Definition gui.c:973
void view_buffer(GtkTextBuffer *buffer)
set a text buffer in the main window or an image
Definition gui.c:309
int main_group_by_section[]
Definition gui.c:165
G_MODULE_EXPORT void show_periodic_table(GtkWidget *widg, gpointer data)
show the periodic table of the elements
Definition gui.c:448
int get_atom_id_from_periodic_table(atom_search *asearch)
get atom Z from selection in the periodic table
Definition w_periodic.c:672
gchar * main_section_names[]
Definition gui.c:164
tint cut_sel
Definition gui.c:145
char * graph_name[NGRAPHS]
Definition gui.c:134
G_MODULE_EXPORT void atomes_menu_bar_action(GSimpleAction *action, GVariant *parameter, gpointer data)
atomes menu bar actions
Definition gui.c:462
int main_shortcut_by_group[]
Definition gui.c:167
GMenuItem * create_gmenu_item(const gchar *label, const gchar *action, const gchar *accel, const gchar *custom, int format, const gchar *icon, gboolean check, gboolean status, gboolean radio, const gchar *rstatus)
create menu item
Definition gui.c:686
G_MODULE_EXPORT void on_create_new_project(GtkWidget *widg, gpointer data)
create a new project
Definition work_menu.c:62
void append_menu_item(GMenu *menu, const gchar *label, const gchar *action, const gchar *accel, const gchar *custom, int format, const gchar *icon, gboolean check, gboolean status, gboolean radio, const gchar *rstatus)
create a menu item, then append it to a menu
Definition gui.c:762
int * object_was_selected[3]
Definition selection.c:213
gchar * dots[NDOTS]
Definition gui.c:105
GMenu * import_section(gchar *act)
create the 'Import' submenu
Definition gui.c:887
void remove_action(gchar *action_name)
add action from the main window action map
Definition gui.c:412
char * calc_name[NCALCS-2]
Definition gui.c:123
GMenu * tool_box_section()
create toolboxes menu item
Definition gui.c:987
GMenu * project_section(gchar *act, int pop_up, int proj, int calc)
create the project section
Definition gui.c:834
G_MODULE_EXPORT void create_about_dialog(GtkWidget *widg, gpointer data)
create the about dialog
Definition interface.c:175
G_MODULE_EXPORT gboolean leaving_question(GtkWidget *widget, GdkEvent *event, gpointer data)
Leaving atomes ?
Definition interface.c:418
Messaging function declarations.
double y
Definition ogl_draw.c:61
double x
Definition ogl_draw.c:61
Function declarations for reading atomes project file Function declarations for saving atomes proje...
float blue
Definition global.h:126
float red
Definition global.h:124
float green
Definition global.h:125
Definition global.h:99
int b
Definition global.h:101
int a
Definition global.h:100
Definition global.h:106
int b
Definition global.h:108
int c
Definition global.h:109
int a
Definition global.h:107
int c
Definition tab-1.c:95
int status
Definition w_advance.c:178
void add_project_to_workspace()
add project(s) to the workspace tree
Definition workspace.c:610
G_MODULE_EXPORT void activate_project(GtkWidget *widg, gpointer data)
activate a project
Definition workspace.c:191
char * work_menu_items[NITEMS-2]
Definition workspace.c:89
G_MODULE_EXPORT void change_project_name(GtkWidget *wid, gpointer edata)
change project name
Definition workspace.c:357
Function declarations for workspace managment.