atomes 1.1.14
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
curve.h
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 header file: 'curve.h'
25*
26* Contains:
27
28 - Variable declarations for the curve widget
29 - Functions for interactions with the curve widget
30
31*/
32
33#ifndef CURVE_H_
34#define CURVE_H_
35
36#include "global.h"
37
38// Grid lines width in pixels
39#define GRIDSIZE 0.1
40// Default position of the legend on the curve
41#define LEGX 0.65
42#define LEGY 0.15
43// Default color of the data from 0 to 65535
44#define RED 1.0
45#define GREEN 0.0
46#define BLUE 0.0
47// Default linewidth of the data line
48#define DTHICK 1.0
49// Number of dash types
50#define NDASHS 11
51// Number of glyph types
52#define NGLYPHS 37
53// The marges between the windows border and the axes
54#define MARGX 100
55#define MARGY 70
56
57extern GtkWidget * axischoice;
58extern GtkWidget * vmin, * vmax;
59extern GtkWidget * majt;
60extern GtkWidget * nmi[2];
61extern GtkWidget * xyp[2];
62extern int resol[2];
63extern int originp;
64extern int ndash;
65extern int nglyph;
66extern double back_alpha;
67extern int activeg;
68extern int activec;
69extern int activer;
70
71typedef struct curve_dash curve_dash;
73{
74 const double * a;
75 int b;
76};
77
78extern gint32 etime;
79extern double XDRAW, YDRAW;
80extern double DXDRAW, DYDRAW;
81extern double xmax, ymax;
82extern double x_min, x_max;
83extern double y_max, y_min;
84extern double ax, ay;
85extern double cxy[2];
86extern double mticks;
87extern int nticks;
88extern int xlog, ylog;
89extern int dxlog, dylog;
90extern char * sca;
91
92extern PangoLayout * layout;
93extern gboolean dogrid;
94extern int x_shift, y_shift;
95extern int amint, amajt;
96extern int tickpos, labpos;
97
98// Marge sur X et Y dans les graphs
99extern int xmarge;
100extern int ymarge;
101extern char * curve_image_file;
102
103extern int get_curve_shift (project * this_proj, int b, int c);
104
105// Number of dash formats
106extern int ndash;
107extern int nglyph;
108extern const double dashed1[];
109extern int len1;
110extern const double pdashed[];
111extern int lenp;
112
113extern curve_dash * selectdash (int iddash);
114extern double scale (double axe);
115extern void prep_plot (project * this_proj, int rid, int cid);
116extern void prep_axis_data (project * this_proj, int rid, int cid, int ax);
117extern void hide_curves (project * this_proj, int c);
118extern void erase_curves (project * this_proj, int c);
119extern void update_curves ();
120extern void update_curve (gpointer curve);
121
122#ifdef GTK3
123extern gboolean show_curve (GtkWidget * grwdget, cairo_t * cr, gpointer curve);
124#else
125extern void show_curve (GtkDrawingArea * area, cairo_t * cr, int width, int height, gpointer curve);
126#endif
127extern void hide_curve (gpointer data);
128#ifdef GTK3
129extern G_MODULE_EXPORT gboolean to_hide_curve (GtkWidget * thecurve, GdkEvent * event, gpointer data);
130#else
131extern G_MODULE_EXPORT gboolean to_hide_curve (GtkWindow * thecurve, gpointer data);
132#endif
133
134extern void clean_curves_data (int calc, int start, int end);
135extern void initcurve (project * pid, int rid, int cid);
136extern void addcurwidgets (int pid, int rid, int st);
137extern void allocextra (int a, int b, int c);
138
139extern void label (cairo_t * cr, double val, int axe, int p, project * this_proj);
140
141extern void show_frame (cairo_t * cd,
142 int tf, int da, int res[2],
143 double ti, double x[2], double y[2],
144 ColRGBA dcol);
145extern void prep_frame (cairo_t * fr, int da, double ti, ColRGBA dcol);
146extern void draw_frame (cairo_t * cr, project * this_proj, int rid, int cid);
147
148extern void draw_glyph (cairo_t * in, int theglyph,
149 double x, double y, ColRGBA gcolor, double size);
150
151extern const gchar * default_title (int ax, int c);
152extern void show_title (cairo_t * cr, project * this_proj, int rid, int cid);
153
154extern void autoscale_axis (project * this_proj, int rid, int cid, int aid);
155extern void setup_xaxis_linear (cairo_t * cr, project * this_proj, int rid, int cid);
156extern void setup_xaxis_log (cairo_t * cr, project * this_proj, int rid, int cid, gboolean draw_it);
157extern void setup_yaxis_linear (cairo_t * cr, project * this_proj, int rid, int cid);
158extern void setup_yaxis_log (cairo_t * cr, project * this_proj, int rid, int cid, gboolean draw_it);
159
160extern void write_curve (gpointer idata);
161extern void save_image (gpointer cdata);
162extern void remove_extra (ExtraSets * sets, CurveExtra * ctmp);
163extern void curve_window_add_menu_bar (tint * data);
164extern GtkWidget * curve_popup_menu (gpointer data);
165extern void show_curve_popup_menu (GdkEvent * event, gpointer data);
166
167void draw_curve (cairo_t * cr,
168 int cid,
169 int rid,
170 project * this_proj,
171 int points,
172 ColRGBA withcolor,
173 int xscale,
174 int yscale,
175 int asp,
176 int vdash,
177 double thick,
178 int glyp,
179 double gize,
180 int freq,
181 double hwidth,
182 double hopac,
183 int hpos,
184 int extra,
185 int pid);
186
187extern void show_legend (cairo_t * cr, project * this_proj, int rid, int cid);
188#endif
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
int tickpos
Definition curve.c:83
void setup_yaxis_log(cairo_t *cr, project *this_proj, int rid, int cid, gboolean draw_it)
setup y axis using a log scale
Definition yaxis.c:233
GtkWidget * xyp[2]
Definition cedit.c:87
int xlog
Definition curve.c:74
int labpos
Definition curve.h:96
GtkWidget * majt
Definition tab-4.c:103
double ay
Definition curve.h:84
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Definition labels.c:56
GtkWidget * curve_popup_menu(gpointer data)
create curve popup menu
Definition m_curve.c:664
double cxy[2]
Definition curve.c:71
int activer
Definition w_curve.c:74
double DYDRAW
Definition curve.h:80
G_MODULE_EXPORT gboolean to_hide_curve(GtkWindow *thecurve, gpointer data)
void draw_frame(cairo_t *cr, project *this_proj, int rid, int cid)
draw frame and axis data
Definition frame.c:165
void show_curve_popup_menu(GdkEvent *event, gpointer data)
GtkWidget * vmin
Definition tab-4.c:104
void hide_curve(gpointer data)
hide curve
Definition show.c:312
double xmax
Definition curve.c:67
int ylog
Definition curve.h:88
void initcurve(project *pid, int rid, int cid)
initialize curve widget
Definition cwidget.c:156
GtkWidget * nmi[2]
Definition tab-4.c:106
void draw_curve(cairo_t *cr, int cid, int rid, project *this_proj, int points, ColRGBA withcolor, int xscale, int yscale, int asp, int vdash, double thick, int glyp, double gize, int freq, double hwidth, double hopac, int hpos, int extra, int pid)
draw target curve to the cairo drawing context
Definition draw.c:85
const gchar * default_title(int ax, int c)
default title string
Definition title.c:54
int dylog
Definition curve.h:89
void erase_curves(project *this_proj, int c)
free all curve(s) data
Definition curve.c:526
int get_curve_shift(project *this_proj, int b, int c)
get cruve window size shift
Definition w_curve.c:576
double scale(double axe)
find appropriate major tick spacing based on axis length
Definition curve.c:204
gint32 etime
Definition curve.c:63
double DXDRAW
Definition curve.c:66
void setup_yaxis_linear(cairo_t *cr, project *this_proj, int rid, int cid)
setup y axis using a linear scale
Definition yaxis.c:121
void setup_xaxis_log(cairo_t *cr, project *this_proj, int rid, int cid, gboolean draw_it)
setup x axis using a log scale
Definition xaxis.c:163
int resol[2]
Definition curve.c:64
void show_legend(cairo_t *cr, project *this_proj, int rid, int cid)
draw legend
Definition legend.c:56
char * sca
Definition curve.c:76
void hide_curves(project *this_proj, int c)
for project hide all curves for a calculation
Definition curve.c:451
void show_title(cairo_t *cr, project *this_proj, int rid, int cid)
draw title
Definition title.c:107
void prep_plot(project *this_proj, int rid, int cid)
prepare curve plot (setting up variables for the plot)
Definition curve.c:315
void save_image(gpointer cdata)
export curve window plot to image - creating the dialog
Definition w_img.c:326
void autoscale_axis(project *this_proj, int rid, int cid, int aid)
autoscale axis
Definition yaxis.c:55
void allocextra(int a, int b, int c)
int activec
Definition w_curve.c:73
void prep_frame(cairo_t *fr, int da, double ti, ColRGBA dcol)
draw frame line
Definition frame.c:56
int xmarge
Definition curve.c:86
const double dashed1[]
Definition curve.c:97
double YDRAW
Definition curve.h:79
int ymarge
Definition curve.c:87
void update_curve(gpointer curve)
update curve rendering
Definition curve.c:589
curve_dash * selectdash(int iddash)
setup dash pointer
Definition curve.c:134
double back_alpha
Definition w_img.c:58
double mticks
Definition curve.c:72
void addcurwidgets(int pid, int rid, int st)
add curve widgets to the project
Definition cwidget.c:259
const double pdashed[]
Definition curve.c:124
void curve_window_add_menu_bar(tint *data)
add menu bar to the curve window
Definition m_curve.c:570
void clean_curves_data(int calc, int start, int end)
clean curve data on a range of curve id
Definition initc.c:55
int ndash
Definition curve.h:106
double XDRAW
Definition curve.c:65
int amajt
Definition curve.h:95
double y_max
Definition curve.c:69
void setup_xaxis_linear(cairo_t *cr, project *this_proj, int rid, int cid)
setup x axis using a linear scale
Definition xaxis.c:54
double x_max
Definition curve.h:82
int activeg
Definition w_curve.c:72
gboolean dogrid
Definition curve.c:80
double ax
Definition curve.c:70
void show_curve(GtkDrawingArea *area, cairo_t *cr, int width, int height, gpointer curve)
show curve callback GTK3
Definition show.c:77
void prep_axis_data(project *this_proj, int rid, int cid, int ax)
prepare axis data
Definition frame.c:134
int lenp
Definition curve.c:125
double y_min
Definition curve.h:83
int nglyph
Definition curve.h:107
int len1
Definition curve.c:98
int dxlog
Definition curve.c:75
int nticks
Definition curve.c:73
void remove_extra(ExtraSets *sets, CurveExtra *ctmp)
remove data from extra set(s)
Definition m_curve.c:142
PangoLayout * layout
Definition curve.c:79
void write_curve(gpointer idata)
save curve data - creating the dialog
Definition w_data.c:164
int x_shift
Definition curve.c:81
GtkWidget * axischoice
Definition tab-4.c:90
int amint
Definition curve.c:82
void update_curves()
update all curve(s) rendering for all project(s) in the workspace
Definition curve.c:559
void draw_glyph(cairo_t *in, int theglyph, double x, double y, ColRGBA gcolor, double size)
draw glyph at (x,y)
Definition glyph.c:88
GtkWidget * vmax
Definition curve.h:58
int originp
Definition curve.c:77
double x_min
Definition curve.c:68
char * curve_image_file
Definition curve.c:88
double ymax
Definition curve.h:81
int y_shift
Definition curve.h:94
float extra
atom * tf
Definition d_measures.c:70
float val
Definition dlp_init.c:117
Global variable declarations Global convenience function declarations Global data structure defin...
double y
Definition ogl_draw.c:57
double x
Definition ogl_draw.c:57
int b
Definition curve.h:75
const double * a
Definition curve.h:74
Definition global.h:98
int b
Definition tab-1.c:95
int c
Definition tab-1.c:95
int a
Definition tab-1.c:95
GtkWidget * res[2]
Definition w_encode.c:212