atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
w_axis.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2024 by CNRS and University of Strasbourg */
15
22/*
23* This file: 'w_axis.c'
24*
25* Contains:
26*
27
28 - The functions to create the axis parameters edition window
29
30*
31* List of functions:
32
33 G_MODULE_EXPORT gboolean scroll_set_axis_position (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data);
34
35 void activate_pos_box (glwin * view, gboolean val);
36 void init_axis_colors (glwin * view);
37 void axis_position_has_changed (gpointer data, double v);
38
39 G_MODULE_EXPORT void set_axis_template (GtkComboBox * box, gpointer data);
40 G_MODULE_EXPORT void set_axis_combo_style (GtkComboBox * box, gpointer data);
41 G_MODULE_EXPORT void set_show_axis_toggle (GtkCheckButton * but, gpointer data);
42 G_MODULE_EXPORT void set_show_axis_toggle (GtkToggleButton * but, gpointer data);
43 G_MODULE_EXPORT void use_axis_default_positions (GtkCheckButton * but, gpointer data);
44 G_MODULE_EXPORT void use_axis_default_positions (GtkToggleButton * but, gpointer data);
45 G_MODULE_EXPORT void use_axis_default_colors (GtkCheckButton * but, gpointer data);
46 G_MODULE_EXPORT void use_axis_default_colors (GtkToggleButton * but, gpointer data);
47 G_MODULE_EXPORT void set_axis_color (GtkColorChooser * colob, gpointer data);
48 G_MODULE_EXPORT void set_axis_position (GtkRange * range, gpointer data);
49 G_MODULE_EXPORT void set_axis_labels (GtkCheckButton * but, gpointer data);
50 G_MODULE_EXPORT void set_axis_labels (GtkToggleButton * but, gpointer data);
51 G_MODULE_EXPORT void set_axis_title (GtkEntry * entry, gpointer data);
52 G_MODULE_EXPORT void axis_advanced (GSimpleAction * action, GVariant * parameter, gpointer data);
53 G_MODULE_EXPORT void axis_advanced (GtkWidget * widg, gpointer data);
54
55*/
56
57#include "global.h"
58#include "interface.h"
59#include "glview.h"
60#include "glwindow.h"
61
62#define AXIS_STYLES 2
63#define AXIS_TEMPLATES 5
64
65gchar * axis[3] = {"X", "Y", "Z"};
66gchar * axis_style[AXIS_STYLES] = {"Wireframe", "Cylinders"};
67gchar * al[3] = {"% of the window width", "% of the window height", "% of the window depth"};
68gchar * axis_template[AXIS_TEMPLATES] = {"Top Right Corner *", "Top Left Corner *", "Bottom Right Corner *", "Bottom Left Corner *", "Center **"};
69
70double axis_init_color[3][3] = {{0.0, 0.0, 1.0},{0.0, 1.0, 0.0},{1.0, 0.0, 0.0}};
71double axis_range[3][2] = {{0.0,100.0}, {0.0, 100.0}, {0.0, 100.0}};
72
73extern G_MODULE_EXPORT void set_labels_render (GtkWidget * widg, gpointer data);
74extern G_MODULE_EXPORT void set_labels_font (GtkFontButton * fontb, gpointer data);
75#ifdef GTK4
76extern G_MODULE_EXPORT void set_labels_scale (GtkCheckButton * but, gpointer data);
77#else
78extern G_MODULE_EXPORT void set_labels_scale (GtkToggleButton * but, gpointer data);
79#endif
80extern G_MODULE_EXPORT void update_bond_parameter (GtkEntry * res, gpointer data);
81
82GtkWidget * axis_data = NULL;
84GtkWidget * templates;
85GtkWidget * styles = NULL;
86GtkWidget * width_box;
87GtkWidget * radius_box;
88GtkWidget * axis_color_title[3];
89GtkWidget * ax_title[3];
90
99void activate_pos_box (glwin * view, gboolean val)
100{
101 int i;
102 if (val)
103 {
104 i = view -> anim -> last -> img -> axispos;
105 }
106 else
107 {
108 i = NONE;
109 }
110 gtk_combo_box_set_active (GTK_COMBO_BOX(templates), i);
112}
113
122G_MODULE_EXPORT void set_axis_template (GtkComboBox * box, gpointer data)
123{
124 glwin * view = (glwin *)data;
125 int i = gtk_combo_box_get_active (box);
126#ifdef GTK4
127 view -> anim -> last -> img -> axispos = i;
128 view -> create_shaders[MAXIS] = TRUE;
129 update (view);
130#else
131 // GTK3 Menu Action To Check
132 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][8+i], TRUE);
133#endif
134}
135
144G_MODULE_EXPORT void set_axis_combo_style (GtkComboBox * box, gpointer data)
145{
146 glwin * view = (glwin *)data;
147 switch (gtk_combo_box_get_active (box))
148 {
149 case 0:
150 view -> anim -> last -> img -> box_axis[1] = WIREFRAME;
153#ifdef GTK3
154 // GTK3 Menu Action To Check
155 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][1], TRUE);
156#endif
157 break;
158 case 1:
159 view -> anim -> last -> img -> box_axis[1] = CYLINDERS;
162#ifdef GTK3
163 // GTK3 Menu Action To Check
164 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][2], TRUE);
165#endif
166 break;
167 }
168#ifdef GTK4
169 view -> create_shaders[MAXIS] = TRUE;
170 update (view);
171#endif
172}
173
174#ifdef GTK4
183G_MODULE_EXPORT void set_show_axis_toggle (GtkCheckButton * but, gpointer data)
184#else
193G_MODULE_EXPORT void set_show_axis_toggle (GtkToggleButton * but, gpointer data)
194#endif
195{
196 gboolean val;
197 glwin * view = (glwin *)data;
198#ifdef GTK4
199 val = gtk_check_button_get_active (but);
200#else
201 val = gtk_toggle_button_get_active (but);
202#endif
203 if (val)
204 {
205#ifdef GTK4
206 // set_box_axis_style ? then what about the menu items ... refresh the menu !
207 view -> anim -> last -> img -> box_axis[1] = WIREFRAME;
208#else
209 // GTK3 Menu Action To Check
210 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][0], TRUE);
211#endif
212 if (GTK_IS_WIDGET(styles) && styles != NULL) gtk_combo_box_set_active (GTK_COMBO_BOX(styles), WIREFRAME-1);
213 }
214 else
215 {
216#ifdef GTK4
217 // set_box_axis_style ? then what about the menu items ... refresh the menu !
218 view -> anim -> last -> img -> box_axis[1] = NONE;
219#else
220 // GTK3 Menu Action To Check
221 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][0], FALSE);
222#endif
223 if (GTK_IS_WIDGET(styles) && styles != NULL) gtk_combo_box_set_active (GTK_COMBO_BOX(styles), NONE);
224 }
226#ifdef GTK4
227 view -> create_shaders[MAXIS] = TRUE;
228 update (view);
229#endif
230}
231
232#ifdef GTK4
241G_MODULE_EXPORT void use_axis_default_positions (GtkCheckButton * but, gpointer data)
242#else
251G_MODULE_EXPORT void use_axis_default_positions (GtkToggleButton * but, gpointer data)
252#endif
253{
254 gboolean val;
255 glwin * view = (glwin *)data;
256#ifdef GTK4
257 val = gtk_check_button_get_active (but);
258#else
259 val = gtk_toggle_button_get_active (but);
260#endif
262 if (val)
263 {
264#ifdef GTK4
265 view -> anim -> last -> img -> axispos = 2;
266#else
267 // GTK3 Menu Action To Check
268 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][10], TRUE);
269#endif
270 }
271 else
272 {
273 view -> anim -> last -> img -> axispos = CUSTOM;
274 int i;
275 for (i=8; i<OGL_AXIS; i++)
276 {
277#ifdef GTK3
278 // GTK3 Menu Action To Check
279 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)view -> ogl_box_axis[1][i], FALSE);
280#endif
281 }
282 }
283 activate_pos_box (view, val);
284 view -> create_shaders[MAXIS] = TRUE;
285 update (view);
286 // Update menu_bar
287}
288
297{
298 int i;
299 for (i = 0; i < 3; i++)
300 {
301 view -> anim -> last -> img -> axis_color[i].red = axis_init_color[i][0];
302 view -> anim -> last -> img -> axis_color[i].green = axis_init_color[i][1];
303 view -> anim -> last -> img -> axis_color[i].blue = axis_init_color[i][2];
304 view -> anim -> last -> img -> axis_color[i].alpha = 1.0;
305 GdkRGBA col = colrgba_togtkrgba (view -> anim -> last -> img -> axis_color[i]);
306 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(axis_color_title[i]), & col);
307 }
308}
309
310#ifdef GTK4
319G_MODULE_EXPORT void use_axis_default_colors (GtkCheckButton * but, gpointer data)
320#else
329G_MODULE_EXPORT void use_axis_default_colors (GtkToggleButton * but, gpointer data)
330#endif
331{
332 int i;
333 gboolean val;
334#ifdef GTK4
335 val = gtk_check_button_get_active (but);
336#else
337 val = gtk_toggle_button_get_active (but);
338#endif
339 glwin * view = (glwin *)data;
340 if (val)
341 {
342 if (view -> anim -> last -> img -> axis_color != NULL)
343 {
344 init_axis_colors (view);
345 g_free (view -> anim -> last -> img -> axis_color);
346 }
347 view -> anim -> last -> img -> axis_color = NULL;
348 }
349 else
350 {
351 view -> anim -> last -> img -> axis_color = g_malloc (3*sizeof*view -> anim -> last -> img -> axis_color);
352 init_axis_colors (view);
353 }
354 for (i=0; i<3; i++) widget_set_sensitive (axis_color_title[i], ! val);
355 view -> create_shaders[MAXIS] = TRUE;
356 update (view);
357}
358
367G_MODULE_EXPORT void set_axis_color (GtkColorChooser * colob, gpointer data)
368{
369 tint * dat = (tint *)data;
370 glwin * view = get_project_by_id(dat -> a) -> modelgl;
371 view -> anim -> last -> img -> axis_color[dat -> b] = get_button_color (colob);
372 view -> create_shaders[MAXIS] = TRUE;
373 update (view);
374}
375
384void axis_position_has_changed (gpointer data, double v)
385{
386 tint * dat = (tint *)data;
387 glwin * view = get_project_by_id(dat -> a) -> modelgl;
388 if (v >= 0.0 && v <= 100.0) view -> anim -> last -> img -> axis_pos[dat -> b] = v;
389 view -> create_shaders[MAXIS] = TRUE;
390 update (view);
391}
392
403G_MODULE_EXPORT gboolean scroll_set_axis_position (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data)
404{
405 axis_position_has_changed (data, value);
406 return FALSE;
407}
408
417G_MODULE_EXPORT void set_axis_position (GtkRange * range, gpointer data)
418{
419 axis_position_has_changed (data, gtk_range_get_value (range));
420}
421
422#ifdef GTK4
431G_MODULE_EXPORT void set_axis_labels (GtkCheckButton * but, gpointer data)
432#else
441G_MODULE_EXPORT void set_axis_labels (GtkToggleButton * but, gpointer data)
442#endif
443{
444 int i;
445 gboolean val;
446 glwin * view = (glwin *)data;
447#ifdef GTK4
448 val = gtk_check_button_get_active (but);
449#else
450 val = gtk_toggle_button_get_active (but);
451#endif
452 view -> anim -> last -> img -> axis_labels = val;
453 for (i=0; i<3; i++) widget_set_sensitive (ax_title[i], val);
454 view -> create_shaders[MAXIS] = TRUE;
455 update (view);
456}
457
466G_MODULE_EXPORT void set_axis_title (GtkEntry * entry, gpointer data)
467{
468 tint * dat = (tint *)data;
469 glwin * view = get_project_by_id(dat ->a) -> modelgl;
470 const gchar * m = entry_get_text (entry);
471 g_free (view -> anim -> last -> img -> axis_title[dat -> b]);
472 view -> anim -> last -> img -> axis_title[dat -> b] = g_strdup_printf ("%s", m);
473 view -> create_shaders[MAXIS] = TRUE;
474 update (view);
475}
476
477#ifdef GTK4
487G_MODULE_EXPORT void axis_advanced (GSimpleAction * action, GVariant * parameter, gpointer data)
488#else
497G_MODULE_EXPORT void axis_advanced (GtkWidget * widg, gpointer data)
498#endif
499{
500 glwin * view = (glwin *)data;
502 GtkWidget * win = dialogmodal ("Advanced axis settings", GTK_WINDOW(view -> win));
503 GtkWidget * vbox = dialog_get_content_area (win);
504 GtkWidget * box;
505 int i;
506 gboolean ac;
507 if (view -> anim -> last -> img -> box_axis[AXIS] != NONE)
508 {
509 ac = TRUE;
510 }
511 else
512 {
513 ac = FALSE;
514 }
515 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, check_button ("Show / hide axis", 100, 40, ac, G_CALLBACK(set_show_axis_toggle), data), FALSE, FALSE, 0);
516
518 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, axis_data, TRUE, TRUE, 0);
520
521 GtkWidget * pos_box = create_hbox (0);
522 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_data, pos_box, FALSE, FALSE, 0);
523 //add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_data, pos_box, TRUE, TRUE, 0);
524 if (view -> anim -> last -> img -> axispos != CUSTOM)
525 {
526 ac = TRUE;
527 }
528 else
529 {
530 ac = FALSE;
531 }
532 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, pos_box,
533 check_button ("Use template positions:", 120, 40, ac,
534 G_CALLBACK(use_axis_default_positions), data), FALSE, FALSE, 0);
536 for (i=0; i < AXIS_TEMPLATES; i++)
537 {
539 }
540 activate_pos_box (view, ac);
541 gtk_widget_set_size_request (templates, 150, -1);
542 g_signal_connect (G_OBJECT (templates), "changed", G_CALLBACK(set_axis_template), data);
543 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, pos_box, templates, FALSE, FALSE, 10);
544
545 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_data, markup_label("\t\t* In front of the atomic model", -1, -1, 0.0, 0.5), FALSE, TRUE, 3);
546 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_data, markup_label("\t\t** Inside the atomic model", -1, -1, 0.0, 0.5), FALSE, TRUE, 3);
547
548 GtkWidget * chbox;
549 GtkWidget * ax_name;
551 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_data, axis_position_box, FALSE, FALSE, 0);
552 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_position_box,
553 markup_label("Please choose axis position:", -1, -1, 0.0, 0.5), FALSE, TRUE, 5);
554
555 // use custom position
556 for (i=0; i<2; i++)
557 {
558 chbox = create_hbox (0);
559 ax_name = gtk_label_new (axis[i]);
560 gtk_widget_set_size_request (ax_name, 20, -1);
561 gtk_label_align (ax_name, 0.5, 0.5);
562 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox, ax_name, FALSE, TRUE, 0);
563 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox, create_hscale (axis_range[i][0], axis_range[i][1], 1.0,
564 view -> anim -> last -> img -> axis_pos[i],
565 GTK_POS_LEFT, 0, 170, G_CALLBACK(set_axis_position),
566 G_CALLBACK(scroll_set_axis_position), & view -> colorp[i][0]),
567 FALSE, TRUE, 0);
568 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_position_box, chbox, FALSE, TRUE, 5);
569 ax_name = gtk_label_new (al[i]);
570 gtk_label_align (ax_name, -1, 0.5);
571 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox, ax_name, FALSE, TRUE, 0);
572 }
574
575 box = abox (axis_data, "Length [Å]: ", 0);
576 GtkWidget * length = create_entry (G_CALLBACK(update_bond_parameter), 150, 10, FALSE, (gpointer)GINT_TO_POINTER(-5));
577 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, length, FALSE, FALSE, 0);
578 update_entry_double (GTK_ENTRY(length), view -> anim -> last -> img -> axis_length);
579
580 box = abox (axis_data, "Style: ", 0);
581 styles = create_combo ();
582 for (i=0; i<AXIS_STYLES; i++)
583 {
585 }
586 if (view -> anim -> last -> img -> box_axis[AXIS] == NONE) i = NONE;
587 if (view -> anim -> last -> img -> box_axis[AXIS] == WIREFRAME) i = 0;
588 if (view -> anim -> last -> img -> box_axis[AXIS] == CYLINDERS) i = 1;
589 gtk_combo_box_set_active (GTK_COMBO_BOX(styles), i);
590 gtk_widget_set_size_request (styles, 150, -1);
591 g_signal_connect (G_OBJECT (styles), "changed", G_CALLBACK(set_axis_combo_style), data);
592 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, styles, FALSE, FALSE, 0);
593
594 width_box = abox (axis_data, "Line width [pts]: ", 0);
595 GtkWidget * width = create_entry (G_CALLBACK(update_bond_parameter), 100, 10, FALSE, (gpointer)GINT_TO_POINTER(-4));
596 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, width_box, width, FALSE, FALSE, 0);
597 update_entry_double (GTK_ENTRY(width), view -> anim -> last -> img -> box_axis_line[AXIS]);
598 radius_box = abox (axis_data, "Cylinder radius [Å]: ", 0);
599 GtkWidget * radius = create_entry (G_CALLBACK(update_bond_parameter), 100, 10, FALSE, (gpointer)GINT_TO_POINTER(-4));
600 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, radius_box, radius, FALSE, FALSE, 0);
601 update_entry_double (GTK_ENTRY(radius), view -> anim -> last -> img -> box_axis_rad[AXIS]);
602
603 // Labels
604 box = abox (axis_data, "Labels:", 0);
605 GtkWidget * lab_box = create_vbox (BSEP);
606 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_data, lab_box, FALSE, FALSE, 0);
607 add_box_child_start (GTK_ORIENTATION_VERTICAL, lab_box,
608 check_button ("Label axis", 100, 40,
609 view -> anim -> last -> img -> axis_labels,
610 G_CALLBACK(set_axis_labels), data), FALSE, FALSE, 0);
611
612 GtkWidget * axis_label_box = create_vbox (BSEP);
613 add_box_child_start (GTK_ORIENTATION_VERTICAL, lab_box, axis_label_box, FALSE, FALSE, 0);
614 box = abox (axis_label_box, "Rendering: ", 0);
615 GtkWidget * config = create_combo ();
616 combo_text_append (config, "Basic text");
617 combo_text_append (config, "Highlighted");
618 gtk_combo_box_set_active (GTK_COMBO_BOX(config), view -> anim -> last -> img -> labels_render[2]);
619 gtk_widget_set_size_request (config, 150, -1);
620 g_signal_connect (G_OBJECT (config), "changed", G_CALLBACK(set_labels_render), & view -> colorp[2][0]);
621 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, config, FALSE, FALSE, 0);
622 box = abox (axis_label_box, "Font:", 0);
623 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box,
624 font_button(view -> anim -> last -> img -> labels_font[2], 150, 30, G_CALLBACK(set_labels_font), & view -> colorp[2][0]),
625 FALSE, FALSE, 0);
626 // Size / scale
627 box = abox (axis_label_box, "Size:", 0);
628 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box,
629 check_button ("scale with zoom in/out", 150, -1, view -> anim -> last -> img -> labels_scale[2], G_CALLBACK(set_labels_scale), & view -> colorp[2][0]),
630 FALSE, FALSE, 10);
631
632 // Colors
633 box = abox (axis_data, "Color:", 0);
634
635 GtkWidget * col_box = create_vbox (BSEP);
636 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_data, col_box, FALSE, FALSE, 0);
637 if ( view -> anim -> last -> img -> axis_color == NULL)
638 {
639 ac = TRUE;
640 }
641 else
642 {
643 ac = FALSE;
644 }
645 add_box_child_start (GTK_ORIENTATION_VERTICAL, col_box, check_button ("Use base colors", 100, 40, ac,
646 G_CALLBACK(use_axis_default_colors), data), FALSE, FALSE, 0);
647 GtkWidget * axis_param_box = create_vbox (BSEP);
648 for (i=0; i<3; i++)
649 {
650 chbox = create_hbox (0);
651 ax_title[i] = create_entry (G_CALLBACK(set_axis_title), 80, 10, FALSE, & view -> colorp[i][0]);
652 update_entry_text (GTK_ENTRY(ax_title[i]), view -> anim -> last -> img -> axis_title[i]);
653 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox, ax_title[i], FALSE, FALSE, 20);
654 widget_set_sensitive (ax_title[i], view -> anim -> last -> img -> axis_labels);
655 if ( view -> anim -> last -> img -> axis_color != NULL)
656 {
657 axis_color_title[i] = color_button (view -> anim -> last -> img -> axis_color[i], TRUE, 80, -1, G_CALLBACK(set_axis_color), & view -> colorp[i][0]);
658 }
659 else
660 {
661 ColRGBA col;
662 col.red = axis_init_color[i][0];
663 col.green = axis_init_color[i][1];
664 col.blue = axis_init_color[i][2];
665 col.alpha = 1.0;
666 axis_color_title[i] = color_button (col, TRUE, 80, -1, G_CALLBACK(set_axis_color), & view -> colorp[i][0]);
667 }
668 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox, axis_color_title[i], FALSE, FALSE, 0);
670 add_box_child_start (GTK_ORIENTATION_VERTICAL, axis_param_box, chbox, FALSE, FALSE, 0);
671
672 }
673 add_box_child_start (GTK_ORIENTATION_VERTICAL, col_box, axis_param_box, FALSE, FALSE, 0);
674
675 g_signal_connect (G_OBJECT(win), "response", G_CALLBACK(run_destroy_dialog), NULL);
676 show_the_widgets (win);
677 if (view -> anim -> last -> img -> box_axis[AXIS] == CYLINDERS)
678 {
680 }
681 else
682 {
684 }
685 dialog_id ++;
686 Event_loop[dialog_id] = g_main_loop_new (NULL, FALSE);
687 g_main_loop_run (Event_loop[dialog_id]);
688#ifdef GTK4
689 update_menu_bar (view);
690#endif
691 styles = NULL;
692 axis_data = NULL;
693}
color colorp[64]
ColRGBA col
Definition d_measures.c:77
float val
Definition dlp_init.c:117
int dialog_id
Definition global.c:167
GMainLoop * Event_loop[5]
Definition global.c:178
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1314
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
Definition gtk-misc.c:633
GtkWidget * font_button(gchar *font, int dimx, int dimy, GCallback handler, gpointer data)
create a font selection button
Definition gtk-misc.c:1750
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
Definition gtk-misc.c:510
gboolean is_the_widget_visible(GtkWidget *widg)
test if a GtkWidget exist, then return if it is visible or not
Definition gtk-misc.c:714
project * proj
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
Definition gtk-misc.c:597
GdkRGBA colrgba_togtkrgba(ColRGBA col)
convert ColRGBA color to GdkRGBA color
Definition gtk-misc.c:1634
#define BSEP
Definition global.h:245
void opengl_project_changed(int id)
change the OpenGL project
Definition update_p.c:245
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1799
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:923
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
Definition gtk-misc.c:825
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
Definition gtk-misc.c:1585
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
Definition gtk-misc.c:299
ColRGBA get_button_color(GtkColorChooser *colob)
get the ColRGBA color from a GtkColorChooser button
Definition gtk-misc.c:2236
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:206
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:813
void gtk_label_align(GtkWidget *lab, float ax, float ay)
set text alignment in a GtkLabel
Definition gtk-misc.c:701
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:900
G_MODULE_EXPORT void run_destroy_dialog(GtkDialog *dialog, gint response_id, gpointer data)
to destroy a GtkDialog when the dialog emit the closing signal
Definition gtk-misc.c:2102
GtkWidget * color_button(ColRGBA col, gboolean alpha, int dimx, int dimy, GCallback handler, gpointer data)
create a color selection button
Definition gtk-misc.c:1728
GtkWidget * create_hscale(float min, float max, float delta, float val, int pos, int round, int size, GCallback handler, GCallback scroll_handler, gpointer data)
create an horizontal scale GtkWidget
Definition gtk-misc.c:744
void update_entry_text(GtkEntry *entry, gchar *text)
update the content of a GtkEntry as string
Definition gtk-misc.c:671
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
Definition gtk-misc.c:189
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:801
GtkWidget * abox(GtkWidget *box, char *lab, int vspace)
box creating routine, to help design faster elements for the GUI
Definition gtk-misc.c:1912
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:173
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
void update(glwin *view)
update the rendering of the OpenGL window
Definition glview.c:439
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
@ CUSTOM
Definition glview.h:210
action
Definition glview.h:189
styles
Definition glview.h:171
@ CYLINDERS
Definition glview.h:177
@ WIREFRAME
Definition glview.h:174
@ NONE
Definition glview.h:172
#define AXIS
Definition glwin.h:55
@ MAXIS
Definition glwin.h:94
#define OGL_AXIS
Definition glwin.h:59
Function declarations for the creation of the OpenGL window.
Messaging function declarations.
float blue
Definition global.h:124
float alpha
Definition global.h:125
float red
Definition global.h:122
float green
Definition global.h:123
Definition glwin.h:875
Definition global.h:104
int b
Definition tab-1.c:95
int a
Definition tab-1.c:95
GtkWidget * axis_title
Definition tab-4.c:101
G_MODULE_EXPORT void set_labels_font(GtkFontButton *fontb, gpointer data)
change label(s) font
Definition w_labels.c:232
GtkWidget * axis_data
Definition w_axis.c:82
double axis_range[3][2]
Definition w_axis.c:71
gchar * axis_template[AXIS_TEMPLATES]
Definition w_axis.c:68
GtkWidget * ax_title[3]
Definition w_axis.c:89
G_MODULE_EXPORT void set_axis_title(GtkEntry *entry, gpointer data)
set axis title callback
Definition w_axis.c:466
#define AXIS_TEMPLATES
Definition w_axis.c:63
G_MODULE_EXPORT void update_bond_parameter(GtkEntry *res, gpointer data)
update bond parameter callback
Definition w_bonds.c:59
G_MODULE_EXPORT gboolean scroll_set_axis_position(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data)
change axis position - scroll callback
Definition w_axis.c:403
gchar * axis_style[AXIS_STYLES]
Definition w_axis.c:66
GtkWidget * width_box
Definition w_axis.c:86
G_MODULE_EXPORT void use_axis_default_positions(GtkToggleButton *but, gpointer data)
use axis default colors callback GTK3
Definition w_axis.c:251
G_MODULE_EXPORT void set_labels_render(GtkWidget *widg, gpointer data)
GtkWidget * radius_box
Definition w_axis.c:87
void axis_position_has_changed(gpointer data, double v)
change axis position
Definition w_axis.c:384
GtkWidget * axis_color_title[3]
Definition w_axis.c:88
gchar * al[3]
Definition w_axis.c:67
G_MODULE_EXPORT void set_axis_combo_style(GtkComboBox *box, gpointer data)
set axis style callback
Definition w_axis.c:144
void init_axis_colors(glwin *view)
initialize axis colors
Definition w_axis.c:296
G_MODULE_EXPORT void set_show_axis_toggle(GtkToggleButton *but, gpointer data)
show / hide axis callback GTK3
Definition w_axis.c:193
G_MODULE_EXPORT void axis_advanced(GtkWidget *widg, gpointer data)
create the axis advanced parameters window callback GTK3
Definition w_axis.c:497
#define AXIS_STYLES
Definition w_axis.c:62
GtkWidget * axis_position_box
Definition w_axis.c:83
gchar * axis[3]
Definition w_axis.c:65
G_MODULE_EXPORT void set_axis_color(GtkColorChooser *colob, gpointer data)
change axis color
Definition w_axis.c:367
G_MODULE_EXPORT void set_axis_template(GtkComboBox *box, gpointer data)
set axis position callback
Definition w_axis.c:122
G_MODULE_EXPORT void set_labels_scale(GtkToggleButton *but, gpointer data)
change label(s) scale - toggle callback GTK3
Definition w_labels.c:356
GtkWidget * templates
Definition w_axis.c:84
G_MODULE_EXPORT void use_axis_default_colors(GtkToggleButton *but, gpointer data)
use axis default color callback GTK3
Definition w_axis.c:329
void activate_pos_box(glwin *view, gboolean val)
update axis position data
Definition w_axis.c:99
G_MODULE_EXPORT void set_axis_labels(GtkToggleButton *but, gpointer data)
set axis labels callback GTK3
Definition w_axis.c:441
G_MODULE_EXPORT void set_axis_position(GtkRange *range, gpointer data)
change axis position - range callback
Definition w_axis.c:417
double axis_init_color[3][3]
Definition w_axis.c:70
GtkWidget * res[2]
Definition w_encode.c:212
GtkWidget * img
Definition workspace.c:70
GtkWidget * vbox
Definition workspace.c:72