atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
w_labels.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
23/*
24* This file: 'w_labels.c'
25*
26* Contains:
27*
28
29 - The functions to create the 'atomic labels' tab of the atom(s) / clone(s) advanced configuration window
30 - The functions to create the measure labels window of the 'Measures' window
31
32*
33* List of functions:
34
35 G_MODULE_EXPORT gboolean scroll_set_label_shift (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data);
36 G_MODULE_EXPORT gboolean scroll_set_measure_factor (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data);
37 G_MODULE_EXPORT gboolean scroll_set_measure_width (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data);
38
39 void init_labels_colors (image * img, int sp, int id);
40 void label_shift_has_changed (gpointer data, double value);
41 void mesure_factor_has_changed (gpointer data, double value);
42 void measure_width_has_changed (gpointer data, double value);
43
44 G_MODULE_EXPORT void set_measure_style (GtkComboBox * box, gpointer data);
45 G_MODULE_EXPORT void set_labels_format (GtkComboBox * box, gpointer data);
46 G_MODULE_EXPORT void set_labels_render (GtkComboBox * box, gpointer data);
47 G_MODULE_EXPORT void use_atom_default_colors (GtkCheckButton * but, gpointer data);
48 G_MODULE_EXPORT void use_atom_default_colors (GtkToggleButton * but, gpointer data);
49 G_MODULE_EXPORT void set_labels_font (GtkFontButton * fontb, gpointer data);
50 G_MODULE_EXPORT void set_label_color (GtkColorChooser * colob, gpointer data);
51 G_MODULE_EXPORT void set_labels_position (GtkComboBox * box, gpointer data);
52 G_MODULE_EXPORT void set_label_shift (GtkRange * range, gpointer data);
53 G_MODULE_EXPORT void set_labels_scale (GtkCheckButton * but, gpointer data);
54 G_MODULE_EXPORT void set_labels_scale (GtkToggleButton * but, gpointer data);
55 G_MODULE_EXPORT void set_labels_tilt (GtkComboBox * box, gpointer data);
56 G_MODULE_EXPORT void set_measure_factor (GtkRange * range, gpointer data);
57 G_MODULE_EXPORT void set_measure_width (GtkRange * range, gpointer data);
58 G_MODULE_EXPORT void enable_lines (GtkCheckButton * but, gpointer data);
59 G_MODULE_EXPORT void enable_lines (GtkToggleButton * but, gpointer data);
60
61 GtkWidget * labels_tab (glwin * view, int id);
62
63*/
64
65#include "global.h"
66#include "interface.h"
67#include "glview.h"
68#include "glwindow.h"
69
70#define LABEL_FORMATS 4
71
72gchar * lab_formats[LABEL_FORMATS] = {"Element name", "Atomic symbol", "Atomic symbol + ID number", "ID number"};
73
74GtkWidget * atom_color_box;
75GtkWidget ** color_title;
76GtkWidget * tilt;
77
86G_MODULE_EXPORT void set_measure_style (GtkComboBox * box, gpointer data)
87{
88 tint * id = (tint *) data;
89 project * this_proj = get_project_by_id(id -> a);
90 this_proj -> modelgl -> anim -> last -> img -> mpattern = gtk_combo_box_get_active (box);
91 this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
92 update (this_proj -> modelgl);
93}
94
103G_MODULE_EXPORT void set_labels_format (GtkComboBox * box, gpointer data)
104{
105 tint * id = (tint *) data;
106 int i = gtk_combo_box_get_active (box);
107 project * this_proj = get_project_by_id(id -> a);
108 if (i != this_proj -> modelgl -> anim -> last -> img -> labels_format[id -> b])
109 {
110 this_proj -> modelgl -> anim -> last -> img -> labels_format[id -> b] = i;
111 if (id -> b < 2) this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
112 if (id -> b == 3 || id -> b == 4) this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
113 update (this_proj -> modelgl);
114 }
115}
116
125G_MODULE_EXPORT void set_labels_render (GtkComboBox * box, gpointer data)
126{
127 tint * id = (tint *) data;
128 int i = gtk_combo_box_get_active (box);
129 project * this_proj = get_project_by_id(id -> a);
130 if (i != this_proj -> modelgl -> anim -> last -> img -> labels_render[id -> b])
131 {
132 this_proj -> modelgl -> anim -> last -> img -> labels_render[id -> b] = i;
133 if (id -> b < 2)
134 {
135 this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
136 }
137 else if (id -> b == 2)
138 {
139 this_proj -> modelgl -> create_shaders[MAXIS] = TRUE;
140 }
141 else if (id -> b == 3 || id -> b == 4)
142 {
143 gtk_combo_box_set_active (GTK_COMBO_BOX(tilt), this_proj -> modelgl -> anim -> last -> img -> mtilt);
144 this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
145 }
146 update (this_proj -> modelgl);
147 }
148}
149
159void init_labels_colors (image * img, int sp, int id)
160{
161 int i;
162 for (i = 0; i < sp; i++)
163 {
164 img -> labels_color[id][i].red = img -> at_color[i+id*sp].red;
165 img -> labels_color[id][i].green = img -> at_color[i+id*sp].green;
166 img -> labels_color[id][i].blue = img -> at_color[i+id*sp].blue;
167 img -> labels_color[id][i].alpha = 1.0;
168 GdkRGBA col = colrgba_togtkrgba (img -> labels_color[id][i]);
169 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(color_title[i]), & col);
170 }
171}
172
173#ifdef GTK4
182G_MODULE_EXPORT void use_atom_default_colors (GtkCheckButton * but, gpointer data)
183#else
192G_MODULE_EXPORT void use_atom_default_colors (GtkToggleButton * but, gpointer data)
193#endif
194{
195 tint * id = (tint *) data;
196 project * this_proj = get_project_by_id(id -> a);
197 int b = id -> b;
198 gboolean val;
199#ifdef GTK4
200 val = gtk_check_button_get_active (but);
201#else
202 val = gtk_toggle_button_get_active (but);
203#endif
204 if (val)
205 {
206 if (this_proj -> modelgl -> anim -> last -> img -> labels_color[b] != NULL)
207 {
208 init_labels_colors (this_proj -> modelgl -> anim -> last -> img, this_proj -> nspec, b);
209 g_free (this_proj -> modelgl -> anim -> last -> img -> labels_color[b]);
210 }
211 this_proj -> modelgl -> anim -> last -> img -> labels_color[b] = NULL;
212 }
213 else
214 {
215 this_proj -> modelgl -> anim -> last -> img -> labels_color[b] = g_malloc (2*this_proj -> nspec
216 *sizeof*this_proj -> modelgl -> anim -> last -> img -> labels_color[b]);
217 init_labels_colors (this_proj -> modelgl -> anim -> last -> img, this_proj -> nspec, b);
218 }
220 this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
221 update (this_proj -> modelgl);
222}
223
232G_MODULE_EXPORT void set_labels_font (GtkFontButton * fontb, gpointer data)
233{
234 tint * id = (tint *) data;
235 project * this_proj = get_project_by_id(id -> a);
236 g_free (this_proj -> modelgl -> anim -> last -> img -> labels_font[id -> b]);
237 this_proj -> modelgl -> anim -> last -> img -> labels_font[id -> b] = g_strdup_printf ("%s", gtk_font_chooser_get_font (GTK_FONT_CHOOSER(fontb)));
238 if (id -> b < 2)
239 {
240 this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
241 }
242 else if (id -> b == 2)
243 {
244 this_proj -> modelgl -> create_shaders[MAXIS] = TRUE;
245 }
246 else if (id -> b == 3 || id -> b == 4)
247 {
248 this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
249 }
250 update (this_proj -> modelgl);
251}
252
261G_MODULE_EXPORT void set_label_color (GtkColorChooser * colob, gpointer data)
262{
263 tint * id = (tint *) data;
264 project * this_proj = get_project_by_id(id -> a);
265 this_proj -> modelgl -> anim -> last -> img -> labels_color[id -> b][id -> c] = get_button_color (colob);
266 if (id -> b < 2) this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
267 if (id -> b == 3 || id -> b == 4) this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
268 update (this_proj -> modelgl);
269}
270
279G_MODULE_EXPORT void set_labels_position (GtkComboBox * box, gpointer data)
280{
281 tint * id = (tint *) data;
282 project * this_proj = get_project_by_id(id -> a);
283 this_proj -> modelgl -> anim -> last -> img -> labels_position[id -> b] = gtk_combo_box_get_active (box);
284 if (id -> b < 2) this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
285 if (id -> b == 3 || id -> b == 4) this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
286 update (this_proj -> modelgl);
287}
288
297void label_shift_has_changed (gpointer data, double value)
298{
299 tint * id = (tint *) data;
300 project * this_proj = get_project_by_id(id -> a);
301 int i = id -> b / 10;
302 int j = id -> b - i * 10;
303 this_proj -> modelgl -> anim -> last -> img -> labels_shift[i][j] = value;
304 if (id -> b < 2) this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
305 update (this_proj -> modelgl);
306}
307
318G_MODULE_EXPORT gboolean scroll_set_label_shift (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data)
319{
320 label_shift_has_changed (data, value);
321 return FALSE;
322}
323
332G_MODULE_EXPORT void set_label_shift (GtkRange * range, gpointer data)
333{
334 label_shift_has_changed (data, gtk_range_get_value (range));
335}
336
337#ifdef GTK4
346G_MODULE_EXPORT void set_labels_scale (GtkCheckButton * but, gpointer data)
347#else
356G_MODULE_EXPORT void set_labels_scale (GtkToggleButton * but, gpointer data)
357#endif
358{
359 tint * id = (tint *) data;
360 project * this_proj = get_project_by_id(id -> a);
361#ifdef GTK4
362 this_proj -> modelgl -> anim -> last -> img -> labels_scale[id -> b] = gtk_check_button_get_active (but);
363#else
364 this_proj -> modelgl -> anim -> last -> img -> labels_scale[id -> b] = gtk_toggle_button_get_active (but);
365#endif
366 if (id -> b < 2) this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
367 if (id -> b == 2) this_proj -> modelgl -> create_shaders[MAXIS] = TRUE;
368 if (id -> b == 3 || id -> b == 4) this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
369 update (this_proj -> modelgl);
370}
371
380G_MODULE_EXPORT void set_labels_tilt (GtkComboBox * box, gpointer data)
381{
382 tint * id = (tint *) data;
383 project * this_proj = get_project_by_id(id -> a);
384 this_proj -> modelgl -> anim -> last -> img -> mtilt = gtk_combo_box_get_active (box);
385 if (id -> b < 2) this_proj -> modelgl -> create_shaders[LABEL] = TRUE;
386 if (id -> b == 3 || id -> b == 4) this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
387 update (this_proj -> modelgl);
388}
389
398void mesure_factor_has_changed (gpointer data, double value)
399{
400 tint * id = (tint *) data;
401 project * this_proj = get_project_by_id(id -> a);
402 this_proj -> modelgl -> anim -> last -> img -> mfactor = (int)value;
403 this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
404 update (this_proj -> modelgl);
405}
406
417G_MODULE_EXPORT gboolean scroll_set_measure_factor (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data)
418{
419 mesure_factor_has_changed (data, value);
420 return FALSE;
421}
422
431G_MODULE_EXPORT void set_measure_factor (GtkRange * range, gpointer data)
432{
433 mesure_factor_has_changed (data, gtk_range_get_value (range));
434}
435
444void measure_width_has_changed (gpointer data, double value)
445{
446 tint * id = (tint *) data;
447 project * this_proj = get_project_by_id(id -> a);
448 this_proj -> modelgl -> anim -> last -> img -> mwidth = value;
449 this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
450 update (this_proj -> modelgl);
451}
452
463G_MODULE_EXPORT gboolean scroll_set_measure_width (GtkRange * range, GtkScrollType scroll, gdouble value, gpointer data)
464{
465 measure_width_has_changed (data, value);
466 return FALSE;
467}
468
477G_MODULE_EXPORT void set_measure_width (GtkRange * range, gpointer data)
478{
479 measure_width_has_changed (data, gtk_range_get_value (range));
480}
481
482GtkWidget * line_box;
483GtkWidget * lstyle;
484
485#ifdef GTK4
494G_MODULE_EXPORT void enable_lines (GtkCheckButton * but, gpointer data)
495#else
504G_MODULE_EXPORT void enable_lines (GtkToggleButton * but, gpointer data)
505#endif
506{
507 tint * id = (tint *) data;
508 project * this_proj = get_project_by_id(id -> a);
509 int i;
510#ifdef GTK4
511 i = gtk_check_button_get_active (but);
512#else
513 i = gtk_toggle_button_get_active (but);
514#endif
516 if (i)
517 {
518 this_proj -> modelgl -> anim -> last -> img -> mpattern = 0;
519 }
520 else
521 {
522 this_proj -> modelgl -> anim -> last -> img -> mpattern = -1;
523 }
524 gtk_combo_box_set_active (GTK_COMBO_BOX(lstyle), this_proj -> modelgl -> anim -> last -> img -> mpattern);
525 this_proj -> modelgl -> create_shaders[MEASU] = TRUE;
526 update (this_proj -> modelgl);
527}
528
537GtkWidget * labels_tab (glwin * view, int lid)
538{
539 int i;
540 gchar * lpos[3] = {"x", "y", "z"};
541
542 project * this_proj = get_project_by_id(view -> proj);
543
544 GtkWidget * tbox = create_vbox (BSEP);
545 GtkWidget * vbox = create_vbox (5);
546 add_box_child_start (GTK_ORIENTATION_VERTICAL, tbox, vbox, FALSE, FALSE, 5);
547
548 GtkWidget * box;
549 if (lid < 3)
550 {
551 box = abox (vbox, "Templates: ", 0);
552 GtkWidget * formats = create_combo ();
553 for (i=0; i<LABEL_FORMATS; i++)
554 {
555 combo_text_append (formats, lab_formats[i]);
556 }
557 gtk_combo_box_set_active (GTK_COMBO_BOX(formats), view -> anim -> last -> img -> labels_format[lid]);
558 gtk_widget_set_size_request (formats, 220, -1);
559 g_signal_connect (G_OBJECT (formats), "changed", G_CALLBACK(set_labels_format), & view -> colorp[lid][0]);
560 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, formats, FALSE, FALSE, 10);
561 }
562 else
563 {
564 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label("<b><u>Label(s):</u></b>", -1, 40, 0.0, 0.5), FALSE, FALSE, 0);
565 }
566 // Rendering
567 box = abox (vbox, "Rendering: ", 0);
568 GtkWidget * config = create_combo ();
569 combo_text_append (config, "Basic text");
570 combo_text_append (config, "Highlighted");
571 gtk_combo_box_set_active (GTK_COMBO_BOX(config), view -> anim -> last -> img -> labels_render[lid]);
572 gtk_widget_set_size_request (config, 220, -1);
573 g_signal_connect (G_OBJECT (config), "changed", G_CALLBACK(set_labels_render), & view -> colorp[lid][0]);
574 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, config, FALSE, FALSE, 10);
575
576 // Font
577 box = abox (vbox, "Font:", 0);
578 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box,
579 font_button (view -> anim -> last -> img -> labels_font[lid], 220, -1, G_CALLBACK(set_labels_font), & view -> colorp[lid][0]),
580 FALSE, FALSE, 10);
581
582 if (lid == 3)
583 {
584 box = abox (vbox, "Font color:", 0);
585 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box,
586 color_button(view -> anim -> last -> img -> labels_color[lid][0], TRUE, 220, -1, G_CALLBACK(set_label_color), & view -> colorp[lid][0]),
587 FALSE, FALSE, 10);
588 }
589
590 // Position
591 box = abox (vbox, "Position:", 0);
592 GtkWidget * position = create_combo ();
593 combo_text_append (position, "Always visible");
594 combo_text_append (position, "Normal");
595 gtk_combo_box_set_active (GTK_COMBO_BOX(position), view -> anim -> last -> img -> labels_position[lid]);
596 gtk_widget_set_size_request (position, 220, -1);
597 g_signal_connect (G_OBJECT (position), "changed", G_CALLBACK(set_labels_position), & view -> colorp[lid][0]);
598 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, position, FALSE, FALSE, 10);
599
600 // Size / scale
601 box = abox (vbox, "Size:", 0);
602 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box,
603 check_button ("scale with zoom in/out", 220, -1, view -> anim -> last -> img -> labels_scale[lid], G_CALLBACK(set_labels_scale), & view -> colorp[lid][0]),
604 FALSE, FALSE, 10);
605
606 if (lid == 3)
607 {
608 // Tilt
609 box = abox (vbox, "Tilt:", 0);
610 tilt = create_combo ();
611 combo_text_append (tilt, "None");
612 combo_text_append (tilt, "Adapted");
613 gtk_combo_box_set_active (GTK_COMBO_BOX(tilt), view -> anim -> last -> img -> mtilt);
614 gtk_widget_set_size_request (tilt, 220, -1);
615 g_signal_connect (G_OBJECT (tilt), "changed", G_CALLBACK(set_labels_tilt), & view -> colorp[lid][0]);
616 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, tilt, FALSE, FALSE, 10);
617 }
618
619 GtkWidget * chbox;
620 if (lid < 3)
621 {
622 box = abox (vbox, "Distance to atom [Å]:", 0);
623 chbox = create_hbox (0);
624 for (i=0; i<2; i++)
625 {
626 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox, markup_label(lpos[i], 30, -1, 0.5, 0.5), FALSE, FALSE, 10);
627 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox,
628 create_hscale(-5.0, 5.0, 0.01, view -> anim -> last -> img -> labels_shift[lid][i], GTK_POS_TOP,
629 3, 100, G_CALLBACK(set_label_shift), G_CALLBACK(scroll_set_label_shift), & view -> colorp[lid*10+i][0]),
630 FALSE, FALSE, 0);
631 }
632 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, chbox, FALSE, FALSE, 0);
633 }
634
635 // Colors
636 gboolean ac;
637 if (view -> anim -> last -> img -> labels_color[lid] == NULL)
638 {
639 ac = TRUE;
640 }
641 else
642 {
643 ac = FALSE;
644 }
645 if (lid < 3)
646 {
647 box = abox (vbox, "Color(s):", 0);
648 GtkWidget * col_box = create_vbox (BSEP);
649 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, col_box, FALSE, FALSE, 0);
650 add_box_child_start (GTK_ORIENTATION_VERTICAL, col_box,
651 check_button ("Use atom colors", 100, 40, ac,
652 G_CALLBACK(use_atom_default_colors), (gpointer)& view -> colorp[lid][0]), FALSE, FALSE, 0);
654 add_box_child_start (GTK_ORIENTATION_VERTICAL, col_box, atom_color_box, FALSE, FALSE, 0);
655 add_box_child_start (GTK_ORIENTATION_VERTICAL, atom_color_box, markup_label ("Please select atom label colors:", -1, -1, 0.25, 0.5), FALSE, FALSE, 5);
656 color_title = g_malloc (this_proj -> nspec*sizeof*color_title);
657 for (i=0; i< this_proj -> nspec; i++)
658 {
659 chbox = create_hbox (0);
660 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox, markup_label(this_proj -> chemistry -> label[i], 120, -1, 0.5, 0.5), FALSE, FALSE, 20);
661 if (view -> anim -> last -> img -> labels_color[lid] == NULL)
662 {
663 color_title[i] = color_button(view -> anim -> last -> img -> at_color[i], TRUE, 80, -1, G_CALLBACK(set_label_color), & view -> colorp[lid][i]);
664 }
665 else
666 {
667 color_title[i] = color_button(view -> anim -> last -> img -> labels_color[lid][i], TRUE, 80, -1, G_CALLBACK(set_label_color), & view -> colorp[lid][i]);
668 }
669 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, chbox, color_title[i], FALSE, FALSE, 0);
670 add_box_child_start (GTK_ORIENTATION_VERTICAL, atom_color_box, chbox, FALSE, FALSE, 0);
671 }
673 }
674 else
675 {
676 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label("<b><u>Line(s):</u></b>", -1, 40, 0.0, 0.5), FALSE, FALSE, 0);
677 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, check_button ("Show / hide: ", -1, 40,
678 view -> anim -> last -> img -> mpattern+1, G_CALLBACK(enable_lines),
679 & view -> colorp[lid][0]), FALSE, FALSE, 0);
681 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, line_box, TRUE, TRUE, 0);
682 box = abox (line_box, "Pattern:", 0);
683 GtkListStore * store = gtk_list_store_new (1, GDK_TYPE_PIXBUF);
684 GtkTreeIter iter;
685 for (i=0; i<NDOTS; i++)
686 {
687 gtk_list_store_append (store, & iter);
688 gtk_list_store_set (store, & iter, 0, gdk_pixbuf_new_from_file (dots[i], NULL), -1);
689 }
690 lstyle = gtk_combo_box_new_with_model (GTK_TREE_MODEL(store));
691 g_object_unref (G_OBJECT(store));
692 GtkCellRenderer * renderer;
693 renderer = gtk_cell_renderer_pixbuf_new();
694 gtk_cell_layout_pack_start( GTK_CELL_LAYOUT(lstyle), renderer, FALSE );
695 gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT(lstyle), renderer, "pixbuf", 0, NULL );
696 gtk_combo_box_set_active (GTK_COMBO_BOX(lstyle), view -> anim -> last -> img -> mpattern);
697 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box, lstyle, TRUE, TRUE, 10);
698 gtk_widget_set_size_request (lstyle, 100, 35);
699 g_signal_connect (G_OBJECT (lstyle), "changed", G_CALLBACK(set_measure_style), & view -> colorp[lid][0]);
700
701 box = abox (line_box, "Factor:", 0);
702 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box,
703 create_hscale(1.0, 10.0, 1.0, (double)view -> anim -> last -> img -> mfactor, GTK_POS_RIGHT, 0, 100,
704 G_CALLBACK(set_measure_factor), G_CALLBACK(scroll_set_measure_factor), & view -> colorp[lid][0]),
705 TRUE, TRUE, 0);
706
707 box = abox (line_box, "Width:", 0);
708 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, box,
709 create_hscale(1.0, 10.0, 1.0, view -> anim -> last -> img -> mwidth, GTK_POS_RIGHT, 0, 100,
710 G_CALLBACK(set_measure_width), G_CALLBACK(scroll_set_measure_width), & view -> colorp[lid][0]),
711 TRUE, TRUE, 0);
712 }
713 return tbox;
714}
integer(kind=c_int) function chemistry()
Definition chemistry.F90:22
color colorp[64]
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Definition labels.c:56
ColRGBA col
Definition d_measures.c:77
float val
Definition dlp_init.c:117
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * font_button(gchar *font, int dimx, int dimy, GCallback handler, gpointer data)
create a font selection button
Definition gtk-misc.c:1750
project * proj
GdkRGBA colrgba_togtkrgba(ColRGBA col)
convert ColRGBA color to GdkRGBA color
Definition gtk-misc.c:1634
#define BSEP
Definition global.h: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 * 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 combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:900
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
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
gchar * dots[NDOTS]
Definition gui.c:104
#define NDOTS
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...
@ LABEL
Definition glwin.h:98
@ MAXIS
Definition glwin.h:94
@ MEASU
Definition glwin.h:99
Function declarations for the creation of the OpenGL window.
Messaging function declarations.
position
Definition m_proj.c:47
Definition glwin.h:875
Definition glwin.h:277
Definition global.h:104
int b
Definition tab-1.c:95
int c
Definition tab-1.c:95
int a
Definition tab-1.c:95
gchar * lpos[3]
Definition w_advance.c:137
G_MODULE_EXPORT void set_label_shift(GtkRange *range, gpointer data)
change label(s) shift - range callback
Definition w_labels.c:332
G_MODULE_EXPORT void set_labels_font(GtkFontButton *fontb, gpointer data)
change label(s) font
Definition w_labels.c:232
G_MODULE_EXPORT gboolean scroll_set_measure_factor(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data)
change measure scall factor - scroll callback
Definition w_labels.c:417
G_MODULE_EXPORT void set_labels_format(GtkComboBox *box, gpointer data)
change label(s) format
Definition w_labels.c:103
G_MODULE_EXPORT gboolean scroll_set_label_shift(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data)
change label(s) shift - scroll callback
Definition w_labels.c:318
void mesure_factor_has_changed(gpointer data, double value)
change measure scale factor
Definition w_labels.c:398
GtkWidget * lstyle
Definition w_labels.c:483
GtkWidget ** color_title
Definition w_labels.c:75
G_MODULE_EXPORT void set_labels_position(GtkComboBox *box, gpointer data)
change label(s) position
Definition w_labels.c:279
G_MODULE_EXPORT gboolean scroll_set_measure_width(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer data)
change measure width - scroll callback
Definition w_labels.c:463
GtkWidget * line_box
Definition w_labels.c:482
G_MODULE_EXPORT void set_measure_width(GtkRange *range, gpointer data)
change measure width - range callback
Definition w_labels.c:477
GtkWidget * atom_color_box
Definition w_labels.c:74
G_MODULE_EXPORT void use_atom_default_colors(GtkToggleButton *but, gpointer data)
use default atom colors - toggle callback GTK3
Definition w_labels.c:192
void init_labels_colors(image *img, int sp, int id)
initialize atomic labels colors
Definition w_labels.c:159
#define LABEL_FORMATS
Definition w_labels.c:70
G_MODULE_EXPORT void set_label_color(GtkColorChooser *colob, gpointer data)
change label(s) color
Definition w_labels.c:261
void measure_width_has_changed(gpointer data, double value)
change measure width
Definition w_labels.c:444
G_MODULE_EXPORT void enable_lines(GtkToggleButton *but, gpointer data)
toggle enable measure lines callback GTK3
Definition w_labels.c:504
GtkWidget * tilt
Definition w_labels.c:76
G_MODULE_EXPORT void set_labels_scale(GtkToggleButton *but, gpointer data)
change label(s) scale - toggle callback GTK3
Definition w_labels.c:356
G_MODULE_EXPORT void set_measure_factor(GtkRange *range, gpointer data)
change measure scall factor - range callback
Definition w_labels.c:431
G_MODULE_EXPORT void set_measure_style(GtkComboBox *box, gpointer data)
change measure style
Definition w_labels.c:86
void label_shift_has_changed(gpointer data, double value)
change label(s) shift
Definition w_labels.c:297
G_MODULE_EXPORT void set_labels_render(GtkComboBox *box, gpointer data)
change label(s) rendering mode
Definition w_labels.c:125
G_MODULE_EXPORT void set_labels_tilt(GtkComboBox *box, gpointer data)
change label(s) tilt
Definition w_labels.c:380
gchar * lab_formats[LABEL_FORMATS]
Definition w_labels.c:72
GtkWidget * labels_tab(glwin *view, int lid)
create atomic label(s) tab for the atom(s) / clone(s) window
Definition w_labels.c:537
GtkWidget * img
Definition workspace.c:70
GtkWidget * vbox
Definition workspace.c:72