157extern G_MODULE_EXPORT
void opengl_advanced (GtkWidget * widg, gpointer data);
158extern G_MODULE_EXPORT
void render_gl_image (GtkWidget * widg, gpointer data);
159extern G_MODULE_EXPORT
void coord_properties (GtkWidget * widg, gpointer data);
170extern GSimpleActionGroup * view_pop_actions;
172extern GtkWidget * color_palette (
glwin * view,
int ideo,
int spec,
int geo);
201 return (view -> atom_win -> visible || view -> selection_mode ==
NSELECTION-1) ? 1 : 0;
233 if (! view -> fullscreen)
235 gtk_window_fullscreen (GTK_WINDOW(view -> win));
237 view -> fullscreen = TRUE;
241 gtk_window_unfullscreen (GTK_WINDOW(view -> win));
243 view -> fullscreen = FALSE;
264 if (g_strcmp0 (
text_styles[i], str) == 0)
return i;
288 g_free (this_search);
290 if (this_proj -> modelgl -> atom_win)
292 if (! this_proj -> modelgl -> atom_win -> visible)
294 if (! this_proj -> modelgl -> cell_win || ! this_proj -> modelgl -> cell_win -> slab_passivate)
296 g_free (this_proj -> modelgl -> atom_win);
297 this_proj -> modelgl -> atom_win = NULL;
322 i = GPOINTER_TO_INT(data);
359 else if (
sel ->
a == 2)
380 selat = selat -> next;
396 const gchar * act = g_action_get_name(G_ACTION(
action));
400 if (strstr(act,
"set-mol-ins"))
402 act_end = g_strdup_printf (
"%c%c", act[k-4], act[k-3]);
407 str = (i < 10) ? g_strdup_printf (
".%d", i) : g_strdup_printf (
"%d", i);
408 if (g_strcmp0(str, act_end) == 0)
412 return g_strdup_printf (
"%s",
mol[i].
object);
420 if (strstr(act,
"set-ifp"))
422 act_end = g_strdup_printf (
"%c%c%c%c", act[k-6], act[k-5], act[k-4], act[k-3]);
429 str = g_strdup_printf (
"-%d.%d", j, i);
430 if (g_strcmp0(str, act_end) == 0)
472 gboolean replace = TRUE;
495 lab = g_strdup_printf (
"%s", gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
500 lab = g_strdup_printf (
"Copied Data");
509 i = GPOINTER_TO_INT(data);
546 else if (
sel ->
a == 2)
569 selat = selat -> next;
593 selat = selat -> next;
613 str = g_strdup_printf (
"No atoms to be removed !");
617 str = g_strdup_printf (
"%d atom(s) removed !", i);
677 str = g_strdup_printf (
"%d atom(s) removed !\n%d atom(s) inserted !", i, j);
703G_MODULE_EXPORT
void add_object (GSimpleAction *
action, GVariant * parameter, gpointer data)
713G_MODULE_EXPORT
void add_object (GtkWidget * widg, gpointer data)
729 lab = g_strdup_printf (
"%s", gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
734 lab = g_strdup_printf (
"Copied Data");
747 for (i=0; i<
object ->
atoms; i++)
749 object -> at_list[i].x +=
opengl_project -> modelgl -> insert_coords.x +
object -> dim*ul.
a;
750 object -> at_list[i].y +=
opengl_project -> modelgl -> insert_coords.y +
object -> dim*ul.
b;
751 object -> at_list[i].z +=
opengl_project -> modelgl -> insert_coords.z +
object -> dim*ul.
c;
770G_MODULE_EXPORT
void to_add_object (GSimpleAction *
action, GVariant * parameter, gpointer data)
832G_MODULE_EXPORT
void copy_this_atom (GSimpleAction *
action, GVariant * parameter, gpointer data)
857 i = GPOINTER_TO_INT(data);
879 for (i=0; i<2; i++)
if (this_proj -> modelgl -> adv_bonding[i]) k ++;
882 numc[i] =
allocint (this_proj -> coord -> totcoord[i]);
883 numv[i] =
allocint (this_proj -> coord -> totcoord[i]);
886 numg[i] =
allocint (this_proj -> nspec);
887 for (j=1; j<this_proj -> nspec; j++)
889 numg[i][j] = this_proj -> coord -> ntg[i][j-1] + numg[i][j-1];
893 for (i=0; i<this_proj -> steps; i++)
895 for (j=0; j<this_proj -> natomes; j++)
897 for (l=0; l<2; l++)
if (this_proj ->
atoms[i][j].show[l]) num[l][this_proj ->
atoms[i][j].sp] ++;
901 if (l < 2 && this_proj ->
atoms[i][j].sp > 0) m += numg[l][this_proj ->
atoms[i][j].sp];
903 if (this_proj ->
atoms[i][j].show[0]) numv[l][m] ++;
908 gboolean update_bar = FALSE;
912 for (j=0; j<this_proj -> nspec; j++)
916 if (num[i][j] == this_proj ->
chemistry -> nsps[j]*this_proj -> steps)
919 if (! this_proj -> modelgl -> anim -> last ->
img -> show_atom[i][j]) update_bar = TRUE;
922 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j], TRUE);
924 this_proj -> modelgl -> anim -> last ->
img -> show_atom[i][j] = TRUE;
927 else if (this_proj -> modelgl -> anim -> last ->
img -> show_atom[i][j])
933 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j], FALSE);
935 this_proj -> modelgl -> anim -> last ->
img -> show_atom[i][j] = FALSE;
944 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
948 if (numc[i][j] == numv[i][j])
951 if (! this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j]) update_bar = TRUE;
954 for (l=0; l<2; l++) gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[l][i][j], TRUE);
957 this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j] = TRUE;
959 else if (this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j])
965 for (l=0; l<2; l++) gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[l][i][j], FALSE);
967 this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j] = FALSE;
973 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
977 this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j] = TRUE;
979 else if (this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j])
981 this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j] = FALSE;
986 for (i=0; i<2; i++) g_free (num[i]);
992 if (i < 2) g_free (numg[i]);
995 if (update_bar) update_menu_bar (this_proj -> modelgl);
1023 int id = GPOINTER_TO_INT (data);
1044 int * naid =
allocint (this_proj -> nspec);
1045 int * nlid =
allocint (this_proj -> nspec);
1046 start = (types == 0 || types == 2) ? 0 : 1;
1047 end = (types == 1 || types == 2) ? 2 : 1;
1050 gboolean update_bar = FALSE;
1052 for (h=start; h<end; h++)
1054 for (i=0; i<this_proj -> nspec; i++) naid[i] = nlid[i] = 0;
1055 for (i=0; i<this_proj -> steps; i++)
1057 for (j=0; j<this_proj -> natomes; j++)
1059 k = this_proj ->
atoms[i][j].sp;
1061 if (this_proj ->
atoms[i][j].
label[h]) nlid[k] ++;
1064 if (h==types || (h == 0 && types == 2)) l = 0;
1065 for (i=0; i<this_proj -> nspec; i++)
1068 if (nlid[i] == naid[i])
1071 if (! this_proj -> modelgl -> anim -> last ->
img -> show_label[h][i]) update_bar = TRUE;
1073 if (! gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[h][i]))
1075 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[h][i], 1);
1078 this_proj -> modelgl -> anim -> last ->
img -> show_label[h][i] = TRUE;
1086 if (this_proj -> modelgl -> anim -> last ->
img -> show_label[h][i]) update_bar = TRUE;
1088 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[h][i]))
1090 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[h][i], 0);
1094 this_proj -> modelgl -> anim -> last ->
img -> show_label[h][i] = FALSE;
1096 if (h==types || (h == 0 && types == 2)) l += nlid[i];
1103 if (update_bar) update_menu_bar (this_proj -> modelgl);
1132 int id = GPOINTER_TO_INT (data);
1180 int h, i, j, k, l, m;
1181 int id = GPOINTER_TO_INT (data);
1260 int id = GPOINTER_TO_INT (data);
1264 j =
get_style ((
char *)gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
1345G_MODULE_EXPORT
void copy_the_atoms (GSimpleAction *
action, GVariant * parameter, gpointer data)
1626 k =
get_style ((
char *)gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
1715G_MODULE_EXPORT
void copy_the_coord (GSimpleAction *
action, GVariant * parameter, gpointer data)
1866 else if (
sel ->
a < 4)
1941 else if (
sel ->
a < 4)
1975 int shader[1] = {
SELEC};
2016 l =
get_style ((
char *)gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
2029 else if (
sel ->
a < 4)
2063 int * pos_sp, * specs;
2074 tmp = selection -> first;
2076 for (i=0; i<selection -> selected; i++)
2078 specs[tmp -> sp] ++;
2079 if (pos_sp[tmp -> sp] < 0)
2082 pos_sp[tmp -> sp] = j;
2084 if (tmp -> next != NULL) tmp = tmp -> next;
2087 for (i=0; i<
opengl_project -> nspec; i++)
if (specs[i] > 0) nspec ++;
2132 tmp = selection -> first;
2135 tmp = selection -> first;
2152 if (tmp -> next != NULL) tmp = tmp -> next;
2199 selected = g_malloc0 (
sizeof*selected);
2215 if (selected -> first)
2223 tmp_a = selected -> first;
2237 if (selected -> first)
2245 tmp_a = selected -> first;
2265G_MODULE_EXPORT
void edit_coord (GSimpleAction *
action, GVariant * parameter, gpointer data)
2284 selected = g_malloc0 (
sizeof*selected);
2305 if (selected -> first)
2313 tmp_a = selected -> first;
2315 selected -> selected ++;
2332G_MODULE_EXPORT
void edit_atoms (GSimpleAction *
action, GVariant * parameter, gpointer data)
2349 selected = g_malloc0 (
sizeof*selected);
2355 if (selected -> first)
2363 tmp_a = selected -> first;
2365 selected -> selected ++;
2395 int i = GPOINTER_TO_INT(data);
2398 g_debug (
"Action for All= %d", i);
2603 i = GPOINTER_TO_INT(data);
2760 int g, h, i, j, k, l, m, n, o;
2761 int mid = GPOINTER_TO_INT(data);
2765 gboolean eqtc, eqpc;
2953 GMenu * menu = g_menu_new ();
2955 gchar * word, * name, * str;
2956 gchar * eact = g_strdup_printf (
"mol-ins-%s-%d", act, aid);
2962 menus = g_menu_new ();
2968 append_opengl_item (view, menus,
mol[i].
object, eact, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
2973 gboolean doit = FALSE;
2985 GMenu * menup = g_menu_new ();
2987 eact = g_strdup_printf (
"ifp-%s-%d", act, aid);
2993 menups = g_menu_new ();
2996 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
2997 str = g_strdup_printf (
"%s-%d", eact, j);
2998 append_opengl_item (view, menups, word, str, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3003 g_object_unref (menups);
3009 g_object_unref (menup);
3011 eact = g_strdup_printf (
"cp-%s-%d", act, aid);
3012 append_opengl_item (view, menu,
"Copied Data", eact, 1, 0,
"<CTRL>V",
IMG_NONE, NULL, FALSE, G_CALLBACK(
add_object), data, FALSE, FALSE, FALSE, (
copied_object) ? TRUE : FALSE);
3030 GMenu * menu = g_menu_new ();
3031 gchar * actc = g_strdup_printf (
"%s-%d", act, aid);
3035 append_opengl_item (view, menu,
text_styles[i], actc, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3052 GtkWidget * menu = gtk_menu_new ();
3053 gtk_menu_item_set_submenu ((GtkMenuItem *)item, menu);
3059 gtk3_menu_item (menu,
text_styles[i],
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3113 GtkWidget * menu = gtk_menu_new ();
3114 GtkWidget * smenu, * pmenu;
3115 GtkWidget * titem, * sitem;
3116 gchar * word, * name;
3117 gtk_menu_item_set_submenu ((GtkMenuItem *)item, menu);
3122 if (
mol[i].type != NULL)
3125 gtk_menu_shell_append ((GtkMenuShell *)menu, titem);
3126 smenu = gtk_menu_new ();
3127 gtk_menu_item_set_submenu ((GtkMenuItem *)titem, smenu);
3129 if (
mol[i].
object != NULL)
3131 gtk3_menu_item (smenu,
mol[i].
object,
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3135 gboolean doit = FALSE;
3148 gtk_menu_shell_append ((GtkMenuShell *)menu, titem);
3149 smenu = gtk_menu_new ();
3150 gtk_menu_item_set_submenu ((GtkMenuItem *)titem, smenu);
3160 gtk_menu_shell_append ((GtkMenuShell *)smenu, sitem);
3161 pmenu = gtk_menu_new ();
3162 gtk_menu_item_set_submenu ((GtkMenuItem *)sitem, pmenu);
3165 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
3166 gtk3_menu_item (pmenu, word,
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3173 GtkWidget * pastem =
gtk3_menu_item (menu,
"Copied Data",
IMG_NONE, NULL, G_CALLBACK(
add_object), data, TRUE, GDK_KEY_v, GDK_CONTROL_MASK, FALSE, FALSE, FALSE);
3196void create_selection_item (GMenu * menu,
glwin * view, gchar * str, gchar * act,
int aid,
int mid,
int gid,
int cid,
int aoc, GCallback handler, gpointer data)
3198 gchar * actc = g_strdup_printf (
"%s-%d", act, aid);
3250 for (i=0; i < gid; i++)
3266 gtk_menu_item_set_submenu ((GtkMenuItem *)sel_item,
color_box(view, j+cid, k, cid));
3281 append_opengl_item (view, menu, str, actc, 1, 0, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3283 g_signal_connect (G_OBJECT (sel_item),
"activate", handler, data);
3293gchar *
mot[2][2]={{
"All Non-Selected Atom(s)/Bond(s)",
"All Selected Atom(s)/Bond(s)"},
3294 {
"All Non-Labelled Atom(s)/Bond(s)",
"All Labelled Atom(s)/Bond(s)"}};
3312GMenu *
selection_menu (
int aid,
glwin * view,
int ati,
int bti,
int aoc,
int mid, GCallback handler_a, GCallback handler_b, GCallback handler_c)
3328GtkWidget *
selection_menu (
glwin * view,
int ati,
int bti,
int aoc,
int mid, GCallback handler_a, GCallback handler_b, GCallback handler_c)
3331 int p = view ->
proj;
3332 int s = view -> anim -> last ->
img ->
step;
3339 GMenu * menu = g_menu_new ();
3342 GtkWidget * menu = gtk_menu_new ();
3345 spa = this_proj ->
atoms[s][ati].sp;
3346 if (bti > -1) spb = this_proj ->
atoms[s][bti].sp;
3347 if (bti < 0 && (((mid == 5 || mid == 6) && this_proj ->
atoms[s][ati].show[aoc])
3363 strb = g_strdup_printf (
"act-%d-%d", aid, mid);
3364 append_opengl_item (view, menu, str, strb, 1, 0, NULL,
IMG_NONE, NULL, FALSE, handler_a, GINT_TO_POINTER(ati), FALSE, FALSE, FALSE, TRUE);
3369 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3380 g_signal_connect (G_OBJECT (
sel),
"activate", handler_a, GINT_TO_POINTER(ati));
3384 else if (bti > -1 && mid != 4 && mid != 7)
3386 str = g_strdup_printf (
"This Bond: %s<sub>%d</sub> - %s<sub>%d</sub>",
3400 strb = g_strdup_printf (
"act-%d-%d", aid, mid);
3401 append_opengl_item (view, menu, str, strb, 1, 0, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
select_action_for_this_bond), GINT_TO_POINTER(mid), FALSE, FALSE, FALSE, TRUE);
3418 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3432 else if ((mid > 1 && mid < 4) && j==1)
3451 strb = g_strdup_printf (
"act-all-%d-%d", aid, mid+k);
3452 append_opengl_item (view, menu,
mot[j][i], strb, 1, 0, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
select_action_for_all), GINT_TO_POINTER(mid+k), FALSE, FALSE, FALSE, TRUE);
3469 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3477 if (this_proj -> modelgl -> adv_bonding[i])
3480 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j+1) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j+1);
3482 create_selection_item (menu, view, str, (! i) ?
"afm" :
"amo", aid, mid, 2+i, j, aoc, handler_b, &
atoid[mid][2+i]);
3484 gtk_menu_shell_append ((GtkMenuShell *)menu,
create_selection_item (view, str, mid, 2+i, j, aoc, handler_b, &
atoid[mid][2+i]));
3491 if (this_proj ->
atoms[s][ati].coord[0] > -1)
3494 str = g_strdup_printf (
"All <b>%d</b> Fold %s Atoms", this_proj -> coord -> geolist[0][spa][i],
exact_name(this_proj ->
chemistry ->
label[spa]));
3496 create_selection_item (menu, view, str,
"atc", aid, mid, 0, i, aoc, handler_b, &
atoid[mid][0]);
3502 if (this_proj ->
atoms[s][ati].coord[1] > -1)
3505 str = g_strdup_printf (
"All <b>%s</b> Coordinations",
env_name (this_proj, i, spa, 1, NULL));
3507 create_selection_item (menu, view, str,
"apc", aid, mid, 1, i, aoc, handler_b, &
atoid[mid][1]);
3522 create_selection_item (menu, view, str,
"asp", aid, mid, 0, -1, aoc, handler_c, &
atoid[mid][2]);
3530 if (this_proj ->
atoms[s][ati].coord[0] > -1 && this_proj ->
atoms[s][bti].coord[0] > -1)
3534 str = g_strdup_printf (
"All %s <b>%d</b> - %s <b>%d</b> Bonds",
3538 create_selection_item (menu, view, str,
"atcb", aid, mid, -1, -1, aoc, G_CALLBACK(
select_action_for_all_bonds), GINT_TO_POINTER(mid+
CONTEXTACT));
3544 if (this_proj ->
atoms[s][ati].coord[1] > -1 && this_proj ->
atoms[s][bti].coord[1] > -1)
3548 str = g_strdup_printf (
"All <b>%s</b> - <b>%s</b> Bonds",
env_name (this_proj, i, spa, 1, NULL),
env_name (this_proj, j, spb, 1, NULL));
3550 create_selection_item (menu, view, str,
"apcb", aid, mid, -1, -1, aoc, G_CALLBACK(
select_action_for_all_bonds), GINT_TO_POINTER(mid+2*
CONTEXTACT));
3558 create_selection_item (menu, view, str,
"acb", aid, mid, -1, -1, aoc, G_CALLBACK(
select_action_for_all_bonds), GINT_TO_POINTER(mid));
3564 if (mid > 3 && mid < 6)
3566 gchar * mat[2]={
"All Hidden Atom(s)/Bond(s)",
"All Visible Atom(s)/Bond(s)"};
3568 strb = g_strdup_printf (
"all-hv-%d-%d", aid, mid);
3569 append_opengl_item (view, menu, mat[mid%2], strb, 1, 0, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
select_action_for_all), GINT_TO_POINTER(mid+2*
CONTEXTACT), FALSE, FALSE, FALSE, TRUE);
3572 gtk3_menu_item (menu, mat[mid%2],
IMG_NONE, NULL, G_CALLBACK(
select_action_for_all), GINT_TO_POINTER(mid+2*
CONTEXTACT), FALSE, 0, 0, FALSE, FALSE, FALSE);
3593void analyze_popup_attach_color_palettes (
glwin * view, GtkWidget * menu,
int ato,
int spc,
int totc,
int parc,
int frag,
int mol)
3607 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, ato*this_proj -> nspec+spc, -1, -1),
"set-asp-7.7"))
3609 g_debug (
"Color palette error: species in selection - custom= set-asp-7.7");
3613 for (j=0;
j<spc;
j++)
3615 i += this_proj -> coord -> ntg[0][
j];
3617 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+i, -1, -1),
"set-atc-7.7"))
3619 g_debug (
"Color palette error: total coordination in selection - custom= set-atc-7.7");
3622 i = this_proj -> coord -> totcoord[0];
3623 for (j=0;
j<spc;
j++)
3625 i += this_proj -> coord -> ntg[1][
j];
3627 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+i, -1, -1),
"set-apc-7.7"))
3629 g_debug (
"Color palette error: partial coordination in selection - custom= set-apc-7.7");
3631 if (view -> adv_bonding[0])
3634 i = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] + frag;
3635 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i, 2, 0),
"set-afm-7.7"))
3637 g_debug (
"Color palette error: fragment in selection - custom= set-afm-7.7");
3640 if (view -> adv_bonding[1])
3643 i = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] + this_proj -> coord -> totcoord[2] +
mol;
3644 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i, 3, 0),
"set-amo-7.7"))
3646 g_debug (
"Color palette error: fragment in selection - custom= set-amo-7.7");
3668 int p = view ->
proj;
3669 int s = view -> anim -> last ->
img ->
step;
3671 gchar * str, * strp;
3672 gchar * menu_names[
CONTEXTACT] = {
"Select",
"Unselect",
"Label",
"Unlabel",
"Show",
"Hide",
"Style",
"Color",
"Edit as New Project",
"Remove",
"Replace",
"Copy"};
3686 if (view_pop_actions) g_object_unref (view_pop_actions);
3687 view_pop_actions = g_simple_action_group_new ();
3688 GMenu * gmenu = g_menu_new ();
3690 GtkWidget * menu = gtk_menu_new ();
3694 g_debug (
"POP_SEL:: spe= %d, ati= %d, bti= %d, aoc= %d", spe, ati, bti, aoc);
3706 if (
is_selected != spe) g_debug (
"Something is wrong in popup");
3715 atoid[i][j].
c = ((i-2*(i/2)) == 0 ? 1 : 0);
3730 str = g_strdup_printf (
"%s<sub>%d</sub> - %s<sub>%d</sub>",
3735 str = g_strdup_printf (
"%s<sub>%d</sub> - %s<sub>%d</sub>",
3740 strp = g_strdup_printf (
"<b>%s \t d= %.3f Ã… (PBC)</b>", str,
dist.length);
3744 strp = g_strdup_printf (
"<b>%s \t d= %.3f Ã…</b>", str,
dist.length);
3747 append_opengl_item (view, gmenu, strp,
"w-dist", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3750 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3755 if (view -> adv_bonding[i])
3758 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j);
3760 append_opengl_item (view, gmenu, str,
"w-dist-fm", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3763 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3780 append_opengl_item (view, gmenu, str,
"w-ac", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3783 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3786 str = g_strdup_printf (
"\tx : <b>%f</b>\n\ty : <b>%f</b>\n\tz : <b>%f</b>",
3789 append_opengl_item (view, gmenu, str,
"xyz", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3792 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3800 append_opengl_item (view, gmenu, str,
"w-tc", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3803 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3807 str = g_strdup_printf (
"Partial Coordination: <b>%s</b>",
3810 append_opengl_item (view, gmenu, str,
"w-pc", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3813 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3819 if (view -> adv_bonding[i])
3822 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j);
3824 append_opengl_item (view, gmenu, str,
"w-fm", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3827 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3847 GMenu * menua = g_menu_new ();
3848 g_menu_append_section (gmenu, NULL, (GMenuModel *)menua);
3854 for (i=0; i<12; i++)
3857 if (i < 9 && view -> mode ==
EDITION) go = FALSE;
3858 if ((i > 8 && i < 11) && view -> mode ==
ANALYZE) go = FALSE;
3859 if (i == 0 && view -> anim -> last ->
img -> selected[mmod] -> selected ==
opengl_project -> natomes) go = FALSE;
3860 if (i == 1 && view -> anim -> last ->
img -> selected[mmod] -> selected == 0) go = FALSE;
3862 if (i == 3 && view -> labelled == 0) go = FALSE;
3863 if (bti > -1 && i == 7) go = FALSE;
3864 j = (i == 8 && view -> mode ==
ANALYZE) ? 11 : (i == 11 && view -> mode ==
ANALYZE) ? 8 : i;
3868 append_submenu (menua, menu_names[j],
selection_menu (i, view, ati, bti, aoc, j, handlers[j][0], handlers[j][1], handlers[j][2]));
3870 gtk_menu_shell_append ((GtkMenuShell *)menu,
menu_item_new_with_submenu(menu_names[j], TRUE,
selection_menu (view, ati, bti, aoc, j, handlers[j][0], handlers[j][1], handlers[j][2])));
3875 GtkWidget * menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)gmenu, GTK_POPOVER_MENU_NESTED);
3879 gtk_widget_set_parent (menu, view -> win);
3880 str = g_strdup_printf (
"gl-%d", view -> action_id);
3881 gtk_widget_insert_action_group (menu, str, G_ACTION_GROUP(view_pop_actions));
3884 i += (view -> adv_bonding[0] && bti < 0) ? 30 : 0;
3885 i += (view -> adv_bonding[1] && bti < 0) ? 30 : 0;
3886 if (bti > -1) i -= (view -> mode ==
ANALYZE) ? 70 : 50;
3887 gtk_widget_set_size_request (menu, -1, i);
3904G_MODULE_EXPORT
void reset_coords (GSimpleAction *
action, GVariant * parameter, gpointer data)
3921 view -> create_shaders[
MEASU] = TRUE;
3922 view -> create_shaders[
PICKS] = TRUE;
3937G_MODULE_EXPORT
void turn_rebuild (GSimpleAction *
action, GVariant * parameter, gpointer data)
3953 view -> rebuild[dat ->
b][0] = ! view -> rebuild[dat ->
b][0];
3954 view -> rebuild[dat ->
b][1] = view -> rebuild[dat ->
b][0];
3955 update_menu_bar (view);
3957 view -> rebuild[dat ->
b][0] = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
3958 view -> rebuild[dat ->
b][1] = view -> rebuild[dat ->
b][0];
3959 if (widg != view -> rbuild[dat ->
b])
3961 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> rbuild[dat ->
b], view -> rebuild[dat ->
b][0]);
3978 ask_yes_no (
"Center crystal atom(s)",
"Are you sure, this can affect the visual representation of the unit cell ?", GTK_MESSAGE_QUESTION, view -> win);
3990GMenu * tools_section (
glwin * view)
3992 GMenu * menu = g_menu_new ();
4004GMenu * anim_section (
glwin * view)
4006 GMenu * menu = g_menu_new ();
4019void analyze_menu_attach_color_palettes (
glwin * view, GtkWidget * menu)
4037 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -1, -1, -1),
"set-box-color.0"))
4039 g_debug (
"Color palette error: box - custom= set-box-color.0");
4044 for (j=0;
j<this_proj -> nspec;
j++)
4046 str = g_strdup_printf (
"set-%s.%d", (! i) ?
"atom-color" :
"clone-color",
j);
4047 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i*this_proj -> nspec+j, -1, -1), (
const gchar *)str))
4049 g_debug (
"Color palette error: %s - %d - custom= %s", (! i) ?
"atom-color" :
"clone-color",
j+1, str);
4057 if (this_proj -> coord -> ntg[i])
4059 for (j=0;
j<this_proj -> nspec;
j++)
4061 for (k=0;
k<this_proj -> coord -> ntg[
i][
j];
k++)
4066 m += this_proj -> coord -> ntg[
i][
l];
4070 str = g_strdup_printf (
"set-%s-c.%d",
exact_name (
env_name (this_proj, k, j, 1, NULL)), m);
4074 str = g_strdup_printf (
"set-%d-c.%d", this_proj -> coord -> geolist[i][j][k], m);
4076 m += (
i) ? this_proj -> coord -> totcoord[0] : 0;
4077 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+m, -1, -1), (
const gchar *)str))
4079 g_debug (
"Color palette error: %s - spec= %d - coord= %d, custom= %s", (! i) ?
"total-coord" :
"partial-coord",
j+1,
k+1, str);
4089 for (j=0;
j<this_proj -> coord -> totcoord[
i];
j++)
4091 str = g_strdup_printf (
"set-%s-%d", (i == 2) ?
"fcol" :
"mcol",
j);
4092 k = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] +
j;
4093 if (i == 3)
k += this_proj -> coord -> totcoord[2];
4094 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, k, i, 0), (
const gchar *)str))
4096 g_debug (
"Color palette error: %s - %d, custom= %s", (i == 2) ?
"fragment" :
"molecule",
j+1, str);
4104 for (j=0;
j<this_proj -> coord -> totcoord[
i];
j++)
4106 str = g_strdup_printf (
"set-rcol-%d-%d", i, j);
4107 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -3, i-4, 0), (
const gchar *)str))
4109 g_debug (
"Color palette error: rings - %d - %d, custom= %s", i, j+1, str);
4115 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -2, -1, -1),
"set-back-color.0"))
4117 g_debug (
"Color palette error: background - custom= set-back-color.0");
4136 if (view_pop_actions) g_object_unref (view_pop_actions);
4137 view_pop_actions = g_simple_action_group_new ();
4138 GMenu * gmenu = g_menu_new ();
4147 g_menu_append_section (gmenu, NULL, (GMenuModel *)tools_section(view));
4148 g_menu_append_section (gmenu, NULL, (GMenuModel *)
menu_view(view, 1));
4149 g_menu_append_section (gmenu, NULL, (GMenuModel *)anim_section(view));
4153 g_menu_append_section (gmenu, NULL, (GMenuModel *)tools_section(view));
4156 append_opengl_item (view, gmenu,
"Reset Motion",
"res-mot", 1, 0, NULL,
IMG_STOCK,
MEDIA_LOOP, FALSE, G_CALLBACK(
reset_coords), view, FALSE, FALSE, FALSE, TRUE);
4158 g_menu_append_section (gmenu, NULL, (GMenuModel*)
menu_reset(view, 1));
4159 g_menu_append_section (gmenu, NULL, (GMenuModel*)
menu_fullscreen(view, 1));
4160 g_menu_append_section (gmenu, NULL, (GMenuModel*)
menu_shortcuts(view, 1));
4162 menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)gmenu, GTK_POPOVER_MENU_NESTED);
4163 if (view -> mode ==
ANALYZE) analyze_menu_attach_color_palettes (view, menu);
4165 gtk_popover_present ((GtkPopover *)menu);
4166 gchar * str = g_strdup_printf (
"gl-%d", view -> action_id);
4167 gtk_widget_insert_action_group (menu, str, G_ACTION_GROUP(view_pop_actions));
4169 gtk_widget_set_parent (menu, view -> win);
4170 gtk_widget_set_size_request (menu, -1, (view -> mode ==
ANALYZE) ? 742 : 242);
4173 menu = gtk_menu_new ();
4177 menu_items_opengl (menu, view, 1);
4184 gtk_menu_shell_append ((GtkMenuShell *)menu,
menu_box_axis (view, 1, 0));
4186 gtk_menu_shell_append ((GtkMenuShell *)menu,
menu_coord (view, 1));
4192 gtk3_menu_item (menu,
"Advanced",
IMG_NONE, NULL, G_CALLBACK(
coord_properties), (gpointer)& view ->
colorp[30][0], TRUE, GDK_KEY_e, GDK_CONTROL_MASK, FALSE, FALSE, FALSE);
4200 gtk_menu_shell_append ((GtkMenuShell *)menu,
menu_anim (view, 1));
4205 gtk_menu_item_set_submenu ((GtkMenuItem *)item,
menu_tools(view, 1));
4206 gtk_menu_shell_append ((GtkMenuShell *)menu, item);
4211 gtk_menu_shell_append ((GtkMenuShell *)menu, item);
4216 gtk3_menu_item (menu,
"Extract/Rebuild on Motion",
IMG_STOCK, (gpointer)
ECUT, G_CALLBACK(
turn_rebuild), & view ->
colorp[0][0], FALSE, 0, 0, TRUE, FALSE, view -> rebuild[0][0]);
4217 gtk3_menu_item (menu,
"Extract/Rebuild on Copy",
IMG_STOCK, (gpointer)
ECUT, G_CALLBACK(
turn_rebuild), & view ->
colorp[1][0], FALSE, 0, 0, TRUE, FALSE, view -> rebuild[1][0]);
4219 gtk3_menu_item (menu,
"Reset Motion",
IMG_STOCK, (gpointer)
MEDIA_LOOP, G_CALLBACK(
reset_coords), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
4222 gtk3_menu_item (menu,
"Reset View",
IMG_STOCK, (gpointer)
FITBEST, G_CALLBACK(
to_reset_view), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
4223 gtk3_menu_item (menu,
"Center Molecule",
IMG_STOCK, (gpointer)
FITBEST, G_CALLBACK(
to_center_this_molecule), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
4225 if (! view -> fullscreen)
4227 gtk3_menu_item (menu,
"Fullscreen",
IMG_STOCK, (gpointer)
FULLSCREEN, G_CALLBACK(
set_full_screen), (gpointer)view, TRUE, GDK_KEY_f, GDK_CONTROL_MASK, FALSE, FALSE, FALSE);
4231 gtk3_menu_item (menu,
"Exit Fullscreen",
IMG_STOCK, (gpointer)
FULLSCREEN, G_CALLBACK(
set_full_screen), (gpointer)view, TRUE, GDK_KEY_Escape, 0, FALSE, FALSE, FALSE);
4234 gtk3_menu_item (menu,
"Shortcuts",
IMG_NONE, NULL, G_CALLBACK(
view_shortcuts), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
void prepare_atom_edition(gpointer data, gboolean visible)
prepare atom edition
void clean_other_window_after_edit(project *this_proj)
update other windows after model edition if required
Function declarations for the mode edition window.
atomic_object * create_object_from_selection(project *this_proj)
create object from atom selection
void init_coordinates(project *this_proj, int status, gboolean win, gboolean init)
preserve atomic coordinates
int get_selected_object_id(gboolean visible, int p, gchar *str, atom_search *asearch)
get the id of the object selected (in contextual menu, or in combo box)
tint ulam_coord(glwin *view)
shift insertion position for object not to have overlapping objects for multiple/repeated insertions
atomic_object * duplicate_atomic_object(atomic_object *old_obj)
duplicate an insert object
void to_insert_in_project(int stat, int orig, project *this_proj, atom_search *asearch, gboolean visible)
to insert object in project
void allocate_todo(atom_search *asearch, int tsize)
allocate the selection list data buffer
Binding to the Fortran90 subroutines.
Callback declarations for main window.
G_MODULE_EXPORT void cut_this_slab(GtkButton *but, gpointer data)
cut this slab callback
integer function chains()
integer(kind=c_int) function chemistry()
GtkWidget * color_box(glwin *view, int ideo, int spec, int geo)
create the color palette pointers and menus GTK3 version
Structure definitions for color management Function declarations for color management.
G_MODULE_EXPORT void window_color_coord(GtkWidget *widg, gpointer data)
create a window to select a color callback GTK3
G_MODULE_EXPORT void to_run_atom_color_window(GtkWidget *widg, gpointer data)
to run atom color selection window callback GTK3
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
void process_selected_atom(project *this_proj, glwin *view, int id, int ac, int se, int pi)
process selected atom
atom_in_selection * tmp_a
void init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
distance distance_3d(cell_info *cell, int mdstep, atom *at, atom *bt)
distance between atom a and b in 3D
int ** allocdint(int xal, int yal)
allocate an int ** pointer
int * allocint(int val)
allocate an int * pointer
double string_to_double(gpointer string)
convert string to double
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * create_menu_item_from_widget(GtkWidget *widg, gboolean check, gboolean radio, gboolean status)
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)
chemical_data * active_chem
void opengl_project_changed(int id)
change the OpenGL project
void pop_menu_at_pointer(GtkWidget *widg, GdkEvent *event)
popup a menu at pointer location
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
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
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)
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
void add_menu_separator(GtkWidget *menu)
GtkWidget * menu_item_new_with_submenu(gchar *name, gboolean active, GtkWidget *sub_menu)
atomic_object * copied_object
void show_the_widgets(GtkWidget *widg)
show GtkWidget
project * get_project_by_id(int p)
get project pointer using id number
void update(glwin *view)
update the rendering of the OpenGL window
void center_this_molecule(glwin *view)
center atomic coordinates around (0,0,0) and refresh shaders
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
void re_create_md_shaders(int nshaders, int shaders[nshaders], project *this_proj)
re-initialize some MD dependent OpenGL shaders
gboolean is_coord_in_menu(int id, project *this_proj)
is this coordination in a menu ?
void update_all_menus(glwin *view, int nats)
update all menus of the OpenGL window
void update_all_selections(glwin *view, int pi)
update the selection data: bonds, angles and dihedrals
void save_all_selections(glwin *view, int pi)
save all selection data
char * text_filled[FILLED_STYLES]
shaders
The different types of shaders in the atomes program.
char * text_styles[OGL_STYLES]
G_MODULE_EXPORT void to_reset_view(GtkWidget *widg, gpointer data)
reset view callback - GTK3
Function declarations for the creation of the OpenGL window.
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 init_project(gboolean alloc_box)
initialize a new project
void show_info(char *information, int val, GtkWidget *win)
add / show information message to widget
gchar * env_name(project *this_proj, int g, int s, int f, GtkTextBuffer *buffer)
ouput the name of a coordination sphere
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
gchar * exact_name(gchar *name)
short cut to print string without spaces
Messaging function declarations.
GMenu * menu_anim(glwin *view, int popm)
create the 'Animate' submenu elements
GMenu * menu_atoms(glwin *view, int popm, int at)
create the 'Atom(s)' submenu elements
GMenu * menu_bonds(glwin *view, int popm, int at)
create the 'Bond(s)' submenu GTK4
GMenuItem * menu_box_axis(glwin *view, int popm, int ab)
create the 'Model -> Box' and 'View -> Axis' submenus GTK4
GMenu * menu_clones(glwin *view, int popm)
create the 'Clone(s)' submenu GTK4
GMenu * menu_coord(glwin *view, int popm)
create the 'Coordination' submenu GTK4
GMenu * menu_rings(glwin *view, int popm)
create the 'Ring(s)' submenu GTK4
GMenu * add_menu_coord(glwin *view, int popm, int id)
create a coordination type submenu
GMenu * color_item(glwin *view, gchar *act, int popm, int id, GCallback handler, gpointer data)
create a submenu to attach a color palette
GMenu * extract_section(glwin *view, int popm)
create the 'Extract/Rebuild' menu items GTK4
GMenu * menu_poly(glwin *view, int popm)
create the 'Chemistry -> Polyehdra' submenu - GTK4
GMenu * menu_fullscreen(glwin *view, int popm)
create the 'Fullscreen' menu item - GTK4
GMenu * menu_reset(glwin *view, int popm)
create the reset menu items - GTK4
GMenu * menu_view(glwin *view, int popm)
create the 'View' submenu - GTK4
void alloc_proj_data(project *this_proj, int cid)
allocate data
Function declarations for reading atomes project file Function declarations for saving atomes proje...
void active_project_changed(int id)
change the active project
void add_project_to_workspace()
add project(s) to the workspace tree
Function declarations for workspace managment.