119cairo_surface_t *
draw_surface (
int aspect,
double hwidth,
double hopac,
int da,
double ti,
ColRGBA dcol,
ColRGBA bcol,
int tglyph,
double tgsize)
121 cairo_surface_t * cst;
125 double x1, x2, y1, y2;
129 cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 100);
130 tcst = cairo_create(cst);
131 cairo_set_source_rgb (tcst, bcol.
red, bcol.
green, bcol.
blue);
134 cairo_set_source_rgba (tcst, dcol.
red, dcol.
green, dcol.
blue, hopac);
135 x1 = (100.0-hwidth*50.0)/2.0;
139 cairo_rectangle (tcst, x1, y1, x2, y2);
141 cairo_set_source_rgba (tcst, dcol.
red, dcol.
green, dcol.
blue, 1.0);
146 cairo_set_dash (tcst, tdash ->
a, tdash ->
b, 0);
147 cairo_set_line_width (tcst, ti);
150 cairo_move_to (tcst, x1, y2);
151 cairo_line_to (tcst, x1, y1);
152 cairo_move_to (tcst, x1, y1);
153 cairo_line_to (tcst, x2, y1);
154 cairo_move_to (tcst, x2, y1);
155 cairo_line_to (tcst, x2, y2);
161 cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 30);
162 tcst = cairo_create(cst);
163 cairo_set_source_rgb (tcst, bcol.
red, bcol.
green, bcol.
blue);
169 cairo_set_dash (tcst, tdash ->
a, tdash ->
b, 0);
170 cairo_set_source_rgb (tcst, dcol.
red, dcol.
green, dcol.
blue);
171 cairo_set_line_width (tcst, ti);
172 cairo_move_to (tcst, 0, 15);
173 cairo_line_to (tcst, 100, 15);
184 cairo_destroy (tcst);
216 cairo_surface_t *
pix;
221 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
238 this_proj -> curves[
b][
c] -> backcolor,
243 cairo_surface_destroy (
pix);
246 gtk_widget_set_hexpand (
stylearea, TRUE);
267 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
268 j = gtk_combo_box_get_active (GTK_COMBO_BOX(gbox));
305 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
306 j = gtk_combo_box_get_active (GTK_COMBO_BOX(gbox));
342 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
374 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
383 this_proj -> curves[
b][
c] ->
layout -> thickness = k;
390 show_warning (
"Line width must be > 0.0", this_proj -> curves[
b][
c] -> window);
422 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
431 this_proj -> curves[
b][
c] ->
layout -> gsize = k;
438 show_warning (
"Glyph size must be > 0.0", this_proj -> curves[
b][
c] -> window);
470 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
479 this_proj -> curves[
b][
c] ->
layout -> hwidth = k;
486 show_warning (
"Bar width must be > 0.0", this_proj -> curves[
b][
c] -> window);
518 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
519 if (k >= 0.0 && k <= 1.0)
527 this_proj -> curves[
b][
c] ->
layout -> hopac = k;
534 show_warning (
"Bar opacity must be in [0.0 - 1.0]", this_proj -> curves[
b][
c] -> window);
561 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
562 j = gtk_combo_box_get_active (GTK_COMBO_BOX(gbox));
593 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
602 this_proj -> curves[
b][
c] ->
layout -> gfreq = j;
609 show_warning (
"Glyph frequency must be > 0", this_proj -> curves[
b][
c] -> window);
629G_MODULE_EXPORT
void choose_set (GtkComboBox * box, gpointer data)
634 i = gtk_combo_box_get_active (box);
651 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(
data_color), &
col);
679 i = gtk_combo_box_get_active (GTK_COMBO_BOX(
setcolorbox));
680 j = gtk_combo_box_get_active (box);
683 gtk_combo_box_set_active (GTK_COMBO_BOX(
data_glyph), 0);
714static void fill_org_model (GtkListStore * store, gpointer data)
716 GtkTreeIter curvelevel;
725 ctmp = this_proj -> curves[
b][
c] -> extrac -> first;
726 if (this_proj -> curves[
b][
c] -> draw_id == this_proj -> curves[
b][
c] -> extrac -> extras)
728 gtk_list_store_append (store, & curvelevel);
729 str = g_strdup_printf (
"%s - %s",
prepare_for_title(this_proj -> name), this_proj -> curves[
b][
c] -> name);
730 gtk_list_store_set (store, & curvelevel, 0,
a, 1,
b, 2,
c, 3, str, -1);
733 i = this_proj -> curves[
b][
c] -> extrac -> extras;
736 gtk_list_store_append (store, & curvelevel);
742 gtk_list_store_set (store, & curvelevel, 0, j, 1, k, 2, l, 3, str, -1);
745 if (this_proj -> curves[
b][
c] -> draw_id == i)
747 gtk_list_store_append (store, & curvelevel);
748 str = g_strdup_printf (
"%s - %s",
prepare_for_title(this_proj -> name), this_proj -> curves[
b][
c] -> name);
749 gtk_list_store_set (store, & curvelevel, 0,
a, 1,
b, 2,
c, 3, str, -1);
773 CurveExtra * ctmpa, * ctmpb, * ctmpc, * ctmpd;
775 l = this_proj -> curves[cid ->
b][cid ->
c] -> extrac -> extras;
776 m = gtk_combo_box_get_active (GTK_COMBO_BOX (
setcolorbox));
779 ctmpa = this_proj -> curves[cid ->
b][cid ->
c] -> extrac -> first;
780 for (i=0; i<m-1; i++) ctmpa = ctmpa -> next;
783 ctmpa = this_proj -> curves[cid ->
b][cid ->
c] -> extrac -> first;
784 valid = gtk_tree_model_get_iter_first (tree_model, & iter);
787 gtk_tree_model_get (tree_model, & iter, 0, & i, 1, & j, 2, & k, -1);
788 if (i == cid ->
a && j == cid ->
b && k == cid ->
c)
790 this_proj -> curves[cid ->
b][cid ->
c] -> draw_id = l;
792 else if (ctmpa ->
id.
a != i || ctmpa ->
id.
b != j || ctmpa ->
id.
c != k)
794 ctmpb = ctmpa -> next;
796 while (! done && ctmpb)
798 if (ctmpb ->
id.
a == i && ctmpb ->
id.
b == j && ctmpb ->
id.
c == k)
804 ctmpb = ctmpb -> next;
811 ctmpc = ctmpa -> prev;
812 if (ctmpb -> prev != ctmpa)
814 ctmpb -> prev -> next = ctmpa;
815 ctmpa -> prev = ctmpb -> prev;
816 ctmpd = ctmpa -> next;
820 ctmpa -> prev = ctmpb;
826 ctmpb -> next -> prev = ctmpa;
827 ctmpa -> next = ctmpb -> next;
831 ctmpa -> next = NULL;
832 this_proj -> curves[cid ->
b][cid ->
c] -> extrac -> last = ctmpa;
837 ctmpb -> prev = ctmpc;
838 ctmpc -> next = ctmpb;
842 ctmpb -> prev = NULL;
843 this_proj -> curves[cid ->
b][cid ->
c] -> extrac -> first = ctmpb;
847 ctmpd -> prev = ctmpb;
848 ctmpb -> next = ctmpd;
852 ctmpb -> next = ctmpa;
853 ctmpa -> prev = ctmpb;
857 ctmpa = ctmpa -> next;
861 ctmpa = ctmpa -> next;
864 valid = gtk_tree_model_iter_next (tree_model, & iter);
868 ctmpa = this_proj -> curves[cid ->
b][cid ->
c] -> extrac -> first;
872 if (cbid.
a == ctmpa ->
id.a && cbid.
b == ctmpa ->
id.b && cbid.
c == ctmpa ->
id.c)
break;
874 ctmpa = ctmpa -> next;
882 prepbox (this_proj ->
id, cid ->
b, cid ->
c);
883 gtk_combo_box_set_active (GTK_COMBO_BOX (
setcolorbox), m);
898 GtkTreeViewColumn * orgcol[4];
899 GtkCellRenderer * orgcell[4];
900 gchar * col_title[4] = {
" ",
" ",
" ",
"Data set(s)"};
901 gchar * ctype[4] = {
"text",
"text",
"text",
"text"};
902 GType
col_type[4] = {G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING};
903 GtkListStore * orglist = gtk_list_store_newv (4,
col_type);
908 orgcell[i] = gtk_cell_renderer_text_new();
909 orgcol[i] = gtk_tree_view_column_new_with_attributes(col_title[i], orgcell[i], ctype[i], i, NULL);
910 gtk_tree_view_append_column(GTK_TREE_VIEW(
orgtree), orgcol[i]);
911 if (i < 3) gtk_tree_view_column_set_visible (orgcol[i], FALSE);
913 fill_org_model (orglist, data);
914 g_object_unref (orglist);
916 gtk_tree_view_expand_all (GTK_TREE_VIEW(
orgtree));
917 gtk_tree_view_set_activate_on_single_click (GTK_TREE_VIEW(
orgtree), TRUE);
925 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(
orgtree), TRUE);
957 this_proj -> curves[
b][
c] -> bshift = gtk_check_button_get_active (
shift);
959 this_proj -> curves[
b][
c] -> bshift = gtk_toggle_button_get_active (
shift);
984 const int naspects = 2;
1000 gtk_widget_set_size_request (dhbox, -1, 270);
1004 for ( i=0 ; i < naspects ; i++ )
1008 gtk_combo_box_set_active (GTK_COMBO_BOX(
data_aspect), this_proj -> curves[
b][
c] ->
layout -> aspect);
1009 gtk_widget_set_size_request (
data_aspect, 120, -1);
1024 for ( i=1 ; i <
ndash ; i++)
1028 gtk_widget_set_size_request (
data_dash, 120, -1);
1029 gtk_combo_box_set_active(GTK_COMBO_BOX(
data_dash), this_proj -> curves[
b][
c] ->
layout -> dash);
1036 if (this_proj -> curves[
b][
c] ->
layout -> dash == 0)
1049 for ( i=1 ; i <
nglyph ; i++)
1053 gtk_widget_set_size_request (
data_glyph, 120, -1);
1054 gtk_combo_box_set_active (GTK_COMBO_BOX(
data_glyph), this_proj -> curves[
b][
c] ->
layout -> glyph);
1067 if (this_proj -> curves[
b][
c] ->
layout -> glyph == 0)
1088 gtk_combo_box_set_active (GTK_COMBO_BOX(
data_hist_pos), this_proj -> curves[
b][
c] ->
layout -> hpos);
1093 add_box_child_start (GTK_ORIENTATION_VERTICAL, databox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 5);
1100 check_button (
"Automatic <i>x axis</i> shift for bar diagram (to improve visibility)", -1, -1, this_proj -> curves[
b][
c] -> bshift, G_CALLBACK(
set_bshift), data),
1102 add_box_child_start (GTK_ORIENTATION_VERTICAL, databox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 5);
1116 gchar * str =
"\tMove up/down to adjust layer position (up to front, down to back)";
Callback declarations for main window.
void prepbox(int k, int l, int m)
prepare the curve selection combo box
Variable declarations for the curve layout edition window.
curve_dash * selectdash(int iddash)
setup dash pointer
void update_curve(gpointer data)
update curve rendering
Variable declarations for the curve widget Functions for interactions with the curve widget.
void draw_glyph(cairo_t *in, int theglyph, double x, double y, ColRGBA gcolor, double size)
draw glyph at (x,y)
GType col_type[MAXDATA][12]
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * create_entry(GCallback handler, int dim, int cdim, gboolean key_release, gpointer data)
Create a GtkEntry.
void update_entry_double(GtkEntry *entry, double doubleval)
update the content of a GtkEntry as double
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
const gchar * entry_get_text(GtkEntry *entry)
get the text in a GtkEntry
GdkRGBA colrgba_togtkrgba(ColRGBA col)
convert ColRGBA color to GdkRGBA color
void update_entry_int(GtkEntry *entry, int intval)
update the content of a GtkEntry as int
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
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.
ColRGBA get_button_color(GtkColorChooser *colob)
get the ColRGBA color from a GtkColorChooser button
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
GtkWidget * create_image_from_data(int format, gpointer item_image)
create Gtk image for data
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
GtkWidget * color_button(ColRGBA col, gboolean alpha, int dimx, int dimy, GCallback handler, gpointer data)
create a color selection button
GtkWidget * bbox(GtkWidget *box, char *lab)
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
project * get_project_by_id(int p)
get project pointer using id number
void show_warning(char *warning, GtkWidget *win)
show warning
Messaging function declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...
cairo_surface_t * draw_surface(int aspect, double hwidth, double hopac, int da, double ti, ColRGBA dcol, ColRGBA bcol, int tglyph, double tgsize)
draw the data set preview
DataLayout * get_extra_layout(int i)
retrieve the i data layout
GtkWidget * data_hist_width
G_MODULE_EXPORT void set_data_hist_opac(GtkEntry *entry, gpointer data)
set histogram bar opacity entry callback
G_MODULE_EXPORT void set_data_hist_width(GtkEntry *entry, gpointer data)
set histogram bar width entry callback
GtkWidget * data_hist_pos
G_MODULE_EXPORT void set_data_hist_pos(GtkComboBox *gbox, gpointer data)
change histogram bar position
GtkWidget * create_tab_2(gpointer data)
handle the creation of the 2nd tab of the curve edition dialog
GtkWidget * data_thickness
GtkWidget * data_glyph_freq
G_MODULE_EXPORT void choose_set(GtkComboBox *box, gpointer data)
change the data set to customize
void set_data_style(gpointer data)
update the data style widgets
G_MODULE_EXPORT void set_data_aspect(GtkComboBox *box, gpointer data)
change data aspect (x/y or histogram bars)
G_MODULE_EXPORT void set_data_thickness(GtkEntry *thickd, gpointer data)
set data thickness entry callback
G_MODULE_EXPORT void move_back_front(GtkTreeModel *tree_model, GtkTreePath *path, gpointer data)
move up or down data set in the tree model to move it front or back in the data plot
G_MODULE_EXPORT void set_bshift(GtkToggleButton *shift, gpointer data)
shift / not histogram bars toggle callback GTK3
G_MODULE_EXPORT void set_data_glyph_size(GtkEntry *glsize, gpointer data)
set glyph size entry callback
GtkWidget * create_org_list(gpointer data)
create the data set organisation widget
G_MODULE_EXPORT void set_data_glyph_freq(GtkEntry *glfreq, gpointer data)
set glyph frequency entry callback
G_MODULE_EXPORT void set_data_color(GtkColorChooser *colob, gpointer data)
set data color
G_MODULE_EXPORT void set_data_glyph(GtkComboBox *gbox, gpointer data)
change glyph type
G_MODULE_EXPORT void set_data_dash(GtkComboBox *gbox, gpointer data)
change data dash style
GtkWidget * data_hist_opac
GtkWidget * data_glyph_size