atomes 1.1.15
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-2024 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
148
150 { "About", "open about dialog", GDK_KEY_a, "<Ctrl>a" },
151 { "Periodic table", "open periodic table", GDK_KEY_p, "<Ctrl>p" },
152 { "Quit", "quit atomes", GDK_KEY_q, "<Ctrl>q" },
153//};
154//{
155 { "Open workspace", "open atomes workspace", GDK_KEY_w, "<Ctrl>w" },
156 { "Save workspace", "save atomes workspace", GDK_KEY_s, "<Ctrl>s" },
157 { "Close workspace", "close atomes workspace", GDK_KEY_c, "<Ctrl>c" },
158//};
159//{
160 { "New project", "create new atomes project", GDK_KEY_n, "<Ctrl>n" },
161 { "Open project", "open atomes project", GDK_KEY_o, "<Ctrl>o" }
162};
163
164gchar * main_section_names[] = { "Main" };
166gchar * main_group_names[] = { "General", "Workspace", "Projects" };
167int main_shortcut_by_group[] = { 3, 3, 2 };
168
181GtkWidget * shortcuts_window (int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups],
182 gchar * section_names[sections], gchar * group_names[groups], shortcuts shortcs[])
183{
184 GtkShortcutsWindow * win = NULL;
185#ifdef G_OS_WIN32
186 win = g_object_new (GTK_TYPE_SHORTCUTS_WINDOW, "modal", FALSE, "resizable", TRUE, "deletable", TRUE, NULL);
187#else
188 win = g_object_new (GTK_TYPE_SHORTCUTS_WINDOW, "modal", FALSE, "resizable", TRUE, NULL);
189#endif
190 GtkShortcutsSection * shortcut_section[sections];
191 GtkShortcutsGroup * shortcut_group[groups];
192 GtkShortcutsShortcut * shortcut;
193#ifdef GTK4
194#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
195 GtkWidget * sections_book = gtk_notebook_new ();
196 gtk_notebook_set_scrollable (GTK_NOTEBOOK(sections_book), TRUE);
197 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(sections_book), GTK_POS_TOP);
198#endif
199#endif // GTK4
200 int i, j, k, l, m;
201 l = m = 0;
202 for (i=0; i<sections; i++)
203 {
204 shortcut_section[i] = g_object_new (GTK_TYPE_SHORTCUTS_SECTION, "visible", TRUE, "title", section_names[i], "section-name", section_names[i], NULL);
205#ifdef GTK4
206#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
207 gtk_orientable_set_orientation ((GtkOrientable *)shortcut_section[i], GTK_ORIENTATION_HORIZONTAL);
208#endif
209#endif
210 for (j=0; j<group_by_section[i]; j++, l++)
211 {
212 shortcut_group[l] = g_object_new (GTK_TYPE_SHORTCUTS_GROUP, "visible", TRUE, "title", group_names[l], NULL);
213 for (k=0; k<shortcut_by_group[l]; k++, m++)
214 {
215 shortcut = g_object_new (GTK_TYPE_SHORTCUTS_SHORTCUT,
216 "visible", TRUE,
217 "shortcut-type", GTK_SHORTCUT_ACCELERATOR,
218 "accelerator", shortcs[m].accelerator,
219 "title", shortcs[m].description,
220 NULL );
221#ifdef GTK4
222#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
223 gtk_shortcuts_group_add_shortcut (shortcut_group[l], shortcut);
224#else
225 add_box_child_start (GTK_ORIENTATION_VERTICAL, (GtkWidget *)shortcut_group[l], (GtkWidget *)shortcut, FALSE, FALSE, 0);
226#endif
227#else
228 gtk_container_add (GTK_CONTAINER((GtkWidget *)shortcut_group[l]), (GtkWidget *)shortcut);
229#endif
230 }
231#ifdef GTK4
232#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
233 gtk_shortcuts_section_add_group (shortcut_section[i], shortcut_group[l]);
234#else
235 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, (GtkWidget *)shortcut_section[i], (GtkWidget *)shortcut_group[l], FALSE, FALSE, 0);
236#endif
237#else
238 gtk_container_add (GTK_CONTAINER((GtkWidget *)shortcut_section[i]), (GtkWidget *)shortcut_group[l]);
239#endif
240 }
241#ifdef GTK4
242#if GTK_MINOR_VERSION > 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION >= 4)
243 gtk_shortcuts_window_add_section (GTK_SHORTCUTS_WINDOW(win), shortcut_section[i]);
244#else
245 gtk_notebook_append_page (GTK_NOTEBOOK(sections_book), (GtkWidget *)shortcut_section[i], gtk_label_new (section_names[i]));
246#endif
247#else
248 gtk_container_add (GTK_CONTAINER((GtkWidget *)win), (GtkWidget *)shortcut_section[i]);
249#endif
250 }
251#ifdef GTK4
252#if GTK_MINOR_VERSION < 14 || (GTK_MINOR_VERSION == 14 && GTK_MICRO_VERSION < 4)
253 gtk_window_set_child ((GtkWindow*) win, sections_book);
254#endif
255#endif
256 add_gtk_close_event ((GtkWidget *)win, G_CALLBACK(destroy_this_window), NULL);
257 show_the_widgets ((GtkWidget *)win);
258 return (GtkWidget *)win;
259}
260
261#ifdef GTK3
271G_MODULE_EXPORT gboolean pop_menu (GtkWidget * widget, GdkEventButton * event, gpointer data)
272{
273 if (event -> button == 3)
274 {
275 pop_menu_at_pointer (work_menu (-1, -1), (GdkEvent *)event);
276 }
277 return FALSE;
278}
279#endif
280
287{
290#ifdef GTK4
291 atomes_logo = gtk_picture_new_for_filename (PACKAGE_LOGO);
292 gtk_widget_set_size_request (atomes_logo, 550, -1);
294#else
295 atomes_logo = gtk_image_new_from_file (PACKAGE_LOGO);
297 gtk_container_add (GTK_CONTAINER(MainEvent), atomes_logo);
298 show_the_widgets (MainEvent);
299#endif
300}
301
309void view_buffer (GtkTextBuffer * buffer)
310{
311 if (atomes_logo)
312 {
314#ifdef GTK4
315 gtk_scrolled_window_set_child ((GtkScrolledWindow *)MainScrol[1], NULL);
316#endif
317 }
318 gboolean add = FALSE;
319 if (! MainView)
320 {
321 MainView = gtk_text_view_new ();
322 gtk_text_view_set_editable (GTK_TEXT_VIEW(MainView), 0);
324 add = TRUE;
325 }
326 gtk_text_view_set_buffer (GTK_TEXT_VIEW(MainView), buffer);
327#ifdef GTK3
328 if (! MainScrol[1])
329 {
330 MainScrol[1] = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
331 gtk_container_add (GTK_CONTAINER(MainEvent), MainScrol[1]);
332 add = TRUE;
333 }
334 if (add) gtk_container_add (GTK_CONTAINER(MainScrol[1]), MainView);
335#else
336 if (add)
337 {
339 }
340#endif
342}
343
352void atomes_key_pressed (guint keyval, GdkModifierType state)
353{
354 if (state & GDK_CONTROL_MASK)
355 {
356 switch (keyval)
357 {
358 case GDK_KEY_a:
359 create_about_dialog (NULL, NULL);
360 break;
361 case GDK_KEY_c:
362 on_close_workspace (NULL, GINT_TO_POINTER(1));
363 break;
364 case GDK_KEY_n:
365 on_create_new_project (NULL, NULL);
366 break;
367 case GDK_KEY_o:
368 on_open_save_activate (NULL, GINT_TO_POINTER(0));
369 break;
370 case GDK_KEY_p:
372 break;
373 case GDK_KEY_q:
374#ifdef GTK4
375 leaving_question (NULL, NULL);
376#else
377 leaving_question (NULL, NULL, NULL);
378#endif
379 break;
380 case GDK_KEY_s:
381 on_save_as_activate (NULL, GINT_TO_POINTER(3));
382 break;
383 case GDK_KEY_t:
384 on_show_curve_toolbox (NULL, NULL);
385 break;
386 case GDK_KEY_w:
387 on_open_save_activate (NULL, GINT_TO_POINTER(2));
388 break;
389 }
390 }
391}
392
400void add_action (GSimpleAction * action)
401{
402 g_action_map_add_action (G_ACTION_MAP(AtomesApp), G_ACTION(action));
403}
404
413{
414 g_action_map_remove_action (G_ACTION_MAP(AtomesApp), (const gchar *)action_name);
415}
416
423{
424 int i;
425 for (i=0; i<G_N_ELEMENTS(edition_acts); i++) remove_action (edition_acts[i].action_name);
426}
427
434{
436 int i;
437 for (i=0; i<G_N_ELEMENTS(analyze_acts); i++) remove_action (analyze_acts[i].action_name);
438}
439
448G_MODULE_EXPORT void show_periodic_table (GtkWidget * widg, gpointer data)
449{
451}
452
462G_MODULE_EXPORT void atomes_menu_bar_action (GSimpleAction * action, GVariant * parameter, gpointer data)
463{
464 gchar * name = g_strdup_printf ("%s", g_action_get_name(G_ACTION(action)));
465 if (g_strcmp0 (name, "workspace.open") == 0)
466 {
467 on_open_save_activate (NULL, data);
468 }
469 else if (g_strcmp0 (name, "workspace.save") == 0)
470 {
471 on_open_save_activate (NULL, data);
472 }
473 else if (g_strcmp0 (name, "workspace.save-as") == 0)
474 {
475 on_save_as_activate (NULL, data);
476 }
477 else if (g_strcmp0 (name, "workspace.close") == 0)
478 {
479 on_close_workspace (NULL, data);
480 }
481 else if (g_strcmp0 (name, "project.new") == 0)
482 {
483 on_create_new_project (NULL, data);
484 }
485 else if (g_strcmp0 (name, "project.edit") == 0)
486 {
487 change_project_name (NULL, data);
488 }
489 else if (g_strcmp0 (name, "project.active") == 0)
490 {
491 activate_project (NULL, data);
492 }
493 else if (g_strcmp0 (name, "project.compute") == 0)
494 {
495 compute_this_prop (NULL, data);
496 }
497 else if (g_strcmp0 (name, "project.open") == 0)
498 {
499 on_open_save_activate (NULL, data);
500 }
501 else if (g_strcmp0 (name, "project.save") == 0)
502 {
503 on_open_save_activate (NULL, data);
504 }
505 else if (g_strcmp0 (name, "project.save-as") == 0)
506 {
507 on_save_as_activate (NULL, data);
508 }
509 else if (g_strcmp0 (name, "project.close") == 0)
510 {
511 on_close_activate (NULL, data);
512 }
513 else if (g_strcmp0 (name, "export.isaacs") == 0)
514 {
515 on_isaacs_port (NULL, data);
516 }
517 else if (g_strcmp0 (name, "export.coordinates") == 0)
518 {
519 on_coord_port (NULL, data);
520 }
521 else if (g_strcmp0 (name, "import.isaacs") == 0)
522 {
523 on_isaacs_port (NULL, data);
524 }
525 else if (g_strcmp0 (name, "import.coordinates") == 0)
526 {
527 on_coord_port (NULL, data);
528 }
529 else if (g_strcmp0 (name, "program.quit") == 0)
530 {
531 leaving_from_menu (NULL, data);
532 }
533 else if (g_strcmp0 (name, "edit.chemistry") == 0)
534 {
535 on_edit_activate (NULL, data);
536 }
537 else if (g_strcmp0 (name, "edit.periodicity") == 0)
538 {
539 on_edit_activate (NULL, data);
540 }
541 else if (g_strcmp0 (name, "edit.cutoffs") == 0)
542 {
543 on_edit_activate (NULL, data);
544 }
545 else if (g_strcmp0 (name, "analyze.gr") == 0)
546 {
547 on_calc_activate (NULL, data);
548 }
549 else if (g_strcmp0 (name, "analyze.sq") == 0)
550 {
551 on_calc_activate (NULL, data);
552 }
553 else if (g_strcmp0 (name, "analyze.sk") == 0)
554 {
555 on_calc_activate (NULL, data);
556 }
557 else if (g_strcmp0 (name, "analyze.gk") == 0)
558 {
559 on_calc_activate (NULL, data);
560 }
561 else if (g_strcmp0 (name, "analyze.bonds") == 0)
562 {
563 on_calc_activate (NULL, data);
564 }
565 else if (g_strcmp0 (name, "analyze.rings") == 0)
566 {
567 on_calc_activate (NULL, data);
568 }
569 else if (g_strcmp0 (name, "analyze.chains") == 0)
570 {
571 on_calc_activate (NULL, data);
572 }
573 else if (g_strcmp0 (name, "analyze.sp") == 0)
574 {
575 on_calc_activate (NULL, data);
576 }
577 else if (g_strcmp0 (name, "analyze.msd") == 0)
578 {
579 on_calc_activate (NULL, data);
580 }
581 else if (g_strcmp0 (name, "analyze.tool-box") == 0)
582 {
583 on_show_curve_toolbox (NULL, data);
584 }
585 else if (g_strcmp0 (name, "help.periodic") == 0)
586 {
587 show_periodic_table (NULL, data);
588 }
589 else if (g_strcmp0 (name, "help.about") == 0)
590 {
591 create_about_dialog (NULL, data);
592 }
593 else if (g_strcmp0 (name, "help.shortcuts") == 0)
594 {
598 }
599 g_free (name);
600}
601
610GIcon * get_gicon_from_data (int format, const gchar * icon)
611{
612 switch (format)
613 {
614 case IMG_FILE:
615 return g_file_icon_new (g_file_new_for_path (icon));
616 break;
617 case IMG_STOCK:
618 return g_themed_icon_new (icon);
619 break;
620 default:
621 return NULL;
622 break;
623 }
624}
625
641void widget_add_action (GSimpleActionGroup * action_group, const gchar * act, GCallback handler, gpointer data,
642 gboolean check, gboolean status, gboolean radio, const gchar * stat)
643{
644 GSimpleAction * action;
645 GVariant * action_state;
646 if (radio)
647 {
648 action_state = g_variant_new_string (stat);
649 action = g_simple_action_new_stateful (act, G_VARIANT_TYPE_STRING, action_state);
650 }
651 else if (check)
652 {
653 action_state = g_variant_new_boolean (status);
654 action = g_simple_action_new_stateful (act, NULL, action_state);
655 }
656 else
657 {
658 action = g_simple_action_new (act, NULL);
659 }
660 g_signal_connect (action, "activate", handler, data);
661 g_action_map_add_action (G_ACTION_MAP(action_group), G_ACTION(action));
662}
663
682GMenuItem * create_gmenu_item (const gchar * label, const gchar * action, const gchar * accel,
683 const gchar * custom, int format, const gchar * icon,
684 gboolean check, gboolean status, gboolean radio, const gchar * rstatus)
685{
686 GMenuItem * item;
687 item = g_menu_item_new (label, action);
688 /* GKT4 bug, normally mark-up should be provided using boolean:
689 g_menu_item_set_attribute (item, "use-markup", "b", TRUE, NULL);
690 But it does not work, however it does using a string: */
691 g_menu_item_set_attribute (item, "use-markup", "s", "TRUE", NULL);
692 if (custom)
693 {
694 g_menu_item_set_attribute (item, "custom", "s", custom, NULL);
695 // g_menu_item_set_attribute_value (item, "custom", g_variant_new_string (custom));
696 GVariant * cust = g_menu_item_get_attribute_value (item, "custom", g_variant_type_new("s"));
697 if (cust) g_print ("item :: %s, custom :: %s\n", label, g_variant_get_string (cust, NULL));
698 }
699 else
700 {
701 if (accel) g_menu_item_set_attribute (item, "accel", "s", accel, NULL);
702 // if (check) g_menu_item_set_attribute (item, "target", "b", status, NULL);
703 if (radio) g_menu_item_set_attribute (item, "target", "s", rstatus, NULL);
704#ifdef MENU_ICONS
705 if (icon)
706 {
707 GIcon * gicon = get_gicon_from_data (format, icon);
708 if (gicon)
709 {
710 g_menu_item_set_icon (item, gicon);
711 g_object_unref (gicon);
712 }
713 }
714#endif
715 }
716 return item;
717}
718
728void append_submenu (GMenu * menu, const gchar * label, GMenu * submenu)
729{
730 GMenuItem * item = g_menu_item_new (label, NULL);
731 /* GKT4 bug, normally mark-up should be provided using boolean:
732 g_menu_item_set_attribute (item, "use-markup", "b", TRUE, NULL);
733 But it does not work, however it does using a string: */
734 g_menu_item_set_attribute (item, "use-markup", "s", "TRUE", NULL);
735 g_menu_item_set_submenu (item, (GMenuModel *)submenu);
736 g_menu_append_item (menu, item);
737}
738
758void append_menu_item (GMenu * menu, const gchar * label, const gchar * action, const gchar * accel,
759 const gchar * custom, int format, const gchar * icon,
760 gboolean check, gboolean status, gboolean radio, const gchar * rstatus)
761{
762 GMenuItem * item = create_gmenu_item (label, action, accel, custom, format, icon, check, status, radio, rstatus);
763 g_menu_append_item (menu, item);
764 g_object_unref (item);
765}
766
775GMenu * workspace_section (gchar * act, int pop)
776{
777 GMenu * menu = g_menu_new ();
778 gchar * str;
779 str = g_strdup_printf ("%s.workspace.open", act);
780 append_menu_item (menu, "Open", (const gchar *)str, "<CTRL>W", NULL, IMG_STOCK, FOPEN, FALSE, FALSE, FALSE, NULL);
781 g_free (str);
782 if (! pop || nprojects)
783 {
784 str = g_strdup_printf ("%s.workspace.save", act);
785 append_menu_item (menu, "Save", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVE, FALSE, FALSE, FALSE, NULL);
786 g_free (str);
787 str = g_strdup_printf ("%s.workspace.save-as", act);
788 append_menu_item (menu, "Save As", (const gchar *)str, "<CTRL>S", NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
789 g_free (str);
790 str = g_strdup_printf ("%s.workspace.close", act);
791 append_menu_item (menu, "Close", (const gchar *)str, "<CTRL>C", NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
792 g_free (str);
793 }
794 return menu;
795}
796
806GMenu * port_section (gchar * act, int pop, int port)
807{
808 gchar * port_action[2]={"export", "import"};
809 GMenu * menu = g_menu_new ();
810 gchar * str;
811 str = g_strdup_printf ("%s.%s.isaacs", act, port_action[port]);
812 append_menu_item (menu, "ISAACS Project File (*.ipf)", (const gchar *)str, NULL, NULL, IMG_FILE, PACKAGE_MOL, FALSE, FALSE, FALSE, NULL);
813 g_free (str);
814 str = g_strdup_printf ("%s.%s.coordinates", act, port_action[port]);
815 append_menu_item (menu, "Atomic Coordinates", (const gchar *)str, NULL, NULL, IMG_FILE, (port) ? PACKAGE_IMP : PACKAGE_CON, FALSE, FALSE, FALSE, NULL);
816 g_free (str);
817 return menu;
818}
819
830GMenu * project_section (gchar * act, int pop_up, int proj, int calc)
831{
832 GMenu * menu = g_menu_new ();
833 gchar * str, * str_n;
834 if (pop_up && nprojects && proj > -1)
835 {
836 if (activep != proj)
837 {
838 str = g_strdup_printf ("%s.project.active", act);
839 append_menu_item (menu, "Make Active", (const gchar *)str, NULL, NULL, IMG_STOCK, YES, FALSE, FALSE, FALSE, NULL);
840 g_free (str);
841 }
842 if (calc > -1)
843 {
844 str = g_strdup_printf ("%s.project.compute", act);
845 str_n = g_strdup_printf ("Analyze: %s", work_menu_items[calc+4]);
846 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);
847 g_free (str);
848 g_free (str_n);
849 }
850 str = g_strdup_printf ("%s.project.edit", act);
851 append_menu_item (menu, "Edit Name", (const gchar *)str, NULL, NULL, IMG_STOCK, EDITA, FALSE, FALSE, FALSE, NULL);
852 g_free (str);
853 }
854 str = g_strdup_printf ("%s.project.new", act);
855 append_menu_item (menu, "New", (const gchar *)str, "<CTRL>N", NULL, IMG_STOCK, FNEW, FALSE, FALSE, FALSE, NULL);
856 g_free (str);
857 str = g_strdup_printf ("%s.project.open", act);
858 append_menu_item (menu, "Open", (const gchar *)str, "<CTRL>O", NULL, IMG_STOCK, FOPEN, FALSE, FALSE, FALSE, NULL);
859 g_free (str);
860 if (! pop_up || proj > -1)
861 {
862 str = g_strdup_printf ("%s.project.save", act);
863 append_menu_item (menu, "Save", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVE, FALSE, FALSE, FALSE, NULL);
864 g_free (str);
865 str = g_strdup_printf ("%s.project.save-as", act);
866 append_menu_item (menu, "Save As", (const gchar *)str, NULL, NULL, IMG_STOCK, FSAVEAS, FALSE, FALSE, FALSE, NULL);
867 g_free (str);
868 str = g_strdup_printf ("%s.project.close", act);
869 append_menu_item (menu, "Close", (const gchar *)str, NULL, NULL, IMG_STOCK, FCLOSE, FALSE, FALSE, FALSE, NULL);
870 g_free (str);
871 append_submenu (menu, "Export", port_section(act, pop_up, 0));
872 }
873 return menu;
874}
875
883GMenu * import_section (gchar * act)
884{
885 GMenu * menu = g_menu_new ();
886 append_submenu (menu, "Import", port_section(act, 0, 1));
887 return menu;
888}
889
897GMenu * quit_section (gchar * act)
898{
899 GMenu * menu = g_menu_new ();
900 gchar * str = g_strdup_printf ("%s.program.quit", act);
901 append_menu_item (menu, "Quit", (const gchar *)str, "<CTRL>Q", NULL, IMG_STOCK, FEXIT, FALSE, FALSE, FALSE, NULL);
902 g_free (str);
903 return menu;
904}
905
912{
913 GMenu * menu = g_menu_new ();
914 append_menu_item (menu, "Workspace", "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
915 return menu;
916}
917
926GMenu * project_title (int pop_up, int proj)
927{
928 GMenu * menu = g_menu_new ();
929 if (pop_up && nprojects && proj > -1)
930 {
931 gchar * str = g_strdup_printf ("<b>%s</b>", get_project_by_id(proj) -> name);
932 append_menu_item (menu, str, "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
933 g_free (str);
934 }
935 else
936 {
937 append_menu_item (menu, "Project(s)", "None", NULL, NULL, IMG_FILE, PACKAGE_TD, FALSE, FALSE, FALSE, NULL);
938 }
939 return menu;
940}
941
952GMenu * create_workspace_menu (gchar * act, int pop_up, int proj, int calc)
953{
954 GMenu * menu = g_menu_new ();
955 g_menu_append_section (menu, NULL, (GMenuModel*)workspace_title());
956 g_menu_append_section (menu, NULL, (GMenuModel*)workspace_section(act, pop_up));
957 g_menu_append_section (menu, NULL, (GMenuModel*)project_title(pop_up, proj));
958 g_menu_append_section (menu, NULL, (GMenuModel*)project_section(act, pop_up, proj, calc));
959 g_menu_append_section (menu, NULL, (GMenuModel*)import_section(act));
960 g_menu_append_section (menu, NULL, (GMenuModel*)quit_section(act));
961 return menu;
962}
963
970{
971 GMenu * menu = g_menu_new ();
972 append_menu_item (menu, "Chemistry and Physics", "app.edit.chemistry", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
973 append_menu_item (menu, "Box and Periodicity", "app.edit.periodicity", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
974 append_menu_item (menu, "Bond Cutoffs", "app.edit.cutoffs", NULL, NULL, IMG_STOCK, DPROPERTIES, FALSE, FALSE, FALSE, NULL);
975 return menu;
976}
977
984{
985 GMenu * menu = g_menu_new ();
986 append_menu_item (menu, "Toolboxes", "app.analyze.tool-box", "<CTRL>T", NULL, IMG_STOCK, PAGE_SETUP, FALSE, FALSE, FALSE, NULL);
987 return menu;
988}
989
996{
997 GMenu * menu = g_menu_new ();
998 append_menu_item (menu, "g(r) / G(r)", "app.analyze.gr", NULL, NULL, IMG_FILE, PACKAGE_GR, FALSE, FALSE, FALSE, NULL);
999 append_menu_item (menu, "S(q) from FFT[g(r)]", "app.analyze.sq", NULL, NULL, IMG_FILE, PACKAGE_SQ, FALSE, FALSE, FALSE, NULL);
1000 append_menu_item (menu, "S(q) from Debye Eq.", "app.analyze.sk", NULL, NULL, IMG_FILE, PACKAGE_SQ, FALSE, FALSE, FALSE, NULL);
1001 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);
1002 append_menu_item (menu, "Bonds and Angles", "app.analyze.bonds", NULL, NULL, IMG_FILE, PACKAGE_BD, FALSE, FALSE, FALSE, NULL);
1003 append_menu_item (menu, "Ring statistics", "app.analyze.rings", NULL, NULL, IMG_FILE, PACKAGE_RI, FALSE, FALSE, FALSE, NULL);
1004 append_menu_item (menu, "Chain statistics", "app.analyze.chains", NULL, NULL, IMG_FILE, PACKAGE_CH, FALSE, FALSE, FALSE, NULL);
1005 append_menu_item (menu, "Spherical Harmonics", "app.analyze.sp", NULL, NULL, IMG_FILE, PACKAGE_SP, FALSE, FALSE, FALSE, NULL);
1006 append_menu_item (menu, "Mean Squared Displacement", "app.analyze.msd", NULL, NULL, IMG_FILE, PACKAGE_MS, FALSE, FALSE, FALSE, NULL);
1007 g_menu_append_section (menu, NULL, (GMenuModel*)tool_box_section());
1008 return menu;
1009}
1010
1017{
1018 GMenu * menu = g_menu_new ();
1019 append_menu_item (menu, "Periodic Table", "app.help.periodic", "<CTRL>P", 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 (PACKAGE_BD, 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 atomes_action main_actions[] = {{ "workspace.open", GINT_TO_POINTER(2)},
1108 { "workspace.save", GINT_TO_POINTER(3)},
1109 { "workspace.save-as", GINT_TO_POINTER(3)},
1110 { "workspace.close", GINT_TO_POINTER(1)},
1111 { "project.new", NULL},
1112 { "project.open", GINT_TO_POINTER(0)},
1113 { "project.save", GINT_TO_POINTER(1) },
1114 { "project.save-as", GINT_TO_POINTER(1)},
1115 { "project.close", NULL},
1116 { "export.isaacs", GINT_TO_POINTER(1)},
1117 { "export.coordinates", GINT_TO_POINTER(1)},
1118 { "import.isaacs", GINT_TO_POINTER(0)},
1119 { "import.coordinates", GINT_TO_POINTER(0)},
1120 { "program.quit", NULL},
1121 { "analyze.tool-box", NULL},
1122 { "help.periodic", NULL},
1123 { "help.about", NULL},
1124 { "help.shortcuts", NULL}};
1125
1126 GSimpleAction * main_act[18];
1127 for (i=0; i<G_N_ELEMENTS(main_actions); i++)
1128 {
1129 main_act[i] = g_simple_action_new (main_actions[i].action_name, NULL);
1130 add_action (main_act[i]);
1131 g_signal_connect (main_act[i], "activate", G_CALLBACK(atomes_menu_bar_action), main_actions[i].action_data);
1132 }
1133 for (i=0; i<G_N_ELEMENTS(edition_acts); i++)
1134 {
1135 edition_actions[i] = g_simple_action_new (edition_acts[i].action_name, NULL);
1136 g_signal_connect (edition_actions[i], "activate", G_CALLBACK(atomes_menu_bar_action), edition_acts[i].action_data);
1137 }
1138 for (i=0; i<G_N_ELEMENTS(analyze_acts); i++)
1139 {
1140 analyze_actions[i] = g_simple_action_new (analyze_acts[i].action_name, NULL);
1141 g_signal_connect (analyze_actions[i], "activate", G_CALLBACK(atomes_menu_bar_action), analyze_acts[i].action_data);
1142 }
1143
1144 /*GtkBuilder * builder = gtk_builder_new_from_file ("menus/main.ui");
1145 GMenuModel * model = G_MENU_MODEL (gtk_builder_get_object (builder, "atomes_menu_bar"));
1146 gtk_application_set_menubar (GTK_APPLICATION(atomes), G_MENU_MODEL(model));
1147 g_object_unref (model);*/
1148 gtk_application_set_menubar (GTK_APPLICATION(atomes), G_MENU_MODEL(atomes_menu_bar()));
1149 gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW(window), TRUE);
1150
1151#ifdef GTK3
1152 MainEvent = gtk_event_box_new ();
1153 gtk_widget_add_events (MainEvent,
1154 GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK |
1155 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
1156 g_signal_connect(G_OBJECT(MainEvent), "button_press_event", G_CALLBACK(pop_menu), NULL);
1157 g_signal_connect(G_OBJECT(MainEvent), "button_release_event", G_CALLBACK(pop_menu), NULL);
1158#else
1159 add_widget_gesture_and_key_action (window, "atomes-context-click", G_CALLBACK(atomes_popup_menu), NULL,
1160 NULL, NULL, NULL,
1161 "atomes-key-pressed", G_CALLBACK(on_atomes_pressed), NULL,
1162 NULL, NULL, NULL, NULL, NULL, NULL);
1163#endif
1164 add_gtk_close_event (window, G_CALLBACK(leaving_question), NULL);
1165 GtkWidget * hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
1166 int frame_size[2]={200, 550};
1167 for (i=0; i<2; i++)
1168 {
1169 MainFrame[i] = gtk_frame_new (NULL);
1170 gtk_widget_set_size_request (MainFrame[i], frame_size[i], -1);
1171 MainScrol[i] = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
1172#ifdef GTK3
1173 if (! i)
1174 {
1176 }
1177 else
1178 {
1180 gtk_container_add (GTK_CONTAINER(MainEvent), MainScrol[i]);
1181 }
1182#else
1183 gtk_scrolled_window_set_propagate_natural_height ((GtkScrolledWindow *)MainScrol[i], TRUE);
1184 gtk_scrolled_window_set_propagate_natural_width ((GtkScrolledWindow *)MainScrol[i], TRUE);
1186#endif
1187 }
1188#ifdef GTK4
1189 gtk_paned_set_start_child (GTK_PANED (hpaned), MainFrame[0]);
1190 gtk_paned_set_resize_start_child (GTK_PANED (hpaned), FALSE);
1191 gtk_paned_set_shrink_start_child (GTK_PANED (hpaned), FALSE);
1192 gtk_paned_set_end_child (GTK_PANED (hpaned), MainFrame[1]);
1193 gtk_paned_set_resize_end_child (GTK_PANED (hpaned), TRUE);
1194 gtk_paned_set_shrink_end_child (GTK_PANED (hpaned), FALSE);
1195#else
1196 gtk_paned_pack1 (GTK_PANED (hpaned), MainFrame[0], FALSE, FALSE);
1197 gtk_paned_pack2 (GTK_PANED (hpaned), MainFrame[1], FALSE, FALSE);
1198#endif
1201 add_container_child (CONTAINER_WIN, window, hpaned);
1202 clean_view ();
1203 show_the_widgets (window);
1204
1205 for (i=0; i<9; i++)
1206 {
1207 davect[i].a = i/3;
1208 davect[i].b = i-3*davect[i].a;
1209 }
1210
1211 calc_img[0] = g_strdup_printf ("%s", PACKAGE_GR);
1212 calc_img[1] = g_strdup_printf ("%s", PACKAGE_SQ);
1213 calc_img[2] = g_strdup_printf ("%s", PACKAGE_SQ);
1214 calc_img[3] = g_strdup_printf ("%s", PACKAGE_GR);
1215 calc_img[4] = g_strdup_printf ("%s", PACKAGE_AN);
1216 calc_img[5] = g_strdup_printf ("%s", PACKAGE_RI);
1217 calc_img[6] = g_strdup_printf ("%s", PACKAGE_CH);
1218 calc_img[7] = g_strdup_printf ("%s", PACKAGE_SP);
1219 calc_img[8] = g_strdup_printf ("%s", PACKAGE_MS);
1220 calc_img[9] = g_strdup_printf ("%s", PACKAGE_BD);
1221
1222 dots[0] = g_strdup_printf ("%s", PACKAGE_DOTA);
1223 dots[1] = g_strdup_printf ("%s", PACKAGE_DOTB);
1224 dots[2] = g_strdup_printf ("%s", PACKAGE_DOTC);
1225 dots[3] = g_strdup_printf ("%s", PACKAGE_DOTD);
1226 dots[4] = g_strdup_printf ("%s", PACKAGE_DOTE);
1227 dots[5] = g_strdup_printf ("%s", PACKAGE_DOTF);
1228 dots[6] = g_strdup_printf ("%s", PACKAGE_DOTG);
1229 dots[7] = g_strdup_printf ("%s", PACKAGE_DOTH);
1230
1231 ifield[0] = g_strdup_printf ("%s", PACKAGE_DFBD);
1232 ifield[1] = g_strdup_printf ("%s", PACKAGE_DFBD);
1233 ifield[2] = g_strdup_printf ("%s", PACKAGE_DFAN);
1234 ifield[3] = g_strdup_printf ("%s", PACKAGE_DFAN);
1235 ifield[4] = g_strdup_printf ("%s", PACKAGE_DFDI);
1236 ifield[5] = g_strdup_printf ("%s", PACKAGE_DFDI);
1237 ifield[6] = g_strdup_printf ("%s", PACKAGE_DFTD);
1238 ifield[7] = g_strdup_printf ("%s", PACKAGE_DFIN);
1239
1240 bravais_img[0] = g_strdup_printf ("%s", PACKAGE_SGTC);
1241 bravais_img[1] = g_strdup_printf ("%s", PACKAGE_SGMP);
1242 bravais_img[2] = g_strdup_printf ("%s", PACKAGE_SGMI);
1243 bravais_img[3] = g_strdup_printf ("%s", PACKAGE_SGOP);
1244 bravais_img[4] = g_strdup_printf ("%s", PACKAGE_SGOI);
1245 bravais_img[5] = g_strdup_printf ("%s", PACKAGE_SGOC);
1246 bravais_img[6] = g_strdup_printf ("%s", PACKAGE_SGOF);
1247 bravais_img[7] = g_strdup_printf ("%s", PACKAGE_SGTP);
1248 bravais_img[8] = g_strdup_printf ("%s", PACKAGE_SGTI);
1249 bravais_img[9] = g_strdup_printf ("%s", PACKAGE_SGTR);
1250 bravais_img[10] = g_strdup_printf ("%s", PACKAGE_SGHP);
1251 bravais_img[11] = g_strdup_printf ("%s", PACKAGE_SGCP);
1252 bravais_img[12] = g_strdup_printf ("%s", PACKAGE_SGCI);
1253 bravais_img[13] = g_strdup_printf ("%s", PACKAGE_SGCF);
1254
1255 // Rouge
1256 std[0].red = 1.0;
1257 std[0].green = 0.0;
1258 std[0].blue = 0.0;
1259 // Jaune
1260 std[1].red = 1.0;
1261 std[1].green = 1.0;
1262 std[1].blue = 0.0;
1263 // Vert
1264 std[2].red = 0.0;
1265 std[2].green = 1.0;
1266 std[2].blue = 0.0;
1267 // Cyan
1268 std[3].red = 0.0;
1269 std[3].green = 1.0;
1270 std[3].blue = 1.0;
1271 // Bleu
1272 std[4].red = 0.0;
1273 std[4].green = 0.0;
1274 std[4].blue = 1.0;
1275 // Rose
1276 std[5].red = 1.0;
1277 std[5].green = 0.0;
1278 std[5].blue = 1.0;
1279
1280 for (i=0; i<3; i++)
1281 {
1282 objects[i] = 0;
1283 object_was_selected[i] = NULL;
1284 tmp_object_id[i] = NULL;
1285 }
1286 cut_sel.a = cut_sel.b = 0;
1287 cut_sel.c = 1;
1288 cut_lab.a = cut_lab.b = cut_lab.c = 0;
1289
1290 return window;
1291}
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
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:775
GMenu * quit_section(gchar *act)
create the 'Quit' menu item
Definition gui.c:897
dint davect[9]
Definition gui.c:146
G_MODULE_EXPORT void compute_this_prop(GtkWidget *widg, gpointer data)
to compute the 'calc_to_compute'
Definition work_menu.c:105
G_MODULE_EXPORT void on_edit_activate(GtkWidget *widg, gpointer data)
create an edition dialog - prepare the dialog
Definition edit_menu.c:835
GMenu * create_analyze_menu()
create atomes 'analyze' menu
Definition gui.c:995
gchar * main_group_names[]
Definition gui.c:166
GMenu * port_section(gchar *act, int pop, int port)
create the import/export menu items
Definition gui.c:806
int objects[3]
Definition selection.c:212
tint cut_lab
Definition gui.c:145
atomes_action edition_acts[]
Definition gui.c:108
void remove_edition_actions()
remove all edition actions
Definition gui.c:422
GIcon * get_gicon_from_data(int format, const gchar *icon)
create a new icon using data
Definition gui.c:610
GMenu * create_workspace_menu(gchar *act, int pop_up, int proj, int calc)
create atomes 'workspace' menu
Definition gui.c:952
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:641
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:728
atomes_action analyze_acts[]
Definition gui.c:112
ColRGBA std[6]
Definition gui.c:147
GMenu * create_help_menu()
create atomes 'help' menu
Definition gui.c:1016
shortcuts main_shortcuts[]
Definition gui.c:149
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:352
GtkWidget * shortcuts_window(int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups], gchar *section_names[sections], gchar *group_names[groups], shortcuts shortcs[])
Create the shortcuts information window.
Definition gui.c:181
GMenu * workspace_title()
create the 'Workspace' menu item
Definition gui.c:911
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:926
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:433
void clean_view()
clean the main window
Definition gui.c:286
G_MODULE_EXPORT void on_calc_activate(GtkWidget *widg, gpointer data)
create a calculation dialog - prepare the dialog
Definition calc_menu.c: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:400
GMenu * create_edit_menu()
create atomes 'edit' menu
Definition gui.c:969
void view_buffer(GtkTextBuffer *buffer)
set a text buffer in the main window or an image
Definition gui.c:309
int main_group_by_section[]
Definition gui.c:165
G_MODULE_EXPORT void show_periodic_table(GtkWidget *widg, gpointer data)
show the periodic table of the elements
Definition gui.c:448
int get_atom_id_from_periodic_table(atom_search *asearch)
get atom Z from selection in the periodic table
Definition w_periodic.c:672
gchar * main_section_names[]
Definition gui.c:164
tint cut_sel
Definition gui.c: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:462
int main_shortcut_by_group[]
Definition gui.c:167
GMenuItem * create_gmenu_item(const gchar *label, const gchar *action, const gchar *accel, const gchar *custom, int format, const gchar *icon, gboolean check, gboolean status, gboolean radio, const gchar *rstatus)
create menu item
Definition gui.c:682
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:758
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:883
void remove_action(gchar *action_name)
add action from the main window action map
Definition gui.c:412
char * calc_name[NCALCS-2]
Definition gui.c:122
GMenu * tool_box_section()
create toolboxes menu item
Definition gui.c:983
GMenu * project_section(gchar *act, int pop_up, int proj, int calc)
create the project section
Definition gui.c:830
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.