95cairo_surface_t *
draw_surface (
int aspect,
double hwidth,
double hopac,
int da,
double ti,
ColRGBA dcol,
ColRGBA bcol,
int tglyph,
double tgsize)
97 cairo_surface_t * cst;
101 double x1, x2, y1, y2;
105 cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 100);
106 tcst = cairo_create(cst);
107 cairo_set_source_rgb (tcst, bcol.
red, bcol.
green, bcol.
blue);
110 cairo_set_source_rgba (tcst, dcol.
red, dcol.
green, dcol.
blue, hopac);
111 x1 = (100.0-hwidth*50.0)/2.0;
115 cairo_rectangle (tcst, x1, y1, x2, y2);
117 cairo_set_source_rgba (tcst, dcol.
red, dcol.
green, dcol.
blue, 1.0);
122 cairo_set_dash (tcst, tdash -> a, tdash -> b, 0);
123 cairo_set_line_width (tcst, ti);
126 cairo_move_to (tcst, x1, y2);
127 cairo_line_to (tcst, x1, y1);
128 cairo_move_to (tcst, x1, y1);
129 cairo_line_to (tcst, x2, y1);
130 cairo_move_to (tcst, x2, y1);
131 cairo_line_to (tcst, x2, y2);
137 cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 30);
138 tcst = cairo_create(cst);
139 cairo_set_source_rgb (tcst, bcol.
red, bcol.
green, bcol.
blue);
145 cairo_set_dash (tcst, tdash -> a, tdash -> b, 0);
146 cairo_set_source_rgb (tcst, dcol.
red, dcol.
green, dcol.
blue);
147 cairo_set_line_width (tcst, ti);
148 cairo_move_to (tcst, 0, 15);
149 cairo_line_to (tcst, 100, 15);
160 cairo_destroy (tcst);
193 cairo_surface_t *
pix;
211 this_curve -> backcolor,
214 this_curve -> curve_edit -> stylearea =
destroy_this_widget (this_curve -> curve_edit -> stylearea);
216 cairo_surface_destroy (
pix);
219 gtk_widget_set_hexpand (this_curve -> curve_edit -> stylearea, TRUE);
221 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, this_curve -> curve_edit -> pixarea, this_curve -> curve_edit -> stylearea, TRUE, TRUE, 0);
341 this_curve ->
layout -> thickness = k;
348 show_warning (_(
"Line width must be > 0.0"), this_curve -> window);
385 this_curve ->
layout -> gsize = k;
392 show_warning (_(
"Glyph size must be > 0.0"), this_curve -> window);
429 this_curve ->
layout -> hwidth = k;
436 show_warning (_(
"Bar width must be > 0.0"), this_curve -> window);
465 if (k >= 0.0 && k <= 1.0)
473 this_curve ->
layout -> hopac = k;
480 show_warning (_(
"Bar opacity must ∈ [0.0 - 1.0]"), this_curve -> window);
540 this_curve ->
layout -> gfreq = j;
547 show_warning (_(
"Glyph frequency must be > 0"), this_curve -> window);
582 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(cedit -> data_color), &
col);
642static void fill_org_model (GtkListStore * store, gpointer data)
644 GtkTreeIter curvelevel;
649 ctmp = this_curve -> extrac -> first;
650 if (this_curve -> draw_id == this_curve -> extrac -> extras)
652 gtk_list_store_append (store, & curvelevel);
653 str = g_strdup_printf (
"%s - %s",
get_project_by_id(((
tint *)data) -> a) -> name, this_curve -> name);
654 gtk_list_store_set (store, & curvelevel, 0, ((
tint *)data) -> a, 1, ((
tint *)data) -> b, 2, ((
tint *)data) -> c, 3, str, -1);
657 i = this_curve -> extrac -> extras;
660 gtk_list_store_append (store, & curvelevel);
665 gtk_list_store_set (store, & curvelevel, 0, j, 1, k, 2, l, 3, str, -1);
668 if (this_curve -> draw_id == i)
670 gtk_list_store_append (store, & curvelevel);
671 str = g_strdup_printf (
"%s - %s",
get_project_by_id(((
tint *)data) -> a) -> name, this_curve -> name);
672 gtk_list_store_set (store, & curvelevel, 0, ((
tint *)data) -> a, 1, ((
tint *)data) -> b, 2, ((
tint *)data) -> c, 3, str, -1);
688 DataLayout * new_layout = g_malloc0(
sizeof*new_layout);
689 new_layout -> datacolor.red = old_layout -> datacolor.red;
690 new_layout -> datacolor.green = old_layout -> datacolor.green;
691 new_layout -> datacolor.blue = old_layout -> datacolor.blue;
692 new_layout -> datacolor.alpha = 1.0;
693 new_layout -> thickness = old_layout -> thickness;
694 new_layout -> hwidth = old_layout -> hwidth;
695 new_layout -> hopac = old_layout -> hopac;
696 new_layout -> hpos = old_layout -> hpos;
697 new_layout -> dash = old_layout -> dash;
698 new_layout -> gfreq = old_layout -> gfreq;
699 new_layout -> aspect = old_layout -> aspect;
700 new_layout -> glyph = old_layout -> glyph;
701 new_layout -> gsize = old_layout -> gsize;
728 ctmpa = this_curve -> extrac -> first;
729 for (i=0; i<m-1; i++) ctmpa = ctmpa -> next;
732 l = this_curve -> extrac -> extras;
733 valid = gtk_tree_model_get_iter_first (tree_model, & iter);
738 gtk_tree_model_get (tree_model, & iter, 0, & i, 1, & j, 2, & k, -1);
739 if (i == cid -> a && j == cid -> b && k == cid -> c)
742 this_curve -> draw_id = l;
747 ctmpa = this_curve -> extrac -> first;
749 while (! done && ctmpa)
751 if (ctmpa ->
id.a == i && ctmpa ->
id.b == j && ctmpa ->
id.c == k)
757 ctmpa = ctmpa -> next;
763 if (new_extra == NULL)
765 new_extra = g_malloc0(
sizeof*tmp_extra);
766 tmp_extra = new_extra;
770 tmp_extra -> next = g_malloc0(
sizeof*tmp_extra -> next);
771 tmp_extra -> next -> prev = tmp_extra;
772 tmp_extra = tmp_extra -> next;
774 tmp_extra ->
id = ctmpa -> id;
778 valid = gtk_tree_model_iter_next (tree_model, & iter);
780 ctmpa = this_curve -> extrac -> first -> next;
783 if (ctmpa -> prev) g_free (ctmpa -> prev);
784 ctmpa = ctmpa -> next;
786 this_curve -> extrac -> first = new_extra;
787 this_curve -> extrac -> last = tmp_extra;
790 ctmpa = this_curve -> extrac -> first;
794 if (cbid.
a == ctmpa ->
id.a && cbid.
b == ctmpa ->
id.b && cbid.
c == ctmpa ->
id.c)
break;
796 ctmpa = ctmpa -> next;
801 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, cedit -> thesetbox, cedit -> setcolorbox, FALSE, FALSE, 0);
805 choose_set (GTK_COMBO_BOX(cedit -> setcolorbox), data);
820void curve_set_markup (GtkTreeViewColumn *
col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
835 GtkTreeViewColumn * orgcol[4];
836 GtkCellRenderer * orgcell[4];
837 gchar * ctype[4] = {
"text",
"text",
"text",
"text"};
838 GType
col_type[4] = {G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING};
839 GtkListStore * orglist = gtk_list_store_newv (4,
col_type);
842 cedit -> orgtree = gtk_tree_view_new_with_model(
orgmodel);
845 orgcell[i] = gtk_cell_renderer_text_new();
846 orgcol[i] = gtk_tree_view_column_new_with_attributes((i<3) ?
" " : _(
"Data set(s)"), orgcell[i], ctype[i], i, NULL);
847 gtk_tree_view_append_column(GTK_TREE_VIEW(cedit -> orgtree), orgcol[i]);
850 gtk_tree_view_column_set_visible (orgcol[i], FALSE);
854 gtk_tree_view_column_set_cell_data_func (orgcol[i], orgcell[i],
curve_set_markup, NULL, NULL);
857 fill_org_model (orglist, data);
858 g_object_unref (orglist);
860 gtk_tree_view_expand_all (GTK_TREE_VIEW(cedit -> orgtree));
861 gtk_tree_view_set_activate_on_single_click (GTK_TREE_VIEW(cedit -> orgtree), TRUE);
869 gtk_tree_view_set_reorderable (GTK_TREE_VIEW(cedit -> orgtree), TRUE);
870 return cedit -> orgtree;
915 add_box_child_start (GTK_ORIENTATION_VERTICAL, databox, cedit -> thesetbox, FALSE, FALSE, 10);
919 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, cedit -> thesetbox, cedit -> setcolorbox, FALSE, FALSE, 10);
922 add_box_child_start (GTK_ORIENTATION_VERTICAL, databox, cedit -> pixarea, FALSE, FALSE, 10);
924 gtk_widget_set_size_request (dhbox, -1, 270);
925 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, cedit -> pixarea, dhbox, FALSE, FALSE, 0);
931 gtk_widget_set_size_request (cedit -> data_aspect, 120, -1);
932 g_signal_connect (G_OBJECT(cedit -> data_aspect),
"changed", G_CALLBACK(
set_data_aspect), data);
933 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (dhbox, _(
"Plot type:")), cedit -> data_aspect, FALSE, FALSE, 0);
934 if (((
tint *)data) -> b ==
MSD)
941 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (dhbox, _(
"Data color:")), cedit -> data_color, FALSE, FALSE, 0);
946 for ( i=1 ; i <
ndash ; i++)
950 gtk_widget_set_size_request (cedit -> data_dash, 120, -1);
952 g_signal_connect (G_OBJECT(cedit -> data_dash),
"changed", G_CALLBACK(
set_data_dash), data);
953 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (dhbox, _(
"Line style:")), cedit -> data_dash, FALSE, FALSE, 0);
958 if (this_curve ->
layout -> dash == 0)
962 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (dhbox, _(
"Line width:")), cedit -> data_thickness, FALSE, FALSE, 0);
967 add_box_child_start (GTK_ORIENTATION_VERTICAL, data_shape, cedit -> Glyph_box, FALSE, FALSE, 0);
971 for ( i=1 ; i <
nglyph ; i++)
975 gtk_widget_set_size_request (cedit -> data_glyph, 120, -1);
977 g_signal_connect (G_OBJECT(cedit -> data_glyph),
"changed", G_CALLBACK(
set_data_glyph), data);
978 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (cedit -> Glyph_box, _(
"Glyph type:")), cedit -> data_glyph, FALSE, FALSE, 0);
983 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (cedit -> Glyph_box, _(
"Glyph size:")), cedit -> data_glyph_size, FALSE, FALSE, 0);
988 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (cedit -> Glyph_box, _(
"Glyph freq.:")), cedit -> data_glyph_freq, FALSE, FALSE, 0);
989 if (this_curve ->
layout -> glyph == 0)
996 add_box_child_start (GTK_ORIENTATION_VERTICAL, data_shape, cedit -> Hist_box, FALSE, FALSE, 0);
1000 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (cedit -> Hist_box, _(
"Bar width:")), cedit -> data_hist_width, FALSE, FALSE, 0);
1004 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (cedit -> Hist_box, _(
"Color opacity:")), cedit -> data_hist_opac, FALSE, FALSE, 0);
1009 gtk_widget_set_size_request (cedit -> data_hist_pos, 120, -1);
1011 g_signal_connect (G_OBJECT(cedit -> data_hist_pos),
"changed", G_CALLBACK(
set_data_hist_pos), data);
1012 add_box_child_start (GTK_ORIENTATION_HORIZONTAL,
bbox (cedit -> Hist_box, _(
"Bar opacity:")), cedit -> data_hist_pos, FALSE, FALSE, 0);
1014 add_box_child_start (GTK_ORIENTATION_VERTICAL, databox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 5);
1016 if (((
tint *)data) -> b !=
MSD)
1021 check_button (_(
"Automatic <i>x axis</i> shift for bar diagram (to improve visibility)"), -1, -1, this_curve -> bshift, G_CALLBACK(
set_bshift), data),
1023 add_box_child_start (GTK_ORIENTATION_VERTICAL, databox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 5);
1037 gchar * str = _(
"\tMove up/down to adjust layer position (up to front, down to back)");
Callback declarations for main window.
G_MODULE_EXPORT void set_data_aspect(GtkComboBox *box, gpointer data)
change data aspect (x/y or histogram bars)
void prepbox(gpointer data)
prepare the curve selection combo box
Curve * get_curve_from_pointer(gpointer data)
get Curve pointer from pointer
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]
double string_to_double(gpointer string)
convert string to double
Global variable declarations Global convenience function declarations Global data structure defin...
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
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
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
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
void set_renderer_markup(GtkTreeModel *mod, GtkTreeIter *iter, GtkCellRenderer *renderer, int col)
set Pango text markup for a GtkCellRenderer
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)
create a GtkLabel with pango markup
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)
box creating routine, to help design faster elements for the GUI
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
int button_get_status(GtkWidget *button)
get status of check / toggle button
void show_the_widgets(GtkWidget *widg)
show GtkWidget
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.
DataLayout * get_extra_layout(int i)
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
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
void curve_set_markup(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
Curve edit window, tab-2, Pango markup in tree view.
G_MODULE_EXPORT void set_data_hist_pos(GtkComboBox *gbox, gpointer data)
change histogram bar position
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
DataLayout * duplicate_curve_layout(DataLayout *old_layout)
duplicate a curve layout
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
DataLayout * get_extra_layout(gpointer data, int i)
retrieve the i data layout
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
GtkWidget * create_tab_2(curve_edition *cedit, gpointer data)
handle the creation of the 2nd tab of the curve edition dialog
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