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);
73 "First-Principles: CPMD",
74 "First-Principles: CP2K",
75 "QM-MM: CPMD - [Soon]",
76 "QM-MM: CP2K - [Soon]"};
78gchar *
modes[3]={
"Analysis",
"Edition",
"Input(s)"};
79gchar *
smodes[
NSELECTION]={
"Atom/Bond",
"Coordination Sphere",
"Fragment",
"Molecule",
"Single Fragment",
"Single Molecule",
"Measures (Edition Mode Only)"};
80gchar *
invl[2]={
"Selection",
"Visible/Hidden"};
102 if (view ->
spin[0] || view ->
spin[1])
106 view ->
spin[i+2] = view ->
spin[i];
107 view -> spin_speed[i+2] = view -> spin_speed[i];
108 view ->
spin[i] = FALSE;
112 else if (view ->
spin[2] || view ->
spin[3])
116 view ->
spin[i] = view ->
spin[i+2];
117 view -> spin_speed[i] = view -> spin_speed[i+2];
119 view ->
spin[i+2] = FALSE;
120 view -> spin_speed[i+2] = 0;
137 int i = this_proj -> modelgl -> selection_mode;
138 int j = the_data ->
b;
144 if (i != j && gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
146 this_proj -> modelgl -> selection_mode =
NONE;
147 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_smode[i], FALSE);
148 if (widg != this_proj -> modelgl -> ogl_smode[j])
150 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_smode[j], TRUE);
153 this_proj -> modelgl -> selection_mode = j;
157 else if (i == j && ! gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
159 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_smode[j], TRUE);
172G_MODULE_EXPORT
void set_mode (GtkWidget * widg, gpointer data)
176 int i = this_proj -> modelgl -> mode;
177 int j = the_data ->
b;
184 if (i != j && gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
187 this_proj -> modelgl -> mode =
NONE;
190 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_mode[i], FALSE);
191 if (widg != this_proj -> modelgl -> ogl_mode[j])
193 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_mode[j], TRUE);
196 this_proj -> modelgl -> mode = j;
197 if (this_proj -> modelgl -> mode ==
EDITION)
206 if (this_proj -> modelgl -> saved_coord[i] != NULL)
208 g_free (this_proj -> modelgl -> saved_coord[i]);
209 this_proj -> modelgl -> saved_coord[i] = NULL;
213 if (this_proj -> modelgl -> selection_mode ==
NSELECTION-1)
219 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_smode[0], TRUE);
233 gtk_window_set_title (GTK_WINDOW (this_proj -> modelgl -> win), str);
235 this_proj -> modelgl -> create_shaders[
MEASU] = TRUE;
236 update (this_proj -> modelgl);
241 else if (i == j && ! gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
243 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_mode[j], TRUE);
259 for (i=0; i<this_proj -> steps; i++)
261 for (j=0; j<this_proj -> natomes; j++)
263 for (k=0; k<2; k++) this_proj ->
atoms[i][j].show[k] = ! this_proj ->
atoms[i][j].show[k];
282 switch (the_data ->
b)
295extern G_MODULE_EXPORT
void window_volumes (GtkWidget * widg, gpointer data);
307 GtkWidget * menut = gtk_menu_new ();
308 gtk3_menu_item (menut,
"Measures",
IMG_NONE, NULL, G_CALLBACK(
window_measures), (gpointer)view, TRUE, GDK_KEY_m, GDK_CONTROL_MASK, FALSE, FALSE, FALSE);
309 GtkWidget * widg =
gtk3_menu_item (menut,
"Volumes",
IMG_NONE, NULL, G_CALLBACK(
window_volumes), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
315 gtk_menu_shell_append ((GtkMenuShell *)menut, widg);
316 GtkWidget * menum = gtk_menu_new ();
317 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menum);
318 guint accel[3]={GDK_KEY_a, GDK_KEY_e, GDK_KEY_i};
319 guint acces[4]={GDK_KEY_A, GDK_KEY_C, GDK_KEY_F, GDK_KEY_M};
325 TRUE, accel[i], GDK_MOD1_MASK, TRUE, TRUE, (i == view -> mode) ? TRUE : FALSE);
334 TRUE, accel[i], GDK_MOD1_MASK, TRUE, TRUE, (i == view -> mode) ? TRUE : FALSE);
362 gtk_menu_shell_append ((GtkMenuShell *)menut, widg);
363 GtkWidget * menusm = gtk_menu_new ();
364 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menusm);
373 TRUE, acces[i], GDK_SHIFT_MASK, TRUE, TRUE, (i == view -> selection_mode) ? TRUE : FALSE);
378 FALSE, 0, 0, TRUE, TRUE, (i == view -> selection_mode) ? TRUE : FALSE);
390 TRUE, acces[i], GDK_SHIFT_MASK, TRUE, TRUE, (i == view -> selection_mode) ? TRUE : FALSE);
395 FALSE, 0, 0, TRUE, TRUE, (i == view -> selection_mode) ? TRUE : FALSE);
403 GtkWidget * menuf = NULL;
406 gtk_menu_shell_append ((GtkMenuShell *)menut, widg);
407 menuf = gtk_menu_new ();
408 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menuf);
414 gtk_menu_shell_append ((GtkMenuShell *)menuf, view -> ogl_mode[i+2+
NINPUTS]);
415 g_signal_connect (G_OBJECT (view -> ogl_mode[i+2+
NINPUTS]),
"activate", G_CALLBACK(
create_field), & view ->
colorp[i][0]);
425 gtk_menu_shell_append ((GtkMenuShell *)menuf, widg);
426 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
create_field), & view ->
colorp[i][0]);
434 GtkWidget * menuin = NULL;
436 gtk_menu_shell_append ((GtkMenuShell *)menut, widg);
437 menuin = gtk_menu_new ();
438 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menuin);
442 gtk_menu_shell_append ((GtkMenuShell *)menuin, widg);
443 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
invert_this), & view ->
colorp[i][0]);
472 GMenu * menu = g_menu_new ();
473 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);
501 GMenu * menu = g_menu_new ();
502 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);
516 GMenu * menu = g_menu_new ();
533 const gchar * mode = g_variant_get_string (parameter, NULL);
534 int lgt = strlen (mode);
535 gchar * name = g_strdup_printf (
"%c%c", mode[lgt-2], mode[lgt-1]);
536 if (g_strcmp0(name,
".1") == 0)
539 name = g_strdup_printf (
"%.*s.0", lgt-2, mode);
540 g_action_group_activate_action ((GActionGroup *)view -> action_group,
"set-mouse-mode", g_variant_new_string((
const gchar *)name));
549 mode_name = g_strdup_printf (
"set-mouse-mode.%d.0", i);
550 if (g_strcmp0(mode, (
const gchar *)
mode_name) == 0)
561 update_menu_bar (view);
575 GMenu * menu = g_menu_new ();
576 gchar * accel[3] = {
"<ALT>A",
"<ALT>E",
"<ALT>I"};
581 append_opengl_item (view, menu,
modes[i],
"mouse-mode", popm, i, accel[i],
IMG_NONE, NULL, FALSE,
599 const gchar * mode = g_variant_get_string (parameter, NULL);
600 int lgt = strlen (mode);
601 gchar * name = g_strdup_printf (
"%c%c", mode[lgt-2], mode[lgt-1]);
602 if (g_strcmp0(name,
".1") == 0)
605 name = g_strdup_printf (
"%.*s.0", lgt-2, mode);
606 g_action_group_activate_action ((GActionGroup *)view -> action_group,
"set-sel-mode", g_variant_new_string((
const gchar *)name));
615 mode_name = g_strdup_printf (
"set-sel-mode.%d.0", i);
616 if (g_strcmp0(mode, (
const gchar *)
mode_name) == 0)
626 g_action_change_state (G_ACTION (
action), parameter);
640 GMenu * menu = g_menu_new ();
641 gchar * acces[4]={
"A",
"C",
"F",
"M"};
649 str = g_strdup_printf (
"<SHIFT>%s", acces[i]);
650 append_opengl_item (view, menu,
smodes[i],
"sel-mode", popm, i, str,
IMG_NONE, NULL, FALSE, G_CALLBACK(
change_sel_mode_radio), (gpointer)view,
651 FALSE, (i == view -> selection_mode) ? TRUE : FALSE, TRUE, j);
656 append_opengl_item (view, menu,
smodes[i],
"sel-mode", popm, i, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
change_sel_mode_radio), (gpointer)view,
657 FALSE, (i == view -> selection_mode) ? TRUE : FALSE, TRUE, j);
673 GMenu * menu = g_menu_new ();
703 GMenu * menu = g_menu_new ();
707 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],
708 FALSE, FALSE, FALSE, (i < 2) ? view -> adv_bonding[1] : (i > 3) ? FALSE : TRUE);
737 GMenu * menu = g_menu_new ();
741 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);
757 GMenu * menu = g_menu_new ();
772 GMenu * menu = g_menu_new ();
773 g_menu_append_section (menu, NULL, (GMenuModel*)
measure_section(view, popm));
774 g_menu_append_section (menu, NULL, (GMenuModel*)
volume_section(view, popm));
775 g_menu_append_section (menu, NULL, (GMenuModel*)
edit_section(view, popm));
776 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
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.
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