55extern G_MODULE_EXPORT
void coord_properties (GtkWidget * widg, gpointer data);
95 j += this_proj -> coord -> ntg[g][i];
99 g_debug (
"SHOW_HIDE_POLY:: p= %d, s= %d, c= %d, g= %d", this_proj ->
id, s,
c, g);
105 state = g_action_get_state (G_ACTION (
action));
106 show = ! g_variant_get_boolean (state);
107 const gchar * poly = g_action_get_name ((GAction *)
action);
108 int lgt = strlen (poly);
109 gchar * name = g_strdup_printf (
"%c%c", poly[lgt-2], poly[lgt-1]);
110 if (g_strcmp0(name,
".1") == 0)
113 name = g_strdup_printf (
"%.*s.0", lgt-2, poly);
114 g_action_group_activate_action ((GActionGroup *)this_proj -> modelgl -> action_group, (
const gchar *)name, NULL);
121 show = this_proj -> modelgl -> anim -> last ->
img -> show_poly[g][j];
124 show = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
132 if (widg != this_proj -> modelgl -> ogl_poly[i][g][j])
134 if (GTK_IS_WIDGET(this_proj -> modelgl -> ogl_poly[i][g][j]))
136 if (gtk_check_menu_item_get_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[i][g][j]) != show)
138 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_poly[i][g][j], show);
147 this_proj -> modelgl -> anim -> last ->
img -> show_poly[g][j] = show;
150 update (this_proj -> modelgl);
154 g_action_change_state (G_ACTION (
action), g_variant_new_boolean (show));
155 g_variant_unref (state);
171G_MODULE_EXPORT
void cloned_poly (GSimpleAction *
action, GVariant * parameter, gpointer data)
185 gboolean doit = TRUE;
188 const gchar * name = g_action_get_name ((GAction *)
action);
189 if (g_strcmp0(name,
"set-cloned-poly.1.1") == 0)
191 g_action_group_activate_action ((GActionGroup *)view -> action_group,
"set-cloned-poly.0.0", NULL);
199 state = g_action_get_state (G_ACTION (
action));
200 show = ! g_variant_get_boolean (state);
202 show = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
203 if (widg != view -> ogl_clones[5]) gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_clones[5], show);
210 g_action_change_state (G_ACTION (
action), g_variant_new_boolean (show));
211 g_variant_unref (state);
227GtkWidget * mpoly (
glwin * view,
int jd,
int id)
231 GtkWidget * menup = gtk_menu_new ();
236 gtk_menu_shell_append ((GtkMenuShell *)menup, pshow);
237 GtkWidget * menus = gtk_menu_new ();
238 gtk_menu_item_set_submenu ((GtkMenuItem *)pshow, menus);
239 j = (
id < 2) ? this_proj -> nspec : this_proj -> coord -> totcoord[
id];
244 if (GTK_IS_WIDGET(view -> oglmpv[jd][
id][i]))
246 widg = gtk_widget_get_parent (view -> oglmpv[jd][
id][i]);
247 if (GTK_IS_WIDGET(widg))
249 g_object_ref (view -> oglmpv[jd][
id][i]);
250 gtk_container_remove (GTK_CONTAINER(widg), view -> oglmpv[jd][
id][i]);
252 gtk_menu_shell_append ((GtkMenuShell *)menus, view -> oglmpv[jd][
id][i]);
257 if (GTK_IS_WIDGET(view -> ogl_poly[jd][
id][i]))
259 widg = gtk_widget_get_parent (view -> ogl_poly[jd][
id][i]);
260 if (GTK_IS_WIDGET(widg))
262 g_object_ref (view -> ogl_poly[jd][
id][i]);
263 gtk_container_remove (GTK_CONTAINER(widg), view -> ogl_poly[jd][
id][i]);
265 gtk_menu_shell_append ((GtkMenuShell *)menus, view -> ogl_poly[jd][
id][i]);
284GtkWidget *
menupoly (
glwin * view,
int jd,
int id, gchar * poln)
290 GtkWidget * menui = gtk_menu_new ();
295 if (view -> ring_max[i])
300 gtk_menu_item_set_submenu ((GtkMenuItem *)view -> ogl_rings[7+i], mpoly(view, jd, 4+i));
301 gtk_menu_shell_append ((GtkMenuShell *)menui, view -> ogl_rings[7+i]);
306 gtk_menu_shell_append ((GtkMenuShell *)menui, item);
307 gtk_menu_item_set_submenu ((GtkMenuItem *)item, mpoly(view, jd, 4+i));
317 gtk_menu_item_set_submenu ((GtkMenuItem *)poly, mpoly (view, jd,
id));
332 GtkWidget * menup = gtk_menu_new ();
333 gtk_menu_shell_append ((GtkMenuShell *)menup,
menupoly(view,
id, 0,
"Total Coordination(s)"));
334 gtk_menu_shell_append ((GtkMenuShell *)menup,
menupoly(view,
id, 1,
"Partial Coordination(s)"));
337 gtk_menu_shell_append ((GtkMenuShell *)menup, view -> ogl_rings[6]);
339 view -> ogl_clones[5] =
gtk3_menu_item (menup,
"Cloned Polyhedra",
IMG_NONE, NULL, G_CALLBACK(
cloned_poly), view, FALSE, 0, 0, TRUE, FALSE, view -> anim -> last ->
img ->
cloned_poly);
344 gtk_menu_item_set_submenu ((GtkMenuItem *)item,
menupoly(view,
id, 2, NULL));
345 gtk_menu_shell_append ((GtkMenuShell *)menup, item);
347 GtkWidget * cloned_p =
gtk3_menu_item (menup,
"Cloned Polyhedra",
IMG_NONE, NULL, G_CALLBACK(
cloned_poly), view, FALSE, 0, 0, TRUE, FALSE, view -> anim -> last ->
img ->
cloned_poly);
364 GMenu * menu = g_menu_new ();
367 gchar * stra, * strb;
369 for (i=0; i<this_proj -> nspec; i++)
372 menus = g_menu_new ();
373 if (this_proj -> coord)
375 if (this_proj -> coord -> ntg[
id])
379 j += this_proj -> coord -> ntg[id][k];
381 for (k=0; k < this_proj -> coord -> ntg[id][i]; k++)
389 stra = g_strdup_printf (
"%d", this_proj -> coord -> geolist[
id][i][k]);
391 strb = g_strdup_printf (
"%s-%d-p", stra,
id);
392 append_opengl_item (view, menus, stra, strb, popm, k+j, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
show_hide_poly), & view -> gcid[
id][k+j][
id],
393 TRUE, view -> anim -> last ->
img -> show_poly[
id][k+j], FALSE, TRUE);
400 g_object_unref (menus);
416 GMenu * menu = g_menu_new ();
418 if (this_proj -> coord)
421 gchar * stra, * strb;
422 for (i=0; i<this_proj -> coord -> totcoord[id]; i++)
424 stra = g_strdup_printf (
"%d", this_proj -> coord -> geolist[
id][0][i]);
425 strb = g_strdup_printf (
"%s-p", stra);
426 append_opengl_item (view, menu, stra, strb, popm, i, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
show_hide_poly), & view -> gcid[
id][i][
id],
427 TRUE, view -> anim -> last ->
img -> show_poly[
id][i], FALSE, TRUE);
446 GMenu * menu = g_menu_new ();
455 append_opengl_item (view, menu,
"Advanced",
"adv-p", popm, aid, NULL,
IMG_STOCK, (gpointer)
DPROPERTIES, FALSE,
470 GMenu * menu = g_menu_new ();
474 if (view -> ring_max[i])
492 GMenu * menu = g_menu_new ();
501 append_menu_item (menu,
"Ring(s)",
"None", NULL, NULL,
IMG_NONE, NULL, FALSE, FALSE, FALSE, NULL);
503 append_opengl_item (view, menu,
"Cloned Polyhedra",
"cloned-poly", popm, popm, NULL,
IMG_NONE, NULL, FALSE,
integer(kind=c_int) function chemistry()
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Global variable declarations Global convenience function declarations Global data structure defin...
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)
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 * add_advanced_item(GtkWidget *menu, GCallback handler, gpointer data, gboolean accel, guint key, GdkModifierType mod)
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 append_menu_item(GMenu *menu, const gchar *label, const gchar *action, const gchar *accel, const gchar *custom, int format, const gchar *icon, gboolean check, gboolean status, gboolean radio, const gchar *rstatus)
create a menu item, then append it to a menu
project * get_project_by_id(int p)
get project pointer using id number
void update(glwin *view)
update the rendering of the OpenGL window
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 ?
shaders
The different types of shaders in the atomes program.
GtkWidget * menupoly(glwin *view, int jd, int id, gchar *poln)
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)
gchar * env_name(project *this_proj, int g, int s, int f, GtkTextBuffer *buffer)
ouput the name of a coordination sphere
gchar * exact_name(gchar *name)
short cut to print string without spaces
Messaging function declarations.
G_MODULE_EXPORT void to_coord_properties(GSimpleAction *action, GVariant *parameter, gpointer data)
open advancedd coordination properties GTK4 callback
G_MODULE_EXPORT void show_hide_poly(GtkWidget *widg, gpointer data)
show / hide polyhedra callback - GTK3
G_MODULE_EXPORT void coord_properties(GtkWidget *widg, gpointer data)
create the environments configuration window
G_MODULE_EXPORT void cloned_poly(GtkWidget *widg, gpointer data)
cloned polyehdra callback - GTK3
GMenu * add_menu_poly(glwin *view, int popm, int aid)
create the 'Show/Hide' polyhedra subemnus - GTK4
GMenu * menu_poly_rings(glwin *view, int popm)
create the 'Polyhedra -> Ring(s)' submenu - GTK4
GMenu * menu_poly(glwin *view, int popm)
create the 'Chemistry -> Polyehdra' submenu - GTK4
GMenu * menu_show_coord_poly(glwin *view, int popm, int id)
create the 'Polyedra -> Coordination -> Show/Hide' submenus - GTK4
GMenu * menu_show_rings_poly(glwin *view, int popm, int id)
create the 'Rings(s) -> Show/Hide' subemnus - GTK4