72extern G_MODULE_EXPORT
void opengl_advanced (GtkWidget * widg, gpointer data);
73extern G_MODULE_EXPORT
void coord_properties (GtkWidget * widg, gpointer data);
74extern G_MODULE_EXPORT
void set_style (GtkWidget * widg, gpointer data);
75extern G_MODULE_EXPORT
void set_render (GtkWidget * widg, gpointer data);
76extern G_MODULE_EXPORT
void set_mode (GtkWidget * widg, gpointer data);
81extern gboolean
spin (gpointer data);
82extern G_MODULE_EXPORT
void spin_stop (GtkButton * but, gpointer data);
83extern G_MODULE_EXPORT
void spin_go (GtkWidget * widg, gpointer data);
86extern G_MODULE_EXPORT
void window_measures (GtkWidget * widg, gpointer data);
87extern G_MODULE_EXPORT
void window_recorder (GtkWidget * widg, gpointer data);
89extern GtkWidget *
menupoly (
glwin * view,
int jd,
int id, gchar * poln);
90extern G_MODULE_EXPORT
void set_color_map (GtkWidget * widg, gpointer data);
92extern void update_menu_bar (
glwin * view);
93extern G_MODULE_EXPORT
void set_full_screen (GSimpleAction *
action, GVariant * parameter, gpointer data);
94extern G_MODULE_EXPORT
void add_object (GSimpleAction *
action, GVariant * parameter, gpointer data);
99extern G_MODULE_EXPORT
void copy_the_atoms (GSimpleAction *
action, GVariant * parameter, gpointer data);
102extern G_MODULE_EXPORT
void set_full_screen (GtkWidget * widg, gpointer data);
103extern G_MODULE_EXPORT
void to_reset_view (GtkWidget * widg, gpointer data);
104extern G_MODULE_EXPORT
void add_object (GtkWidget * widg, gpointer data);
107extern G_MODULE_EXPORT
void remove_the_atoms (GtkWidget * widg, gpointer data);
108extern G_MODULE_EXPORT
void copy_the_atoms (GtkWidget * widg, gpointer data);
121 gchar * section_names[sections], gchar * group_names[
groups],
shortcuts shortcs[]);
127gchar *
opengl_group_names[]={
"Styles",
"Measures",
"Selection mode",
"Window management",
"Mouse mode",
128 "Camera rotation",
"Camera motion",
"Camera spin",
"Model interaction",
129 "Coordinates rotation",
"Coordinates translation",
"Model interaction"};
138 {
"Atom(s) color map",
"change atom(s) color map", GDK_KEY_a,
"a" },
139 {
"Polyhedra color map",
"change polyhedra color map", GDK_KEY_p,
"p" },
140 {
"Ball and stick",
"change global style to ball and stick", GDK_KEY_b,
"b" },
141 {
"Cylinders",
"change global style to cylinders", GDK_KEY_w,
"w" },
142 {
"Spheres",
"change global style to spheres", GDK_KEY_s,
"s" },
143 {
"Covalent radius",
"change global style to cylinders", GDK_KEY_o,
"o" },
144 {
"Ionic radius",
"change global style to cylinders", GDK_KEY_i,
"i" },
145 {
"Van der Waals radius",
"change global style to van der Waals radius", GDK_KEY_v,
"v" },
146 {
"In crystal radius",
"change global style to in crystal radius", GDK_KEY_r,
"r" },
147 {
"Wireframe",
"change global style to wireframe", GDK_KEY_w,
"w" },
149 {
"All measures for the selection, pressed:\n\n"
150 "\t- 1st time: show inter-atomic distance(s)\n"
151 "\t- 2nd time: show inter-atomic angles\n"
152 "\t- 3rd time: hide measures",
"Show measures", GDK_KEY_m,
"m" },
154 {
"Atom",
"atom selection mode", GDK_KEY_a,
"<Shift>a" },
155 {
"Coordination",
"coordination sphere selection mode", GDK_KEY_c,
"<Shift>c" },
156 {
"Fragment",
"fragment selection mode", GDK_KEY_f,
"<Shift>f" },
157 {
"Molecule",
"molecule selection mode", GDK_KEY_m,
"<Shift>m" },
159 {
"Environments",
"Environments window", GDK_KEY_e,
"<Ctrl>e" },
160 {
"Measures",
"Measures window", GDK_KEY_m,
"<Ctrl>m" },
161 {
"Recorder",
"Recorder window", GDK_KEY_r,
"<Ctrl>r" },
162 {
"Create new project",
"Create new project", GDK_KEY_n,
"<Ctrl>n" },
163 {
"Enter fullscreen",
"Enter fullscreen", GDK_KEY_f,
"<Ctrl>f" },
164 {
"Exit fullscreen",
"Exit fullscreen", GDK_KEY_Escape,
"Escape" },
167 {
"Analysis mode",
"Analysis mode", GDK_KEY_a,
"<Meta>a" },
168 {
"Edition mode",
"Edition mode", GDK_KEY_e,
"<Meta>e" },
170 {
"Analysis mode",
"Analysis mode", GDK_KEY_a,
"<Alt>a" },
171 {
"Edition mode",
"Edition mode", GDK_KEY_e,
"<Alt>e" },
176 {
"Rotate right",
"rotate right", GDK_KEY_Right,
"Right" },
177 {
"Rotate left",
"rotate left", GDK_KEY_Left,
"Left" },
178 {
"Rotate up",
"rotate up", GDK_KEY_Up,
"Up" },
179 {
"Rotate down",
"rotate down", GDK_KEY_Down,
"Down" },
181 {
"Move right",
"move camera right", GDK_KEY_Right,
"<Ctrl>Right" },
182 {
"Move left",
"move camera left", GDK_KEY_Left,
"<Ctrl>Left" },
183 {
"Move up",
"move camera up", GDK_KEY_Up,
"<Ctrl>Up" },
184 {
"Move down",
"move camera down", GDK_KEY_Down,
"<Ctrl>Down" },
185 {
"Zoom in",
"zoom camera in", GDK_KEY_Down,
"<Shift>Up" },
186 {
"Zoom out",
"zoom camera out", GDK_KEY_Down,
"<Shift>Down" },
188 {
"Spin right",
"rotate right", GDK_KEY_Right,
"<Ctrl><Shift>Right" },
189 {
"Spin left",
"rotate left", GDK_KEY_Left,
"<Ctrl><Shift>Left" },
190 {
"Spin up",
"rotate up", GDK_KEY_Up,
"<Ctrl><Shift>Up" },
191 {
"Spin down",
"rotate down", GDK_KEY_Down,
"<Ctrl><Shift>Down" },
192 {
"Pause / restart",
"pause / restart spinning", GDK_KEY_space,
"space" },
193 {
"Stop",
"stop spinning", GDK_KEY_s,
"<Ctrl>s" },
195 {
"Label / unlabel all atom(s)",
"Label / unlabel all atom(s)", GDK_KEY_l,
"<Ctrl>l" },
196 {
"Select / unselect all atom(s)",
"Select / unselect all atom(s)", GDK_KEY_a,
"<Ctrl>a" },
197 {
"Copy selection",
"Copy selection", GDK_KEY_c,
"<Ctrl>c" },
201 {
"Rotate right",
"rotate right", GDK_KEY_Right,
"Right" },
202 {
"Rotate left",
"rotate left", GDK_KEY_Left,
"Left" },
203 {
"Rotate up",
"rotate up", GDK_KEY_Up,
"Up" },
204 {
"Rotate down",
"rotate down", GDK_KEY_Down,
"Down" },
206 {
"Translate right",
"move camera right", GDK_KEY_Right,
"<Ctrl>Right" },
207 {
"Translate left",
"move camera left", GDK_KEY_Left,
"<Ctrl>Left" },
208 {
"Translate up",
"move camera up", GDK_KEY_Up,
"<Ctrl>Up" },
209 {
"Translate down",
"move camera down", GDK_KEY_Down,
"<Ctrl>Down" },
210 {
"Zoom in",
"zoom camera in", GDK_KEY_Up,
"<Shift>Up" },
211 {
"Zoom out",
"zoom camera out", GDK_KEY_Down,
"<Shift>Down" },
213 {
"Label / unlabel all atom(s)",
"Label / unlabel all atom(s)", GDK_KEY_l,
"<Ctrl>l" },
214 {
"Select / unselect all atom(s)",
"Select / unselect all atom(s)", GDK_KEY_a,
"<Ctrl>a" },
215 {
"Copy all selection",
"Copy selection", GDK_KEY_c,
"<Ctrl>c" },
216 {
"Cut selection",
"Cut selection", GDK_KEY_x,
"<Ctrl>x" },
217 {
"Paste selection",
"Paste selection", GDK_KEY_v,
"<Ctrl>v" },
218 {
"Delete selection",
"Delete selection", GDK_KEY_Delete,
"Delete" }
257 if (view -> ogl_poly[0][j] != NULL)
261 if (view -> ogl_poly[0][j][k] != NULL)
263 if (GTK_IS_WIDGET(view -> ogl_poly[0][j][k]))
265 widg = gtk_widget_get_parent (view -> ogl_poly[0][j][k]);
266 if (GTK_IS_WIDGET(widg))
268 g_object_ref (view -> ogl_poly[0][j][k]);
269 gtk_container_remove (GTK_CONTAINER(widg), view -> ogl_poly[0][j][k]);
276 if (view -> ogl_geom[0][j] != NULL)
280 if (view -> ogl_geom[0][j][k] != NULL)
282 if (GTK_IS_WIDGET(view -> ogl_geom[0][j][k]))
284 widg = gtk_widget_get_parent (view -> ogl_geom[0][j][k]);
285 if (GTK_IS_WIDGET(widg))
287 g_object_ref (view -> ogl_geom[0][j][k]);
288 gtk_container_remove (GTK_CONTAINER(widg), view -> ogl_geom[0][j][k]);
295 if (view -> ogl_chains[0]) view -> ogl_chains[0] =
destroy_this_widget (view -> ogl_chains[0]);
300 detach_frag_mol_menu (view, i, j);
316 GtkWidget * menu = gtk_menu_new ();
317 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> ogl_coord[1]);
318 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> ogl_coord[2]);
319 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> ogl_rings[0]);
320 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> ogl_chains[0]);
321 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> ogl_coord[3]);
322 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> ogl_coord[4]);
323 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);
341 i = view -> anim -> last ->
img -> style;
345 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_styles[j], FALSE);
348 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_styles[i], TRUE);
353 i = view -> anim -> last ->
img -> filled_type;
354 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> filled_styles[i], TRUE);
358 i = view -> anim -> last ->
img ->
render;
362 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_render[j], FALSE);
363 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_render[i], TRUE);
371 if (view -> anim -> last ->
img -> box_axis[i] ==
NONE)
373 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[i][0], FALSE);
378 j = (view -> anim -> last ->
img -> box_axis[i] ==
WIREFRAME) ? 1 : 2;
381 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[i][0], TRUE);
383 view -> anim -> last ->
img -> box_axis[i] = l;
384 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[i][j], TRUE);
388 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_rep[view -> anim -> last ->
img ->
rep], TRUE);
389 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_rep[! view -> anim -> last ->
img ->
rep], FALSE);
390 for (i=0; i<5; i++) gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][8+i], FALSE);
391 if (view -> anim -> last ->
img -> axispos !=
CUSTOM)
393 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][8+view -> anim -> last ->
img -> axispos], TRUE);
399 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_clones[0], view -> anim -> last ->
img -> draw_clones);
400 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_clones[5], view -> anim -> last ->
img ->
cloned_poly);
403 if (view -> color_styles[0])
405 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> color_styles[0], TRUE);
410 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> color_styles[
ATOM_MAPS], TRUE);
415 gtk_range_set_value (GTK_RANGE(view -> ogl_quality), view -> anim -> last ->
img -> quality);
417 update_menu_bar (view);
445G_MODULE_EXPORT
void view_shortcuts (GSimpleAction *
action, GVariant * parameter, gpointer data)
475void menu_items_opengl (GtkWidget * menu,
glwin * view,
int pop)
477 GtkWidget * style =
gtk3_menu_item (menu,
"Style",
IMG_FILE, (gpointer)
PACKAGE_MOL, NULL, NULL, FALSE, 0, 0, FALSE, FALSE,
get_project_by_id(view ->
proj) -> nspec);
478 gtk_menu_item_set_submenu ((GtkMenuItem *)style,
menu_style(view,
pop));
482 gtk3_menu_item (menu,
"Material And Light(s)",
IMG_NONE, NULL, G_CALLBACK(
opengl_advanced), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
483 gtk3_menu_item (menu,
"Render Image",
IMG_FILE, (gpointer)
PACKAGE_IMG, G_CALLBACK(
render_gl_image), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
494GtkWidget * menu_opengl (
glwin * view,
int pop)
496 GtkWidget * menu = gtk_menu_new ();
497 menu_items_opengl (menu, view,
pop);
510void menu_items_model (GtkWidget * menu,
glwin * view,
int pop)
517 gtk_menu_shell_append ((GtkMenuShell *)menu,
menu_box_axis (view, 0, 0));
529GtkWidget * menu_model (
glwin * view,
int pop)
531 GtkWidget * menu = gtk_menu_new ();
532 menu_items_model (menu, view,
pop);
554 gtk3_menu_item (menu,
"Reset view",
IMG_STOCK, (gpointer)
FITBEST, G_CALLBACK(
to_reset_view), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
555 gtk3_menu_item (menu,
"Center molecule",
IMG_STOCK, (gpointer)
FITBEST, G_CALLBACK(
to_center_this_molecule), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
557 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);
571 GtkWidget * menu = gtk_menu_new ();
584GtkWidget * menu_help (
glwin * view,
int popm)
587 menu = gtk_menu_new ();
588 gtk3_menu_item (menu,
"Shortcuts",
IMG_NONE, NULL, G_CALLBACK(
view_shortcuts), (gpointer)view, FALSE, 0, 0, FALSE, FALSE, FALSE);
607 view -> menu_bar = gtk_menu_bar_new ();
610 gtk_menu_shell_append ((GtkMenuShell *)view -> menu_bar,
menu_item_new_with_submenu (
"Model", this_proj -> nspec, menu_model(view, 0)));
612 gtk_menu_shell_append ((GtkMenuShell *)view -> menu_bar, view -> ogl_coord[0]);
614 if (this_proj -> nspec)
616 gtk_menu_item_set_submenu ((GtkMenuItem *)view -> ogl_coord[0],
coord_menu (view));
620 gtk_menu_shell_append ((GtkMenuShell *)view -> menu_bar,
menu_anim (view, 0));
625 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, view -> menu_box, view -> menu_bar, TRUE, TRUE, 0);
626 GtkWidget * menu = gtk_menu_bar_new ();
632 update_menu_bar (view);
648 if (view -> custom_map) i++;
649 if (view -> anim -> last ->
img -> color_map[
col] < i-1)
651 if (view -> anim -> last ->
img -> color_map[
col] < 2)
655 else if (view -> anim -> last ->
img -> color_map[
col] == 2 && view -> adv_bonding[0])
659 else if (view -> anim -> last ->
img -> color_map[
col] == 3 && view -> adv_bonding[1])
679 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> color_styles[j], TRUE);
682 gchar * variant = g_strdup_printf (
"set-%s.%d.0", (
col) ?
"pmap" :
"amap", j);
683 g_action_group_activate_action ((GActionGroup *)view -> action_group, (
col) ?
"set-pmap" :
"set-amap", g_variant_new_string((
const gchar *)variant));
703 if (state & GDK_CONTROL_MASK)
710 trans = vec3(view -> anim -> last ->
img -> p_depth*(
double) da / view -> pixels[
axis], 0.0, 0.0);
714 trans = vec3(0.0, view -> anim -> last ->
img -> p_depth*(
double) da / view -> pixels[
axis], 0.0);
720 else if (state & GDK_SHIFT_MASK)
726 view -> anim -> last ->
img -> c_shift[!
axis] += (double) da / view -> pixels[
axis];
727 if (view -> camera_widg[!
axis + 5])
729 if (GTK_IS_WIDGET(view -> camera_widg[!
axis + 5]))
731 gtk_spin_button_set_value ((GtkSpinButton *)view -> camera_widg[!
axis + 5], - view -> anim -> last ->
img -> c_shift[!
axis]);
737 else if ((state & GDK_SHIFT_MASK) && UpDown)
740 if (db == 3)
zoom (view, 1);
743 else if (state != GDK_SHIFT_MASK)
746 double cameraAngle[2] = {0.0, 0.0};
747 cameraAngle[
axis] = 0.5*da;
748 rotate_x_y (view, cameraAngle[0], cameraAngle[1]);
764 double gleft, gright, gbottom, gtop;
766 zoom *= (view -> anim -> last ->
img -> p_depth / view -> anim -> last ->
img -> gnear);
767 dw = view -> anim -> last ->
img -> c_shift[0]*2.0*
zoom;
768 dh = view -> anim -> last ->
img -> c_shift[1]*2.0*
zoom;
769 double aspect = (double)view -> pixels[0] / (
double)view -> pixels[1];
784 return m4_ortho (gleft, gright, gbottom, gtop, -view -> anim -> last ->
img -> gfar, view -> anim -> last ->
img -> gfar);
798 insert_pmv_matrix = m4_mul (
insert_projection (view), view -> model_view_matrix);
799 pos = vec3 (view -> mouseX, view -> mouseY, 0.75);
800 return v3_un_project (pos, view -> view_port, insert_pmv_matrix);
814 GVariant * action_state = g_variant_new_string (action_string);
815 g_action_group_activate_action ((GActionGroup *)view -> action_group,
action_name, action_state);
835 if (view -> fullscreen)
860 if (view ->
spin[0] || view ->
spin[1])
864 view ->
spin[i+2] = view ->
spin[i];
865 view -> spin_speed[i+2] = view -> spin_speed[i];
866 view ->
spin[i] = FALSE;
869 else if (view ->
spin[2] || view ->
spin[3])
873 view ->
spin[i] = view ->
spin[i+2];
874 view -> spin_speed[i] = view -> spin_speed[i+2];
876 view ->
spin[i+2] = FALSE;
877 view -> spin_speed[i+2] = 0;
888 if (view -> anim -> last ->
img -> selected[i] -> selected ==
opengl_project -> natomes)
907 else if (state & GDK_META_MASK)
909 else if (state & GDK_ALT_MASK)
912 else if (state & GDK_MOD1_MASK)
921 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_mode[0], TRUE);
940 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_smode[0], TRUE);
952 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_styles[
BALL_AND_STICK], TRUE);
961 if (state & GDK_CONTROL_MASK)
963 if (view -> anim -> last ->
img -> selected[0] -> selected)
968 view -> nth_copy = 1;
992 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_styles[
CYLINDERS], TRUE);
1006 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_smode[1], TRUE);
1018 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_styles[
PUNT], TRUE);
1026 if (state & GDK_CONTROL_MASK)
1032 else if (state & GDK_META_MASK)
1034 else if (state & GDK_ALT_MASK)
1037 else if (state & GDK_MOD1_MASK)
1046 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_mode[1], TRUE);
1068 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_smode[2], TRUE);
1080 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> filled_styles[1], TRUE);
1111 if (state & GDK_CONTROL_MASK)
1113 view -> anim -> last ->
img -> m_is_pressed = 0;
1116 else if (view -> anim -> last ->
img -> m_is_pressed < 2)
1118 view -> anim -> last ->
img -> m_is_pressed ++;
1122 view -> anim -> last ->
img -> m_is_pressed = 0;
1124 view -> create_shaders[
MEASU] = TRUE;
1136 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_smode[3], TRUE);
1151 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> filled_styles[0], TRUE);
1162 if (state & GDK_CONTROL_MASK)
1172 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> filled_styles[3], TRUE);
1183 if (state & GDK_CONTROL_MASK)
1193 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_styles[
SPHERES], TRUE);
1200 if (state & GDK_CONTROL_MASK)
1211 view -> nth_copy ++;
1230 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> filled_styles[2], TRUE);
1242 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_styles[
WIREFRAME], TRUE);
1252 if (view -> anim -> last ->
img -> selected[0] -> selected)
1293G_MODULE_EXPORT gboolean on_key_pressed (GtkWidget * widg, GdkEventKey * event, gpointer data)
1295 if (event -> type == GDK_KEY_PRESS)
1313G_MODULE_EXPORT gboolean
on_glwin_key_pressed (GtkEventControllerKey * self, guint keyval, guint keycode, GdkModifierType state, gpointer data)
1334 if (
pix[0] > 0 &&
pix[1] > 0)
1354void gtk_window_change_gdk_visual (GtkWidget * win)
1360 GdkScreen * screen = gdk_screen_get_default ();
1361 GList * visuals = gdk_screen_list_visuals (screen);
1363 GdkX11Screen* x11_screen = GDK_X11_SCREEN (screen);
1364 g_assert (x11_screen != NULL);
1365 Visual * default_xvisual = DefaultVisual (GDK_SCREEN_XDISPLAY(x11_screen), GDK_SCREEN_XNUMBER(x11_screen));
1366 GdkVisual * default_visual = NULL;
1368 while (visuals != NULL)
1370 GdkVisual * visual = GDK_X11_VISUAL (visuals -> data);
1371 if (default_xvisual -> visualid == gdk_x11_visual_get_xvisual(GDK_X11_VISUAL (visuals -> data)) -> visualid)
1374 default_visual = visual;
1377 visuals = visuals -> next;
1379 gtk_widget_set_visual (win, default_visual);
1388 if (! glXQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), NULL, NULL))
1390 g_warning (
"Sorry OpenGL is not supported !");
1396 if (this_proj -> modelgl)
1398 g_free (this_proj -> modelgl);
1399 this_proj -> modelgl = NULL;
1401 this_proj -> modelgl = g_malloc0 (
sizeof*this_proj -> modelgl);
1402 this_proj -> modelgl -> init = FALSE;
1403 this_proj -> modelgl ->
proj = this_proj -> id;
1404 GtkWidget * gl_vbox;
1407 gchar * str = g_strdup_printf (
"%s - 3D view - [%s mode]", this_proj -> name,
mode_name[0]);
1412 if (!
atomes_visual) gtk_window_change_gdk_visual (this_proj -> modelgl -> win);
1421 this_proj -> modelgl -> menu_box =
create_hbox (0);
1422 add_box_child_start (GTK_ORIENTATION_VERTICAL, gl_vbox, this_proj -> modelgl -> menu_box, FALSE, FALSE, 0);
1424 this_proj -> modelgl -> menu_bar = gtk_menu_bar_new ();
1425 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_proj -> modelgl -> menu_box, this_proj -> modelgl -> menu_bar, TRUE, TRUE, 0);
1429 this_proj -> modelgl ->
plot = gtk_gl_area_new ();
1430 gtk_widget_set_can_focus (this_proj -> modelgl ->
plot, TRUE);
1432 gtk_widget_set_focusable (this_proj -> modelgl ->
plot, TRUE);
1435 this_proj -> modelgl ->
plot = gtk_drawing_area_new ();
1437 gtk_widget_set_size_request (this_proj -> modelgl ->
plot, 100, 100);
1439 gtk_widget_set_double_buffered (this_proj -> modelgl ->
plot, FALSE);
1440 this_proj -> modelgl ->
glcontext = NULL;
1442 gtk_widget_set_hexpand (this_proj -> modelgl ->
plot, TRUE);
1443 gtk_widget_set_vexpand (this_proj -> modelgl ->
plot, TRUE);
1446 gtk_widget_add_events (GTK_WIDGET (this_proj -> modelgl ->
plot),
1448 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
1449 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
1452 gtk_widget_add_events (GTK_WIDGET (this_proj -> modelgl ->
plot),
1453 GDK_SMOOTH_SCROLL_MASK |
1454 GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
1455 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
1460 add_widget_gesture_and_key_action (this_proj -> modelgl -> win, NULL, NULL, NULL,
1465 add_widget_gesture_and_key_action (this_proj -> modelgl ->
plot,
"glwin-button-pressed", G_CALLBACK(
on_glwin_button_pressed), this_proj -> modelgl,
1473 add_widget_gesture_and_key_action (this_proj -> modelgl ->
plot,
"glwin-button-pressed", G_CALLBACK(
on_lib_button_pressed), this_proj -> modelgl,
1480 g_signal_connect (G_OBJECT (this_proj -> modelgl ->
plot),
"motion-notify-event", G_CALLBACK(on_motion), this_proj -> modelgl);
1481 g_signal_connect (G_OBJECT (this_proj -> modelgl ->
plot),
"button-release-event", G_CALLBACK(on_glwin_button_event), this_proj -> modelgl);
1484 g_signal_connect (G_OBJECT (this_proj -> modelgl ->
plot),
"button-press-event", G_CALLBACK(on_glwin_button_event), this_proj -> modelgl);
1485 g_signal_connect (G_OBJECT (this_proj -> modelgl ->
plot),
"scroll-event", G_CALLBACK(on_scrolled), this_proj -> modelgl);
1489 g_signal_connect (G_OBJECT (this_proj -> modelgl ->
plot),
"button-press-event", G_CALLBACK(on_lib_pressed), this_proj -> modelgl);
1496 g_signal_connect (G_OBJECT (this_proj -> modelgl -> win),
"key-press-event", G_CALLBACK(on_key_pressed), this_proj -> modelgl);
1498 g_signal_connect (G_OBJECT (this_proj -> modelgl -> win),
"realize", G_CALLBACK(
on_win_realize), this_proj -> modelgl);
1501 g_signal_connect (G_OBJECT (this_proj -> modelgl ->
plot),
"realize", G_CALLBACK(
on_realize), this_proj -> modelgl);
1503 g_signal_connect (G_OBJECT (this_proj -> modelgl ->
plot),
"render", G_CALLBACK(
on_expose), this_proj -> modelgl);
1505 g_signal_connect (G_OBJECT (this_proj -> modelgl ->
plot),
"draw", G_CALLBACK(
on_expose), this_proj -> modelgl);
1521 gboolean adv_bonding[2];
1522 if (this_proj -> modelgl == NULL)
1532 if (this_proj -> initgl)
1552 adv_bonding[0] = adv_bonding[1] = TRUE;
1554 if (
active_project -> natomes && adv_bonding[0] && adv_bonding[1])
1564 if (gtk_widget_get_visible(this_proj -> modelgl -> win))
GtkWidget * coord_menu(glwin *view)
void restore_color_map(glwin *view, int *colm)
restore saved color maps
int * save_color_map(glwin *view)
save atoms and polyhedra color maps
Variable declarations for the MD input preparation assistants.
integer function chains()
void update_insert_combos()
update some GtkComboBox in the workspace if a project is removed
Structure definitions for color management Function declarations for color management.
void init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
gboolean tmp_adv_bonding[2]
Global variable declarations Global convenience function declarations Global data structure defin...
void update_chains_menus(glwin *view)
#define ATOM_LIMIT
atom number limit to compute fragment(s) and molecule(s) analysis automatically
GtkWidget * gtk3_menu_item(GtkWidget *menu, gchar *name, int icon_format, gpointer item_icon, GCallback handler, gpointer data, gboolean accel, guint key, GdkModifierType mod, gboolean check, gboolean radio, gboolean status)
gboolean is_atom_win_active(glwin *view)
is the model edition window visible ?
void resize_this_window(GtkWidget *window, int x, int y)
resize this GtkWindow
GtkWidget * create_win(gchar *str, GtkWidget *parent, gboolean modal, gboolean resiz)
create a new GtkWindow
int get_widget_height(GtkWidget *widg)
retrive GtkWidget height
void opengl_project_changed(int id)
change the OpenGL project
G_MODULE_EXPORT gboolean hide_this_window(GtkWidget *win, GdkEvent *event, gpointer data)
hide a GtkWindow
void add_gtk_close_event(GtkWidget *widg, GCallback handler, gpointer data)
add a close event signal and callback to a GtkWidget
G_MODULE_EXPORT void on_calc_bonds_released(GtkWidget *widg, gpointer data)
compute bonding properties
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
GtkWidget * create_menu_item(gboolean add_mnemo, gchar *action)
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
void add_box_child_end(GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the end position.
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
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)
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
void update_rings_menus(glwin *view)
void show_the_widgets(GtkWidget *widg)
show GtkWidget
project * get_project_by_id(int p)
get project pointer using id number
G_MODULE_EXPORT void on_realize(GtkWidget *widg, gpointer data)
realize event for the OpenGL widget
G_MODULE_EXPORT void on_glwin_pointer_motion(GtkEventControllerMotion *motc, gdouble x, gdouble y, gpointer data)
handle mouse motion event in the OpenGL window GTK4
void update(glwin *view)
update the rendering of the OpenGL window
G_MODULE_EXPORT void on_lib_button_released(GtkGesture *gesture, int n_press, double x, double y, gpointer data)
handle mouse button release event on the molecular library OpenGL window (limited interaction)
void zoom(glwin *view, int delta)
zoom in or zoom out in the OpenGL window
G_MODULE_EXPORT void on_lib_button_pressed(GtkGesture *gesture, int n_press, double x, double y, gpointer data)
handle mouse button press event on the molecular library OpenGL window (limited interaction)
G_MODULE_EXPORT void on_glwin_button_released(GtkGesture *gesture, int n_press, double x, double y, gpointer data)
mouse button released signal on the OpenGL window
G_MODULE_EXPORT void on_glwin_button_pressed(GtkGesture *gesture, int n_press, double x, double y, gpointer data)
mouse button pressed signal on the OpenGL window
G_MODULE_EXPORT gboolean on_glwin_pointer_scoll(GtkEventControllerScroll *event, gdouble dx, gdouble dy, gpointer data)
handle mouse scroll event on the OpenGL window
G_MODULE_EXPORT gboolean on_expose(GtkWidget *widg, cairo_t *cr, gpointer data)
OpenGL rendering widget expose event callback GTK3.
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
#define ZOOM_MAX
Maximum value for the OpenGL zoom factor.
G_MODULE_EXPORT void to_center_this_molecule(GtkWidget *widg, gpointer data)
center this molecule menu item callback GTK4
#define REFRESH
Refresh time for spinning the OpenGL window in milliseconds.
#define DEFAULT_STYLE
Default OpenGL style: ball and stick.
void activate_glwin_action(gchar *action_string, gchar *action_name, glwin *view)
the keyboard shortcut actions for the OpenGL window
void set_sensitive_coord_menu(glwin *view, gboolean status)
void glwin_key_pressed(guint keyval, GdkModifierType state, gpointer data)
the keyboard shortcut actions for the OpenGL window
void set_color_map_sensitive(glwin *view)
void window_encode(glwin *view, gboolean video)
encoding a movie - creating the dialog
G_MODULE_EXPORT void coord_properties(GtkWidget *widg, gpointer data)
create the environments configuration window
G_MODULE_EXPORT void set_style(GtkWidget *widg, gpointer data)
set style callback
gchar * opengl_group_names[]
int get_selection_type(glwin *view)
get selection type
void save_rotation_quaternion(glwin *view)
save the rotation quaternion of the last image
gchar * opengl_section_names[]
G_MODULE_EXPORT void set_selection_mode(GtkWidget *widg, gpointer data)
set selection mode callback
int opengl_shortcut_by_group[]
void update_all_menus(glwin *view, int nats)
update all menus of the OpenGL window
void prep_model(int p)
prepare, or display, the OpenGL model window
G_MODULE_EXPORT void opengl_advanced(GtkWidget *widg, gpointer data)
create OpenGL rendering advanced window
G_MODULE_EXPORT gboolean on_glwin_key_pressed(GtkEventControllerKey *self, guint keyval, guint keycode, GdkModifierType state, gpointer data)
keyboard key press event for the OpenGL window GTK4
G_MODULE_EXPORT void spin_go(GtkWidget *widg, gpointer data)
void update_menus(glwin *view)
G_MODULE_EXPORT void set_box_axis_style(GtkWidget *widg, gpointer data)
G_MODULE_EXPORT void on_win_realize(GtkWidget *widg, gpointer data)
realize event for the OpenGL window
G_MODULE_EXPORT void set_render(GtkWidget *widg, gpointer data)
set OpenGL rendering mode callback
G_MODULE_EXPORT void set_full_screen(GtkWidget *widg, gpointer data)
set full screen callback GTK3
GtkWidget * shortcuts_window(int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups], gchar *section_names[sections], gchar *group_names[groups], shortcuts shortcs[])
Create the shortcuts information window.
G_MODULE_EXPORT void add_object(GtkWidget *widg, gpointer data)
add object call back GTK3
void prep_all_coord_menus(glwin *view)
G_MODULE_EXPORT void copy_the_atoms(GtkWidget *widg, gpointer data)
copy selected atom(s) callback GTK3
void prepare_opengl_menu_bar(glwin *view)
update the OpenGL window menu bar
G_MODULE_EXPORT void view_shortcuts(GtkWidget *widg, gpointer data)
OpenGL window shortcuts callback GTK3.
G_MODULE_EXPORT void label_unlabel_atoms(GtkWidget *widg, gpointer data)
label / unlabel a type of atom(s) callback GTK3
G_MODULE_EXPORT void window_recorder(GtkWidget *widg, gpointer data)
create video recorder window
void translate(project *this_proj, int status, int axis, vec3_t trans)
translate
gboolean spin(gpointer data)
spin
GtkWidget * menupoly(glwin *view, int jd, int id, gchar *poln)
G_MODULE_EXPORT void select_unselect_atoms(GtkWidget *widg, gpointer data)
select / unselect a type of atom(s) callback GTK3
void change_color_map(glwin *view, int col)
change atom / polyhedra color map
gboolean create_3d_model(int p, gboolean load)
G_MODULE_EXPORT void to_reset_view(GtkWidget *widg, gpointer data)
reset view callback - GTK3
shortcuts opengl_shortcuts[]
G_MODULE_EXPORT void window_measures(GtkWidget *widg, gpointer data)
create the measurements window
G_MODULE_EXPORT void render_gl_image(GtkWidget *widg, gpointer data)
render image from the OpenGL window
G_MODULE_EXPORT void set_mode(GtkWidget *widg, gpointer data)
set mouse mode callback
vec3_t get_insertion_coordinates(glwin *view)
get the insertion coordinates to insert object in the 3D window
G_MODULE_EXPORT void set_color_map(GtkWidget *widg, gpointer data)
set color map callback
G_MODULE_EXPORT void on_create_new_project(GtkWidget *widg, gpointer data)
create a new project
void rotate_x_y(glwin *view, double angle_x, double angle_y)
rotate the OpenGL camera
G_MODULE_EXPORT void edit_in_new_project(GtkWidget *widg, gpointer data)
create new project using selection callback GTK3
G_MODULE_EXPORT void spin_stop(GtkButton *but, gpointer data)
stop spin
atomic_object * copied_object
void set_motion(glwin *view, int axis, int da, int db, gboolean UpDown, GdkModifierType state)
handle keyboard motion event on the OpenGL window
mat4_t insert_projection(glwin *view)
calculate the insertion projection matrix to insert object in the 3D window
int opengl_group_by_section[]
G_MODULE_EXPORT void remove_the_atoms(GtkWidget *widg, gpointer data)
remove selected atom(s) callback GTK3
Function declarations to handle the atomic coordination data.
void set_advanced_bonding_menus(glwin *view)
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_back(glwin *view, int popm)
create the background color menu item GTK4
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 * menu_map(glwin *view, int popm)
create the 'OpenGL -> Color Scheme(s)' submenu - GTK4
G_MODULE_EXPORT void cloned_poly(GtkWidget *widg, gpointer data)
cloned polyehdra callback - GTK3
GMenu * menu_poly(glwin *view, int popm)
create the 'Chemistry -> Polyehdra' submenu - GTK4
GMenu * menu_proj(glwin *view, int popm)
create the 'View -> Projection' submenu - GTK4
GMenu * menu_quality(glwin *view, int popm)
create the 'OpenGL -> Quality' menu item - GTK4
GMenu * menu_render(glwin *view, int popm)
create the 'OpenGL -> Render' submenu - GTK4
GMenu * menu_rep(glwin *view, int popm)
create 'View -> Representation' submenu items - GTK4
GMenu * menu_view(glwin *view, int popm)
create the 'View' submenu - GTK4
GMenu * menu_style(glwin *view, int popm)
create the 'OpenGL -> Style' submenu - GTK4
Function declarations for reading atomes project file Function declarations for saving atomes proje...
void active_project_changed(int id)
change the active project
GtkWidget * prep_rings_menu(glwin *view, int id)