157extern G_MODULE_EXPORT
void render_gl_image (GtkWidget * widg, gpointer data);
158extern G_MODULE_EXPORT
void coord_properties (GtkWidget * widg, gpointer data);
169extern GSimpleActionGroup * view_pop_actions;
171extern GtkWidget * color_palette (
glwin * view,
int ideo,
int spec,
int geo);
200 return (view -> atom_win -> visible || view -> selection_mode ==
NSELECTION-1) ? 1 : 0;
232 if (! view -> fullscreen)
234 gtk_window_fullscreen (GTK_WINDOW(view -> win));
236 view -> fullscreen = TRUE;
240 gtk_window_unfullscreen (GTK_WINDOW(view -> win));
242 view -> fullscreen = FALSE;
263 if (g_strcmp0 (
text_styles[i], str) == 0)
return i;
287 g_free (this_search);
289 if (this_proj -> modelgl -> atom_win)
291 if (! this_proj -> modelgl -> atom_win -> visible)
293 if (! this_proj -> modelgl -> cell_win || ! this_proj -> modelgl -> cell_win -> slab_passivate)
295 g_free (this_proj -> modelgl -> atom_win);
296 this_proj -> modelgl -> atom_win = NULL;
321 i = GPOINTER_TO_INT(data);
358 else if (
sel ->
a == 2)
379 selat = selat -> next;
395 const gchar * act = g_action_get_name(G_ACTION(
action));
399 if (strstr(act,
"set-mol-ins"))
401 act_end = g_strdup_printf (
"%c%c", act[k-4], act[k-3]);
406 str = (i < 10) ? g_strdup_printf (
".%d", i) : g_strdup_printf (
"%d", i);
407 if (g_strcmp0(str, act_end) == 0)
411 return g_strdup_printf (
"%s",
mol[i].
object);
419 if (strstr(act,
"set-ifp"))
421 act_end = g_strdup_printf (
"%c%c%c%c", act[k-6], act[k-5], act[k-4], act[k-3]);
428 str = g_strdup_printf (
"-%d.%d", j, i);
429 if (g_strcmp0(str, act_end) == 0)
471 gboolean replace = TRUE;
494 lab = g_strdup_printf (
"%s", gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
499 lab = g_strdup_printf (
"Copied Data");
508 i = GPOINTER_TO_INT(data);
545 else if (
sel ->
a == 2)
568 selat = selat -> next;
592 selat = selat -> next;
612 str = g_strdup_printf (
"No atoms to be removed !");
616 str = g_strdup_printf (
"%d atom(s) removed !", i);
676 str = g_strdup_printf (
"%d atom(s) removed !\n%d atom(s) inserted !", i, j);
702G_MODULE_EXPORT
void add_object (GSimpleAction *
action, GVariant * parameter, gpointer data)
712G_MODULE_EXPORT
void add_object (GtkWidget * widg, gpointer data)
728 lab = g_strdup_printf (
"%s", gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
733 lab = g_strdup_printf (
"Copied Data");
746 for (i=0; i<
object ->
atoms; i++)
748 object -> at_list[i].x +=
opengl_project -> modelgl -> insert_coords.x +
object -> dim*ul.
a;
749 object -> at_list[i].y +=
opengl_project -> modelgl -> insert_coords.y +
object -> dim*ul.
b;
750 object -> at_list[i].z +=
opengl_project -> modelgl -> insert_coords.z +
object -> dim*ul.
c;
769G_MODULE_EXPORT
void to_add_object (GSimpleAction *
action, GVariant * parameter, gpointer data)
831G_MODULE_EXPORT
void copy_this_atom (GSimpleAction *
action, GVariant * parameter, gpointer data)
856 i = GPOINTER_TO_INT(data);
878 for (i=0; i<2; i++)
if (this_proj -> modelgl -> adv_bonding[i]) k ++;
881 numc[i] =
allocint (this_proj -> coord -> totcoord[i]);
882 numv[i] =
allocint (this_proj -> coord -> totcoord[i]);
885 numg[i] =
allocint (this_proj -> nspec);
886 for (j=1; j<this_proj -> nspec; j++)
888 numg[i][j] = this_proj -> coord -> ntg[i][j-1] + numg[i][j-1];
892 for (i=0; i<this_proj -> steps; i++)
894 for (j=0; j<this_proj -> natomes; j++)
896 for (l=0; l<2; l++)
if (this_proj ->
atoms[i][j].show[l]) num[l][this_proj ->
atoms[i][j].sp] ++;
900 if (l < 2 && this_proj ->
atoms[i][j].sp > 0) m += numg[l][this_proj ->
atoms[i][j].sp];
902 if (this_proj ->
atoms[i][j].show[0]) numv[l][m] ++;
907 gboolean update_bar = FALSE;
911 for (j=0; j<this_proj -> nspec; j++)
915 if (num[i][j] == this_proj ->
chemistry -> nsps[j]*this_proj -> steps)
918 if (! this_proj -> modelgl -> anim -> last ->
img -> show_atom[i][j]) update_bar = TRUE;
921 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j], TRUE);
923 this_proj -> modelgl -> anim -> last ->
img -> show_atom[i][j] = TRUE;
926 else if (this_proj -> modelgl -> anim -> last ->
img -> show_atom[i][j])
932 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[i][j], FALSE);
934 this_proj -> modelgl -> anim -> last ->
img -> show_atom[i][j] = FALSE;
943 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
947 if (numc[i][j] == numv[i][j])
950 if (! this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j]) update_bar = TRUE;
953 for (l=0; l<2; l++) gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[l][i][j], TRUE);
956 this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j] = TRUE;
958 else if (this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j])
964 for (l=0; l<2; l++) gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_geom[l][i][j], FALSE);
966 this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j] = FALSE;
972 for (j=0; j<this_proj -> coord -> totcoord[i]; j++)
976 this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j] = TRUE;
978 else if (this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j])
980 this_proj -> modelgl -> anim -> last ->
img -> show_coord[i][j] = FALSE;
985 for (i=0; i<2; i++) g_free (num[i]);
991 if (i < 2) g_free (numg[i]);
994 if (update_bar) update_menu_bar (this_proj -> modelgl);
1022 int id = GPOINTER_TO_INT (data);
1043 int * naid =
allocint (this_proj -> nspec);
1044 int * nlid =
allocint (this_proj -> nspec);
1045 start = (types == 0 || types == 2) ? 0 : 1;
1046 end = (types == 1 || types == 2) ? 2 : 1;
1049 gboolean update_bar = FALSE;
1051 for (h=start; h<end; h++)
1053 for (i=0; i<this_proj -> nspec; i++) naid[i] = nlid[i] = 0;
1054 for (i=0; i<this_proj -> steps; i++)
1056 for (j=0; j<this_proj -> natomes; j++)
1058 k = this_proj ->
atoms[i][j].sp;
1060 if (this_proj ->
atoms[i][j].
label[h]) nlid[k] ++;
1063 if (h==types || (h == 0 && types == 2)) l = 0;
1064 for (i=0; i<this_proj -> nspec; i++)
1067 if (nlid[i] == naid[i])
1070 if (! this_proj -> modelgl -> anim -> last ->
img -> show_label[h][i]) update_bar = TRUE;
1072 if (! gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[h][i]))
1074 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[h][i], 1);
1077 this_proj -> modelgl -> anim -> last ->
img -> show_label[h][i] = TRUE;
1085 if (this_proj -> modelgl -> anim -> last ->
img -> show_label[h][i]) update_bar = TRUE;
1087 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[h][i]))
1089 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[h][i], 0);
1093 this_proj -> modelgl -> anim -> last ->
img -> show_label[h][i] = FALSE;
1095 if (h==types || (h == 0 && types == 2)) l += nlid[i];
1102 if (update_bar) update_menu_bar (this_proj -> modelgl);
1131 int id = GPOINTER_TO_INT (data);
1179 int h, i, j, k, l, m;
1180 int id = GPOINTER_TO_INT (data);
1259 int id = GPOINTER_TO_INT (data);
1263 j =
get_style ((
char *)gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
1344G_MODULE_EXPORT
void copy_the_atoms (GSimpleAction *
action, GVariant * parameter, gpointer data)
1625 k =
get_style ((
char *)gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
1714G_MODULE_EXPORT
void copy_the_coord (GSimpleAction *
action, GVariant * parameter, gpointer data)
1865 else if (
sel ->
a < 4)
1940 else if (
sel ->
a < 4)
1974 int shader[1] = {
SELEC};
2015 l =
get_style ((
char *)gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
2028 else if (
sel ->
a < 4)
2062 int * pos_sp, * specs;
2073 tmp = selection -> first;
2075 for (i=0; i<selection -> selected; i++)
2077 specs[tmp -> sp] ++;
2078 if (pos_sp[tmp -> sp] < 0)
2081 pos_sp[tmp -> sp] = j;
2083 if (tmp -> next != NULL) tmp = tmp -> next;
2086 for (i=0; i<
opengl_project -> nspec; i++)
if (specs[i] > 0) nspec ++;
2131 tmp = selection -> first;
2134 tmp = selection -> first;
2151 if (tmp -> next != NULL) tmp = tmp -> next;
2198 selected = g_malloc0 (
sizeof*selected);
2214 if (selected -> first)
2222 tmp_a = selected -> first;
2236 if (selected -> first)
2244 tmp_a = selected -> first;
2264G_MODULE_EXPORT
void edit_coord (GSimpleAction *
action, GVariant * parameter, gpointer data)
2283 selected = g_malloc0 (
sizeof*selected);
2304 if (selected -> first)
2312 tmp_a = selected -> first;
2314 selected -> selected ++;
2331G_MODULE_EXPORT
void edit_atoms (GSimpleAction *
action, GVariant * parameter, gpointer data)
2348 selected = g_malloc0 (
sizeof*selected);
2354 if (selected -> first)
2362 tmp_a = selected -> first;
2364 selected -> selected ++;
2394 int i = GPOINTER_TO_INT(data);
2397 g_debug (
"Action for All= %d", i);
2608 i = GPOINTER_TO_INT(data);
2765 int g, h, i, j, k, l, m, n, o;
2766 int mid = GPOINTER_TO_INT(data);
2770 gboolean eqtc, eqpc;
2958 GMenu * menu = g_menu_new ();
2960 gchar * word, * name, * str;
2961 gchar * eact = g_strdup_printf (
"mol-ins-%s-%d", act, aid);
2967 menus = g_menu_new ();
2973 append_opengl_item (view, menus,
mol[i].
object, eact, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
2978 gboolean doit = FALSE;
2990 GMenu * menup = g_menu_new ();
2992 eact = g_strdup_printf (
"ifp-%s-%d", act, aid);
2998 menups = g_menu_new ();
3001 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
3002 str = g_strdup_printf (
"%s-%d", eact, j);
3003 append_opengl_item (view, menups, word, str, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3008 g_object_unref (menups);
3014 g_object_unref (menup);
3016 eact = g_strdup_printf (
"cp-%s-%d", act, aid);
3017 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);
3035 GMenu * menu = g_menu_new ();
3036 gchar * actc = g_strdup_printf (
"%s-%d", act, aid);
3040 append_opengl_item (view, menu,
text_styles[i], actc, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3057 GtkWidget * menu = gtk_menu_new ();
3058 gtk_menu_item_set_submenu ((GtkMenuItem *)item, menu);
3064 gtk3_menu_item (menu,
text_styles[i],
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3118 GtkWidget * menu = gtk_menu_new ();
3119 GtkWidget * smenu, * pmenu;
3120 GtkWidget * titem, * sitem;
3121 gchar * word, * name;
3122 gtk_menu_item_set_submenu ((GtkMenuItem *)item, menu);
3127 if (
mol[i].type != NULL)
3130 gtk_menu_shell_append ((GtkMenuShell *)menu, titem);
3131 smenu = gtk_menu_new ();
3132 gtk_menu_item_set_submenu ((GtkMenuItem *)titem, smenu);
3134 if (
mol[i].
object != NULL)
3136 gtk3_menu_item (smenu,
mol[i].
object,
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3140 gboolean doit = FALSE;
3153 gtk_menu_shell_append ((GtkMenuShell *)menu, titem);
3154 smenu = gtk_menu_new ();
3155 gtk_menu_item_set_submenu ((GtkMenuItem *)titem, smenu);
3165 gtk_menu_shell_append ((GtkMenuShell *)smenu, sitem);
3166 pmenu = gtk_menu_new ();
3167 gtk_menu_item_set_submenu ((GtkMenuItem *)sitem, pmenu);
3170 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
3171 gtk3_menu_item (pmenu, word,
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3178 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);
3201void 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)
3203 gchar * actc = g_strdup_printf (
"%s-%d", act, aid);
3255 for (i=0; i < gid; i++)
3271 gtk_menu_item_set_submenu ((GtkMenuItem *)sel_item,
color_box(view, j+cid, k, cid));
3286 append_opengl_item (view, menu, str, actc, 1, 0, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3288 g_signal_connect (G_OBJECT (sel_item),
"activate", handler, data);
3298gchar *
mot[2][2]={{
"All Non-Selected Atom(s)/Bond(s)",
"All Selected Atom(s)/Bond(s)"},
3299 {
"All Non-Labelled Atom(s)/Bond(s)",
"All Labelled Atom(s)/Bond(s)"}};
3317GMenu *
selection_menu (
int aid,
glwin * view,
int ati,
int bti,
int aoc,
int mid, GCallback handler_a, GCallback handler_b, GCallback handler_c)
3333GtkWidget *
selection_menu (
glwin * view,
int ati,
int bti,
int aoc,
int mid, GCallback handler_a, GCallback handler_b, GCallback handler_c)
3336 int p = view ->
proj;
3337 int s = view -> anim -> last ->
img ->
step;
3344 GMenu * menu = g_menu_new ();
3347 GtkWidget * menu = gtk_menu_new ();
3350 spa = this_proj ->
atoms[s][ati].sp;
3351 if (bti > -1) spb = this_proj ->
atoms[s][bti].sp;
3352 if (bti < 0 && (((mid == 5 || mid == 6) && this_proj ->
atoms[s][ati].show[aoc])
3368 strb = g_strdup_printf (
"act-%d-%d", aid, mid);
3369 append_opengl_item (view, menu, str, strb, 1, 0, NULL,
IMG_NONE, NULL, FALSE, handler_a, GINT_TO_POINTER(ati), FALSE, FALSE, FALSE, TRUE);
3374 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3385 g_signal_connect (G_OBJECT (
sel),
"activate", handler_a, GINT_TO_POINTER(ati));
3389 else if (bti > -1 && mid != 4 && mid != 7)
3391 str = g_strdup_printf (
"This Bond: %s<sub>%d</sub> - %s<sub>%d</sub>",
3405 strb = g_strdup_printf (
"act-%d-%d", aid, mid);
3406 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);
3423 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3437 else if ((mid > 1 && mid < 4) && j==1)
3456 strb = g_strdup_printf (
"act-all-%d-%d", aid, mid+k);
3457 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);
3474 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3482 if (this_proj -> modelgl -> adv_bonding[i])
3485 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j+1) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j+1);
3487 create_selection_item (menu, view, str, (! i) ?
"afm" :
"amo", aid, mid, 2+i, j, aoc, handler_b, &
atoid[mid][2+i]);
3489 gtk_menu_shell_append ((GtkMenuShell *)menu,
create_selection_item (view, str, mid, 2+i, j, aoc, handler_b, &
atoid[mid][2+i]));
3496 if (this_proj ->
atoms[s][ati].coord[0] > -1)
3499 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]));
3501 create_selection_item (menu, view, str,
"atc", aid, mid, 0, i, aoc, handler_b, &
atoid[mid][0]);
3507 if (this_proj ->
atoms[s][ati].coord[1] > -1)
3510 str = g_strdup_printf (
"All <b>%s</b> Coordinations",
env_name (this_proj, i, spa, 1, NULL));
3512 create_selection_item (menu, view, str,
"apc", aid, mid, 1, i, aoc, handler_b, &
atoid[mid][1]);
3527 create_selection_item (menu, view, str,
"asp", aid, mid, 0, -1, aoc, handler_c, &
atoid[mid][2]);
3535 if (this_proj ->
atoms[s][ati].coord[0] > -1 && this_proj ->
atoms[s][bti].coord[0] > -1)
3539 str = g_strdup_printf (
"All %s <b>%d</b> - %s <b>%d</b> Bonds",
3543 create_selection_item (menu, view, str,
"atcb", aid, mid, -1, -1, aoc, G_CALLBACK(
select_action_for_all_bonds), GINT_TO_POINTER(mid+
CONTEXTACT));
3549 if (this_proj ->
atoms[s][ati].coord[1] > -1 && this_proj ->
atoms[s][bti].coord[1] > -1)
3553 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));
3555 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));
3563 create_selection_item (menu, view, str,
"acb", aid, mid, -1, -1, aoc, G_CALLBACK(
select_action_for_all_bonds), GINT_TO_POINTER(mid));
3569 if (mid > 3 && mid < 6)
3571 gchar * mat[2]={
"All Hidden Atom(s)/Bond(s)",
"All Visible Atom(s)/Bond(s)"};
3573 strb = g_strdup_printf (
"all-hv-%d-%d", aid, mid);
3574 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);
3577 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);
3598void analyze_popup_attach_color_palettes (
glwin * view, GtkWidget * menu,
int ato,
int spc,
int totc,
int parc,
int frag,
int mol)
3612 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, ato*this_proj -> nspec+spc, -1, -1),
"set-asp-7.7"))
3614 g_debug (
"Color palette error: species in selection - custom= set-asp-7.7");
3618 for (j=0;
j<spc;
j++)
3620 i += this_proj -> coord -> ntg[0][
j];
3622 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+i, -1, -1),
"set-atc-7.7"))
3624 g_debug (
"Color palette error: total coordination in selection - custom= set-atc-7.7");
3627 i = this_proj -> coord -> totcoord[0];
3628 for (j=0;
j<spc;
j++)
3630 i += this_proj -> coord -> ntg[1][
j];
3632 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+i, -1, -1),
"set-apc-7.7"))
3634 g_debug (
"Color palette error: partial coordination in selection - custom= set-apc-7.7");
3636 if (view -> adv_bonding[0])
3639 i = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] + frag;
3640 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i, 2, 0),
"set-afm-7.7"))
3642 g_debug (
"Color palette error: fragment in selection - custom= set-afm-7.7");
3645 if (view -> adv_bonding[1])
3648 i = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] + this_proj -> coord -> totcoord[2] +
mol;
3649 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i, 3, 0),
"set-amo-7.7"))
3651 g_debug (
"Color palette error: fragment in selection - custom= set-amo-7.7");
3673 int p = view ->
proj;
3674 int s = view -> anim -> last ->
img ->
step;
3676 gchar * str, * strp;
3677 gchar * menu_names[
CONTEXTACT] = {
"Select",
"Unselect",
"Label",
"Unlabel",
"Show",
"Hide",
"Style",
"Color",
"Edit as New Project",
"Remove",
"Replace",
"Copy"};
3691 if (view_pop_actions) g_object_unref (view_pop_actions);
3692 view_pop_actions = g_simple_action_group_new ();
3693 GMenu * gmenu = g_menu_new ();
3695 GtkWidget * menu = gtk_menu_new ();
3699 g_debug (
"POP_SEL:: spe= %d, ati= %d, bti= %d, aoc= %d", spe, ati, bti, aoc);
3711 if (
is_selected != spe) g_debug (
"Something is wrong in popup");
3720 atoid[i][j].
c = ((i-2*(i/2)) == 0 ? 1 : 0);
3735 str = g_strdup_printf (
"%s<sub>%d</sub> - %s<sub>%d</sub>",
3740 str = g_strdup_printf (
"%s<sub>%d</sub> - %s<sub>%d</sub>",
3745 strp = g_strdup_printf (
"<b>%s \t d= %.3f Ã… (PBC)</b>", str,
dist.length);
3749 strp = g_strdup_printf (
"<b>%s \t d= %.3f Ã…</b>", str,
dist.length);
3752 append_opengl_item (view, gmenu, strp,
"w-dist", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3755 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3760 if (view -> adv_bonding[i])
3763 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j);
3765 append_opengl_item (view, gmenu, str,
"w-dist-fm", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3768 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3785 append_opengl_item (view, gmenu, str,
"w-ac", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3788 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3791 str = g_strdup_printf (
"\tx : <b>%f</b>\n\ty : <b>%f</b>\n\tz : <b>%f</b>",
3794 append_opengl_item (view, gmenu, str,
"xyz", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3797 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3805 append_opengl_item (view, gmenu, str,
"w-tc", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3808 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3812 str = g_strdup_printf (
"Partial Coordination: <b>%s</b>",
3815 append_opengl_item (view, gmenu, str,
"w-pc", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3818 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3824 if (view -> adv_bonding[i])
3827 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j);
3829 append_opengl_item (view, gmenu, str,
"w-fm", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3832 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3852 GMenu * menua = g_menu_new ();
3853 g_menu_append_section (gmenu, NULL, (GMenuModel *)menua);
3859 for (i=0; i<12; i++)
3862 if (i < 9 && view -> mode ==
EDITION) go = FALSE;
3863 if ((i > 8 && i < 11) && view -> mode ==
ANALYZE) go = FALSE;
3864 if (i == 0 && view -> anim -> last ->
img -> selected[mmod] -> selected ==
opengl_project -> natomes) go = FALSE;
3865 if (i == 1 && view -> anim -> last ->
img -> selected[mmod] -> selected == 0) go = FALSE;
3867 if (i == 3 && view -> labelled == 0) go = FALSE;
3868 if (bti > -1 && i == 7) go = FALSE;
3869 j = (i == 8 && view -> mode ==
ANALYZE) ? 11 : (i == 11 && view -> mode ==
ANALYZE) ? 8 : i;
3873 append_submenu (menua, menu_names[j],
selection_menu (i, view, ati, bti, aoc, j, handlers[j][0], handlers[j][1], handlers[j][2]));
3875 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])));
3880 GtkWidget * menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)gmenu, GTK_POPOVER_MENU_NESTED);
3884 gtk_widget_set_parent (menu, view -> win);
3885 str = g_strdup_printf (
"gl-%d", view -> action_id);
3886 gtk_widget_insert_action_group (menu, str, G_ACTION_GROUP(view_pop_actions));
3889 i += (view -> adv_bonding[0] && bti < 0) ? 30 : 0;
3890 i += (view -> adv_bonding[1] && bti < 0) ? 30 : 0;
3891 if (bti > -1) i -= (view -> mode ==
ANALYZE) ? 70 : 50;
3892 gtk_widget_set_size_request (menu, -1, i);
3909G_MODULE_EXPORT
void reset_coords (GSimpleAction *
action, GVariant * parameter, gpointer data)
3926 view -> create_shaders[
MEASU] = TRUE;
3927 view -> create_shaders[
PICKS] = TRUE;
3942G_MODULE_EXPORT
void turn_rebuild (GSimpleAction *
action, GVariant * parameter, gpointer data)
3958 view -> rebuild[dat ->
b][0] = ! view -> rebuild[dat ->
b][0];
3959 view -> rebuild[dat ->
b][1] = view -> rebuild[dat ->
b][0];
3960 update_menu_bar (view);
3962 view -> rebuild[dat ->
b][0] = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
3963 view -> rebuild[dat ->
b][1] = view -> rebuild[dat ->
b][0];
3964 if (widg != view -> rbuild[dat ->
b])
3966 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> rbuild[dat ->
b], view -> rebuild[dat ->
b][0]);
3983 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);
3995GMenu * tools_section (
glwin * view)
3997 GMenu * menu = g_menu_new ();
4009GMenu * anim_section (
glwin * view)
4011 GMenu * menu = g_menu_new ();
4024void analyze_menu_attach_color_palettes (
glwin * view, GtkWidget * menu)
4042 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -1, -1, -1),
"set-box-color.0"))
4044 g_debug (
"Color palette error: box - custom= set-box-color.0");
4049 for (j=0;
j<this_proj -> nspec;
j++)
4051 str = g_strdup_printf (
"set-%s.%d", (! i) ?
"atom-color" :
"clone-color", j);
4052 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i*this_proj -> nspec+j, -1, -1), (
const gchar *)str))
4054 g_debug (
"Color palette error: %s - %d - custom= %s", (! i) ?
"atom-color" :
"clone-color", j+1, str);
4062 if (this_proj -> coord -> ntg[i])
4064 for (j=0;
j<this_proj -> nspec;
j++)
4066 for (k=0;
k<this_proj -> coord -> ntg[
i][
j];
k++)
4071 m += this_proj -> coord -> ntg[
i][
l];
4075 str = g_strdup_printf (
"set-%s-c.%d",
exact_name (
env_name (this_proj, k, j, 1, NULL)), m);
4079 str = g_strdup_printf (
"set-%d-c.%d", this_proj -> coord -> geolist[i][j][k], m);
4081 m += (
i) ? this_proj -> coord -> totcoord[0] : 0;
4082 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+m, -1, -1), (
const gchar *)str))
4084 g_debug (
"Color palette error: %s - spec= %d - coord= %d, custom= %s", (! i) ?
"total-coord" :
"partial-coord", j+1, k+1, str);
4094 for (j=0;
j<this_proj -> coord -> totcoord[
i];
j++)
4096 str = g_strdup_printf (
"set-%s-%d", (i == 2) ?
"fcol" :
"mcol", j);
4097 k = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] +
j;
4098 if (i == 3)
k += this_proj -> coord -> totcoord[2];
4099 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, k, i, 0), (
const gchar *)str))
4101 g_debug (
"Color palette error: %s - %d, custom= %s", (i == 2) ?
"fragment" :
"molecule", j+1, str);
4109 for (j=0;
j<this_proj -> coord -> totcoord[
i];
j++)
4111 str = g_strdup_printf (
"set-rcol-%d-%d", i, j);
4112 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -3, i-4, 0), (
const gchar *)str))
4114 g_debug (
"Color palette error: rings - %d - %d, custom= %s", i, j+1, str);
4120 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -2, -1, -1),
"set-back-color.0"))
4122 g_debug (
"Color palette error: background - custom= set-back-color.0");
4141 if (view_pop_actions) g_object_unref (view_pop_actions);
4142 view_pop_actions = g_simple_action_group_new ();
4143 GMenu * gmenu = g_menu_new ();
4152 g_menu_append_section (gmenu, NULL, (GMenuModel *)tools_section(view));
4153 g_menu_append_section (gmenu, NULL, (GMenuModel *)
menu_view(view, 1));
4154 g_menu_append_section (gmenu, NULL, (GMenuModel *)anim_section(view));
4158 g_menu_append_section (gmenu, NULL, (GMenuModel *)tools_section(view));
4161 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);
4163 g_menu_append_section (gmenu, NULL, (GMenuModel*)
menu_reset(view, 1));
4164 g_menu_append_section (gmenu, NULL, (GMenuModel*)
menu_fullscreen(view, 1));
4165 g_menu_append_section (gmenu, NULL, (GMenuModel*)
menu_shortcuts(view, 1));
4167 menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)gmenu, GTK_POPOVER_MENU_NESTED);
4168 if (view -> mode ==
ANALYZE) analyze_menu_attach_color_palettes (view, menu);
4170 gtk_popover_present ((GtkPopover *)menu);
4171 gchar * str = g_strdup_printf (
"gl-%d", view -> action_id);
4172 gtk_widget_insert_action_group (menu, str, G_ACTION_GROUP(view_pop_actions));
4174 gtk_widget_set_parent (menu, view -> win);
4175 gtk_widget_set_size_request (menu, -1, (view -> mode ==
ANALYZE) ? 742 : 242);
4178 menu = gtk_menu_new ();
4182 menu_items_opengl (menu, view, 1);
4189 gtk_menu_shell_append ((GtkMenuShell *)menu,
menu_box_axis (view, 1, 0));
4191 gtk_menu_shell_append ((GtkMenuShell *)menu,
menu_coord (view, 1));
4197 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);
4205 gtk_menu_shell_append ((GtkMenuShell *)menu,
menu_anim (view, 1));
4210 gtk_menu_item_set_submenu ((GtkMenuItem *)item,
menu_tools(view, 1));
4211 gtk_menu_shell_append ((GtkMenuShell *)menu, item);
4216 gtk_menu_shell_append ((GtkMenuShell *)menu, item);
4221 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]);
4222 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]);
4224 gtk3_menu_item (menu,
"Reset Motion",
IMG_STOCK, (gpointer)
MEDIA_LOOP, G_CALLBACK(
reset_coords), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
4227 gtk3_menu_item (menu,
"Reset View",
IMG_STOCK, (gpointer)
FITBEST, G_CALLBACK(
to_reset_view), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
4228 gtk3_menu_item (menu,
"Center Molecule",
IMG_STOCK, (gpointer)
FITBEST, G_CALLBACK(
to_center_this_molecule), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
4230 if (! view -> fullscreen)
4232 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);
4236 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);
4239 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)
create a GtkLabel with pango markup
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.