checks for zero range axes, removed some unused function params
This commit is contained in:
parent
2c09982e5a
commit
33ecb08c4f
|
|
@ -179,9 +179,7 @@ void start_wire(double mx, double my)
|
|||
static int waves_callback(int event, int mx, int my, KeySym key, int button, int aux, int state)
|
||||
{
|
||||
int digital = 0;
|
||||
double wx1 = -2e-6, wx2 = 8e-6;
|
||||
double wy1 = -1, wy2 = 4;
|
||||
double ypos1 = 0, ypos2 = 5;
|
||||
double wx1 = 0, wy1 = 0, wx2 = 1e-6, wy2 = 5, ypos1 = 0, ypos2 = 5;
|
||||
double x1, y1, x2, y2, marginx, marginy;
|
||||
double cx, dx, cy, dy, dcy, ddy;
|
||||
int divx = 10, divy = 5;
|
||||
|
|
@ -220,6 +218,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
val = get_tok_value(r->prop_ptr,"y2",0);
|
||||
if(val[0]) wy2 = atof(val);
|
||||
else wy2 = 5;
|
||||
if(wx1 == wx2) wx2 += 1e-6; /* avoid division by 0 */
|
||||
if(wy1 == wy2) wy2 += 1.0; /* avoid division by 0 */
|
||||
val = get_tok_value(r->prop_ptr,"digital",0);
|
||||
if(val[0]) digital = atoi(val);
|
||||
else digital = 0;
|
||||
|
|
@ -303,6 +303,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
val = get_tok_value(xctx->rect[GRIDLAYER][xctx->graph_master].prop_ptr,"x2",0);
|
||||
if(val[0]) wx2 = atof(val);
|
||||
else wx2 = 1e-6;
|
||||
if(wx1 == wx2) wx2 += 1e-6; /* avoid division by 0 */
|
||||
|
||||
/* second loop: after having determined the master graph do the others */
|
||||
for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
|
||||
|
|
@ -322,12 +323,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
val = get_tok_value(r->prop_ptr,"y2",0);
|
||||
if(val[0]) wy2 = atof(val);
|
||||
else wy2 = 5;
|
||||
val = get_tok_value(r->prop_ptr,"ypos1",0);
|
||||
if(val[0]) ypos1 = atof(val);
|
||||
else ypos1 = 0;
|
||||
val = get_tok_value(r->prop_ptr,"ypos2",0);
|
||||
if(val[0]) ypos2 = atof(val);
|
||||
else ypos2 = 5;
|
||||
if(wy1 == wy2) wy2 += 1.0; /* avoid division by 0 */
|
||||
val = get_tok_value(r->prop_ptr,"dataset",0);
|
||||
if(val[0]) dataset = atoi(val);
|
||||
else dataset = 0;
|
||||
|
|
@ -335,6 +331,15 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
val = get_tok_value(r->prop_ptr,"digital",0);
|
||||
if(val[0]) digital = atoi(val);
|
||||
else digital = 0;
|
||||
if(digital) {
|
||||
val = get_tok_value(r->prop_ptr,"ypos1",0);
|
||||
if(val[0]) ypos1 = atof(val);
|
||||
else ypos1 = 0;
|
||||
val = get_tok_value(r->prop_ptr,"ypos2",0);
|
||||
if(val[0]) ypos2 = atof(val);
|
||||
else ypos2 = 5;
|
||||
if(ypos2 == ypos1) ypos2 += 1.0;
|
||||
}
|
||||
calc_graph_area(GRIDLAYER, i, digital, &x1, &y1, &x2, &y2, &marginx, &marginy);
|
||||
/* cache coefficients for faster graph coord transformations */
|
||||
cx = (x2 - x1) / (wx2 - wx1);
|
||||
|
|
|
|||
40
src/draw.c
40
src/draw.c
|
|
@ -1807,13 +1807,13 @@ int schematic_waves_loaded(void)
|
|||
static void draw_graph_bus_points(const char *ntok, int first, int last,
|
||||
double cx, double dx, double dcy, double ddy,
|
||||
int wave_col, int sweep_idx,
|
||||
int digital, int wcnt, int n_nodes,
|
||||
int wcnt, int n_nodes,
|
||||
double wy1, double wy2, double ypos1, double ypos2)
|
||||
{
|
||||
int p, i;
|
||||
double deltag = wy2 - wy1;
|
||||
double delta = ypos2 - ypos1;
|
||||
double s1 = 0.1 * deltag / delta; /* dig_max_waves; */
|
||||
double s1 = 0.1 * deltag / delta;
|
||||
double s2 = s1 * .8;
|
||||
double c = delta * (n_nodes - wcnt) * s1;
|
||||
double x1 = W_X(xctx->graph_values[sweep_idx][first]);
|
||||
|
|
@ -1903,12 +1903,15 @@ static void draw_graph_points(int v, int first, int last,
|
|||
double yy;
|
||||
int poly_npoints = 0;
|
||||
double deltag = wy2 - wy1;
|
||||
double delta = ypos2 - ypos1;
|
||||
double s1 = 0.1 * deltag / delta; /* dig_max_waves; */
|
||||
double s2 = s1 * .8;
|
||||
double delta;
|
||||
double s1;
|
||||
double s2;
|
||||
double c;
|
||||
|
||||
if(digital) {
|
||||
delta = ypos2 - ypos1;
|
||||
s1 = 0.1 * deltag / delta;
|
||||
s2 = s1 * .8; /* 20% spacing between traces */
|
||||
c = delta * (n_nodes - wcnt) * s1;
|
||||
}
|
||||
if( !digital || (c >= ypos1 && c <= ypos2) ) {
|
||||
|
|
@ -2097,34 +2100,39 @@ void draw_graph(int c, int i, int flags)
|
|||
/* get variables to plot, x/y range, grid info etc */
|
||||
val = get_tok_value(r->prop_ptr,"unitx",0);
|
||||
unitx_suffix = val[0];
|
||||
unitx = get_unit(val);;
|
||||
unitx = get_unit(val);
|
||||
val = get_tok_value(r->prop_ptr,"unity",0);
|
||||
unity_suffix = val[0];
|
||||
unity = get_unit(val);;
|
||||
unity = get_unit(val);
|
||||
val = get_tok_value(r->prop_ptr,"subdivx",0);
|
||||
if(val[0]) subdivx = atoi(val);
|
||||
val = get_tok_value(r->prop_ptr,"subdivy",0);
|
||||
if(val[0]) subdivy = atoi(val);
|
||||
val = get_tok_value(r->prop_ptr,"divx",0);
|
||||
if(val[0]) divx = atoi(val);
|
||||
else divx = 1;
|
||||
val = get_tok_value(r->prop_ptr,"divy",0);
|
||||
if(val[0]) divy = atoi(val);
|
||||
else divy = 1;
|
||||
val = get_tok_value(r->prop_ptr,"x1",0);
|
||||
if(val[0]) wx1 = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"y1",0);
|
||||
if(val[0]) wy1 = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"ypos1",0);
|
||||
if(val[0]) ypos1 = atof(val);
|
||||
else ypos1 = 0;
|
||||
val = get_tok_value(r->prop_ptr,"x2",0);
|
||||
if(val[0]) wx2 = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"y2",0);
|
||||
if(val[0]) wy2 = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"ypos2",0);
|
||||
if(val[0]) ypos2 = atof(val);
|
||||
else ypos2 = 5;
|
||||
if(wx1 == wx2) wx2 += 1e-6;
|
||||
if(wy1 == wy2) wy2 += 1.0;
|
||||
val = get_tok_value(r->prop_ptr,"digital",0);
|
||||
if(val[0]) digital = atoi(val);
|
||||
if(digital) {
|
||||
val = get_tok_value(r->prop_ptr,"ypos1",0);
|
||||
if(val[0]) ypos1 = atof(val);
|
||||
val = get_tok_value(r->prop_ptr,"ypos2",0);
|
||||
if(val[0]) ypos2 = atof(val);
|
||||
if(ypos2 == ypos1) ypos2 += 1.0;
|
||||
}
|
||||
/* plot single dataset */
|
||||
val = get_tok_value(r->prop_ptr,"dataset",0);
|
||||
if(val[0]) dataset = atoi(val);
|
||||
|
|
@ -2211,7 +2219,7 @@ void draw_graph(int c, int i, int flags)
|
|||
double deltag = wy2 - wy1;
|
||||
double delta = ypos2 - ypos1;
|
||||
double s1 = 0.1 * deltag / delta;
|
||||
double delta_div_n = delta * s1; /* dig_max_waves; */
|
||||
double delta_div_n = delta * s1;
|
||||
double yt = delta_div_n * (double)(n_nodes - wcnt);
|
||||
|
||||
if(yt <= ypos2 && yt >= ypos1) {
|
||||
|
|
@ -2265,7 +2273,7 @@ void draw_graph(int c, int i, int flags)
|
|||
if(bus_msb) {
|
||||
if(digital) {
|
||||
draw_graph_bus_points(ntok, first, last, cx, dx, dcy, ddy, wave_color,
|
||||
sweep_idx, digital, wcnt, n_nodes,
|
||||
sweep_idx, wcnt, n_nodes,
|
||||
wy1, wy2, ypos1, ypos2);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -2293,7 +2301,7 @@ void draw_graph(int c, int i, int flags)
|
|||
if(bus_msb) {
|
||||
if(digital) {
|
||||
draw_graph_bus_points(ntok, first, last, cx, dx, dcy, ddy, wave_color,
|
||||
sweep_idx, digital, wcnt, n_nodes,
|
||||
sweep_idx, wcnt, n_nodes,
|
||||
wy1, wy2, ypos1, ypos2);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ y1 = -0.0039
|
|||
y2 = 0.87
|
||||
divy = 3
|
||||
subdivy=1
|
||||
x1=1.30576e-07
|
||||
x2=1.75688e-07 divx=10
|
||||
x1=1.16495e-07
|
||||
x2=2.03183e-07 divx=10
|
||||
node="
|
||||
v(ldbl[0]) v(ldbl[16]) v(ldbl[32])
|
||||
v(ldbl[1]) v(ldbl[17]) v(ldbl[33])
|
||||
|
|
@ -46,8 +46,8 @@ y1 = -0.021
|
|||
y2 = 1.5
|
||||
subdivy=1
|
||||
divy = 4
|
||||
x1=1.30576e-07
|
||||
x2=1.75688e-07
|
||||
x1=1.16495e-07
|
||||
x2=2.03183e-07
|
||||
divx=10
|
||||
subdivx=4
|
||||
node="v(ldcp) v(ldyms[4]) v(ldyms[5]) v(ldyms[6]) v(ldymsref)"
|
||||
|
|
@ -59,8 +59,8 @@ y2 = 1.6
|
|||
divy = 3
|
||||
subdivy=0
|
||||
subdivx = 1
|
||||
x1=1.30576e-07
|
||||
x2=1.75688e-07 divx=10
|
||||
x1=1.16495e-07
|
||||
x2=2.03183e-07 divx=10
|
||||
node="
|
||||
v(ldwl[0]) v(ldwl[1]) v(ldwl[2]) v(ldwl[3])
|
||||
v(ldwl[4]) v(ldwl[5]) v(ldwl[6]) v(ldwl[16])
|
||||
|
|
@ -72,19 +72,19 @@ B 2 1840 -120 2890 -20 {flags=3
|
|||
y1 = -0.021
|
||||
y2 = 0.9
|
||||
divy = 1
|
||||
x1=1.30576e-07
|
||||
x2=1.75688e-07 divx=10
|
||||
x1=1.16495e-07
|
||||
x2=2.03183e-07 divx=10
|
||||
node="v(ldymsref)"
|
||||
color=3 unitx=n subdivy=4}
|
||||
B 2 1840 -880 2890 -420 {flags=3
|
||||
digital=1
|
||||
y1 = 0
|
||||
y2 = 1.6
|
||||
ypos1=0.0211877
|
||||
ypos2=2.22059
|
||||
ypos1=0.035378
|
||||
ypos2=2.02034
|
||||
divy = 1
|
||||
x1=1.16679e-07
|
||||
x2=2.68175e-07
|
||||
x1=1.16495e-07
|
||||
x2=2.03183e-07
|
||||
divx=12
|
||||
subdivx=4
|
||||
node="
|
||||
|
|
@ -107,8 +107,8 @@ B 2 1840 -1280 2890 -1090 {flags=3
|
|||
y1 = -0.022
|
||||
y2 = 1.6
|
||||
divy = 4
|
||||
x1=1.30576e-07
|
||||
x2=1.75688e-07
|
||||
x1=1.16495e-07
|
||||
x2=2.03183e-07
|
||||
divx=8
|
||||
unitx=n
|
||||
node="v(xsa[0].ldqib) v(xsa[5].ldqib) v(xsa[0].ldsali) v(xctrl.ldq_b)"
|
||||
|
|
|
|||
Loading…
Reference in New Issue