atomes 1.3.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-2026 by CNRS and University of Strasbourg */
15
23
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_analysis_action (int act);
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 * create_curve_tool_box ();
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];
107
108atomes_action edition_acts[] = {{"edit.chemistry", GINT_TO_POINTER(0)},
109 {"edit.periodicity", GINT_TO_POINTER(1)},
110 {"edit.cutoffs", GINT_TO_POINTER(2)}};
111
112gchar * calc_name[] = {"g(r)/G(r)",
113 i18n("S(q) from FFT[g(r)]"),
114 i18n("S(q) from Debye Equation"),
115 i18n("g(r)/G(r) from FFT[S(q)]"),
116 i18n("Bonds and Angles"),
117 i18n("Ring Statistics"),
118 i18n("Chain Statistics"),
119 i18n("Spherical Harmonics"),
120 i18n("Mean Squared Displacement"),
121 i18n("Dynamic Structure Factor")};
122
123gchar * graph_name[] = {"g(r)/G(r)",
124 i18n("S(q) from FFT[g(r)]"),
125 i18n("S(q) from Debye Equation"),
126 i18n("g(r)/G(r) from FFT[S(q)]"),
127 i18n("Bond Properties"),
128 i18n("Angle Distributions"),
129 i18n("Ring Statistics"),
130 i18n("Chain Statistics"),
131 i18n("Spherical Harmonics"),
132 i18n("Mean Squared Displacement"),
133 i18n("Dynamic Structure Factor")};
134
135gchar * graph_icon[] = {"pixmaps/gr.png",
136 "pixmaps/sq.png",
137 "pixmaps/sq.png",
138 "pixmaps/gr.png",
139 "pixmaps/bd.png",
140 "pixmaps/an.png",
141 "pixmaps/ri.png",
142 "pixmaps/ch.png",
143 "pixmaps/sp.png",
144 "pixmaps/ms.png",
145 "pixmaps/sq.png"};
146
150
152 { i18n("About"), i18n("open about dialog"), GDK_KEY_a, "<Ctrl>a" },
153 { i18n("Periodic table"), i18n("open periodic table"), GDK_KEY_p, "<Ctrl>p" },
154 { i18n("Quit"), i18n("quit atomes"), GDK_KEY_q, "<Ctrl>q" },
155//};
156//{
157 { i18n("Open workspace"), i18n("open atomes workspace"), GDK_KEY_w, "<Ctrl>w" },
158 { i18n("Save workspace"), i18n("save atomes workspace"), GDK_KEY_s, "<Ctrl>s" },
159 { i18n("Close workspace"), i18n("close atomes workspace"), GDK_KEY_c, "<Ctrl>c" },
160//};
161//{
162 { i18n("New project"), i18n("create new atomes project"), GDK_KEY_n, "<Ctrl>n" },
163 { i18n("Open project"), i18n("open atomes project"), GDK_KEY_o, "<Ctrl>o" }
164};
165
166gchar * main_section_names[] = { "Main" };
168gchar * main_group_names[] = { i18n("General"), i18n("Workspace"), i18n("Projects") };
169int main_shortcut_by_group[] = { 3, 3, 2 };
170
183GtkWidget * shortcuts_window (int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups],
184 gchar * section_names[sections], gchar * group_names[groups], shortcuts shortcs[])
185{
186 GtkShortcutsWindow * win = NULL;
187#ifdef G_OS_WIN32
188 win = g_object_new (GTK_TYPE_SHORTCUTS_WINDOW, "modal", FALSE, "resizable", TRUE, "deletable", TRUE, NULL);
189#else
190 win = g_object_new (GTK_TYPE_SHORTCUTS_WINDOW, "modal", FALSE, "resizable", TRUE, NULL);
191#endif
192 GtkShortcutsSection * shortcut_section[sections];
193 GtkShortcutsGroup * shortcut_group[groups];
194 GtkShortcutsShortcut * shortcut;
195#ifdef GTK4
196#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
197 GtkWidget * sections_book = gtk_notebook_new ();
198 gtk_notebook_set_scrollable (GTK_NOTEBOOK(sections_book), TRUE);
199 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(sections_book), GTK_POS_TOP);
200#endif
201#endif // GTK4
202 int i, j, k, l, m;
203 l = m = 0;
204 for (i=0; i<sections; i++)
205 {
206 shortcut_section[i] = g_object_new (GTK_TYPE_SHORTCUTS_SECTION, "visible", TRUE, "title", _(section_names[i]), "section-name", _(section_names[i]), NULL);
207#ifdef GTK4
208#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
209 gtk_orientable_set_orientation ((GtkOrientable *)shortcut_section[i], GTK_ORIENTATION_HORIZONTAL);
210#endif
211#endif
212 for (j=0; j<group_by_section[i]; j++, l++)
213 {
214 shortcut_group[l] = g_object_new (GTK_TYPE_SHORTCUTS_GROUP, "visible", TRUE, "title", _(group_names[l]), NULL);
215 for (k=0; k<shortcut_by_group[l]; k++, m++)
216 {
217 shortcut = g_object_new (GTK_TYPE_SHORTCUTS_SHORTCUT,
218 "visible", TRUE,
219 "shortcut-type", GTK_SHORTCUT_ACCELERATOR,
220 "accelerator", shortcs[m].accelerator,
221 "title", _(shortcs[m].description),
222 NULL );
223#ifdef GTK4
224#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
225 gtk_shortcuts_group_add_shortcut (shortcut_group[l], shortcut);
226#else
227 add_box_child_start (GTK_ORIENTATION_VERTICAL, (GtkWidget *)shortcut_group[l], (GtkWidget *)shortcut, FALSE, FALSE, 0);
228#endif
229#else
230 gtk_container_add (GTK_CONTAINER((GtkWidget *)shortcut_group[l]), (GtkWidget *)shortcut);
231#endif
232 }
233#ifdef GTK4
234#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
235 gtk_shortcuts_section_add_group (shortcut_section[i], shortcut_group[l]);
236#else
237 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, (GtkWidget *)shortcut_section[i], (GtkWidget *)shortcut_group[l], FALSE, FALSE, 0);
238#endif
239#else
240 gtk_container_add (GTK_CONTAINER((GtkWidget *)shortcut_section[i]), (GtkWidget *)shortcut_group[l]);
241#endif
242 }
243#ifdef GTK4
244#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
245 gtk_shortcuts_window_add_section (GTK_SHORTCUTS_WINDOW(win), shortcut_section[i]);
246#else
247 gtk_notebook_append_page (GTK_NOTEBOOK(sections_book), (GtkWidget *)shortcut_section[i], gtk_label_new (_(section_names[i])));
248#endif
249#else
250 gtk_container_add (GTK_CONTAINER((GtkWidget *)win), (GtkWidget *)shortcut_section[i]);
251#endif
252 }
253#ifdef GTK4
254#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
255 gtk_window_set_child ((GtkWindow*) win, sections_book);
256#endif
257#endif
258 add_gtk_close_event ((GtkWidget *)win, G_CALLBACK(destroy_this_window), NULL);
259 show_the_widgets ((GtkWidget *)win);
260 return (GtkWidget *)win;
261}
262
263#ifdef GTK3
273G_MODULE_EXPORT gboolean pop_menu (GtkWidget * widget, GdkEventButton * event, gpointer data)
274{
275 if (event -> button == 3)
276 {
277 pop_menu_at_pointer (work_menu (-1, -1), (GdkEvent *)event);
278 }
279 return FALSE;
280}
281#endif
282
289{
292#ifdef GTK4
293 atomes_logo = gtk_picture_new_for_filename (PACKAGE_LOGO);
294 gtk_widget_set_size_request (atomes_logo, 550, -1);
296#else
297 atomes_logo = gtk_image_new_from_file (PACKAGE_LOGO);
299 gtk_container_add (GTK_CONTAINER(MainEvent), atomes_logo);
300 show_the_widgets (MainEvent);
301#endif
302}
303
311void view_buffer (GtkTextBuffer * buffer)
312{
313 if (atomes_logo)
314 {
316#ifdef GTK4
317 gtk_scrolled_window_set_child ((GtkScrolledWindow *)MainScrol[1], NULL);
318#endif
319 }
320 gboolean add = FALSE;
321 if (! MainView)
322 {
323 MainView = gtk_text_view_new ();
324 gtk_text_view_set_editable (GTK_TEXT_VIEW(MainView), 0);
326 add = TRUE;
327 }
328 gtk_text_view_set_buffer (GTK_TEXT_VIEW(MainView), buffer);
329#ifdef GTK3
330 if (! MainScrol[1])
331 {
332 MainScrol[1] = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
333 gtk_container_add (GTK_CONTAINER(MainEvent), MainScrol[1]);
334 add = TRUE;
335 }
336 if (add) gtk_container_add (GTK_CONTAINER(MainScrol[1]), MainView);
337#else
338 if (add)
339 {
341 }
342#endif
344}
345
354void atomes_key_pressed (guint keyval, GdkModifierType state)
355{
356 if (state & GDK_CONTROL_MASK)
357 {
358 switch (keyval)
359 {
360 case GDK_KEY_a:
361 create_about_dialog (NULL, NULL);
362 break;
363 case GDK_KEY_c:
364 on_close_workspace (NULL, GINT_TO_POINTER(1));
365 break;
366 case GDK_KEY_n:
367 on_create_new_project (NULL, NULL);
368 break;
369 case GDK_KEY_o:
370 on_open_save_activate (NULL, GINT_TO_POINTER(0));
371 break;
372 case GDK_KEY_p:
374 break;
375 case GDK_KEY_q:
376#ifdef GTK4
377 leaving_question (NULL, NULL);
378#else
379 leaving_question (NULL, NULL, NULL);
380#endif
381 break;
382 case GDK_KEY_s:
383 on_save_as_activate (NULL, GINT_TO_POINTER(3));
384 break;
385 case GDK_KEY_t:
386 on_show_curve_toolbox (NULL, NULL);
387 break;
388 case GDK_KEY_w:
389 on_open_save_activate (NULL, GINT_TO_POINTER(2));
390 break;
391 }
392 }
393}
394
403G_MODULE_EXPORT void show_periodic_table (GtkWidget * widg, gpointer data)
404{
406}
407
417G_MODULE_EXPORT void atomes_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data)
418{
419 gchar * name = g_strdup_printf ("%s", g_action_get_name(G_ACTION(action)));
420
421 if (g_strcmp0 (name, "workspace.open") == 0)
422 {
423 on_open_save_activate (NULL, data);
424 }
425 else if (g_strcmp0 (name, "workspace.save") == 0)
426 {
427 on_open_save_activate (NULL, data);
428 }
429 else if (g_strcmp0 (name, "workspace.save-as") == 0)
430 {
431 on_save_as_activate (NULL, data);
432 }
433 else if (g_strcmp0 (name, "workspace.close") == 0)
434 {
435 on_close_workspace (NULL, data);
436 }
437 else if (g_strcmp0 (name, "project.new") == 0)
438 {
439 on_create_new_project (NULL, data);
440 }
441 else if (g_strcmp0 (name, "project.edit") == 0)
442 {
443 change_project_name (NULL, data);
444 }
445 else if (g_strcmp0 (name, "project.active") == 0)
446 {
447 activate_project (NULL, data);
448 }
449 else if (g_strcmp0 (name, "project.compute") == 0)
450 {
451 compute_this_prop (NULL, data);
452 }
453 else if (g_strcmp0 (name, "project.open") == 0)
454 {
455 on_open_save_activate (NULL, data);
456 }
457 else if (g_strcmp0 (name, "project.save") == 0)
458 {
459 on_open_save_activate (NULL, data);
460 }
461 else if (g_strcmp0 (name, "project.save-as") == 0)
462 {
463 on_save_as_activate (NULL, data);
464 }
465 else if (g_strcmp0 (name, "project.close") == 0)
466 {
467 on_close_activate (NULL, data);
468 }
469 else if (g_strcmp0 (name, "export.isaacs") == 0)
470 {
471 on_isaacs_port (NULL, data);
472 }
473 else if (g_strcmp0 (name, "export.coordinates") == 0)
474 {
475 on_coord_port (NULL, data);
476 }
477 else if (g_strcmp0 (name, "import.isaacs") == 0)
478 {
479 on_isaacs_port (NULL, data);
480 }
481 else if (g_strcmp0 (name, "import.coordinates") == 0)
482 {
483 on_coord_port (NULL, data);
484 }
485 else if (g_strcmp0 (name, "program.quit") == 0)
486 {
487 leaving_from_menu (NULL, data);
488 }
489 else if (g_strcmp0 (name, "edit.chemistry") == 0)
490 {
491 on_edit_activate (NULL, data);
492 }
493 else if (g_strcmp0 (name, "edit.periodicity") == 0)
494 {
495 on_edit_activate (NULL, data);
496 }
497 else if (g_strcmp0 (name, "edit.cutoffs") == 0)
498 {
499 on_edit_activate (NULL, data);
500 }
501 else if (g_strcmp0 (name, "analyze.tool-box") == 0)
502 {
503 on_show_curve_toolbox (NULL, data);
504 }
505 else if (g_strcmp0 (name, "help.periodic") == 0)
506 {
507 show_periodic_table (NULL, data);
508 }
509 else if (g_strcmp0 (name, "help.about") == 0)
510 {
511 create_about_dialog (NULL, data);
512 }
513 else if (g_strcmp0 (name, "help.shortcuts") == 0)
514 {
518 }
519 else if (g_strcmp0 (name, "help.preferences") == 0)
520 {
522 }
523 else
524 {
525 // Only remains analysis actions
526 on_calc_activate (NULL, data);
527 }
528 g_free (name);
529}
530
539{
540 gchar * str = g_strdup_printf ("analyze.%d", act);
541 GSimpleAction * this_action = g_simple_action_new (str, NULL);
542 g_free (str);
543 g_action_map_add_action (G_ACTION_MAP(AtomesApp), G_ACTION(this_action));
544 g_signal_connect (this_action, "activate", G_CALLBACK(atomes_menu_bar_action), GINT_TO_POINTER(act));
545}
546
555{
556 g_action_map_remove_action (G_ACTION_MAP(AtomesApp), (const gchar *)action_name);
557}
558
565{
566 int i;
567 for (i=0; i<G_N_ELEMENTS(edition_acts); i++) remove_action (edition_acts[i].action_name);
568}
569
576{
578 int i;
579 gchar * str;
580 for (i=0; i<NCALCS-1; i++)
581 {
582 str = g_strdup_printf ("analyze.%d", i);
583 remove_action (str);
584 g_free (str);
585 }
586}
587
596GIcon * get_gicon_from_data (int format, const gchar * icon)
597{
598 switch (format)
599 {
600 case IMG_FILE:
601 return g_file_icon_new (g_file_new_for_path (icon));
602 break;
603 case IMG_STOCK:
604 return g_themed_icon_new (icon);
605 break;
606 default:
607 return NULL;
608 break;
609 }
610}
611
627void widget_add_action (GSimpleActionGroup * action_group, const gchar * act, GCallback handler, gpointer data,
628 gboolean check, gboolean status, gboolean radio, const gchar * stat)
629{
630 GSimpleAction * action;
631 GVariant * action_state;
632 if (radio)
633 {
634 action_state = g_variant_new_string (stat);
635 action = g_simple_action_new_stateful (act, G_VARIANT_TYPE_STRING, action_state);
636 }
637 else if (check)
638 {
639 action_state = g_variant_new_boolean (status);
640 action = g_simple_action_new_stateful (act, NULL, action_state);
641 }
642 else
643 {
644 action = g_simple_action_new (act, NULL);
645 }
646 g_signal_connect (action, "activate", handler, data);
647 g_action_map_add_action (G_ACTION_MAP(action_group), G_ACTION(action));
648}
649
668GMenuItem * create_gmenu_item (const gchar * label, const gchar * action, const gchar * accel,
669 const gchar * custom, int format, const gchar * icon,
670 gboolean check, gboolean status, gboolean radio, const gchar * rstatus)
671{
672 GMenuItem * item;
673 item = g_menu_item_new (label, action);
674 /* GKT4 bug, normally mark-up should be provided using boolean:
675 g_menu_item_set_attribute (item, "use-markup", "b", TRUE, NULL);
676 But it does not work, however it does using a string: */
677 g_menu_item_set_attribute (item, "use-markup", "s", "TRUE", NULL);
678 if (custom)
679 {
680 g_menu_item_set_attribute (item, "custom", "s", custom, NULL);
681 // g_menu_item_set_attribute_value (item, "custom", g_variant_new_string (custom));
682 GVariant * cust = g_menu_item_get_attribute_value (item, "custom", g_variant_type_new("s"));
683 if (cust) g_print ("item :: %s, custom :: %s\n", label, g_variant_get_string (cust, NULL));
684 }
685 else
686 {
687 if (accel) g_menu_item_set_attribute (item, "accel", "s", accel, NULL);
688 // if (check) g_menu_item_set_attribute (item, "target", "b", status, NULL);
689 if (radio) g_menu_item_set_attribute (item, "target", "s", rstatus, NULL);
690#ifdef MENU_ICONS
691 if (icon)
692 {
693 GIcon * gicon = get_gicon_from_data (format, icon);
694 if (gicon)
695 {
696 g_menu_item_set_icon (item, gicon);
697 g_object_unref (gicon);
698 }
699 }
700#endif
701 }
702 return item;
703}
704
714void append_submenu (GMenu * menu, const gchar * label, GMenu * submenu)
715{
716 GMenuItem * item = g_menu_item_new (label, NULL);
717 /* GKT4 bug, normally mark-up should be provided using boolean:
718 g_menu_item_set_attribute (item, "use-markup", "b", TRUE, NULL);
719 But it does not work, however it does using a string: */
720 g_menu_item_set_attribute (item, "use-markup", "s", "TRUE", NULL);
721 g_menu_item_set_submenu (item, (GMenuModel *)submenu);
722 g_menu_append_item (menu, item);
723 g_object_unref (item);
724}
725
745void append_menu_item (GMenu * menu, const gchar * label, const gchar * action, const gchar * accel,
746 const gchar * custom, int format, const gchar * icon,
747 gboolean check, gboolean status, gboolean radio, const gchar * rstatus)
748{
749 GMenuItem * item = create_gmenu_item (label, action, accel, custom, format, icon, check, status, radio, rstatus);
750 g_menu_append_item (menu, item);
751 g_object_unref (item);
752}
753
762GMenu * workspace_section (gchar * act, int pop)
763{
764 GMenu * menu = g_menu_new ();
765 gchar * str;
766 str = g_strdup_printf ("%s.workspace.open", act);
767 append_menu_item (menu, _("Open"), (const gchar *)str, "<CTRL>W", NULL, IMG_STOCK, FOPEN, FALSE, FALSE, FALSE, NULL);
768 g_free (str);
769 if (! pop || nprojects)
770 {
771 str = g_strdup_printf ("%s.workspace.save", act);
772 append_menu_item (menu, _("Save"), (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVE, FALSE, FALSE, FALSE, NULL);
773 g_free (str);
774 str = g_strdup_printf ("%s.workspace.save-as", act);
775 append_menu_item (menu, _("Save As"), (const gchar *)str, "<CTRL>S", NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
776 g_free (str);
777 str = g_strdup_printf ("%s.workspace.close", act);
778 append_menu_item (menu, _("Close"), (const gchar *)str, "<CTRL>C", NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
779 g_free (str);
780 }
781 return menu;
782}
783
793GMenu * port_section (gchar * act, int pop, int port)
794{
795 gchar * port_action[2]={"export", "import"};
796 GMenu * menu = g_menu_new ();
797 gchar * str;
798 str = g_strdup_printf ("%s.%s.isaacs", act, port_action[port]);
799 append_menu_item (menu, _("ISAACS Project File (*.ipf)"), (const gchar *)str, NULL, NULL, IMG_FILE, PACKAGE_MOL, FALSE, FALSE, FALSE, NULL);
800 g_free (str);
801 str = g_strdup_printf ("%s.%s.coordinates", act, port_action[port]);
802 append_menu_item (menu, _("Atomic Coordinates"), (const gchar *)str, NULL, NULL, IMG_FILE, (port) ? PACKAGE_IMP : PACKAGE_CON, FALSE, FALSE, FALSE, NULL);
803 g_free (str);
804 return menu;
805}
806
817GMenu * project_section (gchar * act, int pop_up, int proj, int calc)
818{
819 GMenu * menu = g_menu_new ();
820 gchar * str, * str_n;
821 if (pop_up && nprojects && proj > -1)
822 {
823 if (activep != proj)
824 {
825 str = g_strdup_printf ("%s.project.active", act);
826 append_menu_item (menu, _("Make Active"), (const gchar *)str, NULL, NULL, IMG_STOCK, YES, FALSE, FALSE, FALSE, NULL);
827 g_free (str);
828 }
829 if (calc > -1)
830 {
831 str = g_strdup_printf ("%s.project.compute", act);
832 str_n = g_strdup_printf (_("Analyze: %s"), _(graph_name[calc]));
833 append_menu_item (menu, str_n, (get_project_by_id(proj) -> analysis[calc] -> avail_ok) ? (const gchar *)str : "None", NULL, NULL, IMG_FILE, graph_img[calc], FALSE, FALSE, FALSE, NULL);
834 g_free (str);
835 g_free (str_n);
836 }
837 str = g_strdup_printf ("%s.project.edit", act);
838 append_menu_item (menu, _("Edit Name"), (const gchar *)str, NULL, NULL, IMG_STOCK, EDITA, FALSE, FALSE, FALSE, NULL);
839 g_free (str);
840 }
842 {
843 str = g_strdup_printf ("%s.project.new", act);
844 append_menu_item (menu, _("New"), (const gchar *)str, "<CTRL>N", NULL, IMG_STOCK, FNEW, FALSE, FALSE, FALSE, NULL);
845 g_free (str);
846 str = g_strdup_printf ("%s.project.open", act);
847 append_menu_item (menu, _("Open"), (const gchar *)str, "<CTRL>O", NULL, IMG_STOCK, FOPEN, FALSE, FALSE, FALSE, NULL);
848 g_free (str);
849 }
850 if (! pop_up || proj > -1)
851 {
852 str = g_strdup_printf ("%s.project.save", act);
853 append_menu_item (menu, _("Save"), (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVE, FALSE, FALSE, FALSE, NULL);
854 g_free (str);
855 str = g_strdup_printf ("%s.project.save-as", act);
856 append_menu_item (menu, _("Save As"), (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
857 g_free (str);
859 {
860 str = g_strdup_printf ("%s.project.close", act);
861 append_menu_item (menu, _("Close"), (const gchar *)str, NULL, NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
862 g_free (str);
863 }
864 append_submenu (menu, _("Export"), port_section(act, pop_up, 0));
865 }
866 return menu;
867}
868
876GMenu * import_section (gchar * act)
877{
878 GMenu * menu = g_menu_new ();
879 append_submenu (menu, _("Import"), port_section(act, 0, 1));
880 return menu;
881}
882
890GMenu * quit_section (gchar * act)
891{
892 GMenu * menu = g_menu_new ();
893 gchar * str = g_strdup_printf ("%s.program.quit", act);
894 append_menu_item (menu, _("Quit"), (const gchar *)str, "<CTRL>Q", NULL, IMG_STOCK, FEXIT, FALSE, FALSE, FALSE, NULL);
895 g_free (str);
896 return menu;
897}
898
905{
906 GMenu * menu = g_menu_new ();
907 append_menu_item (menu, _("Workspace"), "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
908 return menu;
909}
910
919GMenu * project_title (int pop_up, int proj)
920{
921 GMenu * menu = g_menu_new ();
922 if (pop_up && nprojects && proj > -1)
923 {
924 gchar * str = g_strdup_printf ("<b>%s</b>", get_project_by_id(proj) -> name);
925 append_menu_item (menu, str, "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
926 g_free (str);
927 }
928 else
929 {
930 append_menu_item (menu, _("Project(s)"), "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
931 }
932 return menu;
933}
934
945GMenu * create_workspace_menu (gchar * act, int pop_up, int proj, int calc)
946{
947 GMenu * menu = g_menu_new ();
949 {
950 g_menu_append_section (menu, NULL, (GMenuModel*)workspace_title());
951 g_menu_append_section (menu, NULL, (GMenuModel*)workspace_section(act, pop_up));
952 }
953 g_menu_append_section (menu, NULL, (GMenuModel*)project_title(pop_up, proj));
954 g_menu_append_section (menu, NULL, (GMenuModel*)project_section(act, pop_up, proj, calc));
956 {
957 g_menu_append_section (menu, NULL, (GMenuModel*)import_section(act));
958 }
959 g_menu_append_section (menu, NULL, (GMenuModel*)quit_section(act));
960 return menu;
961}
962
969{
970 GMenu * menu = g_menu_new ();
971 append_menu_item (menu, _("Chemistry and Physics"), "app.edit.chemistry", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
972 append_menu_item (menu, _("Box and Periodicity"), "app.edit.periodicity", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
973 append_menu_item (menu, _("Bond Cutoffs"), "app.edit.cutoffs", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
974 return menu;
975}
976
983{
984 GMenu * menu = g_menu_new ();
985 append_menu_item (menu, _("Toolboxes"), "app.analyze.tool-box", "<CTRL>T", NULL, IMG_STOCK, PAGE_SETUP, FALSE, FALSE, FALSE, NULL);
986 return menu;
987}
988
995{
996 GMenu * menu = g_menu_new ();
997 gchar * str;
998 int i;
999 for (i=0; i<NCALCS-1; i++)
1000 {
1001 str = g_strdup_printf ("app.analyze.%d", i);
1002 append_menu_item (menu, _(calc_name[i]), str, NULL, NULL, IMG_FILE, graph_img[(i < ANG) ? i : i+1], FALSE, FALSE, FALSE, NULL);
1003 g_free (str);
1004 }
1005 // Append new calculation menu element here
1006 g_menu_append_section (menu, NULL, (GMenuModel*)tool_box_section());
1007 return menu;
1008}
1009
1016{
1017 GMenu * menu = g_menu_new ();
1018 append_menu_item (menu, _("Periodic Table"), "app.help.periodic", "<CTRL>P", NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1019 if (! atomes_from_libreoffice) append_menu_item (menu, _("Preferences"), "app.help.preferences", NULL, NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1020 append_menu_item (menu, _("Shortcuts"), "app.help.shortcuts", NULL, NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1021 append_menu_item (menu, _("About"), "app.help.about", "<CTRL>A", NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1022 return menu;
1023}
1024
1031{
1032 GMenu * menu = g_menu_new ();
1033 append_submenu (menu, _("Workspace"), create_workspace_menu("app", 0, -1, -1));
1034 append_submenu (menu, _("Edit"), create_edit_menu());
1035 append_submenu (menu, _("Analyze"), create_analyze_menu());
1036 append_submenu (menu, _("Help"), create_help_menu());
1037 return menu;
1038}
1039
1040#ifdef GTK4
1052G_MODULE_EXPORT void atomes_popup_menu (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
1053{
1054 if (gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture) == GDK_BUTTON_SECONDARY)
1055 {
1056 GtkWidget * popover = work_menu (-1, -1);
1057 gtk_widget_set_parent (popover, MainWindow);
1058 pop_menu_at_pointer (popover, x, y);
1059 }
1060}
1061
1073G_MODULE_EXPORT gboolean on_atomes_pressed (GtkEventControllerKey * self, guint keyval, guint keycode, GdkModifierType state, gpointer data)
1074{
1075 atomes_key_pressed (keyval, state);
1076 return TRUE;
1077}
1078#endif
1079
1087GtkWidget * create_main_window (GApplication * atomes)
1088{
1089 int i;
1090 THETD = gdk_pixbuf_new_from_file (PACKAGE_TD, NULL);
1091#ifdef GTK3
1092 gtk_window_set_default_icon (THETD);
1093#endif
1094 THEMO = gdk_pixbuf_new_from_file (PACKAGE_MOL, NULL);
1095 THEBD = gdk_pixbuf_new_from_file (g_build_filename (PACKAGE_PREFIX, "pixmaps/bd.png", NULL), NULL);
1096 SETTING = gdk_pixbuf_new_from_file (PACKAGE_PRO, NULL);
1097 SETTINGS = gdk_pixbuf_new_from_file (PACKAGE_SET, NULL);
1098 OGL = gdk_pixbuf_new_from_file (PACKAGE_OGL, NULL);
1099 OGLM = gdk_pixbuf_new_from_file (PACKAGE_OGLM, NULL);
1100 OGLC = gdk_pixbuf_new_from_file (PACKAGE_OGLC, NULL);
1101
1102 GtkWidget * window = gtk_application_window_new (GTK_APPLICATION(atomes));
1103 gtk_window_set_title (GTK_WINDOW(window), PACKAGE);
1104 gtk_window_set_resizable (GTK_WINDOW(window), TRUE);
1105 gtk_widget_set_size_request (window, 900, 450);
1106
1107 for (i=0; i<NCALCS; i++)
1108 {
1109 graph_img[i] = g_build_filename (PACKAGE_PREFIX, graph_icon[i], NULL);
1110 }
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 g_action_map_add_action (G_ACTION_MAP(AtomesApp), G_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 gchar * str;
1145 GSimpleAction * this_action;
1146 for (i=0; i<NCALCS-1; i++)
1147 {
1148 str = g_strdup_printf ("analyze.%d", i);
1149 this_action = g_simple_action_new (str, NULL);
1150 g_free (str);
1151 g_signal_connect (this_action, "activate", G_CALLBACK(atomes_menu_bar_action), GINT_TO_POINTER(i));
1152 }
1153
1154 /*GtkBuilder * builder = gtk_builder_new_from_file ("menus/main.ui");
1155 GMenuModel * model = G_MENU_MODEL (gtk_builder_get_object (builder, "atomes_menu_bar"));
1156 gtk_application_set_menubar (GTK_APPLICATION(atomes), G_MENU_MODEL(model));
1157 g_object_unref (model);*/
1158 gtk_application_set_menubar (GTK_APPLICATION(atomes), G_MENU_MODEL(atomes_menu_bar()));
1159 gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW(window), TRUE);
1160
1161#ifdef GTK3
1162 MainEvent = gtk_event_box_new ();
1163 gtk_widget_add_events (MainEvent,
1164 GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK |
1165 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
1166 g_signal_connect(G_OBJECT(MainEvent), "button_press_event", G_CALLBACK(pop_menu), NULL);
1167 g_signal_connect(G_OBJECT(MainEvent), "button_release_event", G_CALLBACK(pop_menu), NULL);
1168#else
1169 add_widget_gesture_and_key_action (window, "atomes-context-click", G_CALLBACK(atomes_popup_menu), NULL,
1170 NULL, NULL, NULL,
1171 "atomes-key-pressed", G_CALLBACK(on_atomes_pressed), NULL,
1172 NULL, NULL, NULL, NULL, NULL, NULL);
1173#endif
1174 add_gtk_close_event (window, G_CALLBACK(leaving_question), NULL);
1175 GtkWidget * hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
1176 int frame_size[2]={200, 550};
1177 for (i=0; i<2; i++)
1178 {
1179 MainFrame[i] = gtk_frame_new (NULL);
1180 gtk_widget_set_size_request (MainFrame[i], frame_size[i], -1);
1181 MainScrol[i] = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
1182#ifdef GTK3
1183 if (! i)
1184 {
1186 }
1187 else
1188 {
1190 gtk_container_add (GTK_CONTAINER(MainEvent), MainScrol[i]);
1191 }
1192#else
1193 gtk_scrolled_window_set_propagate_natural_height ((GtkScrolledWindow *)MainScrol[i], TRUE);
1194 gtk_scrolled_window_set_propagate_natural_width ((GtkScrolledWindow *)MainScrol[i], TRUE);
1196#endif
1197 }
1198#ifdef GTK4
1199 gtk_paned_set_start_child (GTK_PANED (hpaned), MainFrame[0]);
1200 gtk_paned_set_resize_start_child (GTK_PANED (hpaned), FALSE);
1201 gtk_paned_set_shrink_start_child (GTK_PANED (hpaned), FALSE);
1202 gtk_paned_set_end_child (GTK_PANED (hpaned), MainFrame[1]);
1203 gtk_paned_set_resize_end_child (GTK_PANED (hpaned), TRUE);
1204 gtk_paned_set_shrink_end_child (GTK_PANED (hpaned), FALSE);
1205#else
1206 gtk_paned_pack1 (GTK_PANED (hpaned), MainFrame[0], FALSE, FALSE);
1207 gtk_paned_pack2 (GTK_PANED (hpaned), MainFrame[1], FALSE, FALSE);
1208#endif
1211 add_container_child (CONTAINER_WIN, window, hpaned);
1212 clean_view ();
1213 show_the_widgets (window);
1214
1215 for (i=0; i<9; i++)
1216 {
1217 davect[i].a = i/3;
1218 davect[i].b = i-3*davect[i].a;
1219 }
1220
1221 dots[0] = g_strdup_printf ("%s", PACKAGE_DOTA);
1222 dots[1] = g_strdup_printf ("%s", PACKAGE_DOTB);
1223 dots[2] = g_strdup_printf ("%s", PACKAGE_DOTC);
1224 dots[3] = g_strdup_printf ("%s", PACKAGE_DOTD);
1225 dots[4] = g_strdup_printf ("%s", PACKAGE_DOTE);
1226 dots[5] = g_strdup_printf ("%s", PACKAGE_DOTF);
1227 dots[6] = g_strdup_printf ("%s", PACKAGE_DOTG);
1228 dots[7] = g_strdup_printf ("%s", PACKAGE_DOTH);
1229
1230 ifield[0] = g_strdup_printf ("%s", PACKAGE_DFBD);
1231 ifield[1] = g_strdup_printf ("%s", PACKAGE_DFBD);
1232 ifield[2] = g_strdup_printf ("%s", PACKAGE_DFAN);
1233 ifield[3] = g_strdup_printf ("%s", PACKAGE_DFAN);
1234 ifield[4] = g_strdup_printf ("%s", PACKAGE_DFDI);
1235 ifield[5] = g_strdup_printf ("%s", PACKAGE_DFDI);
1236 ifield[6] = g_strdup_printf ("%s", PACKAGE_DFTD);
1237 ifield[7] = g_strdup_printf ("%s", PACKAGE_DFIN);
1238
1239 bravais_img[0] = g_strdup_printf ("%s", PACKAGE_SGTC);
1240 bravais_img[1] = g_strdup_printf ("%s", PACKAGE_SGMP);
1241 bravais_img[2] = g_strdup_printf ("%s", PACKAGE_SGMI);
1242 bravais_img[3] = g_strdup_printf ("%s", PACKAGE_SGOP);
1243 bravais_img[4] = g_strdup_printf ("%s", PACKAGE_SGOI);
1244 bravais_img[5] = g_strdup_printf ("%s", PACKAGE_SGOC);
1245 bravais_img[6] = g_strdup_printf ("%s", PACKAGE_SGOF);
1246 bravais_img[7] = g_strdup_printf ("%s", PACKAGE_SGTP);
1247 bravais_img[8] = g_strdup_printf ("%s", PACKAGE_SGTI);
1248 bravais_img[9] = g_strdup_printf ("%s", PACKAGE_SGTR);
1249 bravais_img[10] = g_strdup_printf ("%s", PACKAGE_SGHP);
1250 bravais_img[11] = g_strdup_printf ("%s", PACKAGE_SGCP);
1251 bravais_img[12] = g_strdup_printf ("%s", PACKAGE_SGCI);
1252 bravais_img[13] = g_strdup_printf ("%s", PACKAGE_SGCF);
1253
1254 // Rouge
1255 std[0].red = 1.0;
1256 std[0].green = 0.0;
1257 std[0].blue = 0.0;
1258 // Jaune
1259 std[1].red = 1.0;
1260 std[1].green = 1.0;
1261 std[1].blue = 0.0;
1262 // Vert
1263 std[2].red = 0.0;
1264 std[2].green = 1.0;
1265 std[2].blue = 0.0;
1266 // Cyan
1267 std[3].red = 0.0;
1268 std[3].green = 1.0;
1269 std[3].blue = 1.0;
1270 // Bleu
1271 std[4].red = 0.0;
1272 std[4].green = 0.0;
1273 std[4].blue = 1.0;
1274 // Rose
1275 std[5].red = 1.0;
1276 std[5].green = 0.0;
1277 std[5].blue = 1.0;
1278
1279 for (i=0; i<3; i++)
1280 {
1281 objects[i] = 0;
1282 object_was_selected[i] = NULL;
1283 tmp_object_id[i] = NULL;
1284 }
1285 cut_sel.a = cut_sel.b = 0;
1286 cut_sel.c = 1;
1287
1288 return window;
1289}
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:1177
G_MODULE_EXPORT void on_close_workspace(GtkWidget *widg, gpointer data)
close the active workspace
Definition callbacks.c:126
G_MODULE_EXPORT void on_open_save_activate(GtkWidget *widg, gpointer data)
open or save an atomes file - prepare the dialog
Definition callbacks.c:549
G_MODULE_EXPORT void on_isaacs_port(GtkWidget *widg, gpointer data)
open or write ISAACS XML file - prepare the dialog
Definition callbacks.c:904
G_MODULE_EXPORT void on_coord_port(GtkWidget *widg, gpointer data)
export or import atomic coordinates: prepare dialog
Definition callbacks.c:1763
G_MODULE_EXPORT void on_save_as_activate(GtkWidget *widg, gpointer data)
open or save, choosing a file name
Definition callbacks.c:747
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:503
#define PACKAGE
Definition config.h:46
gchar * PACKAGE_SET
Definition global.c:107
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_LOGO
Definition global.c:108
gchar * PACKAGE_DOTC
Definition global.c:113
gchar * PACKAGE_DFIN
Definition global.c:123
GtkWidget * MainScrol[2]
Definition global.c:213
int activep
Definition global.c:162
gchar * PACKAGE_IMP
Definition global.c:90
GSimpleAction * edition_actions[3]
Definition global.c:204
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
GdkPixbuf * OGLC
Definition global.c:229
gchar * PACKAGE_DFDI
Definition global.c:121
gchar * PACKAGE_DFTD
Definition global.c:122
gchar * PACKAGE_SGCF
Definition global.c:126
GtkApplication * AtomesApp
Definition global.c:206
gchar * PACKAGE_DFBD
Definition global.c:119
gchar * PACKAGE_CON
Definition global.c:91
gchar * PACKAGE_SGHP
Definition global.c:127
int nprojects
Definition global.c:161
GtkWidget * MainFrame[2]
Definition global.c:209
GtkWidget * atomes_shortcuts
Definition global.c:215
gchar * PACKAGE_OGL
Definition global.c:103
GtkWidget * MainWindow
Definition global.c:207
gchar * PACKAGE_DOTF
Definition global.c:116
GdkPixbuf * OGLM
Definition global.c:228
gchar * PACKAGE_DOTA
Definition global.c:111
gchar * PACKAGE_OGLM
Definition global.c:104
gchar * PACKAGE_SGOC
Definition global.c:133
gchar * PACKAGE_SGOF
Definition global.c:134
gchar * PACKAGE_SGOP
Definition global.c:131
GdkPixbuf * SETTINGS
Definition global.c:226
gchar * PACKAGE_OGLC
Definition global.c:105
gchar * PACKAGE_TD
Definition global.c:101
GdkPixbuf * THEBD
Definition global.c:224
gchar * PACKAGE_SGTC
Definition global.c:137
gchar * PACKAGE_SGCP
Definition global.c:124
GdkPixbuf * OGL
Definition global.c:227
GdkPixbuf * THETD
Definition global.c:222
GtkWidget * atomes_logo
Definition global.c:214
gchar * PACKAGE_PRO
Definition global.c:106
GdkPixbuf * SETTING
Definition global.c:225
#define i18n(String)
Definition global.c:80
gchar * bravais_img[14]
Definition global.c:142
gchar * PACKAGE_MOL
Definition global.c:102
gchar * PACKAGE_DOTB
Definition global.c:112
GtkWidget * curvetoolbox
Definition global.c:211
GdkPixbuf * THEMO
Definition global.c:223
GtkWidget * pop
Definition global.c:210
gchar * ifield[8]
Definition global.c:143
gchar * PACKAGE_SGOI
Definition global.c:132
gchar * PACKAGE_SGCI
Definition global.c:125
gchar * PACKAGE_DOTD
Definition global.c:114
GtkWidget * MainView
Definition global.c:208
gboolean atomes_from_libreoffice
Definition global.c:195
Global variable declarations Global convenience function declarations Global data structure defin...
@ IMG_STOCK
Definition global.h:280
@ IMG_FILE
Definition global.h:279
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:2139
atomes_action edition_acts[]
Definition gui.c:108
project * proj
gchar * graph_img[NCALCS]
Definition gui.c:106
char * graph_name[]
Definition gui.c:123
void pop_menu_at_pointer(GtkWidget *widg, GdkEvent *event)
popup a menu at pointer location
Definition gtk-misc.c:2471
#define EDITA
Definition global.h:218
G_MODULE_EXPORT gboolean destroy_this_window(GtkWidget *win, GdkEvent *event, gpointer data)
destroy a GtkWindow
Definition gtk-misc.c:2514
char * calc_name[]
Definition gui.c:112
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:2557
ColRGBA std[6]
Definition gui.c:149
#define FEXIT
Definition global.h:228
#define FOPEN
Definition global.h:224
#define YES
Definition global.h:217
@ CONTAINER_WIN
Definition global.h:266
@ CONTAINER_FRA
Definition global.h:270
@ CONTAINER_SCR
Definition global.h:267
#define DPROPERTIES
Definition global.h:222
#define ANG
Definition global.h:342
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:340
#define FNEW
Definition global.h:223
void text_view_set_monospace(GtkWidget *view)
set the font of a GtkTextView as monospace
Definition gtk-misc.c:742
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2213
#define FSAVE
Definition global.h:225
tint cut_sel
Definition gui.c:147
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:267
#define FCLOSE
Definition global.h:227
gchar * dots[NDOTS]
Definition gui.c:105
#define PAGE_SETUP
Definition global.h:213
#define NCALCS
#define FSAVEAS
Definition global.h:226
void remove_action(gchar *action_name)
add action from the main window action map
Definition gui.c:554
#define NDOTS
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:202
#define ABOUT
Definition global.h:241
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:762
GMenu * quit_section(gchar *act)
create the 'Quit' menu item
Definition gui.c:890
void create_user_preferences_dialog()
dint davect[9]
Definition gui.c:148
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:865
GMenu * create_analyze_menu()
create atomes 'analyze' menu
Definition gui.c:994
void add_analysis_action(int act)
add action to the main window action map
Definition gui.c:538
gchar * main_group_names[]
Definition gui.c:168
GMenu * port_section(gchar *act, int pop, int port)
create the import/export menu items
Definition gui.c:793
int objects[3]
Definition selection.c:212
void remove_edition_actions()
remove all edition actions
Definition gui.c:564
GIcon * get_gicon_from_data(int format, const gchar *icon)
create a new icon using data
Definition gui.c:596
GMenu * create_workspace_menu(gchar *act, int pop_up, int proj, int calc)
create atomes 'workspace' menu
Definition gui.c:945
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:627
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:714
gchar * graph_icon[]
Definition gui.c:135
GMenu * create_help_menu()
create atomes 'help' menu
Definition gui.c:1015
GtkWidget * create_curve_tool_box()
create the curve tool box window
Definition tools.c:339
shortcuts main_shortcuts[]
Definition gui.c:151
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:354
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:183
GMenu * workspace_title()
create the 'Workspace' menu item
Definition gui.c:904
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:919
GMenu * atomes_menu_bar()
create atomes menu bar
Definition gui.c:1030
GtkWidget * create_main_window(GApplication *atomes)
create the main application window
Definition gui.c:1087
void remove_edition_and_analyze_actions()
remove all edition and analysis action
Definition gui.c:575
void clean_view()
clean the main window
Definition gui.c:288
G_MODULE_EXPORT void on_calc_activate(GtkWidget *widg, gpointer data)
create a calculation dialog - prepare the dialog
Definition calc_menu.c:2049
GtkWidget * work_menu(int p, int c)
create the workspace popup menu
Definition work_menu.c:216
GMenu * create_edit_menu()
create atomes 'edit' menu
Definition gui.c:968
void view_buffer(GtkTextBuffer *buffer)
set a text buffer in the main window or an image
Definition gui.c:311
int main_group_by_section[]
Definition gui.c:167
G_MODULE_EXPORT void show_periodic_table(GtkWidget *widg, gpointer data)
show the periodic table of the elements
Definition gui.c:403
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:166
G_MODULE_EXPORT void atomes_menu_bar_action(GSimpleAction *action, GVariant *parameter, gpointer data)
atomes menu bar actions
Definition gui.c:417
int main_shortcut_by_group[]
Definition gui.c:169
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:668
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:745
int * object_was_selected[3]
Definition selection.c:213
GMenu * import_section(gchar *act)
create the 'Import' submenu
Definition gui.c:876
void remove_action(gchar *action_name)
add action from the main window action map
Definition gui.c:554
GMenu * tool_box_section()
create toolboxes menu item
Definition gui.c:982
GMenu * project_section(gchar *act, int pop_up, int proj, int calc)
create the project section
Definition gui.c:817
G_MODULE_EXPORT void create_about_dialog(GtkWidget *widg, gpointer data)
create the about dialog
Definition interface.c:176
G_MODULE_EXPORT gboolean leaving_question(GtkWidget *widget, GdkEvent *event, gpointer data)
Leaving atomes ?
Definition interface.c:482
Messaging function declarations.
double y
Definition ogl_draw.c:63
double x
Definition ogl_draw.c:63
Function declarations for reading atomes project file Function declarations for saving atomes proje...
Definition global.h:111
Definition global.h:118
int status
Definition w_advance.c:173
void add_project_to_workspace()
add project(s) to the workspace tree
Definition workspace.c:597
G_MODULE_EXPORT void activate_project(GtkWidget *widg, gpointer data)
activate a project
Definition workspace.c:179
G_MODULE_EXPORT void change_project_name(GtkWidget *wid, gpointer edata)
change project name
Definition workspace.c:344
Function declarations for workspace managment.