51extern G_MODULE_EXPORT
void crystal_window (GSimpleAction *
action, GVariant * parameter, gpointer data);
52extern G_MODULE_EXPORT
void turn_rebuild (GSimpleAction *
action, GVariant * parameter, gpointer data);
54extern G_MODULE_EXPORT
void crystal_window (GtkWidget * widg, gpointer data);
55extern G_MODULE_EXPORT
void turn_rebuild (GtkWidget * widg, gpointer data);
98 GtkWidget * menu = gtk_menu_new ();
106 g_signal_connect (G_OBJECT (view -> ogl_box[2+i]),
"activate", G_CALLBACK(
wrapping_coord), view);
110 g_signal_connect (G_OBJECT (view -> ogl_box[2+i]),
"activate", G_CALLBACK(
super_cell), view);
114 k = (
i < 3) ? i-1 :
i-2;
115 g_signal_connect (G_OBJECT (view -> ogl_box[2+i]),
"activate", G_CALLBACK(
edition_win), & view ->
colorp[k][0]);
122 for (l=0;
l<3;
l++) k += view -> anim -> last ->
img-> extra_cell[l];
125 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> ogl_box[2+i]);
135 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
wrapping_coord), view);
139 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
super_cell), view);
143 k = (
i < 3) ? i-1 :
i-2;
144 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
edition_win), & view ->
colorp[k][0]);
151 for (l=0;
l<3;
l++) k += view -> anim -> last ->
img-> extra_cell[l];
154 gtk_menu_shell_append ((GtkMenuShell *)menu, widg);
172 GtkWidget * menu = gtk_menu_new ();
177 g_signal_connect (G_OBJECT (view -> cbuilder),
"activate", G_CALLBACK(
crystal_window), & view ->
colorp[0][0]);
178 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> cbuilder);
183 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
crystal_window), & view ->
colorp[0][0]);
184 gtk_menu_shell_append ((GtkMenuShell *)menu, widg);
186 j = (this_proj -> cell.ltype && this_proj -> steps == 1) ? 1 : 0;
190 gtk_menu_shell_append ((GtkMenuShell *)menu, view -> ogl_box[1]);
198 gtk_menu_shell_append ((GtkMenuShell *)menu, ats);
199 GtkWidget * menua = gtk_menu_new ();
200 gtk_menu_item_set_submenu ((GtkMenuItem *)ats, menua);
201 j = (this_proj -> steps == 1) ? 1 : 0;
205 g_signal_connect (G_OBJECT (widg),
"activate", G_CALLBACK(
action_window), & view ->
colorp[i][0]);
206 gtk_menu_shell_append ((GtkMenuShell *)menua, widg);
213 gchar * rtext[2] = {
"Extract/Rebuild on Motion",
"Extract/Rebuild on Copy"};
216 view -> rbuild[
i] =
gtk3_menu_item (menu, rtext[i],
IMG_STOCK, (gpointer)
ECUT, G_CALLBACK(
turn_rebuild), & view ->
colorp[i][0], FALSE, 0, 0, TRUE, FALSE, view -> rebuild[i][0]);
234 GMenu * menu = g_menu_new ();
241 j = (i == 0) ? i : (i == 3) ? 1 : 2;
242 if (i > 2) sens = sensitive;
243 if (i == 0) sens = ! view -> wrapped;
247 for (l=0; l<3; l++) k += view -> anim -> last ->
img-> extra_cell[l];
250 act = g_strdup_printf (
"ceed-%d", i);
251 if (i == 0 || i == 3)
253 append_opengl_item (view, menu,
edit_names[i], act, popm, i, NULL,
IMG_NONE, NULL, FALSE, edit_handler[j], (gpointer)view, FALSE, FALSE, FALSE, sens);
257 k = (i < 3) ? i-1 : i-2;
258 append_opengl_item (view, menu,
edit_names[i], act, popm, i, NULL,
IMG_NONE, NULL, FALSE, edit_handler[j], & view ->
colorp[k][0], FALSE, FALSE, FALSE, sens);
275 GMenu * menu = g_menu_new ();
279 j = (this_proj -> steps == 1) ? 1 : 0;
282 act = g_strdup_printf (
"ated-%d", i);
283 append_opengl_item (view, menu,
action_name[i], act, popm, 0, NULL,
IMG_NONE, NULL, FALSE,
284 G_CALLBACK(
action_window), & view ->
colorp[i][0], FALSE, FALSE, FALSE, (i == 3) ? j : (this_proj -> natomes) ? j : 0);
303 gboolean doit = TRUE;
304 GVariant * state = g_action_get_state (G_ACTION (
action));
305 const gchar * rebuild = g_action_get_name ((GAction *)
action);
306 int lgt = strlen (rebuild);
307 gchar * name = g_strdup_printf (
"%c%c", rebuild[lgt-2], rebuild[lgt-1]);
308 if (g_strcmp0(name,
".1") == 0)
311 name = g_strdup_printf (
"%.*s.0", lgt-2, rebuild);
312 g_action_group_activate_action ((GActionGroup *)view -> action_group, (
const gchar *)name, NULL);
319 g_action_change_state (G_ACTION (
action), g_variant_new_boolean (! g_variant_get_boolean (state)));
320 g_variant_unref (state);
336 GMenu * menu = g_menu_new ();
337 gchar * rtext[2] = {
"Extract/Rebuild on Motion",
"Extract/Rebuild on Copy"};
340 append_opengl_item (view, menu, rtext[i],
"aext", popm, i, NULL,
IMG_STOCK, (gpointer)
ECUT, FALSE, G_CALLBACK(
to_run_rebuild), & view ->
colorp[i][0],
341 TRUE, view -> rebuild[i][0], FALSE, (this_proj -> steps == 1) ? 1 : 0);
357 GMenu * menu = g_menu_new ();
358 append_opengl_item (view, menu,
"Crystal Builder",
"cbuilder", popm, popm, NULL,
IMG_NONE, NULL, FALSE, G_CALLBACK(
crystal_window), & view ->
colorp[0][0], FALSE, FALSE, FALSE, TRUE);
361 if (! popm) g_menu_append_section (menu, NULL, (GMenuModel*)
extract_section(view, popm));
G_MODULE_EXPORT void action_window(GtkWidget *widg, gpointer data)
open model edition window callback GTK3
Function declarations for the mode edition window.
G_MODULE_EXPORT void edition_win(GtkWidget *widg, gpointer data)
create the cell edition window callback GTK3
Function declarations for the cell edition window.
void wrapping(glwin *view)
wrapping atomic coordinates
G_MODULE_EXPORT void super_cell(GtkWidget *widg, gpointer data)
create super cell menu callback GTK3
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
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 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)
G_MODULE_EXPORT void turn_rebuild(GtkWidget *widg, gpointer data)
rebuild menu items callback GTK3
GMenu * extract_section(glwin *view, int popm)
create the 'Extract/Rebuild' menu items GTK4
GMenu * menu_edit(glwin *view, int popm)
create the 'Edit' submenu GTK4
G_MODULE_EXPORT void wrapping_coord(GtkWidget *widg, gpointer data)
wrapp coordinates callback
GMenu * menu_atom_edit(glwin *view, int popm)
create the 'Edit -> Atom(s)' submenu GTK4
G_MODULE_EXPORT void to_run_rebuild(GSimpleAction *action, GVariant *parameter, gpointer data)
Extract/Rebuild menu items callback GTK4.
GMenu * menu_cell_edit(glwin *view, int popm, int sensitive)
create the 'Edit -> Cell' submenu GTK4
G_MODULE_EXPORT void crystal_window(GtkWidget *widg, gpointer data)
create the crystal build window callback GTK3