atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
w_colors.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-2026 by CNRS and University of Strasbourg */
15
21
22/*
23* This file: 'w_colors.c'
24*
25* Contains:
26*
27
28 - The functions to create the color selection dialogs
29
30*
31* List of functions:
32
33 void update_gradient_widgets (gradient_edition * gradient_win, background * back);
34 void window_color (project * this_proj, glwin * view);
35 void back_position_has_changed (gpointer data, GLfloat v);
36
37 G_MODULE_EXPORT void run_window_color (GtkDialog * win, gint response_id, gpointer data);
38 G_MODULE_EXPORT void to_run_back_color_window (GSimpleAction * action, GVariant * parameter, gpointer data);
39 G_MODULE_EXPORT void to_run_back_color_window (GtkWidget * widg, gpointer data);
40 G_MODULE_EXPORT void to_run_box_color_window (GSimpleAction * action, GVariant * parameter, gpointer data);
41 G_MODULE_EXPORT void to_run_box_color_window (GtkWidget * widg, gpointer data);
42 G_MODULE_EXPORT void to_run_atom_color_window (GSimpleAction * action, GVariant * parameter, gpointer data);
43 G_MODULE_EXPORT void to_run_atom_color_window (GtkWidget * widg, gpointer data);
44 G_MODULE_EXPORT void run_window_color_coord (GtkDialog * win, gint response_id, gpointer data);
45 G_MODULE_EXPORT void window_color_coord (GSimpleAction * action, GVariant * parameter, gpointer data);
46 G_MODULE_EXPORT void window_color_coord (GtkWidget * widg, gpointer data);
47
48 G_MODULE_EXPORT void set_gradient_parameter (GtkWidget * widg, gpointer data);
49 G_MODULE_EXPORT void set_gradient_color (GtkColorChooser * colob, gpointer data);
50 G_MODULE_EXPORT void set_back_position (GtkRange * range, gpointer data);
51 G_MODULE_EXPORT void gradient_advanced (GtkWidget * widg, gpointer data);
52
53 G_MODULE_EXPORT gboolean scroll_set_back_position (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data);
54 G_MODULE_EXPORT gboolean on_gradient_delete (GtkWindow * widg, gpointer data);
55 G_MODULE_EXPORT gboolean on_gradient_delete (GtkWidget * widg, GdkEvent * event, gpointer data);
56
57*/
58
59#include "global.h"
60#include "interface.h"
61#include "project.h"
62#include "glwindow.h"
63#include "glview.h"
64#include "color_box.h"
65#include "preferences.h"
66
67/*
68 The object type for color change
69 -2 : background
70 -1 : box
71 > -1 : coordination
72*/
74
75
85{
86 combo_set_active (gradient_win -> g_box, back -> gradient);
87 int i;
88 GdkRGBA col = colrgba_togtkrgba (back -> color);
89 gtk_color_chooser_set_rgba ((GtkColorChooser *)gradient_win -> col_but, & col);
90 for (i=0; i<2; i++)
91 {
92 col = colrgba_togtkrgba (back -> gradient_color[i]);
93 gtk_color_chooser_set_rgba ((GtkColorChooser *)gradient_win -> grad_but[i], & col);
94 }
95 combo_set_active (gradient_win -> g_box, back -> gradient);
96 if (back -> gradient)
97 {
98 show_the_widgets (gradient_win -> dir);
99 hide_the_widgets (gradient_win -> color_box[0]);
100 show_the_widgets (gradient_win -> color_box[1]);
101 hide_the_widgets (gradient_win -> d_box[(back -> gradient == 2) ? 0 : 1]);
102 show_the_widgets (gradient_win -> d_box[back -> gradient - 1]);
103 combo_set_active (gradient_win -> d_box[back -> gradient - 1], back -> direction);
104 show_the_widgets (gradient_win -> p_box);
105 }
106 else
107 {
108 hide_the_widgets (gradient_win -> dir);
109 show_the_widgets (gradient_win -> color_box[0]);
110 hide_the_widgets (gradient_win -> color_box[1]);
111 for (i=0; i<2; i++) hide_the_widgets (gradient_win -> d_box[i]);
112 hide_the_widgets (gradient_win -> p_box);
113 }
114}
115
125G_MODULE_EXPORT void run_window_color (GtkDialog * win, gint response_id, gpointer data)
126{
127 project * this_proj = (project *)data;
128
129 if (response_id == GTK_RESPONSE_OK)
130 {
131 ColRGBA colo = get_window_color (GTK_WIDGET(win));
132 if (wc_cid == -2)
133 {
134 this_proj -> modelgl -> anim -> last -> img -> back -> color = colo;
135 this_proj -> modelgl -> anim -> last -> img -> back -> gradient = 0;
136 cleaning_shaders (this_proj -> modelgl, BACKG);
137 this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
138 if (this_proj -> modelgl -> gradient_win)
139 {
140 update_gradient_widgets (this_proj -> modelgl -> gradient_win, this_proj -> modelgl -> anim -> last -> img -> back);
141 }
142 }
143 else if (wc_cid == -1)
144 {
145 this_proj -> modelgl -> anim -> last -> img -> abc -> color = colo;
146 this_proj -> modelgl -> create_shaders[MDBOX] = TRUE;
147 }
148 else
149 {
150 this_proj -> modelgl -> anim -> last -> img -> at_color[wc_cid] = colo;
151 int shaders[2] = {ATOMS, BONDS};
152 re_create_md_shaders (2, shaders, this_proj);
153 int shader[1] = {POLYS};
154 if (this_proj -> modelgl -> anim -> last -> img -> color_map[1] == 0) re_create_md_shaders (1, shader, this_proj);
155 }
156 update (this_proj -> modelgl);
157 }
159}
160
169void window_color (project * this_proj, glwin * view)
170{
171 gchar * str;
172 GdkRGBA col;
173 if (wc_cid == -2)
174 {
175 str = g_strdup_printf (_("Background color"));
176 col = colrgba_togtkrgba (view -> anim -> last -> img -> back -> color);
177 }
178 else if (wc_cid == -1)
179 {
180 str = g_strdup_printf (_("Model box color"));
181 col = colrgba_togtkrgba (view -> anim -> last -> img -> abc -> color);
182 }
183 else
184 {
185 if (wc_cid < this_proj -> nspec)
186 {
187 str = g_strdup_printf (_("%s - atom(s) color"), this_proj -> chemistry -> label[wc_cid]);
188 }
189 else
190 {
191 str = g_strdup_printf (_("%s* - clone(s) color"), this_proj -> chemistry -> label[wc_cid-this_proj -> nspec]);
192 }
193 col = colrgba_togtkrgba (view -> anim -> last -> img -> at_color[wc_cid]);
194 }
195 GtkWidget * win = gtk_color_chooser_dialog_new (str, GTK_WINDOW(view -> win));
196 gtk_window_set_modal (GTK_WINDOW(win), TRUE);
197 gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER(win), TRUE);
198 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(win), & col);
199 g_free (str);
200 run_this_gtk_dialog (win, G_CALLBACK(run_window_color), this_proj);
201}
202
203#ifdef GTK4
213G_MODULE_EXPORT void to_run_back_color_window (GSimpleAction * action, GVariant * parameter, gpointer data)
214#else
223G_MODULE_EXPORT void to_run_back_color_window (GtkWidget * widg, gpointer data)
224#endif
225{
226 glwin * view = (glwin *) data;
227 wc_cid = -2;
228 window_color (get_project_by_id(view -> proj), view);
229 update (view);
230}
231
240G_MODULE_EXPORT void set_gradient_color (GtkColorChooser * colob, gpointer data)
241{
242 tint * bid = (tint *)data;
243 glwin * view;
244 if (preferences)
245 {
246 switch (bid -> b)
247 {
248 case 0:
250 break;
251 default:
252 tmp_background -> gradient_color[bid -> b -1] = get_button_color (colob);
253 break;
254 }
255 }
256 else
257 {
258 view = get_project_by_id(bid -> a) -> modelgl;
259 switch (bid -> b)
260 {
261 case 0:
262 view -> anim -> last -> img -> back -> color = get_button_color (colob);
263 break;
264 default:
265 view -> anim -> last -> img -> back -> gradient_color[bid -> b -1] = get_button_color (colob);
266 break;
267 }
268 }
269 if (! preferences)
270 {
271 if (bid -> b)
272 {
273 view -> create_shaders[BACKG] = TRUE;
274 }
275 view -> create_shaders[MEASU] = TRUE;
276 update (view);
277 }
278}
279
288G_MODULE_EXPORT void set_gradient_parameter (GtkWidget * widg, gpointer data)
289{
290 tint * bid = (tint *)data;
291 glwin * view;
292 gradient_edition * the_gradient;
293 background * the_back;
294 int i = combo_get_active (widg);
295 if (preferences)
296 {
297 the_gradient = pref_gradient_win;
298 the_back = tmp_background;
299 switch (bid -> b)
300 {
301 case 0:
302 tmp_background -> gradient = i;
303 tmp_background -> direction = 0;
304 break;
305 case 1:
306 tmp_background -> direction = i;
307 break;
308 }
309 }
310 else
311 {
312 view = get_project_by_id(bid -> a) -> modelgl;
313 the_gradient = view -> gradient_win;
314 the_back = view -> anim -> last -> img -> back;
315 switch (bid -> b)
316 {
317 case 0:
318 view -> anim -> last -> img -> back -> gradient = i;
319 view -> anim -> last -> img -> back -> direction = 0;
320 break;
321 default:
322 view -> anim -> last -> img -> back -> direction = i;
323 break;
324 }
325 }
326
327 update_gradient_widgets (the_gradient, the_back);
328 if (! preferences)
329 {
330 if (! bid -> b && ! i)
331 {
332 cleaning_shaders (view, BACKG);
333 }
334 else
335 {
336 view -> create_shaders[BACKG] = TRUE;
337 }
338 view -> create_shaders[MEASU] = TRUE;
339 update (view);
340 }
341}
342
351void back_position_has_changed (gpointer data, GLfloat v)
352{
353 tint * bid = (tint *)data;
354 if (preferences)
355 {
356 if (v >= 0.0 && v <= 1.0) tmp_background -> position = v;
357 }
358 else
359 {
360 glwin * view = get_project_by_id (bid -> a) -> modelgl;
361 if (v >= 0.0 && v <= 1.0) view -> anim -> last -> img -> back -> position = v;
362 view -> create_shaders[BACKG] = TRUE;
363 update (view);
364 }
365}
366
377G_MODULE_EXPORT gboolean scroll_set_back_position (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data)
378{
379 back_position_has_changed (data, (GLfloat) value);
380 return FALSE;
381}
382
391G_MODULE_EXPORT void set_back_position (GtkRange * range, gpointer data)
392{
393 back_position_has_changed (data, (GLfloat) gtk_range_get_value (range));
394}
395
396#ifdef GTK4
405G_MODULE_EXPORT gboolean on_gradient_delete (GtkWindow * widg, gpointer data)
406#else
416G_MODULE_EXPORT gboolean on_gradient_delete (GtkWidget * widg, GdkEvent * event, gpointer data)
417#endif
418{
419 glwin * view = (glwin *)data;
420 view -> gradient_win -> win = destroy_this_widget (view -> gradient_win -> win);
421 g_free (view -> gradient_win);
422 view -> gradient_win = NULL;
423 return TRUE;
424}
425
434G_MODULE_EXPORT void gradient_advanced (GtkWidget * widg, gpointer data)
435{
436 GtkWidget * hbox, * vbox;
437 GtkWidget * hhbox, * vvbox;
438 gradient_edition * the_gradient;
439 int back_gradient;
440 int back_direction;
441 float back_position;
442 ColRGBA back_color;
443 ColRGBA * gradient_color;
444 glwin * view;
446 if (preferences)
447 {
448 the_gradient = pref_gradient_win;
449 back_gradient = tmp_background -> gradient;
450 back_direction = tmp_background -> direction;
451 back_position = tmp_background -> position;
452 back_color = tmp_background -> color;
453 gradient_color = tmp_background -> gradient_color;
454 }
455 else
456 {
457 view = (glwin *)data;
458 view -> gradient_win = g_malloc0(sizeof*view -> gradient_win);
459 the_gradient = view -> gradient_win;
460 back_gradient = view -> anim -> last -> img -> back -> gradient;
461 back_direction = view -> anim -> last -> img -> back -> direction;
462 back_position = view -> anim -> last -> img -> back -> position;
463 back_color = view -> anim -> last -> img -> back -> color;
464 gradient_color = view -> anim -> last -> img -> back -> gradient_color;
465 }
466 if (preferences)
467 {
468 the_gradient -> win = create_vbox (BSEP);
469 adv_box (the_gradient -> win, _("<b>Background settings</b>"), 5, 120, 0.0);
471 add_box_child_start (GTK_ORIENTATION_VERTICAL, the_gradient -> win, hbox, FALSE, FALSE, 20);
472 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbox, FALSE, FALSE, 60);
473 }
474 else
475 {
476 gchar * str = g_strdup_printf (_("%s - background settings"), get_project_by_id(view -> proj)->name);
477 the_gradient -> win = create_win (str, view -> win, FALSE, FALSE);
478 g_free (str);
479 add_container_child (CONTAINER_WIN, the_gradient -> win, vbox);
480 }
481 int i, j;
482 gchar * g_direction[2][9] = {{i18n("Top to Bottom"), i18n("Right to Left"), i18n("Bottom Right to Top Left"), i18n("Top Right to Bottom Left"), "", "", "", "", ""},
483 {i18n("Right to Left"), i18n("Left to Right"), i18n("Top to Bottom"), i18n("Bottom to Top"),
484 i18n("Bottom Right to Top Left"), i18n("Bottom Left to Top Right"), i18n("Top Right to Bottom Left"), i18n("Top Left to Bottom Right"), i18n("Center")}};
485 int n_val[2] = {4, 9};
486 hbox = abox (vbox, _("Gradient type"), 5);
487 the_gradient -> g_box = create_combo ();
488 combo_text_append (the_gradient -> g_box, _("No Gradient"));
489 combo_text_append (the_gradient -> g_box, _("Linear"));
490 combo_text_append (the_gradient -> g_box, _("Circular"));
491 combo_set_active (the_gradient -> g_box, back_gradient);
492 gtk_widget_set_size_request (the_gradient -> g_box, 200, -1);
493 g_signal_connect (G_OBJECT (the_gradient -> g_box), "changed", G_CALLBACK(set_gradient_parameter), (preferences) ? & pref_pointer[0] : & view -> colorp[0][0]);
494 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, the_gradient -> g_box, FALSE, FALSE, 20);
495
496 the_gradient -> dir = create_vbox (BSEP);
497 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, the_gradient -> dir, FALSE, FALSE, 0);
498
499 hbox = abox (the_gradient -> dir, _("Gradient direction"), 5);
500 for (i=0; i<2; i++)
501 {
502 the_gradient -> d_box[i] = create_combo ();
503 for (j=0; j<n_val[i]; j++)
504 {
505 combo_text_append (the_gradient -> d_box[i], _(g_direction[i][j]));
506 }
507 gtk_widget_set_size_request (the_gradient -> d_box[i], 200, -1);
508 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, the_gradient -> d_box[i], FALSE, FALSE, 20);
509 }
510 if (back_gradient)
511 {
512 combo_set_active (the_gradient -> d_box[back_gradient-1], back_direction);
513 }
514 for (i=0; i<2; i++)
515 {
516 g_signal_connect (G_OBJECT (the_gradient -> d_box[i]), "changed", G_CALLBACK(set_gradient_parameter), (preferences) ? & pref_pointer[1] : & view -> colorp[1][0]);
517 }
518 the_gradient -> color_box[0] = create_vbox (BSEP);
519 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, the_gradient -> color_box[0], FALSE, FALSE, 20);
520 abox (the_gradient -> color_box[0], _("Background color"), 5);
522 add_box_child_start (GTK_ORIENTATION_VERTICAL, the_gradient -> color_box[0], hbox, FALSE, FALSE, 5);
523 vvbox = create_vbox (BSEP);
524 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vvbox, FALSE, FALSE, 60);
525 hhbox = create_hbox (BSEP);
526 add_box_child_start (GTK_ORIENTATION_VERTICAL, vvbox, hhbox, FALSE, FALSE, 0);
527 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hhbox, markup_label (_("Single color"), 150, -1, 0.0, 0.5), FALSE, FALSE, 5);
528 the_gradient -> col_but = color_button (back_color, FALSE, 100, -1, G_CALLBACK(set_gradient_color), (preferences) ? & pref_pointer[0] : & view -> colorp[0][0]);
529 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hhbox, the_gradient -> col_but, FALSE, FALSE, 0);
530
531 the_gradient -> color_box[1] = create_vbox (BSEP);
532 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, the_gradient -> color_box[1], FALSE, FALSE, 20);
533 abox (the_gradient -> color_box[1], _("Gradient colors"), 5);
535 add_box_child_start (GTK_ORIENTATION_VERTICAL, the_gradient -> color_box[1], hbox, FALSE, FALSE, 5);
536 vvbox = create_vbox (BSEP);
537 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vvbox, FALSE, FALSE, 60);
538 gchar * c_name[2] = {i18n("First color"), i18n("Second color")};
539 for (i=0; i<2; i++)
540 {
541 hhbox = create_hbox (BSEP);
542 // g_print ("col.r= %f, col.g= %f, col.b= %f\n", gradient_color[i].red, gradient_color[i].green, gradient_color[i].blue);
543 add_box_child_start (GTK_ORIENTATION_VERTICAL, vvbox, hhbox, FALSE, FALSE, 0);
544 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hhbox, markup_label (_(c_name[i]), 150, -1, 0.0, 0.5), FALSE, FALSE, 5);
545 the_gradient -> grad_but[i] = color_button (gradient_color[i], FALSE, 100, -1, G_CALLBACK(set_gradient_color), (preferences) ? & pref_pointer[i+1] : & view -> colorp[i+1][0]);
546 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hhbox, the_gradient -> grad_but[i], FALSE, FALSE, 0);
547 }
548
549 the_gradient -> p_box = abox (the_gradient -> color_box[1], _("Mixed position"), 5);
550 the_gradient -> p_scale = create_hscale (0.0, 1.0, 0.001, back_position, GTK_POS_TOP, 3, 150, G_CALLBACK(set_back_position), G_CALLBACK(scroll_set_back_position), (preferences) ? & pref_pointer[0] : & view -> colorp[0][0]);
551 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, the_gradient -> p_box, the_gradient -> p_scale, FALSE, FALSE, 20);
552
553 if (! preferences)
554 {
555 add_global_option (vbox, & view -> colorp[3][0]);
556 add_gtk_close_event (the_gradient -> win, G_CALLBACK(on_gradient_delete), view);
557 show_the_widgets (the_gradient -> win);
558 update_gradient_widgets (the_gradient, view -> anim -> last -> img -> back);
559 }
560}
561
562#ifdef GTK4
572G_MODULE_EXPORT void to_run_box_color_window (GSimpleAction * action, GVariant * parameter, gpointer data)
573#else
582G_MODULE_EXPORT void to_run_box_color_window (GtkWidget * widg, gpointer data)
583#endif
584{
585 glwin * view = (glwin *) data;
586 wc_cid = -1;
587 window_color (get_project_by_id(view -> proj), view);
588 view -> create_shaders[MDBOX] = TRUE;
589 update (view);
590}
591
592#ifdef GTK4
602G_MODULE_EXPORT void to_run_atom_color_window (GSimpleAction * action, GVariant * parameter, gpointer data)
603#else
612G_MODULE_EXPORT void to_run_atom_color_window (GtkWidget * widg, gpointer data)
613#endif
614{
615 tint * id = (tint *) data;
616 // g_debug ("Atom color:: proj= %d, id -> b= %d, id -> c= %d", id -> a, id -> b, id -> c);
617 project * this_proj = get_project_by_id(id -> a);
618 wc_cid = id -> c;
619 window_color (this_proj, this_proj -> modelgl);
620 int shaders[3] = {ATOMS, BONDS, SELEC};
621 re_create_md_shaders (3, shaders, this_proj);
622 this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
623 update (this_proj -> modelgl);
624}
625
635G_MODULE_EXPORT void run_window_color_coord (GtkDialog * win, gint response_id, gpointer data)
636{
637 qint * cid = (qint *)data;
638 int c, g, s;
639 project * this_proj = get_project_by_id(cid -> a);
640 s = cid -> b;
641 c = cid -> c;
642 g = cid -> d;
643 if (response_id == GTK_RESPONSE_OK)
644 {
645 if (g > 1) s = 0;
646 this_proj -> modelgl -> anim -> last -> img -> spcolor[g][s][c] = get_window_color (GTK_WIDGET(win));
647 int shaders[4] = {ATOMS, BONDS, POLYS, RINGS};
648 re_create_md_shaders (4, shaders, this_proj);
649 update (this_proj -> modelgl);
650 }
652}
653
654#ifdef GTK4
664G_MODULE_EXPORT void window_color_coord (GSimpleAction * action, GVariant * parameter, gpointer data)
665#else
674G_MODULE_EXPORT void window_color_coord (GtkWidget * widg, gpointer data)
675#endif
676{
677 qint * cid = (qint *)data;
678 gchar * str, * env;
679 int c, g, s;
680 project * this_proj = get_project_by_id(cid -> a);
681 s = cid -> b;
682 c = cid -> c;
683 g = cid -> d;
684 switch (g)
685 {
686 case 0:
687 str = g_strdup_printf (_("%s atom(s) %d fold coordination sphere color"), this_proj -> chemistry -> label[s],
688 this_proj -> coord -> geolist[0][s][c]);
689 break;
690 case 1:
691 env = env_name (this_proj, c, s, 1, NULL);
692 str = g_strdup_printf (_("%s - %s coordination sphere color"), this_proj -> chemistry -> label[s],
694 g_free (env);
695 break;
696 case 2:
697 str = g_strdup_printf (_("Fragment N°%d color"), c);
698 g = s;
699 s = 0;
700 break;
701 case 3:
702 str = g_strdup_printf (_("Molecule N°%d color"), c);
703 g = s;
704 s = 0;
705 break;
706 case 9:
707 str = g_strdup_printf (_("%d atom chain(s) color"), this_proj -> coord -> geolist[g][0][c]);
708 s = 0;
709 break;
710 default:
711 str = g_strdup_printf (_("%s - %d atom ring(s) color"), _(rings_type[s]), this_proj -> coord -> geolist[g][0][c]);
712 s = 0;
713 break;
714 }
715 GtkWidget * win = gtk_color_chooser_dialog_new (str, GTK_WINDOW(this_proj -> modelgl -> win));
716 g_free (str);
717 set_color_chooser_color (win, this_proj -> modelgl -> anim -> last -> img -> spcolor[g][s][c]);
718 gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER(win), TRUE);
719 gtk_window_set_modal ((GtkWindow *)win, TRUE);
720 run_this_gtk_dialog (win, G_CALLBACK(run_window_color_coord), data);
721}
integer(kind=c_int) function chemistry()
Definition chemistry.F90:22
GtkWidget * color_box(glwin *view, int ideo, int spec, int geo)
create the color palette pointers and menus GTK3 version
Definition color_box.c:259
Structure definitions for color management Function declarations for color management.
color colorp[64]
ColRGBA col
Definition d_measures.c:77
GtkWidget * p_box
Definition dlp_edit.c:112
char * rings_type[5]
Definition global.c:147
#define i18n(String)
Definition global.c:80
Global variable declarations Global convenience function declarations Global data structure defin...
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
Definition gtk-misc.c:533
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
Definition gtk-misc.c:935
void set_color_chooser_color(GtkWidget *color_win, ColRGBA col)
set the color of a color selection window
Definition gtk-misc.c:2435
GtkWidget * create_win(gchar *str, GtkWidget *parent, gboolean modal, gboolean resiz)
create a new GtkWindow
Definition gtk-misc.c:486
ColRGBA get_window_color(GtkWidget *color_win)
get the ColRGBA color from a color selection window
Definition gtk-misc.c:2420
project * proj
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
Definition gtk-misc.c:958
GdkRGBA colrgba_togtkrgba(ColRGBA col)
convert ColRGBA color to GdkRGBA color
Definition gtk-misc.c:1721
#define BSEP
Definition global.h:261
void add_gtk_close_event(GtkWidget *widg, GCallback handler, gpointer data)
add a close event signal and callback to a GtkWidget
Definition gtk-misc.c:2557
void add_global_option(GtkWidget *vbox, tint *oid)
add a button to update global user preferences
@ CONTAINER_WIN
Definition global.h:266
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:1010
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
create a GtkLabel with pango markup
Definition gtk-misc.c:1672
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:340
ColRGBA get_button_color(GtkColorChooser *colob)
get the ColRGBA color from a GtkColorChooser button
Definition gtk-misc.c:2406
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
Definition gtk-misc.c:2235
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:849
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:987
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2213
GtkWidget * color_button(ColRGBA col, gboolean alpha, int dimx, int dimy, GCallback handler, gpointer data)
create a color selection button
Definition gtk-misc.c:1833
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:780
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
Definition tools.c:71
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:267
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
Definition gtk-misc.c:224
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:837
GtkWidget * abox(GtkWidget *box, char *lab, int vspace)
box creating routine, to help design faster elements for the GUI
Definition gtk-misc.c:2067
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:202
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:461
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
void re_create_md_shaders(int nshaders, int shaders[nshaders], project *this_proj)
re-initialize some MD dependent OpenGL shaders
action
Definition glview.h:198
void cleaning_shaders(glwin *view, int shader)
re-initialize an OpenGL shader
shaders
The different types of shaders in the atomes program.
Definition glwin.h:88
@ BONDS
Definition glwin.h:90
@ LABEL
Definition glwin.h:98
@ POLYS
Definition glwin.h:92
@ SELEC
Definition glwin.h:91
@ MDBOX
Definition glwin.h:93
@ MEASU
Definition glwin.h:99
@ ATOMS
Definition glwin.h:89
@ RINGS
Definition glwin.h:96
@ BACKG
Definition glwin.h:103
Function declarations for the creation of the OpenGL window.
gchar * env_name(project *this_proj, int g, int s, int f, GtkTextBuffer *buffer)
output the name of a coordination sphere
Definition interface.c:1022
gchar * exact_name(gchar *name)
short cut to print string without spaces
Definition interface.c:434
Messaging function declarations.
position
Definition m_proj.c:48
gradient_edition * pref_gradient_win
tint * pref_pointer
GtkWidget * adv_box(GtkWidget *box, char *lab, int vspace, int size, float xalign)
create a box with markup label
Definition w_advance.c:146
background * tmp_background
gboolean preferences
Preference variable declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...
Definition glwin.h:967
Definition global.h:126
Definition global.h:118
G_MODULE_EXPORT void to_run_back_color_window(GtkWidget *widg, gpointer data)
to run background color selection window callback GTK3
Definition w_colors.c:223
G_MODULE_EXPORT void set_gradient_color(GtkColorChooser *colob, gpointer data)
change background color
Definition w_colors.c:240
G_MODULE_EXPORT void to_run_box_color_window(GtkWidget *widg, gpointer data)
to run box color selection window callback GTK3
Definition w_colors.c:582
int wc_cid
Definition w_colors.c:73
void back_position_has_changed(gpointer data, GLfloat v)
change gradient mixed position
Definition w_colors.c:351
G_MODULE_EXPORT void set_back_position(GtkRange *range, gpointer data)
set gradient mixed position - range callback
Definition w_colors.c:391
G_MODULE_EXPORT gboolean on_gradient_delete(GtkWidget *widg, GdkEvent *event, gpointer data)
gradient window delete event - GTK3
Definition w_colors.c:416
G_MODULE_EXPORT void gradient_advanced(GtkWidget *widg, gpointer data)
Background configuration window.
Definition w_colors.c:434
G_MODULE_EXPORT void set_gradient_parameter(GtkWidget *widg, gpointer data)
set gradient parameter callback
Definition w_colors.c:288
G_MODULE_EXPORT gboolean scroll_set_back_position(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data)
set gradient mixed position - scroll callback
Definition w_colors.c:377
G_MODULE_EXPORT void window_color_coord(GtkWidget *widg, gpointer data)
create a window to select a color callback GTK3
Definition w_colors.c:674
void update_gradient_widgets(gradient_edition *gradient_win, background *back)
update the widgets of the gradient window
Definition w_colors.c:84
G_MODULE_EXPORT void run_window_color(GtkDialog *win, gint response_id, gpointer data)
window color chooser - running the dialog
Definition w_colors.c:125
void window_color(project *this_proj, glwin *view)
window color chooser - creating the dialog
Definition w_colors.c:169
G_MODULE_EXPORT void run_window_color_coord(GtkDialog *win, gint response_id, gpointer data)
window to select a color - running the dialog
Definition w_colors.c:635
G_MODULE_EXPORT void to_run_atom_color_window(GtkWidget *widg, gpointer data)
to run atom color selection window callback GTK3
Definition w_colors.c:612
GtkWidget * hbox
Definition workspace.c:71
GtkWidget * img
Definition workspace.c:70
GtkWidget * vbox
Definition workspace.c:72