atomes 1.1.17
atomes: an atomic scale modeling tool box
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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);
99
100#ifdef GTK3
101GtkWidget * MainEvent;
102#endif
103
104gchar * dots[NDOTS];
105gchar * calc_img[NCALCS-2];
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
112atomes_action analyze_acts[] = {{"analyze.gr", GINT_TO_POINTER(0)},
113 {"analyze.sq", GINT_TO_POINTER(1)},
114 {"analyze.sk", GINT_TO_POINTER(2)},
115 {"analyze.gk", GINT_TO_POINTER(3)},
116 {"analyze.bonds", GINT_TO_POINTER(4)},
117 {"analyze.rings", GINT_TO_POINTER(5)},
118 {"analyze.chains", GINT_TO_POINTER(6)},
119 {"analyze.sp", GINT_TO_POINTER(7)},
120 {"analyze.msd", GINT_TO_POINTER(8)}};
121
122char * calc_name[NCALCS-2] = {"g(r)/G(r)",
123 "S(q) from FFT[g(r)]",
124 "S(q) from Debye equation",
125 "g(r)/G(r) from FFT[S(q)]",
126 "Bonds and angles",
127 "Ring statistics",
128 "Chain statistics",
129 "Spherical harmonics",
130 "Mean Squared Displacement",
131 "Bond valence"};
132
133char * graph_name[NGRAPHS] = {"g(r)/G(r)",
134 "S(q) from FFT[g(r)]",
135 "S(q) from Debye equation",
136 "g(r)/G(r) from FFT[S(q)]",
137 "Bonds properties",
138 "Angle distributions",
139 "Ring statistics",
140 "Chain statistics",
141 "Spherical harmonics",
142 "Mean Squared Displacement"};
143
147
149 { "About", "open about dialog", GDK_KEY_a, "<Ctrl>a" },
150 { "Periodic table", "open periodic table", GDK_KEY_p, "<Ctrl>p" },
151 { "Quit", "quit atomes", GDK_KEY_q, "<Ctrl>q" },
152//};
153//{
154 { "Open workspace", "open atomes workspace", GDK_KEY_w, "<Ctrl>w" },
155 { "Save workspace", "save atomes workspace", GDK_KEY_s, "<Ctrl>s" },
156 { "Close workspace", "close atomes workspace", GDK_KEY_c, "<Ctrl>c" },
157//};
158//{
159 { "New project", "create new atomes project", GDK_KEY_n, "<Ctrl>n" },
160 { "Open project", "open atomes project", GDK_KEY_o, "<Ctrl>o" }
161};
162
163gchar * main_section_names[] = { "Main" };
165gchar * main_group_names[] = { "General", "Workspace", "Projects" };
166int main_shortcut_by_group[] = { 3, 3, 2 };
167
180GtkWidget * shortcuts_window (int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups],
181 gchar * section_names[sections], gchar * group_names[groups], shortcuts shortcs[])
182{
183 GtkShortcutsWindow * win = NULL;
184#ifdef G_OS_WIN32
185 win = g_object_new (GTK_TYPE_SHORTCUTS_WINDOW, "modal", FALSE, "resizable", TRUE, "deletable", TRUE, NULL);
186#else
187 win = g_object_new (GTK_TYPE_SHORTCUTS_WINDOW, "modal", FALSE, "resizable", TRUE, NULL);
188#endif
189 GtkShortcutsSection * shortcut_section[sections];
190 GtkShortcutsGroup * shortcut_group[groups];
191 GtkShortcutsShortcut * shortcut;
192#ifdef GTK4
193#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
194 GtkWidget * sections_book = gtk_notebook_new ();
195 gtk_notebook_set_scrollable (GTK_NOTEBOOK(sections_book), TRUE);
196 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(sections_book), GTK_POS_TOP);
197#endif
198#endif // GTK4
199 int i, j, k, l, m;
200 l = m = 0;
201 for (i=0; i<sections; i++)
202 {
203 shortcut_section[i] = g_object_new (GTK_TYPE_SHORTCUTS_SECTION, "visible", TRUE, "title", section_names[i], "section-name", section_names[i], NULL);
204#ifdef GTK4
205#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
206 gtk_orientable_set_orientation ((GtkOrientable *)shortcut_section[i], GTK_ORIENTATION_HORIZONTAL);
207#endif
208#endif
209 for (j=0; j<group_by_section[i]; j++, l++)
210 {
211 shortcut_group[l] = g_object_new (GTK_TYPE_SHORTCUTS_GROUP, "visible", TRUE, "title", group_names[l], NULL);
212 for (k=0; k<shortcut_by_group[l]; k++, m++)
213 {
214 shortcut = g_object_new (GTK_TYPE_SHORTCUTS_SHORTCUT,
215 "visible", TRUE,
216 "shortcut-type", GTK_SHORTCUT_ACCELERATOR,
217 "accelerator", shortcs[m].accelerator,
218 "title", shortcs[m].description,
219 NULL );
220#ifdef GTK4
221#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
222 gtk_shortcuts_group_add_shortcut (shortcut_group[l], shortcut);
223#else
224 add_box_child_start (GTK_ORIENTATION_VERTICAL, (GtkWidget *)shortcut_group[l], (GtkWidget *)shortcut, FALSE, FALSE, 0);
225#endif
226#else
227 gtk_container_add (GTK_CONTAINER((GtkWidget *)shortcut_group[l]), (GtkWidget *)shortcut);
228#endif
229 }
230#ifdef GTK4
231#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
232 gtk_shortcuts_section_add_group (shortcut_section[i], shortcut_group[l]);
233#else
234 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, (GtkWidget *)shortcut_section[i], (GtkWidget *)shortcut_group[l], FALSE, FALSE, 0);
235#endif
236#else
237 gtk_container_add (GTK_CONTAINER((GtkWidget *)shortcut_section[i]), (GtkWidget *)shortcut_group[l]);
238#endif
239 }
240#ifdef GTK4
241#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
242 gtk_shortcuts_window_add_section (GTK_SHORTCUTS_WINDOW(win), shortcut_section[i]);
243#else
244 gtk_notebook_append_page (GTK_NOTEBOOK(sections_book), (GtkWidget *)shortcut_section[i], gtk_label_new (section_names[i]));
245#endif
246#else
247 gtk_container_add (GTK_CONTAINER((GtkWidget *)win), (GtkWidget *)shortcut_section[i]);
248#endif
249 }
250#ifdef GTK4
251#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
252 gtk_window_set_child ((GtkWindow*) win, sections_book);
253#endif
254#endif
255 add_gtk_close_event ((GtkWidget *)win, G_CALLBACK(destroy_this_window), NULL);
256 show_the_widgets ((GtkWidget *)win);
257 return (GtkWidget *)win;
258}
259
260#ifdef GTK3
270G_MODULE_EXPORT gboolean pop_menu (GtkWidget * widget, GdkEventButton * event, gpointer data)
271{
272 if (event -> button == 3)
273 {
274 pop_menu_at_pointer (work_menu (-1, -1), (GdkEvent *)event);
275 }
276 return FALSE;
277}
278#endif
279
286{
289#ifdef GTK4
290 atomes_logo = gtk_picture_new_for_filename (PACKAGE_LOGO);
291 gtk_widget_set_size_request (atomes_logo, 550, -1);
293#else
294 atomes_logo = gtk_image_new_from_file (PACKAGE_LOGO);
296 gtk_container_add (GTK_CONTAINER(MainEvent), atomes_logo);
297 show_the_widgets (MainEvent);
298#endif
299}
300
308void view_buffer (GtkTextBuffer * buffer)
309{
310 if (atomes_logo)
311 {
313#ifdef GTK4
314 gtk_scrolled_window_set_child ((GtkScrolledWindow *)MainScrol[1], NULL);
315#endif
316 }
317 gboolean add = FALSE;
318 if (! MainView)
319 {
320 MainView = gtk_text_view_new ();
321 gtk_text_view_set_editable (GTK_TEXT_VIEW(MainView), 0);
323 add = TRUE;
324 }
325 gtk_text_view_set_buffer (GTK_TEXT_VIEW(MainView), buffer);
326#ifdef GTK3
327 if (! MainScrol[1])
328 {
329 MainScrol[1] = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
330 gtk_container_add (GTK_CONTAINER(MainEvent), MainScrol[1]);
331 add = TRUE;
332 }
333 if (add) gtk_container_add (GTK_CONTAINER(MainScrol[1]), MainView);
334#else
335 if (add)
336 {
338 }
339#endif
341}
342
351void atomes_key_pressed (guint keyval, GdkModifierType state)
352{
353 if (state & GDK_CONTROL_MASK)
354 {
355 switch (keyval)
356 {
357 case GDK_KEY_a:
358 create_about_dialog (NULL, NULL);
359 break;
360 case GDK_KEY_c:
361 on_close_workspace (NULL, GINT_TO_POINTER(1));
362 break;
363 case GDK_KEY_n:
364 on_create_new_project (NULL, NULL);
365 break;
366 case GDK_KEY_o:
367 on_open_save_activate (NULL, GINT_TO_POINTER(0));
368 break;
369 case GDK_KEY_p:
371 break;
372 case GDK_KEY_q:
373#ifdef GTK4
374 leaving_question (NULL, NULL);
375#else
376 leaving_question (NULL, NULL, NULL);
377#endif
378 break;
379 case GDK_KEY_s:
380 on_save_as_activate (NULL, GINT_TO_POINTER(3));
381 break;
382 case GDK_KEY_t:
383 on_show_curve_toolbox (NULL, NULL);
384 break;
385 case GDK_KEY_w:
386 on_open_save_activate (NULL, GINT_TO_POINTER(2));
387 break;
388 }
389 }
390}
391
399void add_action (GSimpleAction * action)
400{
401 g_action_map_add_action (G_ACTION_MAP(AtomesApp), G_ACTION(action));
402}
403
412{
413 g_action_map_remove_action (G_ACTION_MAP(AtomesApp), (const gchar *)action_name);
414}
415
422{
423 int i;
424 for (i=0; i<G_N_ELEMENTS(edition_acts); i++) remove_action (edition_acts[i].action_name);
425}
426
433{
435 int i;
436 for (i=0; i<G_N_ELEMENTS(analyze_acts); i++) remove_action (analyze_acts[i].action_name);
437}
438
447G_MODULE_EXPORT void show_periodic_table (GtkWidget * widg, gpointer data)
448{
450}
451
461G_MODULE_EXPORT void atomes_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data)
462{
463 gchar * name = g_strdup_printf ("%s", g_action_get_name(G_ACTION(action)));
464 if (g_strcmp0 (name, "workspace.open") == 0)
465 {
466 on_open_save_activate (NULL, data);
467 }
468 else if (g_strcmp0 (name, "workspace.save") == 0)
469 {
470 on_open_save_activate (NULL, data);
471 }
472 else if (g_strcmp0 (name, "workspace.save-as") == 0)
473 {
474 on_save_as_activate (NULL, data);
475 }
476 else if (g_strcmp0 (name, "workspace.close") == 0)
477 {
478 on_close_workspace (NULL, data);
479 }
480 else if (g_strcmp0 (name, "project.new") == 0)
481 {
482 on_create_new_project (NULL, data);
483 }
484 else if (g_strcmp0 (name, "project.edit") == 0)
485 {
486 change_project_name (NULL, data);
487 }
488 else if (g_strcmp0 (name, "project.active") == 0)
489 {
490 activate_project (NULL, data);
491 }
492 else if (g_strcmp0 (name, "project.compute") == 0)
493 {
494 compute_this_prop (NULL, data);
495 }
496 else if (g_strcmp0 (name, "project.open") == 0)
497 {
498 on_open_save_activate (NULL, data);
499 }
500 else if (g_strcmp0 (name, "project.save") == 0)
501 {
502 on_open_save_activate (NULL, data);
503 }
504 else if (g_strcmp0 (name, "project.save-as") == 0)
505 {
506 on_save_as_activate (NULL, data);
507 }
508 else if (g_strcmp0 (name, "project.close") == 0)
509 {
510 on_close_activate (NULL, data);
511 }
512 else if (g_strcmp0 (name, "export.isaacs") == 0)
513 {
514 on_isaacs_port (NULL, data);
515 }
516 else if (g_strcmp0 (name, "export.coordinates") == 0)
517 {
518 on_coord_port (NULL, data);
519 }
520 else if (g_strcmp0 (name, "import.isaacs") == 0)
521 {
522 on_isaacs_port (NULL, data);
523 }
524 else if (g_strcmp0 (name, "import.coordinates") == 0)
525 {
526 on_coord_port (NULL, data);
527 }
528 else if (g_strcmp0 (name, "program.quit") == 0)
529 {
530 leaving_from_menu (NULL, data);
531 }
532 else if (g_strcmp0 (name, "edit.chemistry") == 0)
533 {
534 on_edit_activate (NULL, data);
535 }
536 else if (g_strcmp0 (name, "edit.periodicity") == 0)
537 {
538 on_edit_activate (NULL, data);
539 }
540 else if (g_strcmp0 (name, "edit.cutoffs") == 0)
541 {
542 on_edit_activate (NULL, data);
543 }
544 else if (g_strcmp0 (name, "analyze.gr") == 0)
545 {
546 on_calc_activate (NULL, data);
547 }
548 else if (g_strcmp0 (name, "analyze.sq") == 0)
549 {
550 on_calc_activate (NULL, data);
551 }
552 else if (g_strcmp0 (name, "analyze.sk") == 0)
553 {
554 on_calc_activate (NULL, data);
555 }
556 else if (g_strcmp0 (name, "analyze.gk") == 0)
557 {
558 on_calc_activate (NULL, data);
559 }
560 else if (g_strcmp0 (name, "analyze.bonds") == 0)
561 {
562 on_calc_activate (NULL, data);
563 }
564 else if (g_strcmp0 (name, "analyze.rings") == 0)
565 {
566 on_calc_activate (NULL, data);
567 }
568 else if (g_strcmp0 (name, "analyze.chains") == 0)
569 {
570 on_calc_activate (NULL, data);
571 }
572 else if (g_strcmp0 (name, "analyze.sp") == 0)
573 {
574 on_calc_activate (NULL, data);
575 }
576 else if (g_strcmp0 (name, "analyze.msd") == 0)
577 {
578 on_calc_activate (NULL, data);
579 }
580 else if (g_strcmp0 (name, "analyze.tool-box") == 0)
581 {
582 on_show_curve_toolbox (NULL, data);
583 }
584 else if (g_strcmp0 (name, "help.periodic") == 0)
585 {
586 show_periodic_table (NULL, data);
587 }
588 else if (g_strcmp0 (name, "help.about") == 0)
589 {
590 create_about_dialog (NULL, data);
591 }
592 else if (g_strcmp0 (name, "help.shortcuts") == 0)
593 {
597 }
598 g_free (name);
599}
600
609GIcon * get_gicon_from_data (int format, const gchar * icon)
610{
611 switch (format)
612 {
613 case IMG_FILE:
614 return g_file_icon_new (g_file_new_for_path (icon));
615 break;
616 case IMG_STOCK:
617 return g_themed_icon_new (icon);
618 break;
619 default:
620 return NULL;
621 break;
622 }
623}
624
640void widget_add_action (GSimpleActionGroup * action_group, const gchar * act, GCallback handler, gpointer data,
641 gboolean check, gboolean status, gboolean radio, const gchar * stat)
642{
643 GSimpleAction * action;
644 GVariant * action_state;
645 if (radio)
646 {
647 action_state = g_variant_new_string (stat);
648 action = g_simple_action_new_stateful (act, G_VARIANT_TYPE_STRING, action_state);
649 }
650 else if (check)
651 {
652 action_state = g_variant_new_boolean (status);
653 action = g_simple_action_new_stateful (act, NULL, action_state);
654 }
655 else
656 {
657 action = g_simple_action_new (act, NULL);
658 }
659 g_signal_connect (action, "activate", handler, data);
660 g_action_map_add_action (G_ACTION_MAP(action_group), G_ACTION(action));
661}
662
681GMenuItem * create_gmenu_item (const gchar * label, const gchar * action, const gchar * accel,
682 const gchar * custom, int format, const gchar * icon,
683 gboolean check, gboolean status, gboolean radio, const gchar * rstatus)
684{
685 GMenuItem * item;
686 item = g_menu_item_new (label, action);
687 /* GKT4 bug, normally mark-up should be provided using boolean:
688 g_menu_item_set_attribute (item, "use-markup", "b", TRUE, NULL);
689 But it does not work, however it does using a string: */
690 g_menu_item_set_attribute (item, "use-markup", "s", "TRUE", NULL);
691 if (custom)
692 {
693 g_menu_item_set_attribute (item, "custom", "s", custom, NULL);
694 // g_menu_item_set_attribute_value (item, "custom", g_variant_new_string (custom));
695 GVariant * cust = g_menu_item_get_attribute_value (item, "custom", g_variant_type_new("s"));
696 if (cust) g_print ("item :: %s, custom :: %s\n", label, g_variant_get_string (cust, NULL));
697 }
698 else
699 {
700 if (accel) g_menu_item_set_attribute (item, "accel", "s", accel, NULL);
701 // if (check) g_menu_item_set_attribute (item, "target", "b", status, NULL);
702 if (radio) g_menu_item_set_attribute (item, "target", "s", rstatus, NULL);
703#ifdef MENU_ICONS
704 if (icon)
705 {
706 GIcon * gicon = get_gicon_from_data (format, icon);
707 if (gicon)
708 {
709 g_menu_item_set_icon (item, gicon);
710 g_object_unref (gicon);
711 }
712 }
713#endif
714 }
715 return item;
716}
717
727void append_submenu (GMenu * menu, const gchar * label, GMenu * submenu)
728{
729 GMenuItem * item = g_menu_item_new (label, NULL);
730 /* GKT4 bug, normally mark-up should be provided using boolean:
731 g_menu_item_set_attribute (item, "use-markup", "b", TRUE, NULL);
732 But it does not work, however it does using a string: */
733 g_menu_item_set_attribute (item, "use-markup", "s", "TRUE", NULL);
734 g_menu_item_set_submenu (item, (GMenuModel *)submenu);
735 g_menu_append_item (menu, item);
736}
737
757void append_menu_item (GMenu * menu, const gchar * label, const gchar * action, const gchar * accel,
758 const gchar * custom, int format, const gchar * icon,
759 gboolean check, gboolean status, gboolean radio, const gchar * rstatus)
760{
761 GMenuItem * item = create_gmenu_item (label, action, accel, custom, format, icon, check, status, radio, rstatus);
762 g_menu_append_item (menu, item);
763 g_object_unref (item);
764}
765
774GMenu * workspace_section (gchar * act, int pop)
775{
776 GMenu * menu = g_menu_new ();
777 gchar * str;
778 str = g_strdup_printf ("%s.workspace.open", act);
779 append_menu_item (menu, "Open", (const gchar *)str, "<CTRL>W", NULL, IMG_STOCK, FOPEN, FALSE, FALSE, FALSE, NULL);
780 g_free (str);
781 if (! pop || nprojects)
782 {
783 str = g_strdup_printf ("%s.workspace.save", act);
784 append_menu_item (menu, "Save", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVE, FALSE, FALSE, FALSE, NULL);
785 g_free (str);
786 str = g_strdup_printf ("%s.workspace.save-as", act);
787 append_menu_item (menu, "Save As", (const gchar *)str, "<CTRL>S", NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
788 g_free (str);
789 str = g_strdup_printf ("%s.workspace.close", act);
790 append_menu_item (menu, "Close", (const gchar *)str, "<CTRL>C", NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
791 g_free (str);
792 }
793 return menu;
794}
795
805GMenu * port_section (gchar * act, int pop, int port)
806{
807 gchar * port_action[2]={"export", "import"};
808 GMenu * menu = g_menu_new ();
809 gchar * str;
810 str = g_strdup_printf ("%s.%s.isaacs", act, port_action[port]);
811 append_menu_item (menu, "ISAACS Project File (*.ipf)", (const gchar *)str, NULL, NULL, IMG_FILE, PACKAGE_MOL, FALSE, FALSE, FALSE, NULL);
812 g_free (str);
813 str = g_strdup_printf ("%s.%s.coordinates", act, port_action[port]);
814 append_menu_item (menu, "Atomic Coordinates", (const gchar *)str, NULL, NULL, IMG_FILE, (port) ? PACKAGE_IMP : PACKAGE_CON, FALSE, FALSE, FALSE, NULL);
815 g_free (str);
816 return menu;
817}
818
829GMenu * project_section (gchar * act, int pop_up, int proj, int calc)
830{
831 GMenu * menu = g_menu_new ();
832 gchar * str, * str_n;
833 if (pop_up && nprojects && proj > -1)
834 {
835 if (activep != proj)
836 {
837 str = g_strdup_printf ("%s.project.active", act);
838 append_menu_item (menu, "Make Active", (const gchar *)str, NULL, NULL, IMG_STOCK, YES, FALSE, FALSE, FALSE, NULL);
839 g_free (str);
840 }
841 if (calc > -1)
842 {
843 str = g_strdup_printf ("%s.project.compute", act);
844 str_n = g_strdup_printf ("Analyze: %s", work_menu_items[calc+4]);
845 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);
846 g_free (str);
847 g_free (str_n);
848 }
849 str = g_strdup_printf ("%s.project.edit", act);
850 append_menu_item (menu, "Edit Name", (const gchar *)str, NULL, NULL, IMG_STOCK, EDITA, FALSE, FALSE, FALSE, NULL);
851 g_free (str);
852 }
853 str = g_strdup_printf ("%s.project.new", act);
854 append_menu_item (menu, "New", (const gchar *)str, "<CTRL>N", NULL, IMG_STOCK, FNEW, FALSE, FALSE, FALSE, NULL);
855 g_free (str);
856 str = g_strdup_printf ("%s.project.open", act);
857 append_menu_item (menu, "Open", (const gchar *)str, "<CTRL>O", NULL, IMG_STOCK, FOPEN, FALSE, FALSE, FALSE, NULL);
858 g_free (str);
859 if (! pop_up || proj > -1)
860 {
861 str = g_strdup_printf ("%s.project.save", act);
862 append_menu_item (menu, "Save", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVE, FALSE, FALSE, FALSE, NULL);
863 g_free (str);
864 str = g_strdup_printf ("%s.project.save-as", act);
865 append_menu_item (menu, "Save As", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
866 g_free (str);
867 str = g_strdup_printf ("%s.project.close", act);
868 append_menu_item (menu, "Close", (const gchar *)str, NULL, NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
869 g_free (str);
870 append_submenu (menu, "Export", port_section(act, pop_up, 0));
871 }
872 return menu;
873}
874
882GMenu * import_section (gchar * act)
883{
884 GMenu * menu = g_menu_new ();
885 append_submenu (menu, "Import", port_section(act, 0, 1));
886 return menu;
887}
888
896GMenu * quit_section (gchar * act)
897{
898 GMenu * menu = g_menu_new ();
899 gchar * str = g_strdup_printf ("%s.program.quit", act);
900 append_menu_item (menu, "Quit", (const gchar *)str, "<CTRL>Q", NULL, IMG_STOCK, FEXIT, FALSE, FALSE, FALSE, NULL);
901 g_free (str);
902 return menu;
903}
904
911{
912 GMenu * menu = g_menu_new ();
913 append_menu_item (menu, "Workspace", "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
914 return menu;
915}
916
925GMenu * project_title (int pop_up, int proj)
926{
927 GMenu * menu = g_menu_new ();
928 if (pop_up && nprojects && proj > -1)
929 {
930 gchar * str = g_strdup_printf ("<b>%s</b>", get_project_by_id(proj) -> name);
931 append_menu_item (menu, str, "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
932 g_free (str);
933 }
934 else
935 {
936 append_menu_item (menu, "Project(s)", "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
937 }
938 return menu;
939}
940
951GMenu * create_workspace_menu (gchar * act, int pop_up, int proj, int calc)
952{
953 GMenu * menu = g_menu_new ();
954 g_menu_append_section (menu, NULL, (GMenuModel*)workspace_title());
955 g_menu_append_section (menu, NULL, (GMenuModel*)workspace_section(act, pop_up));
956 g_menu_append_section (menu, NULL, (GMenuModel*)project_title(pop_up, proj));
957 g_menu_append_section (menu, NULL, (GMenuModel*)project_section(act, pop_up, proj, calc));
958 g_menu_append_section (menu, NULL, (GMenuModel*)import_section(act));
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 append_menu_item (menu, "g(r) / G(r)", "app.analyze.gr", NULL, NULL, IMG_FILE, PACKAGE_GR, FALSE, FALSE, FALSE, NULL);
998 append_menu_item (menu, "S(q) from FFT[g(r)]", "app.analyze.sq", NULL, NULL, IMG_FILE, PACKAGE_SQ, FALSE, FALSE, FALSE, NULL);
999 append_menu_item (menu, "S(q) from Debye Eq.", "app.analyze.sk", NULL, NULL, IMG_FILE, PACKAGE_SQ, FALSE, FALSE, FALSE, NULL);
1000 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);
1001 append_menu_item (menu, "Bonds and Angles", "app.analyze.bonds", NULL, NULL, IMG_FILE, PACKAGE_BD, FALSE, FALSE, FALSE, NULL);
1002 append_menu_item (menu, "Ring statistics", "app.analyze.rings", NULL, NULL, IMG_FILE, PACKAGE_RI, FALSE, FALSE, FALSE, NULL);
1003 append_menu_item (menu, "Chain statistics", "app.analyze.chains", NULL, NULL, IMG_FILE, PACKAGE_CH, FALSE, FALSE, FALSE, NULL);
1004 append_menu_item (menu, "Spherical Harmonics", "app.analyze.sp", NULL, NULL, IMG_FILE, PACKAGE_SP, FALSE, FALSE, FALSE, NULL);
1005 append_menu_item (menu, "Mean Squared Displacement", "app.analyze.msd", NULL, NULL, IMG_FILE, PACKAGE_MS, FALSE, FALSE, FALSE, NULL);
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 append_menu_item (menu, "Shortcuts", "app.help.shortcuts", NULL, NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1020 append_menu_item (menu, "About", "app.help.about", "<CTRL>A", NULL, IMG_STOCK, ABOUT, FALSE, FALSE, FALSE, NULL);
1021 return menu;
1022}
1023
1030{
1031 GMenu * menu = g_menu_new ();
1032 append_submenu (menu, "Workspace", create_workspace_menu("app", 0, -1, -1));
1033 append_submenu (menu, "Edit", create_edit_menu());
1034 append_submenu (menu, "Analyze", create_analyze_menu());
1035 append_submenu (menu, "Help", create_help_menu());
1036 return menu;
1037}
1038
1039#ifdef GTK4
1051G_MODULE_EXPORT void atomes_popup_menu (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
1052{
1053 if (gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture) == GDK_BUTTON_SECONDARY)
1054 {
1055 GtkWidget * popover = work_menu (-1, -1);
1056 gtk_widget_set_parent (popover, MainWindow);
1057 pop_menu_at_pointer (popover, x, y);
1058 }
1059}
1060
1072G_MODULE_EXPORT gboolean on_atomes_pressed (GtkEventControllerKey * self, guint keyval, guint keycode, GdkModifierType state, gpointer data)
1073{
1074 atomes_key_pressed (keyval, state);
1075 return TRUE;
1076}
1077#endif
1078
1086GtkWidget * create_main_window (GApplication * atomes)
1087{
1088 int i;
1089 THETD = gdk_pixbuf_new_from_file (PACKAGE_TD, NULL);
1090#ifdef GTK3
1091 gtk_window_set_default_icon (THETD);
1092#endif
1093 THEMO = gdk_pixbuf_new_from_file (PACKAGE_MOL, NULL);
1094 THEBD = gdk_pixbuf_new_from_file (PACKAGE_BD, NULL);
1095 SETTING = gdk_pixbuf_new_from_file (PACKAGE_PRO, NULL);
1096 SETTINGS = gdk_pixbuf_new_from_file (PACKAGE_SET, NULL);
1097 OGL = gdk_pixbuf_new_from_file (PACKAGE_OGL, NULL);
1098 OGLM = gdk_pixbuf_new_from_file (PACKAGE_OGLM, NULL);
1099 OGLC = gdk_pixbuf_new_from_file (PACKAGE_OGLC, NULL);
1100
1101 GtkWidget * window = gtk_application_window_new (GTK_APPLICATION(atomes));
1102 gtk_window_set_title (GTK_WINDOW(window), PACKAGE);
1103 gtk_window_set_resizable (GTK_WINDOW(window), TRUE);
1104 gtk_widget_set_size_request (window, 900, 450);
1105
1106 atomes_action main_actions[] = {{ "workspace.open", GINT_TO_POINTER(2)},
1107 { "workspace.save", GINT_TO_POINTER(3)},
1108 { "workspace.save-as", GINT_TO_POINTER(3)},
1109 { "workspace.close", GINT_TO_POINTER(1)},
1110 { "project.new", NULL},
1111 { "project.open", GINT_TO_POINTER(0)},
1112 { "project.save", GINT_TO_POINTER(1) },
1113 { "project.save-as", GINT_TO_POINTER(1)},
1114 { "project.close", NULL},
1115 { "export.isaacs", GINT_TO_POINTER(1)},
1116 { "export.coordinates", GINT_TO_POINTER(1)},
1117 { "import.isaacs", GINT_TO_POINTER(0)},
1118 { "import.coordinates", GINT_TO_POINTER(0)},
1119 { "program.quit", NULL},
1120 { "analyze.tool-box", NULL},
1121 { "help.periodic", NULL},
1122 { "help.about", NULL},
1123 { "help.shortcuts", NULL}};
1124
1125 GSimpleAction * main_act[18];
1126 for (i=0; i<G_N_ELEMENTS(main_actions); i++)
1127 {
1128 main_act[i] = g_simple_action_new (main_actions[i].action_name, NULL);
1129 add_action (main_act[i]);
1130 g_signal_connect (main_act[i], "activate", G_CALLBACK(atomes_menu_bar_action), main_actions[i].action_data);
1131 }
1132 for (i=0; i<G_N_ELEMENTS(edition_acts); i++)
1133 {
1134 edition_actions[i] = g_simple_action_new (edition_acts[i].action_name, NULL);
1135 g_signal_connect (edition_actions[i], "activate", G_CALLBACK(atomes_menu_bar_action), edition_acts[i].action_data);
1136 }
1137 for (i=0; i<G_N_ELEMENTS(analyze_acts); i++)
1138 {
1139 analyze_actions[i] = g_simple_action_new (analyze_acts[i].action_name, NULL);
1140 g_signal_connect (analyze_actions[i], "activate", G_CALLBACK(atomes_menu_bar_action), analyze_acts[i].action_data);
1141 }
1142
1143 /*GtkBuilder * builder = gtk_builder_new_from_file ("menus/main.ui");
1144 GMenuModel * model = G_MENU_MODEL (gtk_builder_get_object (builder, "atomes_menu_bar"));
1145 gtk_application_set_menubar (GTK_APPLICATION(atomes), G_MENU_MODEL(model));
1146 g_object_unref (model);*/
1147 gtk_application_set_menubar (GTK_APPLICATION(atomes), G_MENU_MODEL(atomes_menu_bar()));
1148 gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW(window), TRUE);
1149
1150#ifdef GTK3
1151 MainEvent = gtk_event_box_new ();
1152 gtk_widget_add_events (MainEvent,
1153 GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK |
1154 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
1155 g_signal_connect(G_OBJECT(MainEvent), "button_press_event", G_CALLBACK(pop_menu), NULL);
1156 g_signal_connect(G_OBJECT(MainEvent), "button_release_event", G_CALLBACK(pop_menu), NULL);
1157#else
1158 add_widget_gesture_and_key_action (window, "atomes-context-click", G_CALLBACK(atomes_popup_menu), NULL,
1159 NULL, NULL, NULL,
1160 "atomes-key-pressed", G_CALLBACK(on_atomes_pressed), NULL,
1161 NULL, NULL, NULL, NULL, NULL, NULL);
1162#endif
1163 add_gtk_close_event (window, G_CALLBACK(leaving_question), NULL);
1164 GtkWidget * hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
1165 int frame_size[2]={200, 550};
1166 for (i=0; i<2; i++)
1167 {
1168 MainFrame[i] = gtk_frame_new (NULL);
1169 gtk_widget_set_size_request (MainFrame[i], frame_size[i], -1);
1170 MainScrol[i] = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
1171#ifdef GTK3
1172 if (! i)
1173 {
1175 }
1176 else
1177 {
1179 gtk_container_add (GTK_CONTAINER(MainEvent), MainScrol[i]);
1180 }
1181#else
1182 gtk_scrolled_window_set_propagate_natural_height ((GtkScrolledWindow *)MainScrol[i], TRUE);
1183 gtk_scrolled_window_set_propagate_natural_width ((GtkScrolledWindow *)MainScrol[i], TRUE);
1185#endif
1186 }
1187#ifdef GTK4
1188 gtk_paned_set_start_child (GTK_PANED (hpaned), MainFrame[0]);
1189 gtk_paned_set_resize_start_child (GTK_PANED (hpaned), FALSE);
1190 gtk_paned_set_shrink_start_child (GTK_PANED (hpaned), FALSE);
1191 gtk_paned_set_end_child (GTK_PANED (hpaned), MainFrame[1]);
1192 gtk_paned_set_resize_end_child (GTK_PANED (hpaned), TRUE);
1193 gtk_paned_set_shrink_end_child (GTK_PANED (hpaned), FALSE);
1194#else
1195 gtk_paned_pack1 (GTK_PANED (hpaned), MainFrame[0], FALSE, FALSE);
1196 gtk_paned_pack2 (GTK_PANED (hpaned), MainFrame[1], FALSE, FALSE);
1197#endif
1200 add_container_child (CONTAINER_WIN, window, hpaned);
1201 clean_view ();
1202 show_the_widgets (window);
1203
1204 for (i=0; i<9; i++)
1205 {
1206 davect[i].a = i/3;
1207 davect[i].b = i-3*davect[i].a;
1208 }
1209
1210 calc_img[0] = g_strdup_printf ("%s", PACKAGE_GR);
1211 calc_img[1] = g_strdup_printf ("%s", PACKAGE_SQ);
1212 calc_img[2] = g_strdup_printf ("%s", PACKAGE_SQ);
1213 calc_img[3] = g_strdup_printf ("%s", PACKAGE_GR);
1214 calc_img[4] = g_strdup_printf ("%s", PACKAGE_AN);
1215 calc_img[5] = g_strdup_printf ("%s", PACKAGE_RI);
1216 calc_img[6] = g_strdup_printf ("%s", PACKAGE_CH);
1217 calc_img[7] = g_strdup_printf ("%s", PACKAGE_SP);
1218 calc_img[8] = g_strdup_printf ("%s", PACKAGE_MS);
1219 calc_img[9] = g_strdup_printf ("%s", PACKAGE_BD);
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:1019
G_MODULE_EXPORT void on_close_workspace(GtkWidget *widg, gpointer data)
close the active workspace
Definition callbacks.c:133
G_MODULE_EXPORT void on_open_save_activate(GtkWidget *widg, gpointer data)
open or save an atomes file - prepare the dialog
Definition callbacks.c:423
G_MODULE_EXPORT void on_isaacs_port(GtkWidget *widg, gpointer data)
open or write ISAACS XML file - prepare the dialog
Definition callbacks.c:775
G_MODULE_EXPORT void on_coord_port(GtkWidget *widg, gpointer data)
export or import atomic coordinates: prepare dialog
Definition callbacks.c:1604
G_MODULE_EXPORT void on_save_as_activate(GtkWidget *widg, gpointer data)
open or save, choosing a file name
Definition callbacks.c:621
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:332
#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:138
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:139
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:264
@ IMG_FILE
Definition global.h:263
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:1960
project * proj
void pop_menu_at_pointer(GtkWidget *widg, GdkEvent *event)
popup a menu at pointer location
Definition gtk-misc.c:2301
#define EDITA
Definition global.h:202
G_MODULE_EXPORT gboolean destroy_this_window(GtkWidget *win, GdkEvent *event, gpointer data)
destroy a GtkWindow
Definition gtk-misc.c:2344
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:2387
#define NGRAPHS
#define FEXIT
Definition global.h:212
#define FOPEN
Definition global.h:208
#define YES
Definition global.h:201
@ CONTAINER_WIN
Definition global.h:250
@ CONTAINER_FRA
Definition global.h:254
@ CONTAINER_SCR
Definition global.h:251
#define DPROPERTIES
Definition global.h:206
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:299
#define FNEW
Definition global.h:207
void text_view_set_monospace(GtkWidget *view)
set the font of a GtkTextView as monospace
Definition gtk-misc.c:687
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2034
#define FSAVE
Definition global.h:209
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:226
#define FCLOSE
Definition global.h:211
#define PAGE_SETUP
Definition global.h:197
#define NCALCS
#define FSAVEAS
Definition global.h:210
#define NDOTS
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:173
#define ABOUT
Definition global.h:225
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
action
Definition glview.h:189
GMenu * workspace_section(gchar *act, int pop)
create the workspace section
Definition gui.c:774
GMenu * quit_section(gchar *act)
create the 'Quit' menu item
Definition gui.c:896
dint davect[9]
Definition gui.c:145
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:839
GMenu * create_analyze_menu()
create atomes 'analyze' menu
Definition gui.c:994
gchar * main_group_names[]
Definition gui.c:165
GMenu * port_section(gchar *act, int pop, int port)
create the import/export menu items
Definition gui.c:805
int objects[3]
Definition selection.c:212
atomes_action edition_acts[]
Definition gui.c:108
void remove_edition_actions()
remove all edition actions
Definition gui.c:421
GIcon * get_gicon_from_data(int format, const gchar *icon)
create a new icon using data
Definition gui.c:609
GMenu * create_workspace_menu(gchar *act, int pop_up, int proj, int calc)
create atomes 'workspace' menu
Definition gui.c:951
gchar * graph_img[NGRAPHS]
Definition gui.c:106
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:640
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:727
atomes_action analyze_acts[]
Definition gui.c:112
ColRGBA std[6]
Definition gui.c:146
GMenu * create_help_menu()
create atomes 'help' menu
Definition gui.c:1015
shortcuts main_shortcuts[]
Definition gui.c:148
gchar * calc_img[NCALCS-2]
Definition gui.c:105
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:351
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:180
GMenu * workspace_title()
create the 'Workspace' menu item
Definition gui.c:910
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:925
GMenu * atomes_menu_bar()
create atomes menu bar
Definition gui.c:1029
GtkWidget * create_main_window(GApplication *atomes)
create the main application window
Definition gui.c:1086
void remove_edition_and_analyze_actions()
remove all edition and analysis action
Definition gui.c:432
void clean_view()
clean the main window
Definition gui.c:285
G_MODULE_EXPORT void on_calc_activate(GtkWidget *widg, gpointer data)
create a calculation dialog - prepare the dialog
Definition calc_menu.c:1387
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:399
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:308
int main_group_by_section[]
Definition gui.c:164
G_MODULE_EXPORT void show_periodic_table(GtkWidget *widg, gpointer data)
show the periodic table of the elements
Definition gui.c:447
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:163
tint cut_sel
Definition gui.c:144
char * graph_name[NGRAPHS]
Definition gui.c:133
G_MODULE_EXPORT void atomes_menu_bar_action(GSimpleAction *action, GVariant *parameter, gpointer data)
atomes menu bar actions
Definition gui.c:461
int main_shortcut_by_group[]
Definition gui.c:166
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:681
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:757
int * object_was_selected[3]
Definition selection.c:213
gchar * dots[NDOTS]
Definition gui.c:104
GMenu * import_section(gchar *act)
create the 'Import' submenu
Definition gui.c:882
void remove_action(gchar *action_name)
add action from the main window action map
Definition gui.c:411
char * calc_name[NCALCS-2]
Definition gui.c:122
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:829
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:57
double x
Definition ogl_draw.c:57
Function declarations for reading atomes project file Function declarations for saving atomes proje...
float blue
Definition global.h:124
float red
Definition global.h:122
float green
Definition global.h:123
Definition global.h:97
int b
Definition global.h:99
int a
Definition global.h:98
Definition global.h:104
int b
Definition global.h:106
int c
Definition global.h:107
int a
Definition global.h:105
int c
Definition tab-1.c:95
int status
Definition w_advance.c:160
void add_project_to_workspace()
add project(s) to the workspace tree
Definition workspace.c:594
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.