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);
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));
235 gtk_widget_hide (view -> menu_bar);
236 view -> fullscreen = TRUE;
240 gtk_window_unfullscreen (GTK_WINDOW(view -> win));
241 gtk_widget_show (view -> menu_bar);
242 view -> fullscreen = FALSE;
259 return (
int) atof ((
const gchar *)g_strdup_printf (
"%c", str[i-1]));
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)
1867 else if (
sel ->
a < 4)
1942 else if (
sel ->
a < 4)
1976 int shader[1] = {
SELEC};
2017 l =
get_style ((
char *)gtk_menu_item_get_label (GTK_MENU_ITEM(widg)));
2030 else if (
sel ->
a < 4)
2064 int * pos_sp, * specs;
2075 tmp = selection -> first;
2077 for (i=0; i<selection -> selected; i++)
2079 specs[tmp -> sp] ++;
2080 if (pos_sp[tmp -> sp] < 0)
2083 pos_sp[tmp -> sp] = j;
2085 if (tmp -> next != NULL) tmp = tmp -> next;
2088 for (i=0; i<
opengl_project -> nspec; i++)
if (specs[i] > 0) nspec ++;
2133 tmp = selection -> first;
2136 tmp = selection -> first;
2153 if (tmp -> next != NULL) tmp = tmp -> next;
2200 selected = g_malloc0 (
sizeof*selected);
2216 if (selected -> first)
2224 tmp_a = selected -> first;
2238 if (selected -> first)
2246 tmp_a = selected -> first;
2266G_MODULE_EXPORT
void edit_coord (GSimpleAction *
action, GVariant * parameter, gpointer data)
2285 selected = g_malloc0 (
sizeof*selected);
2306 if (selected -> first)
2314 tmp_a = selected -> first;
2316 selected -> selected ++;
2333G_MODULE_EXPORT
void edit_atoms (GSimpleAction *
action, GVariant * parameter, gpointer data)
2350 selected = g_malloc0 (
sizeof*selected);
2356 if (selected -> first)
2364 tmp_a = selected -> first;
2366 selected -> selected ++;
2396 int i = GPOINTER_TO_INT(data);
2399 g_debug (
"Action for All= %d", i);
2604 i = GPOINTER_TO_INT(data);
2761 int g, h, i, j, k, l, m, n, o;
2762 int mid = GPOINTER_TO_INT(data);
2766 gboolean eqtc, eqpc;
2954 GMenu * menu = g_menu_new ();
2956 gchar * word, * name, * str;
2957 gchar * eact = g_strdup_printf (
"mol-ins-%s-%d", act, aid);
2963 menus = g_menu_new ();
2969 append_opengl_item (view, menus,
mol[i].
object, eact, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
2974 gboolean doit = FALSE;
2986 GMenu * menup = g_menu_new ();
2988 eact = g_strdup_printf (
"ifp-%s-%d", act, aid);
2994 menups = g_menu_new ();
2997 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
2998 str = g_strdup_printf (
"%s-%d", eact, j);
2999 append_opengl_item (view, menups, word, str, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3004 g_object_unref (menups);
3010 g_object_unref (menup);
3012 eact = g_strdup_printf (
"cp-%s-%d", act, aid);
3013 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);
3031 GMenu * menu = g_menu_new ();
3032 gchar * actc = g_strdup_printf (
"%s-%d", act, aid);
3036 append_opengl_item (view, menu,
text_styles[i], actc, 1, i, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3053 GtkWidget * menu = gtk_menu_new ();
3054 gtk_menu_item_set_submenu ((GtkMenuItem *)item, menu);
3060 gtk3_menu_item (menu,
text_styles[i],
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3114 GtkWidget * menu = gtk_menu_new ();
3115 GtkWidget * smenu, * pmenu;
3116 GtkWidget * titem, * sitem;
3117 gchar * word, * name;
3118 gtk_menu_item_set_submenu ((GtkMenuItem *)item, menu);
3123 if (
mol[i].type != NULL)
3126 gtk_menu_shell_append ((GtkMenuShell *)menu, titem);
3127 smenu = gtk_menu_new ();
3128 gtk_menu_item_set_submenu ((GtkMenuItem *)titem, smenu);
3130 if (
mol[i].
object != NULL)
3132 gtk3_menu_item (smenu,
mol[i].
object,
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3136 gboolean doit = FALSE;
3149 gtk_menu_shell_append ((GtkMenuShell *)menu, titem);
3150 smenu = gtk_menu_new ();
3151 gtk_menu_item_set_submenu ((GtkMenuItem *)titem, smenu);
3161 gtk_menu_shell_append ((GtkMenuShell *)smenu, sitem);
3162 pmenu = gtk_menu_new ();
3163 gtk_menu_item_set_submenu ((GtkMenuItem *)sitem, pmenu);
3166 word = g_strdup_printf (
"%s in %s",
action_atoms[j], name);
3167 gtk3_menu_item (pmenu, word,
IMG_NONE, NULL, handler, data, FALSE, 0, 0, FALSE, FALSE, FALSE);
3174 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);
3197void 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)
3199 gchar * actc = g_strdup_printf (
"%s-%d", act, aid);
3251 for (i=0; i < gid; i++)
3267 gtk_menu_item_set_submenu ((GtkMenuItem *)sel_item,
color_box(view, j+cid, k, cid));
3282 append_opengl_item (view, menu, str, actc, 1, 0, NULL,
IMG_NONE, NULL, FALSE, handler, data, FALSE, FALSE, FALSE, TRUE);
3284 g_signal_connect (G_OBJECT (sel_item),
"activate", handler, data);
3294gchar *
mot[2][2]={{
"All Non-Selected Atom(s)/Bond(s)",
"All Selected Atom(s)/Bond(s)"},
3295 {
"All Non-Labelled Atom(s)/Bond(s)",
"All Labelled Atom(s)/Bond(s)"}};
3313GMenu *
selection_menu (
int aid,
glwin * view,
int ati,
int bti,
int aoc,
int mid, GCallback handler_a, GCallback handler_b, GCallback handler_c)
3329GtkWidget *
selection_menu (
glwin * view,
int ati,
int bti,
int aoc,
int mid, GCallback handler_a, GCallback handler_b, GCallback handler_c)
3332 int p = view ->
proj;
3333 int s = view -> anim -> last ->
img ->
step;
3340 GMenu * menu = g_menu_new ();
3343 GtkWidget * menu = gtk_menu_new ();
3346 spa = this_proj ->
atoms[s][ati].sp;
3347 if (bti > -1) spb = this_proj ->
atoms[s][bti].sp;
3348 if (bti < 0 && (((mid == 5 || mid == 6) && this_proj ->
atoms[s][ati].show[aoc])
3364 strb = g_strdup_printf (
"act-%d-%d", aid, mid);
3365 append_opengl_item (view, menu, str, strb, 1, 0, NULL,
IMG_NONE, NULL, FALSE, handler_a, GINT_TO_POINTER(ati), FALSE, FALSE, FALSE, TRUE);
3370 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3381 g_signal_connect (G_OBJECT (
sel),
"activate", handler_a, GINT_TO_POINTER(ati));
3385 else if (bti > -1 && mid != 4 && mid != 7)
3387 str = g_strdup_printf (
"This Bond: %s<sub>%d</sub> - %s<sub>%d</sub>",
3401 strb = g_strdup_printf (
"act-%d-%d", aid, mid);
3402 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);
3419 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3433 else if ((mid > 1 && mid < 4) && j==1)
3452 strb = g_strdup_printf (
"act-all-%d-%d", aid, mid+k);
3453 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);
3470 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3478 if (this_proj -> modelgl -> adv_bonding[i])
3481 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j+1) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j+1);
3483 create_selection_item (menu, view, str, (! i) ?
"afm" :
"amo", aid, mid, 2+i, j, aoc, handler_b, &
atoid[mid][2+i]);
3485 gtk_menu_shell_append ((GtkMenuShell *)menu,
create_selection_item (view, str, mid, 2+i, j, aoc, handler_b, &
atoid[mid][2+i]));
3492 if (this_proj ->
atoms[s][ati].coord[0] > -1)
3495 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]));
3497 create_selection_item (menu, view, str,
"atc", aid, mid, 0, i, aoc, handler_b, &
atoid[mid][0]);
3503 if (this_proj ->
atoms[s][ati].coord[1] > -1)
3506 str = g_strdup_printf (
"All <b>%s</b> Coordinations",
env_name (this_proj, i, spa, 1, NULL));
3508 create_selection_item (menu, view, str,
"apc", aid, mid, 1, i, aoc, handler_b, &
atoid[mid][1]);
3523 create_selection_item (menu, view, str,
"asp", aid, mid, 0, -1, aoc, handler_c, &
atoid[mid][2]);
3531 if (this_proj ->
atoms[s][ati].coord[0] > -1 && this_proj ->
atoms[s][bti].coord[0] > -1)
3535 str = g_strdup_printf (
"All %s <b>%d</b> - %s <b>%d</b> Bonds",
3539 create_selection_item (menu, view, str,
"atcb", aid, mid, -1, -1, aoc, G_CALLBACK(
select_action_for_all_bonds), GINT_TO_POINTER(mid+
CONTEXTACT));
3545 if (this_proj ->
atoms[s][ati].coord[1] > -1 && this_proj ->
atoms[s][bti].coord[1] > -1)
3549 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));
3551 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));
3559 create_selection_item (menu, view, str,
"acb", aid, mid, -1, -1, aoc, G_CALLBACK(
select_action_for_all_bonds), GINT_TO_POINTER(mid));
3565 if (mid > 3 && mid < 6)
3567 gchar * mat[2]={
"All Hidden Atom(s)/Bond(s)",
"All Visible Atom(s)/Bond(s)"};
3569 strb = g_strdup_printf (
"all-hv-%d-%d", aid, mid);
3570 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);
3573 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);
3594void analyze_popup_attach_color_palettes (
glwin * view, GtkWidget * menu,
int ato,
int spc,
int totc,
int parc,
int frag,
int mol)
3608 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, ato*this_proj -> nspec+spc, -1, -1),
"set-asp-7.7"))
3610 g_debug (
"Color palette error: species in selection - custom= set-asp-7.7");
3614 for (j=0;
j<spc;
j++)
3616 i += this_proj -> coord -> ntg[0][
j];
3618 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+i, -1, -1),
"set-atc-7.7"))
3620 g_debug (
"Color palette error: total coordination in selection - custom= set-atc-7.7");
3623 i = this_proj -> coord -> totcoord[0];
3624 for (j=0;
j<spc;
j++)
3626 i += this_proj -> coord -> ntg[1][
j];
3628 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+i, -1, -1),
"set-apc-7.7"))
3630 g_debug (
"Color palette error: partial coordination in selection - custom= set-apc-7.7");
3632 if (view -> adv_bonding[0])
3635 i = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] + frag;
3636 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i, 2, 0),
"set-afm-7.7"))
3638 g_debug (
"Color palette error: fragment in selection - custom= set-afm-7.7");
3641 if (view -> adv_bonding[1])
3644 i = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] + this_proj -> coord -> totcoord[2] +
mol;
3645 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i, 3, 0),
"set-amo-7.7"))
3647 g_debug (
"Color palette error: fragment in selection - custom= set-amo-7.7");
3669 int p = view ->
proj;
3670 int s = view -> anim -> last ->
img ->
step;
3672 gchar * str, * strp;
3673 gchar * menu_names[
CONTEXTACT] = {
"Select",
"Unselect",
"Label",
"Unlabel",
"Show",
"Hide",
"Style",
"Color",
"Edit as New Project",
"Remove",
"Replace",
"Copy"};
3687 if (view_pop_actions) g_object_unref (view_pop_actions);
3688 view_pop_actions = g_simple_action_group_new ();
3689 GMenu * gmenu = g_menu_new ();
3691 GtkWidget * menu = gtk_menu_new ();
3695 g_debug (
"POP_SEL:: spe= %d, ati= %d, bti= %d, aoc= %d", spe, ati, bti, aoc);
3707 if (
is_selected != spe) g_debug (
"Something is wrong in popup");
3716 atoid[i][j].
c = ((i-2*(i/2)) == 0 ? 1 : 0);
3731 str = g_strdup_printf (
"%s<sub>%d</sub> - %s<sub>%d</sub>",
3736 str = g_strdup_printf (
"%s<sub>%d</sub> - %s<sub>%d</sub>",
3741 strp = g_strdup_printf (
"<b>%s \t d= %.3f Ã… (PBC)</b>", str,
dist.length);
3745 strp = g_strdup_printf (
"<b>%s \t d= %.3f Ã…</b>", str,
dist.length);
3748 append_opengl_item (view, gmenu, strp,
"w-dist", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3751 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3756 if (view -> adv_bonding[i])
3759 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j);
3761 append_opengl_item (view, gmenu, str,
"w-dist-fm", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3764 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3781 append_opengl_item (view, gmenu, str,
"w-ac", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3784 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3787 str = g_strdup_printf (
"\tx : <b>%f</b>\n\ty : <b>%f</b>\n\tz : <b>%f</b>",
3790 append_opengl_item (view, gmenu, str,
"xyz", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3793 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3801 append_opengl_item (view, gmenu, str,
"w-tc", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3804 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3808 str = g_strdup_printf (
"Partial Coordination: <b>%s</b>",
3811 append_opengl_item (view, gmenu, str,
"w-pc", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3814 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3820 if (view -> adv_bonding[i])
3823 str = (! i) ? g_strdup_printf (
"Fragment N°:\t<b>%d</b>", j) : g_strdup_printf (
"Molecule N°:\t<b>%d</b>", j);
3825 append_opengl_item (view, gmenu, str,
"w-fm", 1, 0, NULL,
IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
3828 gtk_menu_shell_append ((GtkMenuShell *)menu,
sel);
3848 GMenu * menua = g_menu_new ();
3849 g_menu_append_section (gmenu, NULL, (GMenuModel *)menua);
3855 for (i=0; i<12; i++)
3858 if (i < 9 && view -> mode ==
EDITION) go = FALSE;
3859 if ((i > 8 && i < 11) && view -> mode ==
ANALYZE) go = FALSE;
3860 if (i == 0 && view -> anim -> last ->
img -> selected[mmod] -> selected ==
opengl_project -> natomes) go = FALSE;
3861 if (i == 1 && view -> anim -> last ->
img -> selected[mmod] -> selected == 0) go = FALSE;
3863 if (i == 3 && view -> labelled == 0) go = FALSE;
3864 if (bti > -1 && i == 7) go = FALSE;
3865 j = (i == 8 && view -> mode ==
ANALYZE) ? 11 : (i == 11 && view -> mode ==
ANALYZE) ? 8 : i;
3869 append_submenu (menua, menu_names[j],
selection_menu (i, view, ati, bti, aoc, j, handlers[j][0], handlers[j][1], handlers[j][2]));
3871 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])));
3876 GtkWidget * menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)gmenu, GTK_POPOVER_MENU_NESTED);
3880 gtk_widget_set_parent (menu, view -> win);
3881 str = g_strdup_printf (
"gl-%d", view -> action_id);
3882 gtk_widget_insert_action_group (menu, str, G_ACTION_GROUP(view_pop_actions));
3885 i += (view -> adv_bonding[0] && bti < 0) ? 30 : 0;
3886 i += (view -> adv_bonding[1] && bti < 0) ? 30 : 0;
3887 if (bti > -1) i -= (view -> mode ==
ANALYZE) ? 70 : 50;
3888 gtk_widget_set_size_request (menu, -1, i);
3905G_MODULE_EXPORT
void reset_coords (GSimpleAction *
action, GVariant * parameter, gpointer data)
3922 view -> create_shaders[
MEASU] = TRUE;
3923 view -> create_shaders[
PICKS] = TRUE;
3938G_MODULE_EXPORT
void turn_rebuild (GSimpleAction *
action, GVariant * parameter, gpointer data)
3954 view -> rebuild[dat ->
b][0] = ! view -> rebuild[dat ->
b][0];
3955 view -> rebuild[dat ->
b][1] = view -> rebuild[dat ->
b][0];
3956 update_menu_bar (view);
3958 view -> rebuild[dat ->
b][0] = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
3959 view -> rebuild[dat ->
b][1] = view -> rebuild[dat ->
b][0];
3960 if (widg != view -> rbuild[dat ->
b])
3962 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> rbuild[dat ->
b], view -> rebuild[dat ->
b][0]);
3979 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);
3991GMenu * tools_section (
glwin * view)
3993 GMenu * menu = g_menu_new ();
4005GMenu * anim_section (
glwin * view)
4007 GMenu * menu = g_menu_new ();
4020void analyze_menu_attach_color_palettes (
glwin * view, GtkWidget * menu)
4038 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -1, -1, -1),
"set-box-color.0"))
4040 g_debug (
"Color palette error: box - custom= set-box-color.0");
4045 for (j=0;
j<this_proj -> nspec;
j++)
4047 str = g_strdup_printf (
"set-%s.%d", (! i) ?
"atom-color" :
"clone-color",
j);
4048 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, i*this_proj -> nspec+j, -1, -1), (
const gchar *)str))
4050 g_debug (
"Color palette error: %s - %d - custom= %s", (! i) ?
"atom-color" :
"clone-color",
j+1, str);
4058 if (this_proj -> coord -> ntg[i])
4060 for (j=0;
j<this_proj -> nspec;
j++)
4062 for (k=0;
k<this_proj -> coord -> ntg[
i][
j];
k++)
4067 m += this_proj -> coord -> ntg[
i][
l];
4071 str = g_strdup_printf (
"set-%s-c.%d",
exact_name (
env_name (this_proj, k, j, 1, NULL)), m);
4075 str = g_strdup_printf (
"set-%d-c.%d", this_proj -> coord -> geolist[i][j][k], m);
4077 m += (
i) ? this_proj -> coord -> totcoord[0] : 0;
4078 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, 2*this_proj -> nspec+m, -1, -1), (
const gchar *)str))
4080 g_debug (
"Color palette error: %s - spec= %d - coord= %d, custom= %s", (! i) ?
"total-coord" :
"partial-coord",
j+1,
k+1, str);
4090 for (j=0;
j<this_proj -> coord -> totcoord[
i];
j++)
4092 str = g_strdup_printf (
"set-%s-%d", (i == 2) ?
"fcol" :
"mcol",
j);
4093 k = 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1] +
j;
4094 if (i == 3)
k += this_proj -> coord -> totcoord[2];
4095 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, k, i, 0), (
const gchar *)str))
4097 g_debug (
"Color palette error: %s - %d, custom= %s", (i == 2) ?
"fragment" :
"molecule",
j+1, str);
4105 for (j=0;
j<this_proj -> coord -> totcoord[
i];
j++)
4107 str = g_strdup_printf (
"set-rcol-%d-%d", i, j);
4108 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -3, i-4, 0), (
const gchar *)str))
4110 g_debug (
"Color palette error: rings - %d - %d, custom= %s", i, j+1, str);
4116 if (! gtk_popover_menu_add_child ((GtkPopoverMenu *)menu, color_palette (view, -2, -1, -1),
"set-back-color.0"))
4118 g_debug (
"Color palette error: background - custom= set-back-color.0");
4137 if (view_pop_actions) g_object_unref (view_pop_actions);
4138 view_pop_actions = g_simple_action_group_new ();
4139 GMenu * gmenu = g_menu_new ();
4148 g_menu_append_section (gmenu, NULL, (GMenuModel *)tools_section(view));
4149 g_menu_append_section (gmenu, NULL, (GMenuModel *)
menu_view(view, 1));
4150 g_menu_append_section (gmenu, NULL, (GMenuModel *)anim_section(view));
4154 g_menu_append_section (gmenu, NULL, (GMenuModel *)tools_section(view));
4157 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);
4159 g_menu_append_section (gmenu, NULL, (GMenuModel*)
menu_reset(view, 1));
4160 g_menu_append_section (gmenu, NULL, (GMenuModel*)
menu_fullscreen(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);
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
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 add_menu_separator(GtkWidget *menu)
GtkWidget * menu_item_new_with_submenu(gchar *name, gboolean active, GtkWidget *sub_menu)
atomic_object * copied_object
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.