various regressions due to refactoring fixed
This commit is contained in:
parent
c35d7b5d22
commit
223b9dc0a6
|
|
@ -169,7 +169,7 @@ void start_wire(double mx, double my)
|
||||||
/* process user input (arrow keys for now) when only graphs are selected */
|
/* process user input (arrow keys for now) when only graphs are selected */
|
||||||
|
|
||||||
/* xctx->graph_flags:
|
/* xctx->graph_flags:
|
||||||
* 1:
|
* 1: dnu, reserved, used in draw_graphs()
|
||||||
* 2: draw x-cursor1
|
* 2: draw x-cursor1
|
||||||
* 4: draw x-cursor2
|
* 4: draw x-cursor2
|
||||||
* 8: dnu, reserved, used in draw_graphs()
|
* 8: dnu, reserved, used in draw_graphs()
|
||||||
|
|
@ -182,9 +182,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
{
|
{
|
||||||
Graph_ctx *gr;
|
Graph_ctx *gr;
|
||||||
char s[30];
|
char s[30];
|
||||||
int i, need_redraw = 0;
|
int i, need_redraw = 0, dataset = 0;
|
||||||
double xx1, xx2, yy1, yy2;
|
double xx1, xx2, yy1, yy2;
|
||||||
double lock_gx1, lock_gx2;
|
|
||||||
double delta_threshold = 0.25;
|
double delta_threshold = 0.25;
|
||||||
double zoom_m = 0.5;
|
double zoom_m = 0.5;
|
||||||
xRect *r;
|
xRect *r;
|
||||||
|
|
@ -204,7 +203,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
/* check if this is the master graph (the one containing the mouse pointer) */
|
/* check if this is the master graph (the one containing the mouse pointer) */
|
||||||
/* determine if mouse pointer is below xaxis or left of yaxis in some graph */
|
/* determine if mouse pointer is below xaxis or left of yaxis in some graph */
|
||||||
if( POINTINSIDE(xctx->mousex, xctx->mousey, r->x1, r->y1, r->x2, r->y2)) {
|
if( POINTINSIDE(xctx->mousex, xctx->mousey, r->x1, r->y1, r->x2, r->y2)) {
|
||||||
setup_graph_data(i, xctx->graph_flags, gr);
|
setup_graph_data(i, xctx->graph_flags, gr, 0);
|
||||||
|
|
||||||
/* move cursor1 */
|
/* move cursor1 */
|
||||||
/* set cursor position from master graph x-axis */
|
/* set cursor position from master graph x-axis */
|
||||||
|
|
@ -230,8 +229,6 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
xctx->graph_master = i;
|
xctx->graph_master = i;
|
||||||
zoom_m = (xctx->mousex - gr->x1) / gr->w;
|
zoom_m = (xctx->mousex - gr->x1) / gr->w;
|
||||||
lock_gx1 = gr->gx1;
|
|
||||||
lock_gx2 = gr->gx2;
|
|
||||||
/* dragging cursors when mouse is very close */
|
/* dragging cursors when mouse is very close */
|
||||||
if(event == ButtonPress && button == Button1) {
|
if(event == ButtonPress && button == Button1) {
|
||||||
if( (xctx->graph_flags & 2) && fabs(xctx->mousex - W_X(xctx->graph_cursor1_x)) < 10) {
|
if( (xctx->graph_flags & 2) && fabs(xctx->mousex - W_X(xctx->graph_cursor1_x)) < 10) {
|
||||||
|
|
@ -279,7 +276,12 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
|
|
||||||
/* second loop: after having determined the master graph do the others */
|
/* second loop: after having determined the master graph do the others */
|
||||||
for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
|
for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
|
||||||
setup_graph_data(i, xctx->graph_flags, gr);
|
r = &xctx->rect[GRIDLAYER][i];
|
||||||
|
if( !(r->flags & 1) ) continue;
|
||||||
|
setup_graph_data(i, xctx->graph_flags, gr, xctx->graph_master);
|
||||||
|
/* if no dataset given assume 0 for graph scaling calculations */
|
||||||
|
if(gr->dataset == -1) dataset = 0;
|
||||||
|
else dataset = gr->dataset;
|
||||||
/* destroy / show measurement widget */
|
/* destroy / show measurement widget */
|
||||||
if(i == xctx->graph_master) {
|
if(i == xctx->graph_master) {
|
||||||
if(xctx->graph_flags & 64) {
|
if(xctx->graph_flags & 64) {
|
||||||
|
|
@ -308,7 +310,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbg(1, "%g %g %g %g - %d %d\n", lock_gx1, gr->gy1, lock_gx2, gr->gy2, gr->divx, gr->divy);
|
dbg(1, "%g %g %g %g - %d %d\n", gr->gx1, gr->gy1, gr->gx2, gr->gy2, gr->divx, gr->divy);
|
||||||
if( event == KeyPress || event == ButtonPress || event == MotionNotify ) {
|
if( event == KeyPress || event == ButtonPress || event == MotionNotify ) {
|
||||||
/* move cursor1 */
|
/* move cursor1 */
|
||||||
if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 16 )) {
|
if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 16 )) {
|
||||||
|
|
@ -352,12 +354,12 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delta = gr->gw;
|
delta = gr->master_gw;
|
||||||
delta_threshold = 0.01;
|
delta_threshold = 0.01;
|
||||||
if( r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if( r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
if(fabs(xctx->mx_double_save - xctx->mousex_snap) > fabs(gr->cx * delta) * delta_threshold) {
|
if(fabs(xctx->mx_double_save - xctx->mousex_snap) > fabs(gr->cx * delta) * delta_threshold) {
|
||||||
xx1 = lock_gx1 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx;
|
xx1 = gr->master_gx1 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx;
|
||||||
xx2 = lock_gx2 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx;
|
xx2 = gr->master_gx2 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1410, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1410, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -401,10 +403,10 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if( r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
delta = gr->gw;
|
delta = gr->master_gw;
|
||||||
delta_threshold = 0.05;
|
delta_threshold = 0.05;
|
||||||
xx1 = lock_gx1 - delta * delta_threshold;
|
xx1 = gr->master_gx1 - delta * delta_threshold;
|
||||||
xx2 =lock_gx2 - delta * delta_threshold;
|
xx2 =gr->master_gx2 - delta * delta_threshold;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1428, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1428, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -431,10 +433,10 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
need_redraw = 1;
|
need_redraw = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delta = gr->gw;
|
delta = gr->master_gw;
|
||||||
delta_threshold = 0.05;
|
delta_threshold = 0.05;
|
||||||
xx1 = lock_gx1 - delta * delta_threshold;
|
xx1 = gr->master_gx1 - delta * delta_threshold;
|
||||||
xx2 = lock_gx2 - delta * delta_threshold;
|
xx2 = gr->master_gx2 - delta * delta_threshold;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1395, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1395, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -469,10 +471,10 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
delta = gr->gw;
|
delta = gr->master_gw;
|
||||||
delta_threshold = 0.05;
|
delta_threshold = 0.05;
|
||||||
xx1 = lock_gx1 + delta * delta_threshold;
|
xx1 = gr->master_gx1 + delta * delta_threshold;
|
||||||
xx2 = lock_gx2 + delta * delta_threshold;
|
xx2 = gr->master_gx2 + delta * delta_threshold;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1397, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1397, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -499,10 +501,10 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
need_redraw = 1;
|
need_redraw = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delta = gr->gw;
|
delta = gr->master_gw;
|
||||||
delta_threshold = 0.05;
|
delta_threshold = 0.05;
|
||||||
xx1 = lock_gx1 + delta * delta_threshold;
|
xx1 = gr->master_gx1 + delta * delta_threshold;
|
||||||
xx2 = lock_gx2 + delta * delta_threshold;
|
xx2 = gr->master_gx2 + delta * delta_threshold;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1430, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1430, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -544,9 +546,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
double var = 0.2 * (lock_gx2 -lock_gx1);
|
double var = 0.2 * gr->master_gw;
|
||||||
xx2 = lock_gx2 + var * (1 - zoom_m);
|
xx2 = gr->master_gx2 + var * (1 - zoom_m);
|
||||||
xx1 = lock_gx1 - var * zoom_m;
|
xx1 = gr->master_gx1 - var * zoom_m;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1399, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1399, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -558,9 +560,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
else if(key == XK_Down) {
|
else if(key == XK_Down) {
|
||||||
if(!xctx->graph_left) {
|
if(!xctx->graph_left) {
|
||||||
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
double var = 0.2 * (lock_gx2 -lock_gx1);
|
double var = 0.2 * gr->master_gw;
|
||||||
xx2 = lock_gx2 + var * (1 - zoom_m);
|
xx2 = gr->master_gx2 + var * (1 - zoom_m);
|
||||||
xx1 = lock_gx1 - var * zoom_m;
|
xx1 = gr->master_gx1 - var * zoom_m;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1418, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1418, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -602,9 +604,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
double var = 0.2 * (lock_gx2 - lock_gx1);;
|
double var = 0.2 * gr->master_gw;
|
||||||
xx2 = lock_gx2 - var * (1 - zoom_m);
|
xx2 = gr->master_gx2 - var * (1 - zoom_m);
|
||||||
xx1 = lock_gx1 + var * zoom_m;
|
xx1 = gr->master_gx1 + var * zoom_m;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1449, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1449, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -616,9 +618,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
else if(key == XK_Up) {
|
else if(key == XK_Up) {
|
||||||
if(!xctx->graph_left) {
|
if(!xctx->graph_left) {
|
||||||
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
double var = 0.2 * (lock_gx2 -lock_gx1);
|
double var = 0.2 * gr->master_gw;
|
||||||
xx2 = lock_gx2 - var * (1 - zoom_m);
|
xx2 = gr->master_gx2 - var * (1 - zoom_m);
|
||||||
xx1 = lock_gx1 + var * zoom_m;
|
xx1 = gr->master_gx1 + var * zoom_m;
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1445, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1445, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -642,8 +644,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
nptr = NULL;
|
nptr = NULL;
|
||||||
j = get_raw_index(ntok);
|
j = get_raw_index(ntok);
|
||||||
if(j >= 0) {
|
if(j >= 0) {
|
||||||
for(i = 0; i < xctx->graph_npoints[gr->dataset]; i++) {
|
for(i = 0; i < xctx->graph_npoints[dataset]; i++) {
|
||||||
v = get_raw_value(gr->dataset, j, i);
|
v = get_raw_value(dataset, j, i);
|
||||||
if(first || v < min) {min = v; first = 0;}
|
if(first || v < min) {min = v; first = 0;}
|
||||||
if(first || v > max) {max = v; first = 0;}
|
if(first || v > max) {max = v; first = 0;}
|
||||||
}
|
}
|
||||||
|
|
@ -661,8 +663,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
xx1 = get_raw_value(gr->dataset, 0, 0);
|
xx1 = get_raw_value(dataset, 0, 0);
|
||||||
xx2 = get_raw_value(gr->dataset, 0, xctx->graph_npoints[gr->dataset] -1);
|
xx2 = get_raw_value(dataset, 0, xctx->graph_npoints[dataset] -1);
|
||||||
my_snprintf(s, S(s), "%g", xx1);
|
my_snprintf(s, S(s), "%g", xx1);
|
||||||
my_strdup(1409, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
my_strdup(1409, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
|
||||||
my_snprintf(s, S(s), "%g", xx2);
|
my_snprintf(s, S(s), "%g", xx2);
|
||||||
|
|
@ -677,9 +679,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
|
|
||||||
if(xctx->graph_values) {
|
if(xctx->graph_values) {
|
||||||
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
|
||||||
delta = lock_gx2 - lock_gx1;
|
delta = gr->master_gw;
|
||||||
wwx1 = get_raw_value(gr->dataset, 0, 0);
|
wwx1 = get_raw_value(dataset, 0, 0);
|
||||||
wwx2 = get_raw_value(gr->dataset, 0, xctx->graph_npoints[gr->dataset] - 1);
|
wwx2 = get_raw_value(dataset, 0, xctx->graph_npoints[dataset] - 1);
|
||||||
ccx = (gr->x2 - gr->x1) / (wwx2 - wwx1);
|
ccx = (gr->x2 - gr->x1) / (wwx2 - wwx1);
|
||||||
ddx = gr->x1 - wwx1 * ccx;
|
ddx = gr->x1 - wwx1 * ccx;
|
||||||
p = (xctx->mousex_snap - ddx) / ccx;
|
p = (xctx->mousex_snap - ddx) / ccx;
|
||||||
|
|
@ -716,6 +718,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
}
|
}
|
||||||
} /* else if( event == ButtonRelease) */
|
} /* else if( event == ButtonRelease) */
|
||||||
if(need_redraw) {
|
if(need_redraw) {
|
||||||
|
setup_graph_data(i, xctx->graph_flags, gr, xctx->graph_master);
|
||||||
draw_graph(i, 1 + 8 + (xctx->graph_flags & 6), gr); /* draw data in each graph box */
|
draw_graph(i, 1 + 8 + (xctx->graph_flags & 6), gr); /* draw data in each graph box */
|
||||||
}
|
}
|
||||||
} /* for(i=0; i< xctx->rects[GRIDLAYER]; i++ */
|
} /* for(i=0; i< xctx->rects[GRIDLAYER]; i++ */
|
||||||
|
|
|
||||||
45
src/draw.c
45
src/draw.c
|
|
@ -1768,10 +1768,8 @@ int schematic_waves_loaded(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_bus_value(int n_bits, int *idx_arr, int p, char *busval, double yval1, double yval2)
|
static int get_bus_value(int n_bits, int hex_digits, int *idx_arr, int p, char *busval, double vth)
|
||||||
{
|
{
|
||||||
int hex_digits = ((n_bits - 1) >> 2) + 1;
|
|
||||||
double vth = (yval1 + yval2) * 0.5;
|
|
||||||
double val;
|
double val;
|
||||||
int i;
|
int i;
|
||||||
int hexdigit = 0;
|
int hexdigit = 0;
|
||||||
|
|
@ -1795,8 +1793,6 @@ static int get_bus_value(int n_bits, int *idx_arr, int p, char *busval, double y
|
||||||
}
|
}
|
||||||
|
|
||||||
busval[hex_digits] = '\0';
|
busval[hex_digits] = '\0';
|
||||||
|
|
||||||
/* my_strncpy(busval, "AA", 3); */
|
|
||||||
return hex_digits;
|
return hex_digits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1832,7 +1828,7 @@ static int *get_bus_idx_array(const char *ntok, int *n_bits)
|
||||||
static void draw_graph_bus_points(const char *ntok, int n_bits, int *idx_arr,
|
static void draw_graph_bus_points(const char *ntok, int n_bits, int *idx_arr,
|
||||||
int first, int last, int wave_col, int sweep_idx, int wcnt, int n_nodes, Graph_ctx *gr)
|
int first, int last, int wave_col, int sweep_idx, int wcnt, int n_nodes, Graph_ctx *gr)
|
||||||
{
|
{
|
||||||
int p;
|
int p, len;
|
||||||
double s1 = DIG_NWAVES; /* 1/DIG_NWAVES waveforms fit in graph if unscaled vertically */
|
double s1 = DIG_NWAVES; /* 1/DIG_NWAVES waveforms fit in graph if unscaled vertically */
|
||||||
double s2 = DIG_SPACE; /* (DIG_NWAVES - DIG_SPACE) spacing between traces */
|
double s2 = DIG_SPACE; /* (DIG_NWAVES - DIG_SPACE) spacing between traces */
|
||||||
double c = (n_nodes - wcnt) * s1 * gr->gh - gr->gy1 * s2; /* trace baseline */
|
double c = (n_nodes - wcnt) * s1 * gr->gh - gr->gy1 * s2; /* trace baseline */
|
||||||
|
|
@ -1847,17 +1843,19 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, int *idx_arr,
|
||||||
double labsize = 0.015 * ydelta;
|
double labsize = 0.015 * ydelta;
|
||||||
double charwidth = labsize * 38.0;
|
double charwidth = labsize * 38.0;
|
||||||
double x_size = 1.5 * xctx->zoom;
|
double x_size = 1.5 * xctx->zoom;
|
||||||
|
double vth = (gr->gy1 + gr->gy2) * 0.5;
|
||||||
|
int hex_digits = ((n_bits - 1) >> 2) + 1;
|
||||||
if(c1 >= gr->ypos1 && c1 <=gr->ypos2) {
|
if(c1 >= gr->ypos1 && c1 <=gr->ypos2) {
|
||||||
drawline(wave_col, NOW, lx1, ylow, lx2, ylow, 0);
|
drawline(wave_col, NOW, lx1, ylow, lx2, ylow, 0);
|
||||||
drawline(wave_col, NOW, lx1, yhigh, lx2, yhigh, 0);
|
drawline(wave_col, NOW, lx1, yhigh, lx2, yhigh, 0);
|
||||||
for(p = first ; p <= last; p++) {
|
for(p = first ; p <= last; p++) {
|
||||||
/* calculate value of bus by adding all binary bits */
|
/* calculate value of bus by adding all binary bits */
|
||||||
/* hex_digits = */
|
/* hex_digits = */
|
||||||
get_bus_value(n_bits, idx_arr, p, busval, gr->gy1, gr->gy2);
|
len = get_bus_value(n_bits, hex_digits, idx_arr, p, busval, vth);
|
||||||
xval = W_X(xctx->graph_values[sweep_idx][p]);
|
xval = W_X(xctx->graph_values[sweep_idx][p]);
|
||||||
/* used to draw bus value before 1st transition */
|
/* used to draw bus value before 1st transition */
|
||||||
if(p == first) {
|
if(p == first) {
|
||||||
my_strncpy(old_busval, busval, strlen(busval)+1);
|
my_strncpy(old_busval, busval, len+1);
|
||||||
xval_old = xval;
|
xval_old = xval;
|
||||||
}
|
}
|
||||||
if(p > first && strcmp(busval, old_busval)) {
|
if(p > first && strcmp(busval, old_busval)) {
|
||||||
|
|
@ -2004,7 +2002,7 @@ static void draw_graph_grid(Graph_ctx *gr)
|
||||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_graph_data(int i, const int flags, Graph_ctx *gr)
|
void setup_graph_data(int i, const int flags, Graph_ctx *gr, int master)
|
||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
const char *val;
|
const char *val;
|
||||||
|
|
@ -2016,6 +2014,17 @@ void setup_graph_data(int i, const int flags, Graph_ctx *gr)
|
||||||
gr->digital = 0;
|
gr->digital = 0;
|
||||||
gr->gx1 = 0;
|
gr->gx1 = 0;
|
||||||
gr->gx2 = 1e-6;
|
gr->gx2 = 1e-6;
|
||||||
|
val = get_tok_value(r->prop_ptr,"x1",0);
|
||||||
|
if(val[0]) gr->gx1 = atof(val);
|
||||||
|
val = get_tok_value(r->prop_ptr,"x2",0);
|
||||||
|
if(val[0]) gr->gx2 = atof(val);
|
||||||
|
if(gr->gx1 == gr->gx2) gr->gx2 += 1e-6;
|
||||||
|
gr->gw = gr->gx2 - gr->gx1;
|
||||||
|
if(i == master) {
|
||||||
|
gr->master_gx1 = gr->gx1;
|
||||||
|
gr->master_gx2 = gr->gx2;
|
||||||
|
gr->master_gw = gr->gw;
|
||||||
|
}
|
||||||
gr->gy1 = 0;
|
gr->gy1 = 0;
|
||||||
gr->gy2 = 5;
|
gr->gy2 = 5;
|
||||||
gr->dataset = -1; /* -1 means 'plot all datasets' */
|
gr->dataset = -1; /* -1 means 'plot all datasets' */
|
||||||
|
|
@ -2059,15 +2068,10 @@ void setup_graph_data(int i, const int flags, Graph_ctx *gr)
|
||||||
if(val[0]) gr->divx = atoi(val);
|
if(val[0]) gr->divx = atoi(val);
|
||||||
val = get_tok_value(r->prop_ptr,"divy",0);
|
val = get_tok_value(r->prop_ptr,"divy",0);
|
||||||
if(val[0]) gr->divy = atoi(val);
|
if(val[0]) gr->divy = atoi(val);
|
||||||
val = get_tok_value(r->prop_ptr,"x1",0);
|
|
||||||
if(val[0]) gr->gx1 = atof(val);
|
|
||||||
val = get_tok_value(r->prop_ptr,"x2",0);
|
|
||||||
if(val[0]) gr->gx2 = atof(val);
|
|
||||||
val = get_tok_value(r->prop_ptr,"y1",0);
|
val = get_tok_value(r->prop_ptr,"y1",0);
|
||||||
if(val[0]) gr->gy1 = atof(val);
|
if(val[0]) gr->gy1 = atof(val);
|
||||||
val = get_tok_value(r->prop_ptr,"y2",0);
|
val = get_tok_value(r->prop_ptr,"y2",0);
|
||||||
if(val[0]) gr->gy2 = atof(val);
|
if(val[0]) gr->gy2 = atof(val);
|
||||||
if(gr->gx1 == gr->gx2) gr->gx2 += 1e-6;
|
|
||||||
if(gr->gy1 == gr->gy2) gr->gy2 += 1.0;
|
if(gr->gy1 == gr->gy2) gr->gy2 += 1.0;
|
||||||
val = get_tok_value(r->prop_ptr,"digital",0);
|
val = get_tok_value(r->prop_ptr,"digital",0);
|
||||||
if(val[0]) gr->digital = atoi(val);
|
if(val[0]) gr->digital = atoi(val);
|
||||||
|
|
@ -2084,7 +2088,6 @@ void setup_graph_data(int i, const int flags, Graph_ctx *gr)
|
||||||
val = get_tok_value(r->prop_ptr,"dataset",0);
|
val = get_tok_value(r->prop_ptr,"dataset",0);
|
||||||
if(val[0]) gr->dataset = atoi(val);
|
if(val[0]) gr->dataset = atoi(val);
|
||||||
|
|
||||||
gr->gw = gr->gx2 - gr->gx1;
|
|
||||||
gr->gh = gr->gy2 - gr->gy1;
|
gr->gh = gr->gy2 - gr->gy1;
|
||||||
|
|
||||||
/* set margins */
|
/* set margins */
|
||||||
|
|
@ -2156,9 +2159,9 @@ static void draw_cursor(double active_cursorx, double other_cursorx, int cursor_
|
||||||
if(xx >= gr->x1 && xx <= gr->x2) {
|
if(xx >= gr->x1 && xx <= gr->x2) {
|
||||||
drawline(cursor_color, NOW, xx, gr->ry1, xx, gr->ry2, 1);
|
drawline(cursor_color, NOW, xx, gr->ry1, xx, gr->ry2, 1);
|
||||||
if(gr->unitx != 1.0)
|
if(gr->unitx != 1.0)
|
||||||
my_snprintf(tmpstr, S(tmpstr), "%.4g%c", gr->unitx * xctx->graph_cursor2_x , gr->unitx_suffix);
|
my_snprintf(tmpstr, S(tmpstr), "%.4g%c", gr->unitx * active_cursorx , gr->unitx_suffix);
|
||||||
else
|
else
|
||||||
my_snprintf(tmpstr, S(tmpstr), "%.4g", xctx->graph_cursor2_x);
|
my_snprintf(tmpstr, S(tmpstr), "%.4g", active_cursorx);
|
||||||
text_bbox(tmpstr, txtsize, txtsize, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, &tx1, &ty1, &tx2, &ty2, &tmp, &tmp);
|
text_bbox(tmpstr, txtsize, txtsize, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, &tx1, &ty1, &tx2, &ty2, &tmp, &tmp);
|
||||||
filledrect(0, NOW, tx1, ty1, tx2, ty2);
|
filledrect(0, NOW, tx1, ty1, tx2, ty2);
|
||||||
draw_string(cursor_color, NOW, tmpstr, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, txtsize, txtsize);
|
draw_string(cursor_color, NOW, tmpstr, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, txtsize, txtsize);
|
||||||
|
|
@ -2256,6 +2259,7 @@ static void show_node_measures(int measure_p, double measure_x, double measure_p
|
||||||
double diffx = measure_x - measure_prev_x;
|
double diffx = measure_x - measure_prev_x;
|
||||||
double yy = yy1 + diffy / diffx * (xctx->graph_cursor1_x - measure_prev_x);
|
double yy = yy1 + diffy / diffx * (xctx->graph_cursor1_x - measure_prev_x);
|
||||||
char *fmt1, *fmt2;
|
char *fmt1, *fmt2;
|
||||||
|
int hex_digits = ((n_bits - 1) >> 2) + 1;
|
||||||
|
|
||||||
if(SIGN0(gr->gy1) != SIGN0(gr->gy2) && fabs(yy) < 1e-4 * fabs(gr->gh)) yy = 0.0;
|
if(SIGN0(gr->gy1) != SIGN0(gr->gy2) && fabs(yy) < 1e-4 * fabs(gr->gh)) yy = 0.0;
|
||||||
if(yy != 0.0 && fabs(yy * gr->unity) < 1.0e-3) {
|
if(yy != 0.0 && fabs(yy * gr->unity) < 1.0e-3) {
|
||||||
|
|
@ -2273,7 +2277,7 @@ static void show_node_measures(int measure_p, double measure_x, double measure_p
|
||||||
if(gr->unity != 1.0) my_snprintf(tmpstr, S(tmpstr), fmt2, yy * gr->unity, gr->unity_suffix);
|
if(gr->unity != 1.0) my_snprintf(tmpstr, S(tmpstr), fmt2, yy * gr->unity, gr->unity_suffix);
|
||||||
else my_snprintf(tmpstr, S(tmpstr), fmt1, yy);
|
else my_snprintf(tmpstr, S(tmpstr), fmt1, yy);
|
||||||
} else {
|
} else {
|
||||||
get_bus_value(n_bits, idx_arr, measure_p, tmpstr, gr->gy1, gr->gy2);
|
get_bus_value(n_bits, hex_digits, idx_arr, measure_p, tmpstr, (gr->gy1 + gr->gy2) * 0.5);
|
||||||
}
|
}
|
||||||
if(!bus_msb && !gr->digital) {
|
if(!bus_msb && !gr->digital) {
|
||||||
draw_string(wave_color, NOW, tmpstr, 0, 0, 0, 0,
|
draw_string(wave_color, NOW, tmpstr, 0, 0, 0, 0,
|
||||||
|
|
@ -2320,12 +2324,10 @@ void draw_graph(int i, const int flags, Graph_ctx *gr)
|
||||||
|
|
||||||
if(RECT_OUTSIDE( gr->sx1, gr->sy1, gr->sx2, gr->sy2,
|
if(RECT_OUTSIDE( gr->sx1, gr->sy1, gr->sx2, gr->sy2,
|
||||||
xctx->areax1, xctx->areay1, xctx->areax2, xctx->areay2)) return;
|
xctx->areax1, xctx->areay1, xctx->areax2, xctx->areay2)) return;
|
||||||
|
|
||||||
/* draw stuff */
|
/* draw stuff */
|
||||||
if(flags & 8) {
|
if(flags & 8) {
|
||||||
/* graph box, gridlines and axes */
|
/* graph box, gridlines and axes */
|
||||||
draw_graph_grid(gr);
|
draw_graph_grid(gr);
|
||||||
|
|
||||||
/* get data to plot */
|
/* get data to plot */
|
||||||
my_strdup2(1389, &node, get_tok_value(r->prop_ptr,"node",0));
|
my_strdup2(1389, &node, get_tok_value(r->prop_ptr,"node",0));
|
||||||
my_strdup2(1390, &color, get_tok_value(r->prop_ptr,"color",0));
|
my_strdup2(1390, &color, get_tok_value(r->prop_ptr,"color",0));
|
||||||
|
|
@ -2351,7 +2353,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draw_graph_variables(wcnt, wave_color, n_nodes, sweep_idx, flags, ntok, stok, bus_msb, gr);
|
draw_graph_variables(wcnt, wave_color, n_nodes, sweep_idx, flags, ntok, stok, bus_msb, gr);
|
||||||
|
|
||||||
/* quickly find index number of ntok variable to be plotted */
|
/* quickly find index number of ntok variable to be plotted */
|
||||||
if( (idx = get_raw_index(bus_msb ? bus_msb : ntok)) != -1 ) {
|
if( (idx = get_raw_index(bus_msb ? bus_msb : ntok)) != -1 ) {
|
||||||
int p, dset, ofs;
|
int p, dset, ofs;
|
||||||
|
|
@ -2512,7 +2513,7 @@ void draw_graph_all(int flags)
|
||||||
if(xctx->enable_layer[GRIDLAYER]) for(i = 0; i < xctx->rects[GRIDLAYER]; i++) {
|
if(xctx->enable_layer[GRIDLAYER]) for(i = 0; i < xctx->rects[GRIDLAYER]; i++) {
|
||||||
xRect *r = &xctx->rect[GRIDLAYER][i];
|
xRect *r = &xctx->rect[GRIDLAYER][i];
|
||||||
if(r->flags & 1) {
|
if(r->flags & 1) {
|
||||||
setup_graph_data(i, flags, &xctx->graph_struct);
|
setup_graph_data(i, flags, &xctx->graph_struct, 0);
|
||||||
draw_graph(i, flags, &xctx->graph_struct); /* draw data in each graph box */
|
draw_graph(i, flags, &xctx->graph_struct); /* draw data in each graph box */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
src/xschem.h
16
src/xschem.h
|
|
@ -676,6 +676,7 @@ typedef struct {
|
||||||
/* graph box (smaller than rect container due to margins) */
|
/* graph box (smaller than rect container due to margins) */
|
||||||
double x1, y1, x2, y2, w, h;
|
double x1, y1, x2, y2, w, h;
|
||||||
double gx1, gy1, gx2, gy2, gw, gh;
|
double gx1, gy1, gx2, gy2, gw, gh;
|
||||||
|
double master_gx1, master_gx2, master_gw;
|
||||||
/* y area range for digital graphs */
|
/* y area range for digital graphs */
|
||||||
double ypos1, ypos2, posh;
|
double ypos1, ypos2, posh;
|
||||||
double marginx; /* will be recalculated later */
|
double marginx; /* will be recalculated later */
|
||||||
|
|
@ -869,9 +870,16 @@ typedef struct {
|
||||||
double graph_cursor1_x;
|
double graph_cursor1_x;
|
||||||
double graph_cursor2_x;
|
double graph_cursor2_x;
|
||||||
int graph_unlock_x;
|
int graph_unlock_x;
|
||||||
int graph_flags; /* 1: zoom / pan all graphs even if only one selected
|
/* graph_flags:
|
||||||
* 2: x-axis cursor1
|
* 1: dnu, reserved, used in draw_graphs()
|
||||||
* 4: x-axis cursor2 */
|
* 2: draw x-cursor1
|
||||||
|
* 4: draw x-cursor2
|
||||||
|
* 8: dnu, reserved, used in draw_graphs()
|
||||||
|
* 16: move cursor1
|
||||||
|
* 32: move cursor2
|
||||||
|
* 64: show measurement tooltip
|
||||||
|
*/
|
||||||
|
int graph_flags;
|
||||||
int graph_master; /* graph where mouse operations are started, used to lock x-axis */
|
int graph_master; /* graph where mouse operations are started, used to lock x-axis */
|
||||||
int graph_bottom; /* graph where mouse operations are started, used to lock x-axis */
|
int graph_bottom; /* graph where mouse operations are started, used to lock x-axis */
|
||||||
int graph_left; /* graph where mouse operations are started, used to lock x-axis */
|
int graph_left; /* graph where mouse operations are started, used to lock x-axis */
|
||||||
|
|
@ -996,7 +1004,7 @@ extern double get_raw_value(int dataset, int idx, int point);
|
||||||
extern int schematic_waves_loaded(void);
|
extern int schematic_waves_loaded(void);
|
||||||
extern void draw_graph(int i, int flags, Graph_ctx *gr);
|
extern void draw_graph(int i, int flags, Graph_ctx *gr);
|
||||||
extern void draw_graph_all(int flags);
|
extern void draw_graph_all(int flags);
|
||||||
extern void setup_graph_data(int i, const int flags, Graph_ctx *gr);
|
extern void setup_graph_data(int i, const int flags, Graph_ctx *gr, int skip_master_x);
|
||||||
extern void free_rawfile(int dr);
|
extern void free_rawfile(int dr);
|
||||||
extern int read_rawfile(const char *f);
|
extern int read_rawfile(const char *f);
|
||||||
extern double timer(int start);
|
extern double timer(int start);
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ y1 = -0.0039
|
||||||
y2 = 0.87
|
y2 = 0.87
|
||||||
divy = 3
|
divy = 3
|
||||||
subdivy=1
|
subdivy=1
|
||||||
x1=1.52536e-07
|
x1=1.21536e-07
|
||||||
x2=1.84201e-07 divx=10
|
x2=3.17599e-07 divx=10
|
||||||
node="
|
node="
|
||||||
ldbl[0] ldbl[16] ldbl[32]
|
ldbl[0] ldbl[16] ldbl[32]
|
||||||
ldbl[1] ldbl[17] ldbl[33]
|
ldbl[1] ldbl[17] ldbl[33]
|
||||||
|
|
@ -47,8 +47,8 @@ y1 = -0.021
|
||||||
y2 = 1.5
|
y2 = 1.5
|
||||||
subdivy=1
|
subdivy=1
|
||||||
divy = 4
|
divy = 4
|
||||||
x1=1.52536e-07
|
x1=1.21536e-07
|
||||||
x2=1.84201e-07
|
x2=3.17599e-07
|
||||||
divx=10
|
divx=10
|
||||||
subdivx=4
|
subdivx=4
|
||||||
node="ldcp ldyms[4] ldyms[5] ldyms[6] ldymsref"
|
node="ldcp ldyms[4] ldyms[5] ldyms[6] ldymsref"
|
||||||
|
|
@ -61,8 +61,8 @@ y2 = 1.6
|
||||||
divy = 3
|
divy = 3
|
||||||
subdivy=0
|
subdivy=0
|
||||||
subdivx = 1
|
subdivx = 1
|
||||||
x1=1.52536e-07
|
x1=1.21536e-07
|
||||||
x2=1.84201e-07 divx=10
|
x2=3.17599e-07 divx=10
|
||||||
node="
|
node="
|
||||||
ldwl[0] ldwl[1] ldwl[2] ldwl[3]
|
ldwl[0] ldwl[1] ldwl[2] ldwl[3]
|
||||||
ldwl[4] ldwl[5] ldwl[6] ldwl[16]
|
ldwl[4] ldwl[5] ldwl[6] ldwl[16]
|
||||||
|
|
@ -74,8 +74,8 @@ B 2 1840 -120 2890 -20 {flags=3
|
||||||
y1 = -0.021
|
y1 = -0.021
|
||||||
y2 = 0.9
|
y2 = 0.9
|
||||||
divy = 1
|
divy = 1
|
||||||
x1=1.52536e-07
|
x1=1.21536e-07
|
||||||
x2=1.84201e-07 divx=10
|
x2=3.17599e-07 divx=10
|
||||||
node="ldymsref"
|
node="ldymsref"
|
||||||
color=3 unitx=n subdivy=4
|
color=3 unitx=n subdivy=4
|
||||||
}
|
}
|
||||||
|
|
@ -86,8 +86,8 @@ y2 = 1.6
|
||||||
ypos1=-0.0272427
|
ypos1=-0.0272427
|
||||||
ypos2=2.11513
|
ypos2=2.11513
|
||||||
divy = 1
|
divy = 1
|
||||||
x1=1.52536e-07
|
x1=1.21536e-07
|
||||||
x2=1.84201e-07
|
x2=3.17599e-07
|
||||||
divx=12
|
divx=12
|
||||||
subdivx=4
|
subdivx=4
|
||||||
node="
|
node="
|
||||||
|
|
@ -111,8 +111,8 @@ B 2 1840 -1280 2890 -1090 {flags=3
|
||||||
y1 = -0.022
|
y1 = -0.022
|
||||||
y2 = 1.6
|
y2 = 1.6
|
||||||
divy = 4
|
divy = 4
|
||||||
x1=1.52536e-07
|
x1=1.19234e-07
|
||||||
x2=1.84201e-07
|
x2=3.15297e-07
|
||||||
divx=8
|
divx=8
|
||||||
unitx=n
|
unitx=n
|
||||||
node="xsa[0].ldqib xsa[5].ldqib xsa[0].ldsali xctrl.ldq_b"
|
node="xsa[0].ldqib xsa[5].ldqib xsa[0].ldsali xctrl.ldq_b"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue