57G_MODULE_EXPORT
void box_advanced (GSimpleAction *
action, GVariant * parameter, gpointer data);
58extern G_MODULE_EXPORT
void window_bonds (GSimpleAction *
action, GVariant * parameter, gpointer data);
60G_MODULE_EXPORT
void box_advanced (GtkWidget * widg, gpointer data);
61extern G_MODULE_EXPORT
void window_bonds (GtkWidget * widg, gpointer data);
62extern G_MODULE_EXPORT
void window_lines (GtkWidget * widg, gpointer data);
82 k = this_proj -> modelgl -> anim -> last ->
img -> box_axis[o];
87 if (k != j && gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
89 this_proj -> modelgl -> anim -> last ->
img -> box_axis[
o] =
NONE - 1;
90 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_box_axis[o][l], FALSE);
93 if (widg != this_proj -> modelgl -> ogl_box_axis[o][(k ==
NONE) ? 1 :
m])
95 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_box_axis[o][(k ==
NONE) ? 1 :
m], TRUE);
100 else if (k == j && ! gtk_check_menu_item_get_active ((GtkCheckMenuItem *)widg))
102 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_box_axis[o][(k ==
NONE) ? 1 :
m], TRUE);
108 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_box_axis[o][i], FALSE);
113 for (i=6;
i<dim[
o];
i++)
117 if (widg != this_proj -> modelgl -> ogl_box_axis[o][0]) gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_box_axis[o][0], FALSE);
118 this_proj -> modelgl -> anim -> last ->
img -> box_axis[
o] =
NONE;
120 this_proj -> modelgl -> create_shaders[
o+
MDBOX] = TRUE;
121 update (this_proj -> modelgl);
135GtkWidget * create_box_axis_menu (
char * name,
int val,
int box, GtkWidget * menu,
tint * data)
138 FALSE, 0, 0, TRUE, (data ->
b != 0) ? TRUE : FALSE, (box ==
val &&
val !=
NONE) ? TRUE : FALSE);
158GtkWidget * create_color_widget (GtkWidget * widg,
glwin * view,
int va)
160 GtkWidget * color_widget =
color_box(view, -1, 0, 0);
161 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, color_widget);
182 gtk_menu_shell_append ((GtkMenuShell *)menu,
layout);
200 gchar * menu_title[2]={
"Box",
"Axis"};
202 GtkWidget * menu_ab = gtk_menu_new ();
203 if (
id == 0 && ab == 0)
206 gtk_menu_item_set_submenu ((GtkMenuItem *)view -> ogl_box[0], menu_ab);
212 gtk_menu_item_set_submenu ((GtkMenuItem *)ab_menu, menu_ab);
217 int i = view -> anim -> last ->
img -> box_axis[
ab];
220 view -> ogl_box_axis[
ab][0] = create_box_axis_menu (
"Show/_Hide", i, i, menu_ab, & view ->
colorp[0][ab]);
224 widg = create_box_axis_menu (
"Show/Hide", i, i, menu_ab, & view ->
colorp[0][ab]);
227 gtk_menu_shell_append ((GtkMenuShell *)menu_ab, widg);
228 GtkWidget * menus = gtk_menu_new ();
229 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menus);
231 str = g_strdup_printf (
"Width [ %f pts ]", view -> anim -> last ->
img -> box_axis_line[ab]);
234 view -> ogl_box_axis[
ab][1] = create_box_axis_menu (
text_styles[1], i, 1, menus, & view ->
colorp[1][ab]);
235 view -> ogl_box_axis[
ab][2] = create_box_axis_menu (
text_styles[4], i, 4, menus, & view ->
colorp[4][ab]);
237 gtk_menu_shell_append ((GtkMenuShell *)menu_ab, view -> ogl_box_axis[ab][3]);
238 menul = gtk_menu_new ();
239 gtk_menu_item_set_submenu ((GtkMenuItem *)view -> ogl_box_axis[ab][3], menul);
249 gtk_menu_shell_append ((GtkMenuShell *)menu_ab, widg);
250 menul = gtk_menu_new ();
251 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menul);
257 str = g_strdup_printf (
"Radius [ %f Å ]", view -> anim -> last ->
img -> box_axis_rad[ab]);
261 gtk_menu_shell_append ((GtkMenuShell *)menu_ab, view -> ogl_box_axis[ab][5]);
262 menul = gtk_menu_new ();
263 gtk_menu_item_set_submenu ((GtkMenuItem *)view -> ogl_box_axis[ab][5], menul);
269 gtk_menu_shell_append ((GtkMenuShell *)menu_ab, widg);
270 menul = gtk_menu_new ();
271 gtk_menu_item_set_submenu ((GtkMenuItem *)widg, menul);
279 gtk_menu_shell_append ((GtkMenuShell *)menu_ab, widg);
282 view -> ogl_box_axis[
ab][7] = create_color_widget (widg, view, i);
286 widg = create_color_widget (widg, view, i);
295 if (
id == 0 && ab == 0)
297 return view -> ogl_box[0];
318 const gchar * name = g_action_get_name ((GAction *)
action);
319 int lgt = strlen (name);
320 gchar * str = g_strdup_printf (
"%c%c", name[lgt-2], name[lgt-1]);
321 if (g_strcmp0(str,
".1") == 0)
324 str = g_strdup_printf (
"%.*s.0.0", lgt-4, name);
325 g_action_group_activate_action ((GActionGroup *)view -> action_group, (
const gchar *)str, NULL);
332 state = g_action_get_state (G_ACTION (
action));
333 show = ! g_variant_get_boolean (state);
336 view -> anim -> last ->
img -> box_axis[the_data ->
c] =
WIREFRAME;
340 view -> anim -> last ->
img -> box_axis[the_data ->
c] =
NONE;
342 view -> create_shaders[the_data ->
c+
MDBOX] = TRUE;
344 g_action_change_state (G_ACTION (
action), g_variant_new_boolean (show));
345 g_variant_unref (state);
364 const gchar * style = g_variant_get_string (parameter, NULL);
365 int lgt = strlen (style);
366 gchar * name = g_strdup_printf (
"%c%c", style[lgt-2], style[lgt-1]);
367 if (g_strcmp0(name,
".1") == 0)
369 name = g_strdup_printf (
"%.*s.0", lgt-2, style);
370 gchar * str = g_strdup_printf (
"set-%s-style", (i) ?
"axis" :
"box");
371 g_action_group_activate_action ((GActionGroup *)view -> action_group, (
const gchar *)str, g_variant_new_string((
const gchar *)name));
377 gchar * style_name = NULL;
378 gchar * str = g_strdup_printf (
"set-%s-style", (i) ?
"axis" :
"box");
381 style_name = g_strdup_printf (
"%s.%d.0", str, j);
382 if (g_strcmp0(style, (
const gchar *)style_name) == 0)
385 view -> create_shaders[i+
MDBOX] = TRUE;
395 g_action_change_state (G_ACTION (
action), parameter);
411 GMenu * menu = g_menu_new ();
412 gchar * str = g_strdup_printf (
"%s-style", (ab) ?
"axis" :
"box");
413 append_opengl_item (view, menu,
text_styles[1], str, popm, 0, NULL,
IMG_NONE, NULL, FALSE,
415 TRUE, (abs !=
NONE) ? TRUE : FALSE);
417 str = g_strdup_printf (
"%s-style", (ab) ?
"axis" :
"box");
418 append_opengl_item (view, menu,
text_styles[4], str, popm, 1, NULL,
IMG_NONE, NULL, FALSE,
420 TRUE, (abs !=
NONE) ? TRUE : FALSE);
440 str = g_strdup_printf (
"Width [ %f pts ]", view -> anim -> last ->
img -> box_axis_line[ab]);
441 key = g_strdup_printf (
"%s-width", (ab) ?
"axis" :
"box");
445 str = g_strdup_printf (
"Radius [ %f Å ]", view -> anim -> last ->
img -> box_axis_rad[ab]);
446 key = g_strdup_printf (
"%s-radius", (ab) ?
"axis" :
"box");
450 str = g_strdup_printf (
" length [ %f Å ]", view -> anim -> last ->
img -> axis_length);
451 key = g_strdup_printf (
"axis-legnth");
453 GMenu * menu = g_menu_new ();
454 append_opengl_item (view, menu, str, key, popm, ab, NULL,
IMG_NONE, NULL, FALSE,
472 GMenuItem * ab_item = g_menu_item_new ((ab) ?
"Axis" :
"Box", (ab) ? NULL : (
get_project_by_id(view ->
proj) -> cell.ltype) ? NULL :
"None");
473 int i = view -> anim -> last ->
img -> box_axis[ab];
474 GMenu * menu = g_menu_new ();
475 append_opengl_item (view, menu,
"Show/Hide", (ab) ?
"show-axis" :
"show-box", popm, popm, NULL,
IMG_NONE, NULL, FALSE,
482 item = g_menu_item_new (
"Lines", (view -> anim -> last ->
img -> box_axis[ab]) !=
NONE ? NULL :
"None");
483 g_menu_item_set_attribute (item,
"custom",
"s", (ab) ?
"axis-lines" :
"box-lines", NULL);
485 g_menu_append_item (menu, item);
489 item = g_menu_item_new (
"Cylinders", (view -> anim -> last ->
img -> box_axis[ab]) !=
NONE ? NULL :
"None");
490 g_menu_item_set_attribute (item,
"custom",
"s", (ab) ?
"axis-cylinders" :
"box-cylinders", NULL);
492 g_menu_append_item (menu, item);
497 GMenu * menuc = g_menu_new ();
498 append_opengl_item (view, menuc,
"box-color",
"box-color", popm, popm, NULL,
IMG_NONE, NULL, TRUE, NULL, NULL, FALSE, FALSE, FALSE, FALSE);
499 append_opengl_item (view, menuc,
"More colors ...",
"box-color", popm, popm, NULL,
IMG_NONE, NULL, FALSE,
502 g_object_unref (menuc);
503 append_opengl_item (view, menu,
"Advanced",
"box-advanced", popm, popm, NULL,
IMG_STOCK,
DPROPERTIES, FALSE,
504 G_CALLBACK(
box_advanced), (gpointer)view, FALSE, FALSE, FALSE, TRUE);
510 g_menu_item_set_submenu (ab_item, (GMenuModel *)menu);
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_box_color_window(GtkWidget *widg, gpointer data)
to run box color selection window callback GTK3
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 hide_the_widgets(GtkWidget *widg)
hide GtkWidget
void show_the_widgets(GtkWidget *widg)
show GtkWidget
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...
char * text_styles[OGL_STYLES]
G_MODULE_EXPORT void set_box_axis_style(GtkWidget *widg, gpointer data)
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)
GtkWidget * create_layout_widget(gchar *str, GtkWidget *menu, int vab, gpointer data)
void menu_axis(GMenu *menu_ab, glwin *view, int popm)
create the 'Axis' submenu GTK4
G_MODULE_EXPORT void change_box_axis_radio(GSimpleAction *action, GVariant *parameter, gpointer data)
handle a box/axis radio menu item signal GTK4
GMenuItem * menu_box_axis(glwin *view, int popm, int ab)
create the 'Model -> Box' and 'View -> Axis' submenus GTK4
G_MODULE_EXPORT void window_bonds(GtkWidget *widg, gpointer data)
create bond(s) configuration window(s) callback GTK3
GMenu * axis_box_style(glwin *view, int popm, int ab, int abs)
create the box/axis '-> Style' submenu GTK4
G_MODULE_EXPORT void box_advanced(GtkWidget *widg, gpointer data)
create the box edition window callback GTK3
G_MODULE_EXPORT void window_lines(GtkWidget *widg, gpointer data)
GMenu * axis_box_param(glwin *view, int popm, int ab, int style)
create the box/axis '-> Length/Width/Radius' submenus GTK4
G_MODULE_EXPORT void show_hide_box_axis(GSimpleAction *action, GVariant *parameter, gpointer data)
handle the 'box/axis' show/hide signal GTK4