atomes 1.1.14
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
tab-1.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: 'tab-1.c'
24*
25* Contains:
26*
27
28 - The 1st tab of the curve layout edition dialog
29
30*
31* List of functions:
32
33 void set_frame_style (gpointer data);
34
35 G_MODULE_EXPORT void set_window_size (GtkEntry * maj, gpointer data);
36 G_MODULE_EXPORT void set_title (GtkCheckButton * but, gpointer data);
37 G_MODULE_EXPORT void set_title (GtkToggleButton * but, gpointer data);
38 G_MODULE_EXPORT void set_title_default (GtkCheckButton * but, gpointer data);
39 G_MODULE_EXPORT void set_title_default (GtkToggleButton * but, gpointer data);
40 G_MODULE_EXPORT void set_title_custom (GtkEntry * tit, gpointer data);
41 G_MODULE_EXPORT void set_title_font (GtkFontButton * fontb, gpointer data);
42 G_MODULE_EXPORT void set_title_color (GtkColorChooser * colob, gpointer data);
43 G_MODULE_EXPORT void set_title_pos (GtkEntry * entry, gpointer data);
44 G_MODULE_EXPORT void set_show_frame (GtkCheckButton * but, gpointer data);
45 G_MODULE_EXPORT void set_show_frame (GtkToggleButton * but, gpointer data);
46 G_MODULE_EXPORT void set_background_color (GtkColorChooser * colob, gpointer data);
47 G_MODULE_EXPORT void set_frame_type (GtkComboBox * fbox, gpointer data);
48 G_MODULE_EXPORT void set_frame_line (GtkComboBox * fbox, gpointer data);
49 G_MODULE_EXPORT void set_frame_thickness (GtkEntry * entry, gpointer data);
50 G_MODULE_EXPORT void set_frame_color (GtkColorChooser * colob, gpointer data);
51 G_MODULE_EXPORT void set_frame_pos (GtkEntry * fen, gpointer data);
52
53 cairo_surface_t * draw_frame_surface (int tf,
54 int da,
55 double ti,
56 double x[2],
57 double y[2],
58 ColRGBA dcol,
59 ColRGBA bcol);
60
61 GtkWidget * create_tab_1 (gpointer data);
62
63*/
64
65#ifdef HAVE_CONFIG_H
66# include <config.h>
67#endif
68
69#include <gtk/gtk.h>
70#include <cairo.h>
71#include <cairo-pdf.h>
72#include <cairo-svg.h>
73#include <string.h>
74#include <stdlib.h>
75#include <math.h>
76
77#include "global.h"
78#include "interface.h"
79#include "callbacks.h"
80#include "project.h"
81#include "curve.h"
82#include "cedit.h"
83
84extern void set_data_style (gpointer data);
85
86GtkWidget * title_box = NULL;
87GtkWidget * frame[11];
88GtkWidget * frame_box = NULL;
89GtkWidget * frame_style_area = NULL;
90GtkWidget * frame_pix_box = NULL;
91char * ctext[2];
94GtkWidget * custom_title = NULL;
95int a, b, c, d;
96
105G_MODULE_EXPORT void set_window_size (GtkEntry * maj, gpointer data)
106{
107 const gchar *m;
108 char * text[2];
109 int i;
110 qint * ad = (qint *)data;
111
112 a = ad -> a;
113 b = ad -> b;
114 c = ad -> c;
115 d = ad -> d;
116 project * this_proj = get_project_by_id(a);
117 int shift = get_curve_shift (this_proj, b, c);
118 text[0] = "X size must be > 0";
119 text[1] = "Y size must be > 0";
120 m = entry_get_text (maj);
121
122 i = atof(m);
123 if (i > 0)
124 {
125 switch (d)
126 {
127 case 0:
128 resize_this_window (this_proj -> curves[b][c] -> window, i, this_proj -> curves[b][c] -> wsize[1] + shift);
129 break;
130 case 1:
131 resize_this_window (this_proj -> curves[b][c] -> window, this_proj -> curves[b][c] -> wsize[0], i + shift);
132 break;
133 }
134 this_proj -> curves[b][c] -> wsize[d] = i;
135 }
136 else
137 {
138 show_warning (text[d], this_proj -> curves[b][c] -> window);
139 }
140 update_entry_int (maj, this_proj -> curves[b][c] -> wsize[d]);
141}
142
162cairo_surface_t * draw_frame_surface (int tf,
163 int da,
164 double ti,
165 double x[2],
166 double y[2],
167 ColRGBA dcol,
168 ColRGBA bcol)
169{
170 cairo_surface_t * cst;
171 cairo_t * tcst;
172 int r[2];
173 r[0] = 100;
174 r[1] = 100;
175 cst = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 100, 100);
176 tcst = cairo_create (cst);
177 cairo_set_source_rgb (tcst, bcol.red, bcol.green, bcol.blue);
178 cairo_paint (tcst);
179 show_frame (tcst, tf, da, r, ti, x, y, dcol);
180 cairo_destroy (tcst);
181 return cst;
182}
183
184#ifdef GTK4
193G_MODULE_EXPORT void set_title (GtkCheckButton * but, gpointer data)
194#else
203G_MODULE_EXPORT void set_title (GtkToggleButton * but, gpointer data)
204#endif
205{
206 tint * ad = (tint *)data;
207 a = ad -> a;
208 b = ad -> b;
209 c = ad -> c;
210 project * this_proj = get_project_by_id(a);
211#ifdef GTK4
212 this_proj -> curves[b][c] -> show_title = gtk_check_button_get_active (but);
213#else
214 this_proj -> curves[b][c] -> show_title = gtk_toggle_button_get_active (but);
215#endif
216 widget_set_sensitive (title_box, this_proj -> curves[b][c] -> show_title);
217 update_curve (data);
218}
219
220#ifdef GTK4
229G_MODULE_EXPORT void set_title_default (GtkCheckButton * but, gpointer data)
230#else
239G_MODULE_EXPORT void set_title_default (GtkToggleButton * but, gpointer data)
240#endif
241{
242 tint * ad = (tint *)data;
243 a = ad -> a;
244 b = ad -> b;
245 c = ad -> c;
246 project * this_proj = get_project_by_id(a);
247#ifdef GTK4
248 this_proj -> curves[b][c] -> default_title = gtk_check_button_get_active (but);
249#else
250 this_proj -> curves[b][c] -> default_title = gtk_toggle_button_get_active (but);
251#endif
252 widget_set_sensitive (custom_title, ! this_proj -> curves[b][c] -> default_title);
253 if (this_proj -> curves[b][c] -> default_title)
254 {
255 g_free (this_proj -> curves[b][c] -> title);
256 this_proj -> curves[b][c] -> title = g_strdup_printf ("%s - %s", prepare_for_title(this_proj -> name), this_proj -> curves[b][c] -> name);
257 }
258 update_entry_text (GTK_ENTRY(custom_title), this_proj -> curves[b][c] -> title);
259 update_curve (data);
260}
261
270G_MODULE_EXPORT void set_title_custom (GtkEntry * tit, gpointer data)
271{
272 tint * ad = (tint *)data;
273 a = ad -> a;
274 b = ad -> b;
275 c = ad -> c;
276 project * this_proj = get_project_by_id(a);
277 g_free (this_proj -> curves[b][c] -> title);
278 this_proj -> curves[b][c] -> title = g_strdup_printf ("%s", entry_get_text (tit));
279 update_entry_text (tit, this_proj -> curves[b][c] -> title);
280 update_curve (data);
281}
282
291G_MODULE_EXPORT void set_title_font (GtkFontButton * fontb, gpointer data)
292{
293 tint * ad = (tint *)data;
294 a = ad -> a;
295 b = ad -> b;
296 c = ad -> c;
297 project * this_proj = get_project_by_id(a);
298 g_free (this_proj -> curves[b][c] -> title_font);
299 this_proj -> curves[b][c] -> title_font = g_strdup_printf ("%s", gtk_font_chooser_get_font (GTK_FONT_CHOOSER(fontb)));
300 update_curve (data);
301}
302
311G_MODULE_EXPORT void set_title_color (GtkColorChooser * colob, gpointer data)
312{
313 tint * ad = (tint *)data;
314 a = ad -> a;
315 b = ad -> b;
316 c = ad -> c;
317 project * this_proj = get_project_by_id(a);
318 this_proj -> curves[b][c] -> title_color = get_button_color (colob);
319 update_curve (data);
320}
321
330G_MODULE_EXPORT void set_title_pos (GtkEntry * entry, gpointer data)
331{
332 const gchar * p;
333 double v;
334 qint * ad = (qint *)data;
335 tint cd;
336 a = ad -> a;
337 b = ad -> b;
338 c = ad -> c;
339 d = ad -> d;
340 project * this_proj = get_project_by_id(a);
341 p = entry_get_text (entry);
342 v = atof(p);
343 if (v >= 0.0 && v <= 1.0)
344 {
345 this_proj -> curves[b][c] -> title_pos[d] = v;
346 }
347 else
348 {
349 show_warning (ctext[ad -> d], this_proj -> curves[b][c] -> window);
350 }
351 update_entry_double (entry, this_proj -> curves[b][c] -> title_pos[d]);
352 cd.a = ad -> a;
353 cd.b = ad -> b;
354 cd.c = ad -> c;
355 update_curve ((gpointer)& cd);
356}
357
365void set_frame_style (gpointer data)
366{
367 cairo_surface_t * surf;
368 tint * ad = (tint *)data;
369 a = ad -> a;
370 b = ad -> b;
371 c = ad -> c;
372 project * this_proj = get_project_by_id(a);
373 surf = draw_frame_surface (this_proj -> curves[b][c] -> frame_type,
374 this_proj -> curves[b][c] -> frame_dash,
375 this_proj -> curves[b][c] -> frame_thickness,
376 this_proj -> curves[b][c] -> frame_pos[0],
377 this_proj -> curves[b][c] -> frame_pos[1],
378 this_proj -> curves[b][c] -> frame_color,
379 this_proj -> curves[b][c] -> backcolor);
382 cairo_surface_destroy (surf);
383 widget_set_sensitive (frame_style_area, this_proj -> curves[b][c] -> show_frame);
384 gtk_widget_show (frame_style_area);
385#ifdef GTK4
386 gtk_widget_set_hexpand (frame_style_area, TRUE);
387#endif
388 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, frame_pix_box, frame_style_area, TRUE, TRUE, 20);
389 update_curve (data);
390}
391
392#ifdef GTK4
401G_MODULE_EXPORT void set_show_frame (GtkCheckButton * but, gpointer data)
402#else
411G_MODULE_EXPORT void set_show_frame (GtkToggleButton * but, gpointer data)
412#endif
413{
414 tint * ad = (tint *)data;
415 a = ad -> a;
416 b = ad -> b;
417 c = ad -> c;
418 project * this_proj = get_project_by_id(a);
419#ifdef GTK4
420 this_proj -> curves[b][c] -> show_frame = gtk_check_button_get_active (but);
421#else
422 this_proj -> curves[b][c] -> show_frame = gtk_toggle_button_get_active (but);
423#endif
424 widget_set_sensitive (frame_box, this_proj -> curves[b][c] -> show_frame);
425 update_curve (data);
426}
427
436G_MODULE_EXPORT void set_background_color (GtkColorChooser * colob, gpointer data)
437{
438 tint * ad = (tint *)data;
439 a = ad -> a;
440 b = ad -> b;
441 c = ad -> c;
442 project * this_proj = get_project_by_id(a);
443 this_proj -> curves[b][c] -> backcolor = get_button_color (colob);
444 set_data_style (data);
445}
446
455G_MODULE_EXPORT void set_frame_type (GtkComboBox * fbox, gpointer data)
456{
457 tint * ad = (tint *)data;
458 a = ad -> a;
459 b = ad -> b;
460 c = ad -> c;
461 get_project_by_id(a) -> curves[b][c] -> frame_type = gtk_combo_box_get_active (GTK_COMBO_BOX(fbox));
462 set_frame_style (data);
463}
464
473G_MODULE_EXPORT void set_frame_line (GtkComboBox * fbox, gpointer data)
474{
475 tint * ad = (tint *)data;
476 a = ad -> a;
477 b = ad -> b;
478 c = ad -> c;
479 get_project_by_id(a) -> curves[b][c] -> frame_dash = gtk_combo_box_get_active (GTK_COMBO_BOX(fbox)) + 1;
480 set_frame_style (data);
481}
482
491G_MODULE_EXPORT void set_frame_thickness (GtkEntry * entry, gpointer data)
492{
493 const gchar * str;
494 tint * ad = (tint *)data;
495 a = ad -> a;
496 b = ad -> b;
497 c = ad -> c;
498 str = entry_get_text (entry);
499 project * this_proj = get_project_by_id(a);
500 this_proj -> curves[b][c] -> frame_thickness = atof(str);
501 update_entry_double (entry, this_proj -> curves[b][c] -> frame_thickness);
502 set_frame_style (data);
503}
504
513G_MODULE_EXPORT void set_frame_color (GtkColorChooser * colob, gpointer data)
514{
515 tint * ad = (tint *)data;
516 a = ad -> a;
517 b = ad -> b;
518 c = ad -> c;
519 project * this_proj = get_project_by_id(a);
520 this_proj -> curves[b][c] -> frame_color = get_button_color (colob);
521 set_frame_style (data);
522}
523
532G_MODULE_EXPORT void set_frame_pos (GtkEntry * fen, gpointer data)
533{
534 qint * cd = (qint *)data;
535 int k;
536 const gchar * m;
537 double z;
538 a = cd -> a;
539 b = cd -> b;
540 c = cd -> c;
541 d = cd -> d;
542 project * this_proj = get_project_by_id(a);
543 m = entry_get_text (fen);
544 z= atof(m);
545 if (d < 2)
546 {
547 if (d == 0)
548 {
549 k = 0;
550 if (z < this_proj -> curves[b][c] -> frame_pos[0][1])
551 {
552 this_proj -> curves[b][c] -> frame_pos[0][0] = z;
553 }
554 else
555 {
556 show_warning ("Frame x min must be < to frame x max", this_proj -> curves[b][c] -> window);
557 }
558 }
559 else if (d == 1)
560 {
561 k = 1;
562 if (z > this_proj -> curves[b][c] -> frame_pos[0][0])
563 {
564 this_proj -> curves[b][c] -> frame_pos[0][1] = z;
565 }
566 else
567 {
568 show_warning ("Frame x max must be > to frame x min", this_proj -> curves[b][c] -> window);
569 }
570 }
571 update_entry_double (fen, this_proj -> curves[b][c] -> frame_pos[0][k]);
572 }
573 else
574 {
575 if (d == 2)
576 {
577 k = 0;
578 if (z > this_proj -> curves[b][c] -> frame_pos[1][1])
579 {
580 this_proj -> curves[b][c] -> frame_pos[1][0] = z;
581 }
582 else
583 {
584 show_warning ("Frame y min must be > to frame y max", this_proj -> curves[b][c] -> window);
585 }
586 }
587 else
588 {
589 k = 1;
590 if (z < this_proj -> curves[b][c] -> frame_pos[1][0])
591 {
592 this_proj -> curves[b][c] -> frame_pos[1][1] = z;
593 }
594 else
595 {
596 show_warning ("Frame y max must be < to frame y min", this_proj -> curves[b][c] -> window);
597 }
598 }
599 update_entry_double (fen, this_proj -> curves[b][c] -> frame_pos[1][k]);
600 }
601 set_frame_style (data);
602}
603
611GtkWidget * create_tab_1 (gpointer data)
612{
613 GtkWidget * graphbox;
614 GtkWidget * fbox;
615 GtkWidget * ghbox;
616 GtkWidget * gvbox;
617 GtkWidget * frame_style_box;
618 GtkWidget * frame_thickness;
619 GtkWidget * xyf;
620
621 gchar * str[2];
622 str[0] = "min";
623 str[1] = "max";
624 gchar * axl[2];
625 axl[0] = "x";
626 axl[1] = "y";
627 gchar * ftb[5];
628 ftb[0] = "closed";
629 ftb[1] = "top open";
630 ftb[2] = "right open";
631 ftb[3] = "left open";
632 ftb[4] = "open";
633 int xlgt, ylgt;
634 int i, j, k;
635
636 tint * cd = (tint *) data;
637 a = cd -> a;
638 b = cd -> b;
639 c = cd -> c;
640 project * this_proj = get_project_by_id(a);
641 // Axis related signals
642 for ( i=0 ; i < 2 ; i++ )
643 {
644 dataxe[i].a = a;
645 dataxe[i].b = b;
646 dataxe[i].c = c;
647 dataxe[i].d = i;
648 xyp[i] = create_entry (G_CALLBACK(set_window_size), 100, 10, FALSE, (gpointer)& dataxe[i]);
649 }
650 graphbox = create_vbox (BSEP);
651 ghbox = create_hbox (0);
652 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, ghbox, FALSE, FALSE, 15);
653 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label("Size:", 50, 35, 1.0, 0.5), FALSE, FALSE, 20);
654 xlgt = gtk_widget_get_allocated_width (this_proj -> curves[b][c] -> plot);
655 ylgt = gtk_widget_get_allocated_height (this_proj -> curves[b][c] -> plot);
656 update_entry_int (GTK_ENTRY(xyp[0]), xlgt);
657 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, xyp[0], FALSE, FALSE, 0);
658 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label("x", -1, -1, 0.5, 0.5), FALSE, FALSE, 10);
659 update_entry_int (GTK_ENTRY(xyp[1]), ylgt);
660 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, xyp[1], FALSE, FALSE, 0);
661 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label("pixels", -1, -1, 0.0, 0.5), FALSE, FALSE, 20);
662
663 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 5);
664 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox,
665 check_button ("Insert title", -1, -1, this_proj -> curves[b][c] -> show_title, G_CALLBACK(set_title), data),
666 FALSE, FALSE, 10);
667
669 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, title_box, FALSE, FALSE, 0);
670
671 ghbox = create_hbox (0);
672 add_box_child_start (GTK_ORIENTATION_VERTICAL, title_box, ghbox, FALSE, FALSE, 2);
673 gvbox = create_hbox (0);
674 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, gvbox, FALSE, FALSE, 0);
675 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, gvbox,
676 check_button ("Default title", 100, 35, this_proj -> curves[b][c] -> default_title, G_CALLBACK(set_title_default), data),
677 FALSE, FALSE, 40);
678 custom_title = create_entry (G_CALLBACK(set_title_custom), 200, 15, TRUE, data);
679 gtk_entry_set_alignment (GTK_ENTRY(custom_title), 0.0);
680 if (this_proj -> curves[b][c] -> show_title)
681 {
682 widget_set_sensitive (custom_title, ! this_proj -> curves[b][c] -> default_title);
683 }
684 else
685 {
687 }
688 update_entry_text (GTK_ENTRY(custom_title), this_proj -> curves[b][c] -> title);
689 add_box_child_end (gvbox, custom_title, FALSE, FALSE, 0);
690
691 add_box_child_end (bbox (title_box, "Font:"),
692 font_button (this_proj -> curves[b][c] -> title_font, 150, 35, G_CALLBACK(set_title_font), data),
693 FALSE, FALSE, 0);
694
695 add_box_child_end (bbox (title_box, "Color:"),
696 color_button (this_proj -> curves[b][c] -> title_color, TRUE, 150, 30, G_CALLBACK(set_title_color), data),
697 FALSE, FALSE, 0);
698
699 ghbox = bbox (title_box, "Position:");
700 GtkWidget * txyc;
701 for ( i=0 ; i < 2 ; i++ )
702 {
703 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label(lapos[i], (i==0)?10:30, -1, 1.0, 0.5), FALSE, FALSE, 5);
704 txyc = create_entry (G_CALLBACK(set_title_pos), 100, 10, FALSE, (gpointer)& dataxe[i]);
705 update_entry_double (GTK_ENTRY(txyc), this_proj -> curves[b][c] -> title_pos[i]);
706 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, txyc, FALSE, FALSE, 5);
707 }
708 widget_set_sensitive (title_box, this_proj -> curves[b][c] -> show_title);
709
710 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 10);
711
712 ghbox = create_hbox (0);
713 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, ghbox, FALSE, FALSE, 0);
714 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label("Background color:", 120, 30, 0.0, 0.5), FALSE, FALSE, 40);
715 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox,
716 color_button (this_proj -> curves[b][c] -> backcolor, TRUE, 100, -1, G_CALLBACK(set_background_color), data),
717 FALSE, FALSE, 40);
718
719 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 10);
720
721// Frame
722 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox,
723 check_button ("Show/hide frame", -1, -1, this_proj -> curves[b][c] -> show_frame, G_CALLBACK(set_show_frame), data),
724 FALSE, FALSE, 10);
725
727 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, frame_box, FALSE, FALSE, 0);
729 frame_style_box = create_vbox (BSEP);
730 add_box_child_start (GTK_ORIENTATION_VERTICAL, frame_box, frame_pix_box, FALSE, FALSE, 0);
731 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, frame_pix_box, frame_style_box, FALSE, FALSE, 0);
732
733// Frame style
734 fbox = create_combo ();
735 for (i=0; i<5; i++)
736 {
737 combo_text_append (fbox, ftb[i]);
738 }
739 gtk_widget_set_size_request (fbox, 150, 30);
740 gtk_combo_box_set_active(GTK_COMBO_BOX(fbox), this_proj -> curves[b][c] -> frame_type);
741 g_signal_connect (G_OBJECT(fbox), "changed", G_CALLBACK(set_frame_type), data);
742 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, bbox (frame_style_box, "Type:"), fbox, FALSE, FALSE, 0);
743
744// Frame line style
745 fbox = create_combo ();
746 for ( i=1 ; i < ndash ; i++)
747 {
748 combo_text_append (fbox, g_strdup_printf("%d", i));
749 }
750 gtk_widget_set_size_request (fbox, 150, 30);
751 gtk_combo_box_set_active(GTK_COMBO_BOX(fbox), this_proj -> curves[b][c] -> frame_dash - 1);
752 g_signal_connect (G_OBJECT(fbox), "changed", G_CALLBACK(set_frame_line), data);
753 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, bbox (frame_style_box, "Line style:"), fbox, FALSE, FALSE, 0);
754
755// Frame line width
756 frame_thickness = create_entry (G_CALLBACK(set_frame_thickness), -1, 10, FALSE, data);
757 update_entry_double (GTK_ENTRY(frame_thickness), this_proj -> curves[b][c] -> frame_thickness);
758 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, bbox (frame_style_box, "Line width:"), frame_thickness, FALSE, FALSE, 0);
759
760// Frame color
761 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, bbox (frame_style_box, "Color:"),
762 color_button (this_proj -> curves[b][c] -> frame_color, TRUE, 150, 30, G_CALLBACK(set_frame_color), data),
763 FALSE, FALSE, 0);
764
765// Frame pix
766 cairo_surface_t * frame = draw_frame_surface (this_proj -> curves[b][c] -> frame_type,
767 this_proj -> curves[b][c] -> frame_dash,
768 this_proj -> curves[b][c] -> frame_thickness,
769 this_proj -> curves[b][c] -> frame_pos[0],
770 this_proj -> curves[b][c] -> frame_pos[1],
771 this_proj -> curves[b][c] -> frame_color,
772 this_proj -> curves[b][c] -> backcolor);
774 cairo_surface_destroy (frame);
775
776 gtk_widget_set_size_request (frame_pix_box, -1, 150);
777#ifdef GTK4
778 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, frame_pix_box, markup_label(" ", 20, -1, 0.0, 0.0), FALSE, FALSE, 0);
779 gtk_widget_set_hexpand (frame_style_area, TRUE);
780#endif
781 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, frame_pix_box, frame_style_area, FALSE, FALSE, 20);
782
783 bbox (frame_box, "Position: ");
784 GtkWidget * fxyc;
785 k = -1;
786 for (i=0; i<2; i++)
787 {
788 ghbox = create_hbox (0);
789 add_box_child_start (GTK_ORIENTATION_VERTICAL, frame_box, ghbox, FALSE, FALSE, 0);
790 for (j=0; j<2; j++)
791 {
792 k = k + 1;
793 framxe[k].a = a;
794 framxe[k].b = b;
795 framxe[k].c = c;
796 framxe[k].d = k;
797 xyf = markup_label (g_strdup_printf ("%s %s: ",axl[i], str[j]), 70, -1, 1.0, 0.5);
798 widget_set_sensitive (xyf, this_proj -> curves[b][c] -> show_frame);
799 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, xyf, FALSE, FALSE, 20);
800 fxyc = create_entry (G_CALLBACK(set_frame_pos), 100, 10, FALSE, (gpointer)& framxe[k]);
801 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, fxyc, FALSE, FALSE, 0);
802 update_entry_double (GTK_ENTRY(fxyc), this_proj -> curves[b][c] -> frame_pos[i][j]);
803 }
804 }
805
806 widget_set_sensitive (frame_box, this_proj -> curves[b][c] -> show_frame);
807 return graphbox;
808}
Callback declarations for main window.
GtkWidget * xyp[2]
Definition cedit.c:87
char * lapos[2]
Definition cedit.c:89
Variable declarations for the curve layout edition window.
int ndash
Definition curve.c:91
void update_curve(gpointer data)
update curve rendering
Definition curve.c:589
Variable declarations for the curve widget Functions for interactions with the curve widget.
void show_frame(cairo_t *cd, int tf, int da, int res[2], double ti, double x[2], double y[2], ColRGBA dcol)
draw frame
Definition frame.c:81
const gchar * default_title(int ax, int c)
default title string
Definition title.c:54
int get_curve_shift(project *this_proj, int b, int c)
get cruve window size shift
Definition w_curve.c:576
void show_title(cairo_t *cr, project *this_proj, int rid, int cid)
draw title
Definition title.c:107
atom * tf
Definition d_measures.c:70
int * shift
Definition d_measures.c:72
gchar * text
Definition datab.c:105
Global variable declarations Global convenience function declarations Global data structure defin...
@ IMG_SURFACE
Definition global.h:234
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1294
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
Definition gtk-misc.c:613
GtkWidget * font_button(gchar *font, int dimx, int dimy, GCallback handler, gpointer data)
create a font selection button
Definition gtk-misc.c:1730
void resize_this_window(GtkWidget *window, int x, int y)
resize this GtkWindow
Definition gtk-misc.c:561
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
Definition gtk-misc.c:577
#define BSEP
Definition global.h:217
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
Definition gtk-misc.c:594
GtkWidget * fbox(GtkWidget *box, char *lab)
Definition gtk-misc.c:1921
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1779
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:903
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
Definition gtk-misc.c:1565
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:279
ColRGBA get_button_color(GtkColorChooser *colob)
get the ColRGBA color from a GtkColorChooser button
Definition gtk-misc.c:2212
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:186
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:793
GtkWidget * create_image_from_data(int format, gpointer item_image)
create Gtk image for data
Definition gtk-misc.c:1423
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:880
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2010
GtkWidget * color_button(ColRGBA col, gboolean alpha, int dimx, int dimy, GCallback handler, gpointer data)
create a color selection button
Definition gtk-misc.c:1708
GtkWidget * bbox(GtkWidget *box, char *lab)
Definition gtk-misc.c:1901
void add_box_child_end(GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the end position.
Definition gtk-misc.c:257
void update_entry_text(GtkEntry *entry, gchar *text)
update the content of a GtkEntry as string
Definition gtk-misc.c:651
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
Definition tools.c:71
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:781
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
image * plot
Definition ogl_draw.c:66
void show_warning(char *warning, GtkWidget *win)
show warning
Definition interface.c:260
Messaging function declarations.
double z
Definition ogl_draw.c:57
double y
Definition ogl_draw.c:57
double x
Definition ogl_draw.c:57
Function declarations for reading atomes project file Function declarations for saving atomes proje...
float blue
Definition global.h:118
float red
Definition global.h:116
float green
Definition global.h:117
Definition global.h:106
int b
Definition global.h:108
int c
Definition global.h:109
int d
Definition global.h:110
int a
Definition global.h:107
Definition global.h:98
int b
Definition global.h:100
int c
Definition global.h:101
int a
Definition global.h:99
GtkWidget * title_box
Definition tab-1.c:86
int b
Definition tab-1.c:95
G_MODULE_EXPORT void set_title(GtkToggleButton *but, gpointer data)
show / hide title toggle callback GTK3
Definition tab-1.c:203
GtkWidget * frame_style_area
Definition tab-1.c:89
cairo_surface_t * draw_frame_surface(int tf, int da, double ti, double x[2], double y[2], ColRGBA dcol, ColRGBA bcol)
draw frame preview
Definition tab-1.c:162
G_MODULE_EXPORT void set_title_color(GtkColorChooser *colob, gpointer data)
set title color
Definition tab-1.c:311
void set_data_style(gpointer data)
update the data style widgets
Definition tab-2.c:213
G_MODULE_EXPORT void set_title_font(GtkFontButton *fontb, gpointer data)
set title font
Definition tab-1.c:291
G_MODULE_EXPORT void set_frame_type(GtkComboBox *fbox, gpointer data)
change frame type
Definition tab-1.c:455
int c
Definition tab-1.c:95
G_MODULE_EXPORT void set_title_custom(GtkEntry *tit, gpointer data)
set custom title entry callback
Definition tab-1.c:270
G_MODULE_EXPORT void set_title_pos(GtkEntry *entry, gpointer data)
set axis title position entry callback
Definition tab-1.c:330
int d
Definition tab-1.c:95
GtkWidget * create_tab_1(gpointer data)
handle the creation of the 1st tab of the curve edition dialog
Definition tab-1.c:611
qint framxe[4]
Definition tab-1.c:93
G_MODULE_EXPORT void set_frame_line(GtkComboBox *fbox, gpointer data)
change frame line type
Definition tab-1.c:473
int a
Definition tab-1.c:95
GtkWidget * frame_pix_box
Definition tab-1.c:90
GtkWidget * frame_box
Definition tab-1.c:88
G_MODULE_EXPORT void set_frame_color(GtkColorChooser *colob, gpointer data)
set frame color
Definition tab-1.c:513
char * ctext[2]
Definition tab-1.c:91
G_MODULE_EXPORT void set_background_color(GtkColorChooser *colob, gpointer data)
change background color
Definition tab-1.c:436
G_MODULE_EXPORT void set_title_default(GtkToggleButton *but, gpointer data)
use / not default title toggle callback GTK3
Definition tab-1.c:239
G_MODULE_EXPORT void set_frame_thickness(GtkEntry *entry, gpointer data)
set frame thickness entry callback
Definition tab-1.c:491
qint dataxe[2]
Definition tab-1.c:92
G_MODULE_EXPORT void set_frame_pos(GtkEntry *fen, gpointer data)
set frame position entry callback
Definition tab-1.c:532
G_MODULE_EXPORT void set_show_frame(GtkToggleButton *but, gpointer data)
show / hide frame toggle callback GTK3
Definition tab-1.c:411
GtkWidget * frame[11]
Definition tab-1.c:87
void set_frame_style(gpointer data)
create frame preview
Definition tab-1.c:365
GtkWidget * custom_title
Definition tab-1.c:94
G_MODULE_EXPORT void set_window_size(GtkEntry *maj, gpointer data)
change window size entry callback
Definition tab-1.c:105