65extern G_MODULE_EXPORT
void window_measures (GtkWidget * widg, gpointer data);
66extern G_MODULE_EXPORT
void window_volumes (GtkWidget * widg, gpointer data);
67extern G_MODULE_EXPORT
void create_field (GtkWidget * widg, gpointer data);
68extern gboolean
spin (gpointer data);
72 i18n(
"Classical: LAMMPS"),
73 i18n(
"First-Principles: CPMD"),
74 i18n(
"First-Principles: CP2K"),
75 i18n(
"QM-MM: CPMD - [Soon]"),
76 i18n(
"QM-MM: CP2K - [Soon]")};
81 i18n(
"Coordination Sphere"),
84 i18n(
"Single Fragment"),
85 i18n(
"Single Molecule"),
86 i18n(
"Measures (Edition Mode Only)")};
110 if (view ->
spin[0] || view ->
spin[1])
114 view ->
spin[i+2] = view ->
spin[i];
115 view -> spin_speed[i+2] = view -> spin_speed[i];
116 view ->
spin[i] = FALSE;
120 else if (view ->
spin[2] || view ->
spin[3])
124 view ->
spin[i] = view ->
spin[i+2];
125 view -> spin_speed[i] = view -> spin_speed[i+2];
127 view ->
spin[i+2] = FALSE;
128 view -> spin_speed[i+2] = 0;
145 int i = this_proj -> modelgl -> selection_mode;
146 int j = the_data -> b;
152 if (i != j && gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
154 this_proj -> modelgl -> selection_mode =
NONE;
155 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_smode[i], FALSE);
156 if (widg != this_proj -> modelgl -> ogl_smode[j])
158 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_smode[j], TRUE);
161 this_proj -> modelgl -> selection_mode = j;
165 else if (i == j && ! gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
167 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_smode[j], TRUE);
180G_MODULE_EXPORT
void set_mode (GtkWidget * widg, gpointer data)
184 int i = this_proj -> modelgl -> mode;
185 int j = the_data -> b;
192 if (i != j && gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
195 this_proj -> modelgl -> mode =
NONE;
198 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_mode[i], FALSE);
199 if (widg != this_proj -> modelgl -> ogl_mode[j])
201 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_mode[j], TRUE);
204 this_proj -> modelgl -> mode = j;
205 if (this_proj -> modelgl -> mode ==
EDITION)
214 if (this_proj -> modelgl -> saved_coord[i] != NULL)
216 g_free (this_proj -> modelgl -> saved_coord[i]);
217 this_proj -> modelgl -> saved_coord[i] = NULL;
221 if (this_proj -> modelgl -> selection_mode ==
NSELECTION-1)
227 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_smode[0], TRUE);
241 gtk_window_set_title (GTK_WINDOW (this_proj -> modelgl -> win), str);
243 this_proj -> modelgl -> create_shaders[
MEASU] = TRUE;
244 update (this_proj -> modelgl);
249 else if (i == j && ! gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
251 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_mode[j], TRUE);
267 for (i=0; i<this_proj -> steps; i++)
269 for (j=0; j<this_proj -> natomes; j++)
271 for (k=0; k<2; k++) this_proj ->
atoms[i][j].show[k] = ! this_proj ->
atoms[i][j].show[k];
290 switch (the_data -> b)
303extern G_MODULE_EXPORT
void window_volumes (GtkWidget * widg, gpointer data);
315 GtkWidget * menut = gtk_menu_new ();
316 gtk3_menu_item (menut, _(
"Measures"),
IMG_NONE, NULL, G_CALLBACK(
window_measures), (gpointer)view, TRUE, GDK_KEY_m, GDK_CONTROL_MASK, FALSE, FALSE, FALSE);
317 GtkWidget * widg =
gtk3_menu_item (menut, _(
"Volumes"),
IMG_NONE, NULL, G_CALLBACK(
window_volumes), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
323 gtk_menu_shell_append ((GtkMenuShell *)menut, widg);
324 GtkWidget * menum = gtk_menu_new ();
325 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menum);
326 guint accel[3]={GDK_KEY_a, GDK_KEY_e, GDK_KEY_i};
327 guint acces[4]={GDK_KEY_A, GDK_KEY_C, GDK_KEY_F, GDK_KEY_M};
333 TRUE, accel[i], GDK_MOD1_MASK, TRUE, TRUE, (i == view -> mode) ? TRUE : FALSE);
342 TRUE, accel[i], GDK_MOD1_MASK, TRUE, TRUE, (i == view -> mode) ? TRUE : FALSE);
370 gtk_menu_shell_append ((GtkMenuShell *)menut, widg);
371 GtkWidget * menusm = gtk_menu_new ();
372 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menusm);
381 TRUE, acces[i], GDK_SHIFT_MASK, TRUE, TRUE, (i == view -> selection_mode) ? TRUE : FALSE);
386 FALSE, 0, 0, TRUE, TRUE, (i == view -> selection_mode) ? TRUE : FALSE);
398 TRUE, acces[i], GDK_SHIFT_MASK, TRUE, TRUE, (i == view -> selection_mode) ? TRUE : FALSE);
403 FALSE, 0, 0, TRUE, TRUE, (i == view -> selection_mode) ? TRUE : FALSE);
411 GtkWidget * menuf = NULL;
414 gtk_menu_shell_append ((GtkMenuShell *)menut, widg);
415 menuf = gtk_menu_new ();
416 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menuf);
422 gtk_menu_shell_append ((GtkMenuShell *)menuf, view -> ogl_mode[i+2+
NINPUTS]);
423 g_signal_connect (G_OBJECT (view -> ogl_mode[i+2+
NINPUTS]),
"activate", G_CALLBACK(
create_field), & view ->
colorp[i][0]);
433 gtk_menu_shell_append ((GtkMenuShell *)menuf, widg);
434 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
create_field), & view ->
colorp[i][0]);
442 GtkWidget * menuin = NULL;
444 gtk_menu_shell_append ((GtkMenuShell *)menut, widg);
445 menuin = gtk_menu_new ();
446 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menuin);
450 gtk_menu_shell_append ((GtkMenuShell *)menuin, widg);
451 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
invert_this), & view ->
colorp[i][0]);
480 GMenu * menu = g_menu_new ();
481 append_opengl_item (view, menu, _(
"Measures"),
"measures", popm, popm,
"<CTRL>M",
IMG_NONE, NULL, FALSE, G_CALLBACK(
to_window_measures), (gpointer)view, FALSE, FALSE, FALSE, TRUE);
509 GMenu * menu = g_menu_new ();
510 append_opengl_item (view, menu, _(
"Volumes"),
"volumes", popm, popm, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
to_window_volumes), (gpointer)view, FALSE, FALSE, FALSE, TRUE);
524 GMenu * menu = g_menu_new ();
541 const gchar * mode = g_variant_get_string (parameter, NULL);
542 int lgt = strlen (mode);
543 gchar * name = g_strdup_printf (
"%c%c", mode[lgt-2], mode[lgt-1]);
544 if (g_strcmp0(name,
".1") == 0)
547 name = g_strdup_printf (
"%.*s.0", lgt-2, mode);
548 g_action_group_activate_action ((GActionGroup *)view -> action_group,
"set-mouse-mode", g_variant_new_string((
const gchar *)name));
557 mode_name = g_strdup_printf (
"set-mouse-mode.%d.0", i);
558 if (g_strcmp0(mode, (
const gchar *)
mode_name) == 0)
569 update_menu_bar (view);
583 GMenu * menu = g_menu_new ();
584 gchar * accel[3] = {
"<ALT>A",
"<ALT>E",
"<ALT>I"};
589 append_opengl_item (view, menu, _(
modes[i]),
"mouse-mode", popm, i, accel[i],
IMG_NONE, NULL, FALSE,
607 const gchar * mode = g_variant_get_string (parameter, NULL);
608 int lgt = strlen (mode);
609 gchar * name = g_strdup_printf (
"%c%c", mode[lgt-2], mode[lgt-1]);
610 if (g_strcmp0(name,
".1") == 0)
613 name = g_strdup_printf (
"%.*s.0", lgt-2, mode);
614 g_action_group_activate_action ((GActionGroup *)view -> action_group,
"set-sel-mode", g_variant_new_string((
const gchar *)name));
623 mode_name = g_strdup_printf (
"set-sel-mode.%d.0", i);
624 if (g_strcmp0(mode, (
const gchar *)
mode_name) == 0)
634 g_action_change_state (G_ACTION (
action), parameter);
648 GMenu * menu = g_menu_new ();
649 gchar * acces[4]={
"A",
"C",
"F",
"M"};
657 str = g_strdup_printf (
"<SHIFT>%s", acces[i]);
658 append_opengl_item (view, menu, _(
smodes[i]),
"sel-mode", popm, i, str,
IMG_NONE, NULL, FALSE, G_CALLBACK(
change_sel_mode_radio), (gpointer)view,
659 FALSE, (i == view -> selection_mode) ? TRUE : FALSE, TRUE, j);
664 append_opengl_item (view, menu, _(
smodes[i]),
"sel-mode", popm, i, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
change_sel_mode_radio), (gpointer)view,
665 FALSE, (i == view -> selection_mode) ? TRUE : FALSE, TRUE, j);
681 GMenu * menu = g_menu_new ();
711 GMenu * menu = g_menu_new ();
715 append_opengl_item (view, menu, _(
input_types[i]),
"md", popm, i, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
to_create_field), & view ->
colorp[i][0],
716 FALSE, FALSE, FALSE, (i < 2) ? view -> adv_bonding[1] : (i > 3) ? FALSE : TRUE);
745 GMenu * menu = g_menu_new ();
749 append_opengl_item (view, menu, _(
invl[i]),
"inv", popm, i, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
to_invert_this), & view ->
colorp[i][0], FALSE, FALSE, FALSE, TRUE);
765 GMenu * menu = g_menu_new ();
780 GMenu * menu = g_menu_new ();
781 g_menu_append_section (menu, NULL, (GMenuModel*)
measure_section(view, popm));
782 g_menu_append_section (menu, NULL, (GMenuModel*)
volume_section(view, popm));
783 g_menu_append_section (menu, NULL, (GMenuModel*)
edit_section(view, popm));
784 g_menu_append_section (menu, NULL, (GMenuModel*)
modes_section(view, popm));
Function declarations for the mode edition window.
void init_coordinates(project *this_proj, int status, gboolean win, gboolean init)
preserve atomic coordinates
G_MODULE_EXPORT void create_field(GtkWidget *widg, gpointer data)
start an input creation assistant
char * input_types[NINPUTS]
void invert_selection(project *this_proj)
invert atom(s) selection
Function declarations for the cell edition window.
void init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
GtkWidget * gtk3_menu_item(GtkWidget *menu, gchar *name, int icon_format, gpointer item_icon, GCallback handler, gpointer data, gboolean accel, guint key, GdkModifierType mod, gboolean check, gboolean radio, gboolean status)
gboolean is_atom_win_active(glwin *view)
is the model edition window visible ?
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
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
GtkWidget * create_menu_item(gboolean add_mnemo, gchar *action)
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
void add_menu_separator(GtkWidget *menu)
GtkWidget * menu_item_new_with_submenu(gchar *name, gboolean active, GtkWidget *sub_menu)
project * get_project_by_id(int p)
get project pointer using id number
void update(glwin *view)
update the rendering of the OpenGL window
#define REFRESH
Refresh time for spinning the OpenGL window in milliseconds.
G_MODULE_EXPORT void set_selection_mode(GtkWidget *widg, gpointer data)
set selection mode callback
gboolean spin(gpointer data)
spin
void append_opengl_item(glwin *view, GMenu *menu, const gchar *name, gchar *key, int mpop, int item_id, gchar *accel, int image_format, gpointer icon, gboolean custom, GCallback handler, gpointer data, gboolean check, gboolean status, gboolean radio, gboolean sensitive)
void set_advanced_bonding_menus(glwin *view)
GMenu * menu_edit(glwin *view, int popm)
create the 'Edit' submenu GTK4
void active_project_changed(int id)
change the active project
G_MODULE_EXPORT void window_measures(GtkWidget *widg, gpointer data)
create the measurements window