80 for (i=0; i < this_proj -> nspec; i++)
85 str = g_strdup_printf (
"%s [ %f Å ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> sphererad[i]);
88 str = g_strdup_printf (
"%s [ %f pts ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> pointrad[i]);
91 str = g_strdup_printf (
"%s [ %f pts ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> sphererad[i+this_proj -> nspec]);
94 str = g_strdup_printf (
"%s [ %f pts ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> pointrad[i+this_proj -> nspec]);
97 str = g_strdup_printf (
"%s [ %f Å ]", this_proj ->
chemistry ->
label[i], view -> anim -> last ->
img -> atomicrad[i]);
102 mot = g_strdup_printf (
"%s", str);
106 tmp = g_strdup_printf (
"%s",
mot);
108 mot = g_strdup_printf (
"%s\n%s", tmp, str);
117extern G_MODULE_EXPORT
void set_show_hide_all_atom_labels (GtkWidget * widg, gpointer data);
118extern G_MODULE_EXPORT
void atom_properties (GtkWidget * widg, gpointer data);
131 int j = the_data ->
b;
132 int k = the_data ->
c;
135 gboolean
v = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
136 if (widg != this_proj -> modelgl -> ogl_spec[j][k])
138 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_spec[j][k], v);
140 for (l=0;
l<this_proj -> steps;
l++)
142 for (m=0;
m<this_proj -> natomes;
m++)
144 if (this_proj ->
atoms[l][m].sp == k) this_proj ->
atoms[
l][
m].show[
j] =
v;
147 this_proj -> modelgl -> anim -> last ->
img -> show_atom[
j][
k] =
v;
167 gboolean
v = gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg);
168 if (widg != this_proj -> modelgl -> ogl_lab[j][k])
170 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[j][k], v);
172 for (l=0;
l<this_proj -> steps;
l++)
174 for (m=0;
m<this_proj -> natomes;
m++)
176 if (this_proj ->
atoms[l][m].sp == k)
186 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
187 update (this_proj -> modelgl);
203 gboolean show = TRUE;
205 for (k=0;
k<this_proj -> nspec;
k++)
207 if (
plot -> show_label[j][k]) show = FALSE;
209 for (k=0;
k<this_proj -> nspec;
k++)
211 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_lab[j][k], show);
227GtkWidget * create_spec_menu (
char * name, gboolean va, gboolean vb, GtkWidget * menu, GCallback handler,
tint * data)
229 GtkWidget * spec_widget =
gtk3_menu_item (menu, name,
IMG_NONE, NULL, handler, data, FALSE, 0, 0, TRUE, FALSE, va);
243GtkWidget * create_atom_layout_widget (gchar * str, GtkWidget * widg,
tint * data)
245 GtkWidget * menu = gtk_menu_new ();
246 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menu);
248 gtk_menu_shell_append ((GtkMenuShell *)menu,
layout);
264 GtkWidget * mshow = gtk_menu_new ();
266 gboolean sensitive = (! at) ? TRUE : view -> anim -> last ->
img -> draw_clones;
270 view -> ogl_spec[at] = g_malloc (this_proj -> nspec*
sizeof*view -> ogl_spec[at]);
273 for (i=0;
i< this_proj -> nspec;
i++)
281 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
285 view -> ogl_spec[at][
i] = create_spec_menu (str,
286 view -> anim -> last ->
img -> show_atom[at][i],
295 create_spec_menu (str, view -> anim -> last ->
img -> show_atom[at][i],
317 GtkWidget * menuc = gtk_menu_new ();
328 j = this_proj -> nspec;
330 for (i=0;
i< this_proj -> nspec;
i++)
338 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
342 gtk_menu_shell_append ((GtkMenuShell *)menuc, sp);
343 gtk_menu_item_set_submenu ((GtkMenuItem *)sp,
color_box(view, i+j, 0, 0));
360 GtkWidget * menul = gtk_menu_new ();
363 gtk_menu_shell_append ((GtkMenuShell *)menul, all);
365 gtk_menu_shell_append ((GtkMenuShell *)menul, l_show);
366 GtkWidget * mshow = gtk_menu_new ();
367 gtk_menu_item_set_submenu ((GtkMenuItem *)l_show, mshow);
370 gboolean sensitive = (! at) ? TRUE : view -> anim -> last ->
img -> draw_clones;
373 view -> ogl_lab[at] = g_malloc (this_proj -> nspec*
sizeof*view -> ogl_lab[at]);
376 for (i=0;
i< this_proj -> nspec;
i++)
384 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
388 view -> ogl_lab[at][
i] = create_spec_menu (str,
389 view -> anim -> last ->
img -> show_label[at][i],
397 create_spec_menu (str,
398 view -> anim -> last ->
img -> show_label[at][i],
405 if (at == 0 ||
id == 1)
408 gtk_menu_shell_append ((GtkMenuShell *)menul, l_sel);
409 g_signal_connect (G_OBJECT (l_sel),
"activate",G_CALLBACK(
atom_properties), & view ->
colorp[at][2]);
417 gtk_menu_shell_append ((GtkMenuShell *)menul, view -> ogl_clones[2]);
418 g_signal_connect (G_OBJECT (view -> ogl_clones[2]),
"activate",G_CALLBACK(
atom_properties), & view ->
colorp[at][2]);
441 GtkWidget * menua = gtk_menu_new ();
443 if (at == 1 &&
id == 0)
446 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]));
454 i = view -> anim -> last ->
img -> style;
459 gtk_menu_shell_append ((GtkMenuShell *)menua, view -> ogl_atoms[4*at]);
460 view -> ogl_atoms[4*at+1] = create_atom_layout_widget (str, view -> ogl_atoms[4*at], & view ->
colorp[at][0]);
461 if (at == 1 && ! view -> anim -> last ->
img -> draw_clones)
469 gtk_menu_shell_append ((GtkMenuShell *)menua, widg);
470 widg = create_atom_layout_widget (str, widg, & view ->
colorp[at][0]);
471 if (at == 1 && ! view -> anim -> last ->
img -> draw_clones)
482 gtk_menu_shell_append ((GtkMenuShell *)menua, view -> ogl_atoms[4*at+2]);
483 view -> ogl_atoms[4*at+3] = create_atom_layout_widget (str, view -> ogl_atoms[4*at+2], & view ->
colorp[at][1]);
484 if (at == 1 && ! view -> anim -> last ->
img -> draw_clones)
492 gtk_menu_shell_append ((GtkMenuShell *)menua, widg);
493 widg = create_atom_layout_widget (str, widg, & view ->
colorp[at][1]);
494 if (at == 1 && ! view -> anim -> last ->
img -> draw_clones)
500 if (
id == 0 && at == 1)
520extern G_MODULE_EXPORT
void atom_properties (GSimpleAction *
action, GVariant * state, gpointer data);
534 int j = the_data ->
b;
535 int k = the_data ->
c;
537 gboolean doit = TRUE;
543 state = g_action_get_state (G_ACTION (
action));
544 show = ! g_variant_get_boolean (state);
545 const gchar *
atom = g_action_get_name ((GAction *)
action);
546 int lgt = strlen (
atom);
547 gchar * name = g_strdup_printf (
"%c%c",
atom[lgt-2],
atom[lgt-1]);
548 if (g_strcmp0(name,
".1") == 0)
551 name = g_strdup_printf (
"%.*s.0", lgt-2,
atom);
552 g_action_group_activate_action ((GActionGroup *)this_proj -> modelgl -> action_group, (
const gchar *)name, NULL);
559 show = this_proj -> modelgl -> anim -> last ->
img -> show_atom[j][k];
563 for (l=0; l<this_proj -> steps; l++)
565 for (m=0; m<this_proj -> natomes; m++)
567 if (this_proj ->
atoms[l][m].sp == k) this_proj ->
atoms[l][m].show[j] = show;
570 this_proj -> modelgl -> anim -> last ->
img -> show_atom[j][k] = show;
574 g_action_change_state (G_ACTION (
action), g_variant_new_boolean (show));
575 g_variant_unref (state);
592 int j = the_data ->
b;
593 int k = the_data ->
c;
594 gboolean doit = TRUE;
600 state = g_action_get_state (G_ACTION (
action));
601 show = ! g_variant_get_boolean (state);
602 const gchar *
label = g_action_get_name ((GAction *)
action);
603 int lgt = strlen (
label);
604 gchar * name = g_strdup_printf (
"%c%c",
label[lgt-2],
label[lgt-1]);
605 if (g_strcmp0(name,
".1") == 0)
608 name = g_strdup_printf (
"%.*s.0", lgt-2,
label);
609 g_action_group_activate_action ((GActionGroup *)this_proj -> modelgl -> action_group, (
const gchar *)name, NULL);
616 show = ! this_proj -> modelgl -> anim -> last ->
img -> show_label[j][k];
621 for (l=0; l<this_proj -> steps; l++)
623 for (m=0; m<this_proj -> natomes; m++)
625 if (this_proj ->
atoms[l][m].sp == k)
627 if (this_proj ->
atoms[l][m].
label[j] != show)
629 this_proj ->
atoms[l][m].label[j] = show;
635 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
636 update (this_proj -> modelgl);
639 g_action_change_state (G_ACTION (
action), g_variant_new_boolean (show));
640 g_variant_unref (state);
661 gboolean show = ! this_proj ->
atoms[0][0].label[i];
662 for (j=0; j<this_proj -> steps; j++)
664 for (k=0; k<this_proj -> natomes; k++)
666 this_proj ->
atoms[j][k].label[i] = show;
670 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
671 update (this_proj -> modelgl);
672 update_menu_bar (this_proj -> modelgl);
687 GMenu * menu = g_menu_new ();
688 append_opengl_item (view, menu,
"Show/Hide All", (at) ?
"clones-labels-all" :
"atoms-labels-all", popm, popm, NULL,
IMG_NONE, NULL,
690 GMenu * smenu = g_menu_new ();
694 for (i=0; i< this_proj -> nspec; i++)
702 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
706 TRUE, view -> anim -> last ->
img -> show_label[at][i], FALSE, sensitive);
728 GMenu * menu = g_menu_new ();
731 gchar * stra, * strb;
733 for (i=0; i< this_proj -> nspec; i++)
737 stra = g_strdup_printf (
"%s", this_proj ->
chemistry ->
label[i]);
741 stra = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
743 strb = g_strdup_printf (
"%s", (! at) ?
"atom-color" :
"clone-color");
744 menuc = g_menu_new ();
745 append_opengl_item (view, menuc, strb, strb, popm, i, NULL,
IMG_NONE, NULL, TRUE, NULL, NULL, FALSE, FALSE, FALSE, FALSE);
751 g_object_unref (menuc);
768 GMenu * menu = g_menu_new ();
772 for (i=0; i<this_proj -> nspec; i++)
780 str = g_strdup_printf (
"%s*", this_proj ->
chemistry ->
label[i]);
784 TRUE, view -> anim -> last ->
img -> show_atom[at][i], FALSE, sensitive);
801 int i = view -> anim -> last ->
img -> style;
802 gboolean sensitive = (at) ? view -> anim -> last ->
img -> draw_clones : TRUE;
804 GMenu * menu = g_menu_new ();
811 item = g_menu_item_new (
"Radius(ii)", (sensitive) ? NULL :
"None");
812 g_menu_item_set_attribute (item,
"custom",
"s", (at) ?
"clone-radii" :
"atom-radii", NULL);
813 g_menu_append_item (menu, item);
817 item = g_menu_item_new (
"Point size(s)", (sensitive) ? NULL :
"None");
818 g_menu_item_set_attribute (item,
"custom",
"s", (at) ?
"clone-pts" :
"atom-pts", NULL);
819 g_menu_append_item (menu, item);
823 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
void check_hidden_visible(project *this_proj)
check how many atom(s) are visible
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