atomes 1.2.1
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-2025 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 = string_to_double ((gpointer)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 this_proj -> curves[b][c] -> show_title = button_get_status ((GtkWidget *)but);
212 widget_set_sensitive (title_box, this_proj -> curves[b][c] -> show_title);
213 update_curve (data);
214}
215
216#ifdef GTK4
225G_MODULE_EXPORT void set_title_default (GtkCheckButton * but, gpointer data)
226#else
235G_MODULE_EXPORT void set_title_default (GtkToggleButton * but, gpointer data)
236#endif
237{
238 tint * ad = (tint *)data;
239 a = ad -> a;
240 b = ad -> b;
241 c = ad -> c;
242 project * this_proj = get_project_by_id(a);
243 this_proj -> curves[b][c] -> default_title = button_get_status ((GtkWidget *)but);
244 widget_set_sensitive (custom_title, ! this_proj -> curves[b][c] -> default_title);
245 if (this_proj -> curves[b][c] -> default_title)
246 {
247 g_free (this_proj -> curves[b][c] -> title);
248 this_proj -> curves[b][c] -> title = g_strdup_printf ("%s - %s", prepare_for_title(this_proj -> name), this_proj -> curves[b][c] -> name);
249 }
250 update_entry_text (GTK_ENTRY(custom_title), this_proj -> curves[b][c] -> title);
251 update_curve (data);
252}
253
262G_MODULE_EXPORT void set_title_custom (GtkEntry * tit, gpointer data)
263{
264 tint * ad = (tint *)data;
265 a = ad -> a;
266 b = ad -> b;
267 c = ad -> c;
268 project * this_proj = get_project_by_id(a);
269 g_free (this_proj -> curves[b][c] -> title);
270 this_proj -> curves[b][c] -> title = g_strdup_printf ("%s", entry_get_text (tit));
271 update_entry_text (tit, this_proj -> curves[b][c] -> title);
272 update_curve (data);
273}
274
283G_MODULE_EXPORT void set_title_font (GtkFontButton * fontb, gpointer data)
284{
285 tint * ad = (tint *)data;
286 a = ad -> a;
287 b = ad -> b;
288 c = ad -> c;
289 project * this_proj = get_project_by_id(a);
290 g_free (this_proj -> curves[b][c] -> title_font);
291 this_proj -> curves[b][c] -> title_font = g_strdup_printf ("%s", gtk_font_chooser_get_font (GTK_FONT_CHOOSER(fontb)));
292 update_curve (data);
293}
294
303G_MODULE_EXPORT void set_title_color (GtkColorChooser * colob, gpointer data)
304{
305 tint * ad = (tint *)data;
306 a = ad -> a;
307 b = ad -> b;
308 c = ad -> c;
309 project * this_proj = get_project_by_id(a);
310 this_proj -> curves[b][c] -> title_color = get_button_color (colob);
311 update_curve (data);
312}
313
322G_MODULE_EXPORT void set_title_pos (GtkEntry * entry, gpointer data)
323{
324 const gchar * p;
325 double v;
326 qint * ad = (qint *)data;
327 tint cd;
328 a = ad -> a;
329 b = ad -> b;
330 c = ad -> c;
331 d = ad -> d;
332 project * this_proj = get_project_by_id(a);
333 p = entry_get_text (entry);
334 v = string_to_double ((gpointer)p);
335 if (v >= 0.0 && v <= 1.0)
336 {
337 this_proj -> curves[b][c] -> title_pos[d] = v;
338 }
339 else
340 {
341 show_warning (ctext[ad -> d], this_proj -> curves[b][c] -> window);
342 }
343 update_entry_double (entry, this_proj -> curves[b][c] -> title_pos[d]);
344 cd.a = ad -> a;
345 cd.b = ad -> b;
346 cd.c = ad -> c;
347 update_curve ((gpointer)& cd);
348}
349
357void set_frame_style (gpointer data)
358{
359 cairo_surface_t * surf;
360 tint * ad = (tint *)data;
361 a = ad -> a;
362 b = ad -> b;
363 c = ad -> c;
364 project * this_proj = get_project_by_id(a);
365 surf = draw_frame_surface (this_proj -> curves[b][c] -> frame_type,
366 this_proj -> curves[b][c] -> frame_dash,
367 this_proj -> curves[b][c] -> frame_thickness,
368 this_proj -> curves[b][c] -> frame_pos[0],
369 this_proj -> curves[b][c] -> frame_pos[1],
370 this_proj -> curves[b][c] -> frame_color,
371 this_proj -> curves[b][c] -> backcolor);
374 cairo_surface_destroy (surf);
375 widget_set_sensitive (frame_style_area, this_proj -> curves[b][c] -> show_frame);
377#ifdef GTK4
378 gtk_widget_set_hexpand (frame_style_area, TRUE);
379#endif
380 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, frame_pix_box, frame_style_area, TRUE, TRUE, 20);
381 update_curve (data);
382}
383
384#ifdef GTK4
393G_MODULE_EXPORT void set_show_frame (GtkCheckButton * but, gpointer data)
394#else
403G_MODULE_EXPORT void set_show_frame (GtkToggleButton * but, gpointer data)
404#endif
405{
406 tint * ad = (tint *)data;
407 a = ad -> a;
408 b = ad -> b;
409 c = ad -> c;
410 project * this_proj = get_project_by_id(a);
411 this_proj -> curves[b][c] -> show_frame = button_get_status ((GtkWidget *)but);
412 widget_set_sensitive (frame_box, this_proj -> curves[b][c] -> show_frame);
413 update_curve (data);
414}
415
424G_MODULE_EXPORT void set_background_color (GtkColorChooser * colob, gpointer data)
425{
426 tint * ad = (tint *)data;
427 a = ad -> a;
428 b = ad -> b;
429 c = ad -> c;
430 project * this_proj = get_project_by_id(a);
431 this_proj -> curves[b][c] -> backcolor = get_button_color (colob);
432 set_data_style (data);
433}
434
443G_MODULE_EXPORT void set_frame_type (GtkComboBox * fbox, gpointer data)
444{
445 tint * ad = (tint *)data;
446 a = ad -> a;
447 b = ad -> b;
448 c = ad -> c;
449 get_project_by_id(a) -> curves[b][c] -> frame_type = combo_get_active ((GtkWidget *)fbox);
450 set_frame_style (data);
451}
452
461G_MODULE_EXPORT void set_frame_line (GtkComboBox * fbox, gpointer data)
462{
463 tint * ad = (tint *)data;
464 a = ad -> a;
465 b = ad -> b;
466 c = ad -> c;
467 get_project_by_id(a) -> curves[b][c] -> frame_dash = combo_get_active ((GtkWidget *)fbox) + 1;
468 set_frame_style (data);
469}
470
479G_MODULE_EXPORT void set_frame_thickness (GtkEntry * entry, gpointer data)
480{
481 const gchar * str;
482 tint * ad = (tint *)data;
483 a = ad -> a;
484 b = ad -> b;
485 c = ad -> c;
486 str = entry_get_text (entry);
487 project * this_proj = get_project_by_id(a);
488 this_proj -> curves[b][c] -> frame_thickness = string_to_double ((gpointer)str);
489 update_entry_double (entry, this_proj -> curves[b][c] -> frame_thickness);
490 set_frame_style (data);
491}
492
501G_MODULE_EXPORT void set_frame_color (GtkColorChooser * colob, gpointer data)
502{
503 tint * ad = (tint *)data;
504 a = ad -> a;
505 b = ad -> b;
506 c = ad -> c;
507 project * this_proj = get_project_by_id(a);
508 this_proj -> curves[b][c] -> frame_color = get_button_color (colob);
509 set_frame_style (data);
510}
511
520G_MODULE_EXPORT void set_frame_pos (GtkEntry * fen, gpointer data)
521{
522 qint * cd = (qint *)data;
523 int k;
524 const gchar * m;
525 double z;
526 a = cd -> a;
527 b = cd -> b;
528 c = cd -> c;
529 d = cd -> d;
530 project * this_proj = get_project_by_id(a);
531 m = entry_get_text (fen);
532 z= string_to_double ((gpointer)m);
533 if (d < 2)
534 {
535 if (d == 0)
536 {
537 k = 0;
538 if (z < this_proj -> curves[b][c] -> frame_pos[0][1])
539 {
540 this_proj -> curves[b][c] -> frame_pos[0][0] = z;
541 }
542 else
543 {
544 show_warning ("Frame x min must be < to frame x max", this_proj -> curves[b][c] -> window);
545 }
546 }
547 else if (d == 1)
548 {
549 k = 1;
550 if (z > this_proj -> curves[b][c] -> frame_pos[0][0])
551 {
552 this_proj -> curves[b][c] -> frame_pos[0][1] = z;
553 }
554 else
555 {
556 show_warning ("Frame x max must be > to frame x min", this_proj -> curves[b][c] -> window);
557 }
558 }
559 update_entry_double (fen, this_proj -> curves[b][c] -> frame_pos[0][k]);
560 }
561 else
562 {
563 if (d == 2)
564 {
565 k = 0;
566 if (z > this_proj -> curves[b][c] -> frame_pos[1][1])
567 {
568 this_proj -> curves[b][c] -> frame_pos[1][0] = z;
569 }
570 else
571 {
572 show_warning ("Frame y min must be > to frame y max", this_proj -> curves[b][c] -> window);
573 }
574 }
575 else
576 {
577 k = 1;
578 if (z < this_proj -> curves[b][c] -> frame_pos[1][0])
579 {
580 this_proj -> curves[b][c] -> frame_pos[1][1] = z;
581 }
582 else
583 {
584 show_warning ("Frame y max must be < to frame y min", this_proj -> curves[b][c] -> window);
585 }
586 }
587 update_entry_double (fen, this_proj -> curves[b][c] -> frame_pos[1][k]);
588 }
589 set_frame_style (data);
590}
591
599GtkWidget * create_tab_1 (gpointer data)
600{
601 GtkWidget * graphbox;
602 GtkWidget * fbox;
603 GtkWidget * ghbox;
604 GtkWidget * gvbox;
605 GtkWidget * frame_style_box;
606 GtkWidget * frame_thickness;
607 GtkWidget * xyf;
608
609 gchar * str[2];
610 str[0] = "min";
611 str[1] = "max";
612 gchar * axl[2];
613 axl[0] = "x";
614 axl[1] = "y";
615 gchar * ftb[5];
616 ftb[0] = "closed";
617 ftb[1] = "top open";
618 ftb[2] = "right open";
619 ftb[3] = "left open";
620 ftb[4] = "open";
621 int xlgt, ylgt;
622 int i, j, k;
623
624 tint * cd = (tint *) data;
625 a = cd -> a;
626 b = cd -> b;
627 c = cd -> c;
628 project * this_proj = get_project_by_id(a);
629 // Axis related signals
630 for ( i=0 ; i < 2 ; i++ )
631 {
632 dataxe[i].a = a;
633 dataxe[i].b = b;
634 dataxe[i].c = c;
635 dataxe[i].d = i;
636 xyp[i] = create_entry (G_CALLBACK(set_window_size), 100, 10, FALSE, (gpointer)& dataxe[i]);
637 }
638 graphbox = create_vbox (BSEP);
639 ghbox = create_hbox (0);
640 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, ghbox, FALSE, FALSE, 15);
641 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label("Size:", 50, 35, 1.0, 0.5), FALSE, FALSE, 20);
642 xlgt = get_widget_width (this_proj -> curves[b][c] -> plot);
643 ylgt = get_widget_height (this_proj -> curves[b][c] -> plot);
644 update_entry_int (GTK_ENTRY(xyp[0]), xlgt);
645 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, xyp[0], FALSE, FALSE, 0);
646 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label("x", -1, -1, 0.5, 0.5), FALSE, FALSE, 10);
647 update_entry_int (GTK_ENTRY(xyp[1]), ylgt);
648 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, xyp[1], FALSE, FALSE, 0);
649 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label("pixels", -1, -1, 0.0, 0.5), FALSE, FALSE, 20);
650
651 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 5);
652 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox,
653 check_button ("Insert title", -1, -1, this_proj -> curves[b][c] -> show_title, G_CALLBACK(set_title), data),
654 FALSE, FALSE, 10);
655
657 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, title_box, FALSE, FALSE, 0);
658
659 ghbox = create_hbox (0);
660 add_box_child_start (GTK_ORIENTATION_VERTICAL, title_box, ghbox, FALSE, FALSE, 2);
661 gvbox = create_hbox (0);
662 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, gvbox, FALSE, FALSE, 0);
663 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, gvbox,
664 check_button ("Default title", 100, 35, this_proj -> curves[b][c] -> default_title, G_CALLBACK(set_title_default), data),
665 FALSE, FALSE, 40);
666 custom_title = create_entry (G_CALLBACK(set_title_custom), 200, 15, TRUE, data);
667 gtk_entry_set_alignment (GTK_ENTRY(custom_title), 0.0);
668 if (this_proj -> curves[b][c] -> show_title)
669 {
670 widget_set_sensitive (custom_title, ! this_proj -> curves[b][c] -> default_title);
671 }
672 else
673 {
675 }
676 update_entry_text (GTK_ENTRY(custom_title), this_proj -> curves[b][c] -> title);
677 add_box_child_end (gvbox, custom_title, FALSE, FALSE, 0);
678
679 add_box_child_end (bbox (title_box, "Font:"),
680 font_button (this_proj -> curves[b][c] -> title_font, 150, 35, G_CALLBACK(set_title_font), data),
681 FALSE, FALSE, 0);
682
683 add_box_child_end (bbox (title_box, "Color:"),
684 color_button (this_proj -> curves[b][c] -> title_color, TRUE, 150, 30, G_CALLBACK(set_title_color), data),
685 FALSE, FALSE, 0);
686
687 ghbox = bbox (title_box, "Position:");
688 GtkWidget * txyc;
689 for ( i=0 ; i < 2 ; i++ )
690 {
691 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label(lapos[i], (i==0)?10:30, -1, 1.0, 0.5), FALSE, FALSE, 5);
692 txyc = create_entry (G_CALLBACK(set_title_pos), 100, 10, FALSE, (gpointer)& dataxe[i]);
693 update_entry_double (GTK_ENTRY(txyc), this_proj -> curves[b][c] -> title_pos[i]);
694 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, txyc, FALSE, FALSE, 5);
695 }
696 widget_set_sensitive (title_box, this_proj -> curves[b][c] -> show_title);
697
698 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 10);
699
700 ghbox = create_hbox (0);
701 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, ghbox, FALSE, FALSE, 0);
702 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, markup_label("Background color:", 120, 30, 0.0, 0.5), FALSE, FALSE, 40);
703 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox,
704 color_button (this_proj -> curves[b][c] -> backcolor, TRUE, 100, -1, G_CALLBACK(set_background_color), data),
705 FALSE, FALSE, 40);
706
707 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 10);
708
709// Frame
710 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox,
711 check_button ("Show/hide frame", -1, -1, this_proj -> curves[b][c] -> show_frame, G_CALLBACK(set_show_frame), data),
712 FALSE, FALSE, 10);
713
715 add_box_child_start (GTK_ORIENTATION_VERTICAL, graphbox, frame_box, FALSE, FALSE, 0);
717 frame_style_box = create_vbox (BSEP);
718 add_box_child_start (GTK_ORIENTATION_VERTICAL, frame_box, frame_pix_box, FALSE, FALSE, 0);
719 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, frame_pix_box, frame_style_box, FALSE, FALSE, 0);
720
721// Frame style
722 fbox = create_combo ();
723 for (i=0; i<5; i++)
724 {
725 combo_text_append (fbox, ftb[i]);
726 }
727 gtk_widget_set_size_request (fbox, 150, 30);
728 combo_set_active (fbox, this_proj -> curves[b][c] -> frame_type);
729 g_signal_connect (G_OBJECT(fbox), "changed", G_CALLBACK(set_frame_type), data);
730 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, bbox (frame_style_box, "Type:"), fbox, FALSE, FALSE, 0);
731
732// Frame line style
733 fbox = create_combo ();
734 for ( i=1 ; i < ndash ; i++)
735 {
736 combo_text_append (fbox, g_strdup_printf("%d", i));
737 }
738 gtk_widget_set_size_request (fbox, 150, 30);
739 combo_set_active (fbox, this_proj -> curves[b][c] -> frame_dash - 1);
740 g_signal_connect (G_OBJECT(fbox), "changed", G_CALLBACK(set_frame_line), data);
741 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, bbox (frame_style_box, "Line style:"), fbox, FALSE, FALSE, 0);
742
743// Frame line width
744 frame_thickness = create_entry (G_CALLBACK(set_frame_thickness), -1, 10, FALSE, data);
745 update_entry_double (GTK_ENTRY(frame_thickness), this_proj -> curves[b][c] -> frame_thickness);
746 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, bbox (frame_style_box, "Line width:"), frame_thickness, FALSE, FALSE, 0);
747
748// Frame color
749 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, bbox (frame_style_box, "Color:"),
750 color_button (this_proj -> curves[b][c] -> frame_color, TRUE, 150, 30, G_CALLBACK(set_frame_color), data),
751 FALSE, FALSE, 0);
752
753// Frame pix
754 cairo_surface_t * frame = draw_frame_surface (this_proj -> curves[b][c] -> frame_type,
755 this_proj -> curves[b][c] -> frame_dash,
756 this_proj -> curves[b][c] -> frame_thickness,
757 this_proj -> curves[b][c] -> frame_pos[0],
758 this_proj -> curves[b][c] -> frame_pos[1],
759 this_proj -> curves[b][c] -> frame_color,
760 this_proj -> curves[b][c] -> backcolor);
762 cairo_surface_destroy (frame);
763
764 gtk_widget_set_size_request (frame_pix_box, -1, 150);
765#ifdef GTK4
766 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, frame_pix_box, markup_label(" ", 20, -1, 0.0, 0.0), FALSE, FALSE, 0);
767 gtk_widget_set_hexpand (frame_style_area, TRUE);
768#endif
769 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, frame_pix_box, frame_style_area, FALSE, FALSE, 20);
770
771 bbox (frame_box, "Position: ");
772 GtkWidget * fxyc;
773 k = -1;
774 for (i=0; i<2; i++)
775 {
776 ghbox = create_hbox (0);
777 add_box_child_start (GTK_ORIENTATION_VERTICAL, frame_box, ghbox, FALSE, FALSE, 0);
778 for (j=0; j<2; j++)
779 {
780 k = k + 1;
781 framxe[k].a = a;
782 framxe[k].b = b;
783 framxe[k].c = c;
784 framxe[k].d = k;
785 xyf = markup_label (g_strdup_printf ("%s %s: ",axl[i], str[j]), 70, -1, 1.0, 0.5);
786 widget_set_sensitive (xyf, this_proj -> curves[b][c] -> show_frame);
787 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, xyf, FALSE, FALSE, 20);
788 fxyc = create_entry (G_CALLBACK(set_frame_pos), 100, 10, FALSE, (gpointer)& framxe[k]);
789 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ghbox, fxyc, FALSE, FALSE, 0);
790 update_entry_double (GTK_ENTRY(fxyc), this_proj -> curves[b][c] -> frame_pos[i][j]);
791 }
792 }
793
794 widget_set_sensitive (frame_box, this_proj -> curves[b][c] -> show_frame);
795 return graphbox;
796}
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
double string_to_double(gpointer string)
convert string to double
Definition global.c:624
Global variable declarations Global convenience function declarations Global data structure defin...
@ IMG_SURFACE
Definition global.h:264
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
Definition gtk-misc.c:909
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
Definition gtk-misc.c:1375
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
Definition gtk-misc.c:643
GtkWidget * font_button(gchar *font, int dimx, int dimy, GCallback handler, gpointer data)
create a font selection button
Definition gtk-misc.c:1811
void resize_this_window(GtkWidget *window, int x, int y)
resize this GtkWindow
Definition gtk-misc.c:591
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
Definition gtk-misc.c:932
int get_widget_height(GtkWidget *widg)
retrive GtkWidget height
Definition gtk-misc.c:2554
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
Definition gtk-misc.c:607
#define BSEP
Definition global.h:247
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
Definition gtk-misc.c:624
int get_widget_width(GtkWidget *widg)
retrive GtkWidget width
Definition gtk-misc.c:2538
GtkWidget * fbox(GtkWidget *box, char *lab)
box creating routine, to help design faster elements for the GUI
Definition gtk-misc.c:2076
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1893
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:984
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
create a GtkLabel with pango markup
Definition gtk-misc.c:1646
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:308
ColRGBA get_button_color(GtkColorChooser *colob)
get the ColRGBA color from a GtkColorChooser button
Definition gtk-misc.c:2371
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:215
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:823
GtkWidget * create_image_from_data(int format, gpointer item_image)
create Gtk image for data
Definition gtk-misc.c:1504
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:961
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2169
GtkWidget * color_button(ColRGBA col, gboolean alpha, int dimx, int dimy, GCallback handler, gpointer data)
create a color selection button
Definition gtk-misc.c:1789
GtkWidget * bbox(GtkWidget *box, char *lab)
box creating routine, to help design faster elements for the GUI
Definition gtk-misc.c:2040
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:286
void update_entry_text(GtkEntry *entry, gchar *text)
update the content of a GtkEntry as string
Definition gtk-misc.c:681
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:811
int button_get_status(GtkWidget *button)
get status of check / toggle button
Definition gtk-misc.c:1855
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:182
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
image * plot
Definition ogl_draw.c:70
void show_warning(char *warning, GtkWidget *win)
show warning
Definition interface.c:260
Messaging function declarations.
double z
Definition ogl_draw.c:61
double y
Definition ogl_draw.c:61
double x
Definition ogl_draw.c:61
Function declarations for reading atomes project file Function declarations for saving atomes proje...
float blue
Definition global.h:126
float red
Definition global.h:124
float green
Definition global.h:125
Definition global.h:114
int b
Definition global.h:116
int c
Definition global.h:117
int d
Definition global.h:118
int a
Definition global.h:115
Definition global.h:106
int b
Definition global.h:108
int c
Definition global.h:109
int a
Definition global.h:107
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:303
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:283
G_MODULE_EXPORT void set_frame_type(GtkComboBox *fbox, gpointer data)
change frame type
Definition tab-1.c:443
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:262
G_MODULE_EXPORT void set_title_pos(GtkEntry *entry, gpointer data)
set axis title position entry callback
Definition tab-1.c:322
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:599
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:461
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:501
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:424
G_MODULE_EXPORT void set_title_default(GtkToggleButton *but, gpointer data)
use / not default title toggle callback GTK3
Definition tab-1.c:235
G_MODULE_EXPORT void set_frame_thickness(GtkEntry *entry, gpointer data)
set frame thickness entry callback
Definition tab-1.c:479
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:520
G_MODULE_EXPORT void set_show_frame(GtkToggleButton *but, gpointer data)
show / hide frame toggle callback GTK3
Definition tab-1.c:403
GtkWidget * frame[11]
Definition tab-1.c:87
void set_frame_style(gpointer data)
create frame preview
Definition tab-1.c:357
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