simplify node measurements and cursor handling
This commit is contained in:
parent
89f494aa85
commit
7756769a4e
33
src/draw.c
33
src/draw.c
|
|
@ -3109,7 +3109,7 @@ static void show_node_measures(
|
||||||
dbg(0, "show_node_measures(): no raw struct allocated\n");
|
dbg(0, "show_node_measures(): no raw struct allocated\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dbg(0, "show_node_measures(): bus_msb=%s, ntok=%s\n", bus_msb, ntok);
|
dbg(1, "show_node_measures(): bus_msb=%s, ntok=%s\n", bus_msb ? bus_msb : "NULL", ntok);
|
||||||
/* draw node values in graph */
|
/* draw node values in graph */
|
||||||
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
||||||
bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2);
|
bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2);
|
||||||
|
|
@ -3514,9 +3514,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
const char *ntok, *ctok, *stok;
|
const char *ntok, *ctok, *stok;
|
||||||
char *bus_msb = NULL;
|
char *bus_msb = NULL;
|
||||||
int wcnt = 0, idx, expression;
|
int wcnt = 0, idx, expression;
|
||||||
int *measure_p = NULL;
|
|
||||||
double *measure_x = NULL;
|
|
||||||
double *measure_prev_x = NULL;
|
|
||||||
char *express = NULL;
|
char *express = NULL;
|
||||||
xRect *r = &xctx->rect[GRIDLAYER][i];
|
xRect *r = &xctx->rect[GRIDLAYER][i];
|
||||||
Raw *raw = NULL;
|
Raw *raw = NULL;
|
||||||
|
|
@ -3538,7 +3535,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
|
|
||||||
/* draw stuff */
|
/* draw stuff */
|
||||||
if(flags & 8) {
|
if(flags & 8) {
|
||||||
int k;
|
|
||||||
char *tmp_ptr = NULL;
|
char *tmp_ptr = NULL;
|
||||||
int save_datasets = -1, save_npoints = -1;
|
int save_datasets = -1, save_npoints = -1;
|
||||||
#if !defined(__unix__) && HAS_CAIRO==1
|
#if !defined(__unix__) && HAS_CAIRO==1
|
||||||
|
|
@ -3561,14 +3557,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
cptr = color;
|
cptr = color;
|
||||||
sptr = sweep;
|
sptr = sweep;
|
||||||
n_nodes = count_items(node, "\n\t ", "\"");
|
n_nodes = count_items(node, "\n\t ", "\"");
|
||||||
measure_p = my_malloc(_ALLOC_ID_, sizeof(int) * n_nodes);
|
|
||||||
measure_x = my_malloc(_ALLOC_ID_, sizeof(double) * n_nodes);
|
|
||||||
measure_prev_x = my_malloc(_ALLOC_ID_, sizeof(double) * n_nodes);
|
|
||||||
for(k = 0 ; k < n_nodes; k++) {
|
|
||||||
measure_p[k] = -1;
|
|
||||||
measure_x[k] = 0.0;
|
|
||||||
measure_prev_x[k] = 0.0;
|
|
||||||
}
|
|
||||||
/* process each node given in "node" attribute, get also associated color/sweep var if any*/
|
/* process each node given in "node" attribute, get also associated color/sweep var if any*/
|
||||||
while( (ntok = my_strtok_r(nptr, "\n\t ", "\"", 4, &saven)) ) {
|
while( (ntok = my_strtok_r(nptr, "\n\t ", "\"", 4, &saven)) ) {
|
||||||
|
|
||||||
|
|
@ -3697,7 +3685,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
bbox(SET, 0.0, 0.0, 0.0, 0.0);
|
bbox(SET, 0.0, 0.0, 0.0, 0.0);
|
||||||
/* loop through all datasets found in raw file */
|
/* loop through all datasets found in raw file */
|
||||||
for(dset = 0 ; dset < raw->datasets; dset++) {
|
for(dset = 0 ; dset < raw->datasets; dset++) {
|
||||||
double prev_x;
|
|
||||||
int cnt=0, wrap;
|
int cnt=0, wrap;
|
||||||
register SPICE_DATA *gv = raw->values[sweep_idx];
|
register SPICE_DATA *gv = raw->values[sweep_idx];
|
||||||
|
|
||||||
|
|
@ -3707,7 +3694,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
my_realloc(_ALLOC_ID_, &point, raw->npoints[dset] * sizeof(XPoint));
|
my_realloc(_ALLOC_ID_, &point, raw->npoints[dset] * sizeof(XPoint));
|
||||||
/* Process "npoints" simulation items
|
/* Process "npoints" simulation items
|
||||||
* p loop split repeated 2 timed (for x and y points) to preserve cache locality */
|
* p loop split repeated 2 timed (for x and y points) to preserve cache locality */
|
||||||
prev_x = 0;
|
|
||||||
last = ofs;
|
last = ofs;
|
||||||
for(p = ofs ; p < ofs_end; p++) {
|
for(p = ofs ; p < ofs_end; p++) {
|
||||||
if(gr->logx) xx = mylog10(gv[p]);
|
if(gr->logx) xx = mylog10(gv[p]);
|
||||||
|
|
@ -3743,21 +3729,10 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
if(first == -1) first = p;
|
if(first == -1) first = p;
|
||||||
/* Build poly x array. Translate from graph coordinates to screen coords */
|
/* Build poly x array. Translate from graph coordinates to screen coords */
|
||||||
point[poly_npoints].x = (short)S_X(xx);
|
point[poly_npoints].x = (short)S_X(xx);
|
||||||
if(dataset == -1 || dataset == sweepvar_wrap) {
|
|
||||||
/* cursor1: show measurements on nodes in graph */
|
|
||||||
if(measure_p[wcnt] == -1 && flags & 2 && cnt) {
|
|
||||||
if(XSIGN(xx - xctx->graph_cursor1_x) != XSIGN(prev_x - xctx->graph_cursor1_x)) {
|
|
||||||
measure_p[wcnt] = p;
|
|
||||||
measure_x[wcnt] = xx;
|
|
||||||
measure_prev_x[wcnt] = prev_x;
|
|
||||||
}
|
|
||||||
} /* if(measure_p[wcnt] == -1 && flags & 2 && p > ofs) */
|
|
||||||
} /* if(dataset == -1 || dataset == sweepvar_wrap) */
|
|
||||||
last = p;
|
last = p;
|
||||||
poly_npoints++;
|
poly_npoints++;
|
||||||
++cnt;
|
++cnt;
|
||||||
} /* if(xx >= start && xx <= end) */
|
} /* if(xx >= start && xx <= end) */
|
||||||
prev_x = xx;
|
|
||||||
} /* for(p = ofs ; p < ofs + raw->npoints[dset]; p++) */
|
} /* for(p = ofs ; p < ofs + raw->npoints[dset]; p++) */
|
||||||
if(first != -1) {
|
if(first != -1) {
|
||||||
if(dataset == -1 || dataset == sweepvar_wrap) {
|
if(dataset == -1 || dataset == sweepvar_wrap) {
|
||||||
|
|
@ -3780,8 +3755,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
sweepvar_wrap++;
|
sweepvar_wrap++;
|
||||||
} /* for(dset...) */
|
} /* for(dset...) */
|
||||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||||
if(measure_p[wcnt] != -1)
|
show_node_measures(bus_msb, wave_color, idx, idx_arr, n_bits, n_nodes, ntok_copy, wcnt, gr);
|
||||||
show_node_measures(bus_msb, wave_color, idx, idx_arr, n_bits, n_nodes, ntok_copy, wcnt, gr);
|
|
||||||
my_free(_ALLOC_ID_, &point);
|
my_free(_ALLOC_ID_, &point);
|
||||||
if(idx_arr) my_free(_ALLOC_ID_, &idx_arr);
|
if(idx_arr) my_free(_ALLOC_ID_, &idx_arr);
|
||||||
} /* if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1 ) */
|
} /* if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1 ) */
|
||||||
|
|
@ -3806,9 +3780,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
||||||
my_free(_ALLOC_ID_, &node);
|
my_free(_ALLOC_ID_, &node);
|
||||||
my_free(_ALLOC_ID_, &color);
|
my_free(_ALLOC_ID_, &color);
|
||||||
my_free(_ALLOC_ID_, &sweep);
|
my_free(_ALLOC_ID_, &sweep);
|
||||||
my_free(_ALLOC_ID_, &measure_p);
|
|
||||||
my_free(_ALLOC_ID_, &measure_x);
|
|
||||||
my_free(_ALLOC_ID_, &measure_prev_x);
|
|
||||||
|
|
||||||
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
||||||
bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2);
|
bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue