79 for (i=0; i < this_proj -> nspec; i++)
84 str = g_strdup_printf (
"%s [ %f Å ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> sphererad[i]);
87 str = g_strdup_printf (
"%s [ %f pts ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> pointrad[i]);
90 str = g_strdup_printf (
"%s [ %f pts ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> sphererad[i+this_proj -> nspec]);
93 str = g_strdup_printf (
"%s [ %f pts ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> pointrad[i+this_proj -> nspec]);
96 str = g_strdup_printf (
"%s [ %f Å ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> atomicrad[i]);
101 mot = g_strdup_printf (
"%s", str);
105 tmp = g_strdup_printf (
"%s",
mot);
107 mot = g_strdup_printf (
"%s\n%s", tmp, str);
116extern G_MODULE_EXPORT
void set_show_hide_all_atom_labels (GtkWidget * widg, gpointer data);
117extern G_MODULE_EXPORT
void atom_properties (GtkWidget * widg, gpointer data);
130 int j = the_data ->
b;
131 int k = the_data ->
c;
134 gboolean
v = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
135 if (widg != this_proj -> modelgl -> ogl_spec[j][k])
137 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[j][k], v);
139 for (l=0;
l<this_proj -> steps;
l++)
141 for (m=0;
m<this_proj -> natomes;
m++)
143 if (this_proj ->
atoms[l][m].sp == k) this_proj ->
atoms[
l][
m].show[
j] =
v;
146 this_proj -> modelgl -> anim -> last ->
img -> show_atom[
j][
k] =
v;
165 gboolean
v = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
166 if (widg != this_proj -> modelgl -> ogl_lab[j][k])
168 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[j][k], v);
170 for (l=0;
l<this_proj -> steps;
l++)
172 for (m=0;
m<this_proj -> natomes;
m++)
174 if (this_proj ->
atoms[l][m].sp == k)
184 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
185 update (this_proj -> modelgl);
201 gboolean show = TRUE;
203 for (k=0;
k<this_proj -> nspec;
k++)
205 if (
plot -> show_label[j][k]) show = FALSE;
207 for (k=0;
k<this_proj -> nspec;
k++)
209 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[j][k], show);
225GtkWidget * create_spec_menu (
char * name, gboolean va, gboolean vb, GtkWidget * menu, GCallback handler,
tint * data)
227 GtkWidget * spec_widget =
gtk3_menu_item (menu, name,
IMG_NONE, NULL, handler, data, FALSE, 0, 0, TRUE, FALSE, va);
241GtkWidget * create_atom_layout_widget (gchar * str, GtkWidget * widg,
tint * data)
243 GtkWidget * menu = gtk_menu_new ();
244 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menu);
246 gtk_menu_shell_append ((GtkMenuShell *)menu,
layout);
262 GtkWidget * mshow = gtk_menu_new ();
264 gboolean sensitive = (! at) ? TRUE : view -> anim -> last ->
img -> draw_clones;
268 view -> ogl_spec[at] = g_malloc (this_proj -> nspec*
sizeof*view -> ogl_spec[at]);
271 for (i=0;
i< this_proj -> nspec;
i++)
279 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
283 view -> ogl_spec[at][
i] = create_spec_menu (str,
284 view -> anim -> last ->
img -> show_atom[at][i],
293 create_spec_menu (str, view -> anim -> last ->
img -> show_atom[at][i],
315 GtkWidget * menuc = gtk_menu_new ();
326 j = this_proj -> nspec;
328 for (i=0;
i< this_proj -> nspec;
i++)
336 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
340 gtk_menu_shell_append ((GtkMenuShell *)menuc, sp);
341 gtk_menu_item_set_submenu ((GtkMenuItem *)sp,
color_box(view, i+j, 0, 0));
358 GtkWidget * menul = gtk_menu_new ();
361 gtk_menu_shell_append ((GtkMenuShell *)menul, all);
363 gtk_menu_shell_append ((GtkMenuShell *)menul, l_show);
364 GtkWidget * mshow = gtk_menu_new ();
365 gtk_menu_item_set_submenu ((GtkMenuItem *)l_show, mshow);
368 gboolean sensitive = (! at) ? TRUE : view -> anim -> last ->
img -> draw_clones;
371 view -> ogl_lab[at] = g_malloc (this_proj -> nspec*
sizeof*view -> ogl_lab[at]);
374 for (i=0;
i< this_proj -> nspec;
i++)
382 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
386 view -> ogl_lab[at][
i] = create_spec_menu (str,
387 view -> anim -> last ->
img -> show_label[at][i],
395 create_spec_menu (str,
396 view -> anim -> last ->
img -> show_label[at][i],
403 if (at == 0 ||
id == 1)
406 gtk_menu_shell_append ((GtkMenuShell *)menul, l_sel);
407 g_signal_connect (G_OBJECT (l_sel),
"activate",G_CALLBACK(
atom_properties), & view ->
colorp[at][2]);
415 gtk_menu_shell_append ((GtkMenuShell *)menul, view -> ogl_clones[2]);
416 g_signal_connect (G_OBJECT (view -> ogl_clones[2]),
"activate",G_CALLBACK(
atom_properties), & view ->
colorp[at][2]);
439 GtkWidget * menua = gtk_menu_new ();
441 if (at == 1 &&
id == 0)
444 gtk_menu_shell_append ((GtkMenuShell *)menua,
menu_item_new_with_submenu (
"Color(s)", ! (view -> anim -> last ->
img -> color_map[0] != 0), view -> ogl_clones[1]));
452 i = view -> anim -> last ->
img -> style;
457 gtk_menu_shell_append ((GtkMenuShell *)menua, view -> ogl_atoms[4*at]);
458 view -> ogl_atoms[4*at+1] = create_atom_layout_widget (str, view -> ogl_atoms[4*at], & view ->
colorp[at][0]);
459 if (at == 1 && ! view -> anim -> last ->
img -> draw_clones)
467 gtk_menu_shell_append ((GtkMenuShell *)menua, widg);
468 widg = create_atom_layout_widget (str, widg, & view ->
colorp[at][0]);
469 if (at == 1 && ! view -> anim -> last ->
img -> draw_clones)
480 gtk_menu_shell_append ((GtkMenuShell *)menua, view -> ogl_atoms[4*at+2]);
481 view -> ogl_atoms[4*at+3] = create_atom_layout_widget (str, view -> ogl_atoms[4*at+2], & view ->
colorp[at][1]);
482 if (at == 1 && ! view -> anim -> last ->
img -> draw_clones)
490 gtk_menu_shell_append ((GtkMenuShell *)menua, widg);
491 widg = create_atom_layout_widget (str, widg, & view ->
colorp[at][1]);
492 if (at == 1 && ! view -> anim -> last ->
img -> draw_clones)
498 if (
id == 0 && at == 1)
518extern G_MODULE_EXPORT
void atom_properties (GSimpleAction *
action, GVariant * state, gpointer data);
532 int j = the_data ->
b;
533 int k = the_data ->
c;
535 gboolean doit = TRUE;
541 state = g_action_get_state (G_ACTION (
action));
542 show = ! g_variant_get_boolean (state);
543 const gchar *
atom = g_action_get_name ((GAction *)
action);
544 int lgt = strlen (
atom);
545 gchar * name = g_strdup_printf (
"%c%c",
atom[lgt-2],
atom[lgt-1]);
546 if (g_strcmp0(name,
".1") == 0)
549 name = g_strdup_printf (
"%.*s.0", lgt-2,
atom);
550 g_action_group_activate_action ((GActionGroup *)this_proj -> modelgl -> action_group, (
const gchar *)name, NULL);
557 show = this_proj -> modelgl -> anim -> last ->
img -> show_atom[j][k];
561 for (l=0; l<this_proj -> steps; l++)
563 for (m=0; m<this_proj -> natomes; m++)
565 if (this_proj ->
atoms[l][m].sp == k) this_proj ->
atoms[l][m].show[j] = show;
568 this_proj -> modelgl -> anim -> last ->
img -> show_atom[j][k] = show;
572 g_action_change_state (G_ACTION (
action), g_variant_new_boolean (show));
573 g_variant_unref (state);
590 int j = the_data ->
b;
591 int k = the_data ->
c;
592 gboolean doit = TRUE;
598 state = g_action_get_state (G_ACTION (
action));
599 show = ! g_variant_get_boolean (state);
600 const gchar *
label = g_action_get_name ((GAction *)
action);
601 int lgt = strlen (
label);
602 gchar * name = g_strdup_printf (
"%c%c",
label[lgt-2],
label[lgt-1]);
603 if (g_strcmp0(name,
".1") == 0)
606 name = g_strdup_printf (
"%.*s.0", lgt-2,
label);
607 g_action_group_activate_action ((GActionGroup *)this_proj -> modelgl -> action_group, (
const gchar *)name, NULL);
614 show = ! this_proj -> modelgl -> anim -> last ->
img -> show_label[j][k];
619 for (l=0; l<this_proj -> steps; l++)
621 for (m=0; m<this_proj -> natomes; m++)
623 if (this_proj ->
atoms[l][m].sp == k)
625 if (this_proj ->
atoms[l][m].
label[j] != show)
627 this_proj ->
atoms[l][m].label[j] = show;
633 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
634 update (this_proj -> modelgl);
637 g_action_change_state (G_ACTION (
action), g_variant_new_boolean (show));
638 g_variant_unref (state);
659 gboolean show = ! this_proj ->
atoms[0][0].label[i];
660 for (j=0; j<this_proj -> steps; j++)
662 for (k=0; k<this_proj -> natomes; k++)
664 this_proj ->
atoms[j][k].label[i] = show;
668 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
669 update (this_proj -> modelgl);
670 update_menu_bar (this_proj -> modelgl);
685 GMenu * menu = g_menu_new ();
686 append_opengl_item (view, menu,
"Show/Hide All", (at) ?
"clones-labels-all" :
"atoms-labels-all", popm, popm, NULL,
IMG_NONE, NULL,
688 GMenu * smenu = g_menu_new ();
692 for (i=0; i< this_proj -> nspec; i++)
700 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
704 TRUE, view -> anim -> last ->
img -> show_label[at][i], FALSE, sensitive);
726 GMenu * menu = g_menu_new ();
729 gchar * stra, * strb;
731 for (i=0; i< this_proj -> nspec; i++)
735 stra = g_strdup_printf (
"%s", this_proj ->
chemistry ->
label[i]);
739 stra = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
741 strb = g_strdup_printf (
"%s", (! at) ?
"atom-color" :
"clone-color");
742 menuc = g_menu_new ();
743 append_opengl_item (view, menuc, strb, strb, popm, i, NULL,
IMG_NONE, NULL, TRUE, NULL, NULL, FALSE, FALSE, FALSE, FALSE);
749 g_object_unref (menuc);
766 GMenu * menu = g_menu_new ();
770 for (i=0; i<this_proj -> nspec; i++)
778 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
782 TRUE, view -> anim -> last ->
img -> show_atom[at][i], FALSE, sensitive);
799 int i = view -> anim -> last ->
img -> style;
800 gboolean sensitive = (at) ? view -> anim -> last ->
img -> draw_clones : TRUE;
802 GMenu * menu = g_menu_new ();
809 item = g_menu_item_new (
"Radius(ii)", (sensitive) ? NULL :
"None");
810 g_menu_item_set_attribute (item,
"custom",
"s", (at) ?
"clone-radii" :
"atom-radii", NULL);
811 g_menu_append_item (menu, item);
815 item = g_menu_item_new (
"Point size(s)", (sensitive) ? NULL :
"None");
816 g_menu_item_set_attribute (item,
"custom",
"s", (at) ?
"clone-pts" :
"atom-pts", NULL);
817 g_menu_append_item (menu, item);
821 FALSE, FALSE, FALSE, sensitive);
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 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 init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
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)
GtkWidget * menu_item_new_with_submenu(gchar *name, gboolean active, GtkWidget *sub_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...
int check_label_numbers(project *this_proj, int types)
check how many atom label(s) are visible
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)
GMenu * color_atoms_submenu(glwin *view, int popm, int at, gboolean sensitive)
create the 'Atom(s) -> Color(s)' submenu elements
G_MODULE_EXPORT void atom_properties(GSimpleAction *action, GVariant *state, gpointer data)
atom(s) propery callback GTK4
gchar * label_atpts(project *this_proj, glwin *view, int id)
prepare the text of a menu item in the 'Model -> Atom(s)' submenu
G_MODULE_EXPORT void show_hide_labels(GSimpleAction *action, GVariant *parameter, gpointer data)
handle the show/hide label signal GTK4
G_MODULE_EXPORT void show_hide_atoms(GSimpleAction *action, GVariant *parameter, gpointer data)
handle the show/hide signal GTK4
GMenu * show_atoms_submenu(glwin *view, int popm, int at, gboolean sensitive)
create the 'Atom(s) -> Show' submenu elements
GMenu * label_atoms_submenu(glwin *view, int popm, int at, gboolean sensitive)
create the 'Atom(s) -> Label(s)' submenu elements
GMenu * menu_atoms(glwin *view, int popm, int at)
create the 'Atom(s)' submenu elements
G_MODULE_EXPORT void show_hide_all_atom_labels(GSimpleAction *action, GVariant *parameter, gpointer data)
handle the show/hide all labels GTK4
G_MODULE_EXPORT void set_atom_parameter(GtkWidget *widg, gpointer data)
set atom parameter - creating the dialog