mouse actions (move, zoom) on waveforms
This commit is contained in:
parent
673eb243e7
commit
8a0fc1c1df
182
src/callback.c
182
src/callback.c
|
|
@ -24,16 +24,22 @@
|
|||
static int waves_selected()
|
||||
{
|
||||
int n, c, i;
|
||||
int is_inside = 0;
|
||||
xRect *r;
|
||||
rebuild_selected_array();
|
||||
if(xctx->ui_state != SELECTION || !xctx->lastsel) return 0;
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
c = xctx->sel_array[i].col;
|
||||
if(xctx->sel_array[i].type == xRECT && c == 2) {
|
||||
n = xctx->sel_array[i].n;
|
||||
if(xctx->rect[c][n].flags != 1) return 0;
|
||||
r = &xctx->rect[c][n];
|
||||
if( POINTINSIDE(xctx->mousex, xctx->mousey, r->x1, r->y1, r->x2, r->y2) ) {
|
||||
is_inside = 1;
|
||||
}
|
||||
if(r->flags != 1) return 0;
|
||||
} else return 0;
|
||||
}
|
||||
return 1;
|
||||
return is_inside;
|
||||
}
|
||||
|
||||
void redraw_w_a_l_r_p_rubbers(void)
|
||||
|
|
@ -152,17 +158,31 @@ void start_wire(double mx, double my)
|
|||
}
|
||||
|
||||
/* process user input (arrow keys for now) when only graphs are selected */
|
||||
#define W_X(x) (cx * (x) + dx)
|
||||
#define W_Y(y) (cy * (y) + dy)
|
||||
static int waves_callback(int event, int mx, int my, KeySym key, int button, int aux, int state)
|
||||
{
|
||||
double wx1 = -2e-6;
|
||||
double wy1 = -1;
|
||||
double wx2 = 8e-6;
|
||||
double wy2 = 4;
|
||||
double x1, y1, x2, y2, marginx, marginy;
|
||||
double cx;
|
||||
int divisx = 10;
|
||||
int divisy = 5;
|
||||
const char *val;
|
||||
xRect bb;
|
||||
char s[30];
|
||||
int n, c, i;
|
||||
double xx1, xx2;
|
||||
int need_redraw = 0;
|
||||
|
||||
#if HAS_CAIRO==1
|
||||
cairo_save(xctx->cairo_ctx);
|
||||
cairo_save(xctx->cairo_save_ctx);
|
||||
cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
#endif
|
||||
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
c = xctx->sel_array[i].col;
|
||||
/* process only graph boxes */
|
||||
|
|
@ -182,83 +202,86 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
if(val[0]) wx2 = atof(val);
|
||||
val = get_tok_value(xctx->rect[c][n].prop_ptr,"y2",0);
|
||||
if(val[0]) wy2 = atof(val);
|
||||
calc_graph_area(c, n, &x1, &y1, &x2, &y2, &marginx, &marginy);
|
||||
/* cache coefficients for faster graph coord transformations */
|
||||
cx = (x2 - x1) / (wx2 - wx1);
|
||||
dbg(1, "%g %g %g %g - %d %d\n", wx1, wy1, wx2, wy2, divisx, divisy);
|
||||
}
|
||||
if(key == XK_Left) {
|
||||
char s[30];
|
||||
if(event == MotionNotify && state && Button1Mask) {
|
||||
double delta = (wx2 - wx1) / divisx;
|
||||
double x1, x2;
|
||||
x1 = wx1 - delta;
|
||||
x2 = wx2 - delta;
|
||||
my_snprintf(s, S(s), "%g", x1);
|
||||
dbg(1, "waves_callback: Motion: %g %g --> %g %g\n",
|
||||
xctx->mx_double_save, xctx->my_double_save, xctx->mousex_snap, xctx->mousey_snap);
|
||||
if(fabs(xctx->mx_double_save - xctx->mousex_snap) > fabs(cx * delta)) {
|
||||
if( xctx->mousex_snap > xctx->mx_double_save) key = XK_Left;
|
||||
else key = XK_Right;
|
||||
xctx->mx_double_save = xctx->mousex_snap;
|
||||
xctx->my_double_save = xctx->mousey_snap;
|
||||
}
|
||||
}
|
||||
if(key == XK_Left || (button == Button5 && state == 0)) {
|
||||
double delta = (wx2 - wx1) / divisx;
|
||||
xx1 = round_to_n_digits(wx1 - delta, 4);
|
||||
xx2 = round_to_n_digits(wx2 - delta, 4);
|
||||
my_snprintf(s, S(s), "%g", xx1);
|
||||
my_strdup(1395, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x1", s));
|
||||
my_snprintf(s, S(s), "%g", x2);
|
||||
my_snprintf(s, S(s), "%g", xx2);
|
||||
my_strdup(1396, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s));
|
||||
need_redraw = 1;
|
||||
}
|
||||
if(key == XK_Right) {
|
||||
char s[30];
|
||||
else if(key == XK_Right || (button == Button4 && state == 0)) {
|
||||
double delta = (wx2 - wx1) / divisx;
|
||||
double x1, x2;
|
||||
x1 = wx1 + delta;
|
||||
x2 = wx2 + delta;
|
||||
my_snprintf(s, S(s), "%g", x1);
|
||||
xx1 = round_to_n_digits(wx1 + delta, 4);
|
||||
xx2 = round_to_n_digits(wx2 + delta, 4);
|
||||
my_snprintf(s, S(s), "%g", xx1);
|
||||
my_strdup(1397, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x1", s));
|
||||
my_snprintf(s, S(s), "%g", x2);
|
||||
my_snprintf(s, S(s), "%g", xx2);
|
||||
my_strdup(1398, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s));
|
||||
need_redraw = 1;
|
||||
}
|
||||
if(key == XK_Down) {
|
||||
char s[30];
|
||||
else if(key == XK_Down || (button == Button5 && state == ShiftMask)) {
|
||||
double delta = (wx2 - wx1);
|
||||
double x2;
|
||||
x2 = wx2 + delta;
|
||||
my_snprintf(s, S(s), "%g", x2);
|
||||
xx2 = round_to_n_digits(wx2 + delta, 2);
|
||||
my_snprintf(s, S(s), "%g", xx2);
|
||||
my_strdup(1399, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s));
|
||||
need_redraw = 1;
|
||||
}
|
||||
if(key == XK_Up) {
|
||||
char s[30];
|
||||
else if(key == XK_Up || (button == Button4 && state == ShiftMask)) {
|
||||
double delta = (wx2 - wx1)/ 2.0;
|
||||
double x2, tmp;
|
||||
double tmp;
|
||||
|
||||
if(fabs(wx2) > fabs(wx1) ) tmp = fabs(wx2);
|
||||
else tmp = fabs(wx1);
|
||||
if( tmp / fabs(wx2 - wx1) > 1e-5) {
|
||||
x2 = wx2 - delta;
|
||||
my_snprintf(s, S(s), "%g", x2);
|
||||
if( tmp / fabs(wx2 - wx1) < 1e2) {
|
||||
xx2 = round_to_n_digits(wx2 - delta, 2);
|
||||
my_snprintf(s, S(s), "%g", xx2);
|
||||
my_strdup(1400, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s));
|
||||
}
|
||||
need_redraw = 1;
|
||||
}
|
||||
else if(key == 'f') {
|
||||
xx1 = 0.0;
|
||||
xx2 = xctx->values[0][xctx->npoints -1];
|
||||
my_snprintf(s, S(s), "%g", xx1);
|
||||
my_strdup(1409, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x1", s));
|
||||
my_snprintf(s, S(s), "%g", xx2);
|
||||
my_strdup(1409, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "x2", s));
|
||||
need_redraw = 1;
|
||||
}
|
||||
else if(event == ButtonPress && button == Button1) {
|
||||
xctx->mx_double_save = xctx->mousex_snap;
|
||||
xctx->my_double_save = xctx->mousey_snap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
calc_drawing_bbox(&bb, 1); /* selection bbox */
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
bbox(ADD, bb.x1, bb.y1, bb.x2, bb.y2);
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
if(xctx->draw_pixmap)
|
||||
XFillRectangle(display, xctx->save_pixmap, xctx->gc[BACKLAYER], xctx->areax1, xctx->areay1,
|
||||
xctx->areaw, xctx->areah);
|
||||
if(xctx->draw_window)
|
||||
XFillRectangle(display, xctx->window, xctx->gc[BACKLAYER], xctx->areax1, xctx->areay1,
|
||||
xctx->areaw, xctx->areah);
|
||||
drawgrid();
|
||||
draw_waves();
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
c = xctx->sel_array[i].col;
|
||||
/* repaint graph borders */
|
||||
if(xctx->sel_array[i].type == xRECT && c == 2) {
|
||||
xRect *r;
|
||||
n = xctx->sel_array[i].n;
|
||||
r = &xctx->rect[c][n];
|
||||
if(c == 2 && r->flags == 1)
|
||||
drawrect(c, ADD, r->x1, r->y1, r->x2, r->y2, 1);
|
||||
}
|
||||
if(need_redraw) draw_graph(c, n); /* draw data in each graph box */
|
||||
|
||||
}
|
||||
if(!xctx->draw_window) {
|
||||
XCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gctiled, xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
}
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw_selection(xctx->gc[SELLAYER], 0);
|
||||
#if HAS_CAIRO==1
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
cairo_restore(xctx->cairo_save_ctx);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -379,7 +402,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
|
||||
case Expose:
|
||||
dbg(1, "callback: Expose, winpath=%s, %dx%d+%d+%d\n", winpath, button, aux, mx, my);
|
||||
dbg(0, "callback: Expose, winpath=%s, %dx%d+%d+%d\n", winpath, button, aux, mx, my);
|
||||
XCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gctiled, mx,my,button,aux,mx,my);
|
||||
{
|
||||
XRectangle xr[1];
|
||||
|
|
@ -401,8 +424,12 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
|
||||
case MotionNotify:
|
||||
if( waves_selected()) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
break;
|
||||
}
|
||||
if(xctx->ui_state & STARTPAN2) pan2(RUBBER, mx, my);
|
||||
#ifndef __unix__
|
||||
#ifndef __unix__
|
||||
if ((xctx->ui_state & STARTWIRE) || (xctx->ui_state & STARTARC) ||
|
||||
(xctx->ui_state & STARTLINE) || (xctx->ui_state & STARTMOVE) ||
|
||||
(xctx->ui_state & STARTCOPY) || (xctx->ui_state & STARTRECT) ||
|
||||
|
|
@ -411,7 +438,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
XCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gctiled, xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if(xctx->semaphore >= 2) break;
|
||||
if(xctx->ui_state) {
|
||||
#ifdef TURBOX_FIX
|
||||
|
|
@ -432,10 +459,9 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
if( (state & Button1Mask) && (state & Mod1Mask)) { /* 20171026 added unselect by area */
|
||||
select_rect(RUBBER,0);
|
||||
} else if(state & Button1Mask) {
|
||||
select_rect(RUBBER,1);
|
||||
select_rect(RUBBER,1);
|
||||
}
|
||||
}
|
||||
|
||||
if(xctx->ui_state & STARTMOVE) {
|
||||
if(constrained_move == 1) xctx->mousey_snap = xctx->my_double_save;
|
||||
if(constrained_move == 2) xctx->mousex_snap = xctx->mx_double_save;
|
||||
|
|
@ -1606,6 +1632,10 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key=='f' && state == 0 ) /* full zoom */
|
||||
{
|
||||
if(waves_selected()) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
break;
|
||||
}
|
||||
if(xctx->ui_state == SELECTION)
|
||||
zoom_full(1, 1, 3, 0.97);
|
||||
else
|
||||
|
|
@ -1633,8 +1663,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
xctx->my_double_save=xctx->mousey_snap;
|
||||
break;
|
||||
}
|
||||
if(button==Button5 && state == 0 ) view_unzoom(CADZOOMSTEP);
|
||||
else if(button == Button3 && state == ControlMask && xctx->semaphore <2)
|
||||
if(button == Button3 && state == ControlMask && xctx->semaphore <2)
|
||||
{
|
||||
sel = select_object(xctx->mousex, xctx->mousey, SELECTED, 0);
|
||||
if(sel) select_connected_wires(1);
|
||||
|
|
@ -1762,13 +1791,34 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if(button==Button4 && state == 0 ) view_zoom(CADZOOMSTEP);
|
||||
else if(button==Button5 && state == 0 ) {
|
||||
if(waves_selected()) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
break;
|
||||
}
|
||||
view_unzoom(CADZOOMSTEP);
|
||||
}
|
||||
else if(button==Button4 && state == 0 ) {
|
||||
if(waves_selected()) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
break;
|
||||
}
|
||||
view_zoom(CADZOOMSTEP);
|
||||
}
|
||||
else if(button==Button4 && (state & ShiftMask) && !(state & Button2Mask)) {
|
||||
if(waves_selected()) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
break;
|
||||
}
|
||||
xctx->xorigin+=-CADMOVESTEP*xctx->zoom/2.;
|
||||
draw();
|
||||
redraw_w_a_l_r_p_rubbers();
|
||||
}
|
||||
else if(button==Button5 && (state & ShiftMask) && !(state & Button2Mask)) {
|
||||
if(waves_selected()) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
break;
|
||||
}
|
||||
xctx->xorigin-=-CADMOVESTEP*xctx->zoom/2.;
|
||||
draw();
|
||||
redraw_w_a_l_r_p_rubbers();
|
||||
|
|
@ -1810,6 +1860,10 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
}
|
||||
else if(button==Button1)
|
||||
{
|
||||
if(waves_selected()) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
break;
|
||||
}
|
||||
if(tclgetboolvar("persistent_command") && xctx->last_command) {
|
||||
if(xctx->last_command == STARTLINE) start_line(mx, my);
|
||||
if(xctx->last_command == STARTWIRE) start_wire(mx, my);
|
||||
|
|
|
|||
99
src/draw.c
99
src/draw.c
|
|
@ -1627,7 +1627,30 @@ int read_rawfile(const char *f)
|
|||
draw();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
void calc_graph_area(int c, int i, double *x1, double *y1,double *x2,double *y2,
|
||||
double *marginx, double *marginy)
|
||||
{
|
||||
double rx1, rx2, ry1, ry2, rw, rh, tmp;
|
||||
rx1 = xctx->rect[c][i].x1;
|
||||
ry1 = xctx->rect[c][i].y1;
|
||||
rx2 = xctx->rect[c][i].x2;
|
||||
ry2 = xctx->rect[c][i].y2;
|
||||
rw = (rx2 - rx1);
|
||||
rh = (ry2 - ry1);
|
||||
/* set margins */
|
||||
tmp = rw * 0.05;
|
||||
*marginx = tmp < 50 ? 50 : tmp;
|
||||
tmp = rh * 0.1;
|
||||
*marginy = tmp < 20 ? 20 : tmp;
|
||||
|
||||
/* calculate graph bounding box (container - margin)
|
||||
* This is the box where plot is done */
|
||||
*x1 = rx1 + *marginx;
|
||||
*x2 = rx2 - *marginx/1.3;
|
||||
*y1 = ry1 + *marginy;
|
||||
tmp = *marginy < 30 ? 30 : *marginy;
|
||||
*y2 = ry2 - tmp; /* some more space to accomodate x-axis label */
|
||||
}
|
||||
|
||||
/* fill each graph box with simulation data */
|
||||
/* #define W_X(x) (x1 + (x2 - x1) / (wx2 - wx1) * ((x) - wx1)) */
|
||||
|
|
@ -1637,7 +1660,7 @@ int read_rawfile(const char *f)
|
|||
void draw_graph(int c, int i)
|
||||
{
|
||||
/* container box */
|
||||
double rx1, ry1, rx2, ry2, rw, rh;
|
||||
double rx1, ry1, rx2, ry2, rw;
|
||||
/* graph box (smaller due to margins) */
|
||||
double x1, y1, x2, y2, w, h;
|
||||
/* graph coordinate, some defaults */
|
||||
|
|
@ -1659,43 +1682,31 @@ void draw_graph(int c, int i)
|
|||
double txtsizelab, txtsizey, txtsizex, tmp;
|
||||
struct int_hashentry *entry;
|
||||
int sweep_idx = 0;
|
||||
xRect *r = &xctx->rect[c][i];
|
||||
|
||||
/* container ( ebnedding rectangle) coordinates */
|
||||
rx1 = xctx->rect[c][i].x1;
|
||||
ry1 = xctx->rect[c][i].y1;
|
||||
rx2 = xctx->rect[c][i].x2;
|
||||
ry2 = xctx->rect[c][i].y2;
|
||||
/* container (embedding rectangle) coordinates */
|
||||
rx1 = r->x1;
|
||||
ry1 = r->y1;
|
||||
rx2 = r->x2;
|
||||
ry2 = r->y2;
|
||||
rw = (rx2 - rx1);
|
||||
rh = (ry2 - ry1);
|
||||
|
||||
/* set margins */
|
||||
tmp = rw * 0.05;
|
||||
marginx = tmp < 50 ? 50 : tmp;
|
||||
tmp = rh * 0.1;
|
||||
marginy = tmp < 20 ? 20 : tmp;
|
||||
|
||||
/* calculate graph bounding box (container - margin)
|
||||
* This is the box where plot is done */
|
||||
x1 = rx1 + marginx;
|
||||
x2 = rx2 - marginx/1.3;
|
||||
y1 = ry1 + marginy;
|
||||
tmp = marginy < 30 ? 30 : marginy;
|
||||
y2 = ry2 - tmp; /* some more space to accomodate x-axis label */
|
||||
calc_graph_area(c, i, &x1, &y1, &x2, &y2, &marginx, &marginy);
|
||||
w = (x2 - x1);
|
||||
h = (y2 - y1);
|
||||
|
||||
/* get variables to plot, x/y range, grid info etc */
|
||||
val = get_tok_value(xctx->rect[c][i].prop_ptr,"divx",0);
|
||||
val = get_tok_value(r->prop_ptr,"divx",0);
|
||||
if(val[0]) divisx = atoi(val);
|
||||
val = get_tok_value(xctx->rect[c][i].prop_ptr,"divy",0);
|
||||
val = get_tok_value(r->prop_ptr,"divy",0);
|
||||
if(val[0]) divisy = atoi(val);
|
||||
val = get_tok_value(xctx->rect[c][i].prop_ptr,"x1",0);
|
||||
val = get_tok_value(r->prop_ptr,"x1",0);
|
||||
if(val[0]) wx1 = atof(val);
|
||||
val = get_tok_value(xctx->rect[c][i].prop_ptr,"y1",0);
|
||||
val = get_tok_value(r->prop_ptr,"y1",0);
|
||||
if(val[0]) wy1 = atof(val);
|
||||
val = get_tok_value(xctx->rect[c][i].prop_ptr,"x2",0);
|
||||
val = get_tok_value(r->prop_ptr,"x2",0);
|
||||
if(val[0]) wx2 = atof(val);
|
||||
val = get_tok_value(xctx->rect[c][i].prop_ptr,"y2",0);
|
||||
val = get_tok_value(r->prop_ptr,"y2",0);
|
||||
if(val[0]) wy2 = atof(val);
|
||||
/* cache coefficients for faster graph coord transformations */
|
||||
cx = (x2 - x1) / (wx2 - wx1);
|
||||
|
|
@ -1723,7 +1734,9 @@ void draw_graph(int c, int i)
|
|||
txtsizelab = marginy / 100;
|
||||
|
||||
/* background */
|
||||
filledrect(0, NOW, x1, y1, x2, y2);
|
||||
filledrect(0, NOW, rx1, ry1, rx2, ry2);
|
||||
drawrect(c, NOW, rx1, ry1, rx2, ry2, 1);
|
||||
|
||||
/* vertical grid lines */
|
||||
for(j = 0; j <= divisx; j++) {
|
||||
wx = wx1 + j * (wx2 -wx1) / divisx;
|
||||
|
|
@ -1753,9 +1766,9 @@ void draw_graph(int c, int i)
|
|||
double *xarr = NULL, *yarr = NULL;
|
||||
xarr = my_malloc(1401, xctx->npoints * sizeof(double));
|
||||
yarr = my_malloc(1402, xctx->npoints * sizeof(double));
|
||||
my_strdup2(1389, &node, get_tok_value(xctx->rect[c][i].prop_ptr,"node",0));
|
||||
my_strdup2(1390, &color, get_tok_value(xctx->rect[c][i].prop_ptr,"color",0));
|
||||
my_strdup2(1407, &sweep, get_tok_value(xctx->rect[c][i].prop_ptr,"sweep",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(1407, &sweep, get_tok_value(r->prop_ptr,"sweep",0));
|
||||
nptr = node;
|
||||
cptr = color;
|
||||
sptr = sweep;
|
||||
|
|
@ -1779,10 +1792,6 @@ void draw_graph(int c, int i)
|
|||
/* draw node labels in graph */
|
||||
draw_string(wave_color, NOW, ntok, 0, 0, 0, 0, rx1 + rw/6 * wcnt, ry1, txtsizelab, txtsizelab);
|
||||
/* clipping everything outside graph area */
|
||||
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD,x1, y1, x2, y2);
|
||||
dbg(1, "draw_graph(ADD): %g %g %g %g\n", x1, y1, x2, y2);
|
||||
bbox(SET, 0.0, 0.0, 0.0, 0.0);
|
||||
/* quickly find index number of ntok variable to be plotted */
|
||||
entry = int_hash_lookup(xctx->raw_table, ntok, 0, XLOOKUP);
|
||||
if(entry) {
|
||||
|
|
@ -1794,6 +1803,9 @@ void draw_graph(int c, int i)
|
|||
double start = (wx1 <= wx2) ? wx1 : wx2;
|
||||
double end = (wx1 <= wx2) ? wx2 : wx1;
|
||||
|
||||
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD,x1, y1, x2, y2);
|
||||
bbox(SET, 0.0, 0.0, 0.0, 0.0);
|
||||
/* skip if nothing in viewport */
|
||||
if(xctx->values[sweep_idx][xctx->npoints -1] > start) {
|
||||
/* Process "npoints" simulation items
|
||||
|
|
@ -1823,10 +1835,20 @@ void draw_graph(int c, int i)
|
|||
drawpolygon(wave_color, 0, xarr, yarr, poly_npoints, 0, 0);
|
||||
}
|
||||
}
|
||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||
wcnt++;
|
||||
}
|
||||
|
||||
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, rx1, ry1, rx2, ry2);
|
||||
bbox(SET, 0.0, 0.0, 0.0, 0.0);
|
||||
if(!xctx->draw_window) {
|
||||
XCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gctiled, xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);
|
||||
}
|
||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
my_free(1403, &xarr);
|
||||
my_free(1404, &yarr);
|
||||
my_free(1391, &node);
|
||||
|
|
@ -1840,10 +1862,7 @@ void draw_waves(void)
|
|||
{
|
||||
int c, i;
|
||||
int bbox_set = 0;
|
||||
double save_lw;
|
||||
int save_bbx1, save_bby1, save_bbx2, save_bby2;
|
||||
save_lw = xctx->lw;
|
||||
xctx->lw = 0;
|
||||
/* save bbox data, since draw_waves() is called from draw() which may be called after a bbox(SET) */
|
||||
if(xctx->sem) {
|
||||
bbox_set = 1;
|
||||
|
|
@ -1853,8 +1872,6 @@ void draw_waves(void)
|
|||
save_bby2 = xctx->bby2;
|
||||
bbox(END, 0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
/* thin / dashed lines (axis etc) */
|
||||
XSetLineAttributes(display, xctx->gc[2], 0, LineSolid, CapRound, JoinRound);
|
||||
#if HAS_CAIRO==1
|
||||
cairo_save(xctx->cairo_ctx);
|
||||
cairo_save(xctx->cairo_save_ctx);
|
||||
|
|
@ -1874,8 +1891,6 @@ void draw_waves(void)
|
|||
cairo_restore(xctx->cairo_ctx);
|
||||
cairo_restore(xctx->cairo_save_ctx);
|
||||
#endif
|
||||
xctx->lw = save_lw;
|
||||
XSetLineAttributes(display, xctx->gc[2], INT_WIDTH(xctx->lw), LineSolid, CapRound , JoinRound);
|
||||
/* restore previous bbox */
|
||||
if(bbox_set) {
|
||||
xctx->bbx1 = save_bbx1;
|
||||
|
|
|
|||
|
|
@ -889,6 +889,9 @@ extern char cli_opt_netlist_dir[PATH_MAX];
|
|||
extern Xschem_ctx *xctx;
|
||||
|
||||
/* FUNCTIONS */
|
||||
extern void calc_graph_area(int c, int i, double *x1, double *y1,double *x2, double *y2,
|
||||
double *marginx,double *marginy);
|
||||
extern void draw_graph(int c, int i);
|
||||
extern void draw_waves(void);
|
||||
extern void free_rawfile(void);
|
||||
extern int read_rawfile(const char *f);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ B 2 1040 -770 1510 -570 {flags=1
|
|||
y1 = -60
|
||||
y2 = 60
|
||||
divy = 12
|
||||
x1=0.00
|
||||
x1=0
|
||||
x2=0.03
|
||||
divx=10
|
||||
node="v(outp) v(outm) v(vpp) v(vnn) v(x1.vboost) v(x0.vboost)"
|
||||
|
|
@ -27,7 +27,7 @@ B 2 1040 -550 1510 -360 {flags=1
|
|||
y1 = 0
|
||||
y2 = 12
|
||||
divy = 6
|
||||
x1=0.00
|
||||
x1=0
|
||||
x2=0.03
|
||||
divx=10
|
||||
node="i(v.x1.vu) i(v.x0.vu) i(v.x1.vd) i(v.x0.vd)"
|
||||
|
|
@ -57,7 +57,7 @@ each with different bias points these
|
|||
annotator dinamically show the correct
|
||||
data.} 780 -830 0 0 0.2 0.2 {layer=4}
|
||||
T {Select one or more graphs (and no other objects)
|
||||
and use arrow keys to zoom / pan waveforms} 1060 -820 0 0 0.3 0.3 {}
|
||||
and use arrow keys to zoom / pan waveforms} 1060 -830 0 0 0.3 0.3 {}
|
||||
N 150 -1220 150 -1200 {lab=#net1}
|
||||
N 150 -1080 150 -1060 {lab=#net2}
|
||||
N 360 -1140 370 -1140 {lab=VSS}
|
||||
|
|
|
|||
|
|
@ -18,23 +18,23 @@ L 4 410 -150 570 -150 {}
|
|||
L 4 570 -170 570 -150 {}
|
||||
L 4 570 -170 690 -170 {}
|
||||
L 7 1090 -260 2520 -260 {}
|
||||
B 2 260 -1080 720 -900 {flags=1
|
||||
B 2 260 -1080 720 -980 {flags=1
|
||||
y1 = 0
|
||||
y2 = 1
|
||||
divy = 5
|
||||
x1=1e-7
|
||||
x2=5e-7
|
||||
divx=8
|
||||
x1=1.25e-07
|
||||
x2=3.75e-07
|
||||
divx=10
|
||||
node="v(cal) v(saout)"
|
||||
color="4 5"}
|
||||
B 2 260 -1270 720 -1090 {flags=1
|
||||
y1 = 0.64
|
||||
y2 = 0.66
|
||||
divy = 5
|
||||
x1=1e-7
|
||||
x2=5e-7
|
||||
divx=8
|
||||
node="v(minus) v(plus)"
|
||||
B 2 260 -1220 720 -1090 {flags=1
|
||||
y1 = 0.645
|
||||
y2 = 0.655
|
||||
divy = 10
|
||||
x1=1.25e-07
|
||||
x2=3.75e-07
|
||||
divx=5
|
||||
node="v(plus) v(minus)"
|
||||
color="4 5"}
|
||||
T {CAL} 140 -180 0 1 0.4 0.4 {}
|
||||
T {EN} 140 -130 0 1 0.4 0.4 {}
|
||||
|
|
@ -51,9 +51,9 @@ Gaussian Threshold variation (via delvto parameter) is added to all MOS transist
|
|||
T {.param ABSVAR=0.05
|
||||
delvto='agauss(0,ABSVAR,3)'} 1390 -120 0 0 0.6 0.6 {layer=8}
|
||||
T {Select one or more graphs (and no other objects)
|
||||
and use arrow keys to zoom / pan waveforms} 300 -1310 0 0 0.3 0.3 {}
|
||||
and use arrow keys to zoom / pan waveforms} 300 -1320 0 0 0.3 0.3 {}
|
||||
N 120 -470 120 -450 {lab=TEMPERAT}
|
||||
N 160 -1180 190 -1180 {lab=#net1}
|
||||
N 160 -1180 190 -1180 {lab=VSS}
|
||||
N 160 -1150 160 -1130 {lab=VSS}
|
||||
N 160 -1230 160 -1210 {lab=VSSI}
|
||||
N 1120 -1100 1150 -1100 {lab=VSS}
|
||||
|
|
|
|||
|
|
@ -31,51 +31,51 @@ B 2 1870 -810 2380 -710 {flags=1
|
|||
y1 = 0
|
||||
y2 = 2
|
||||
divy = 4
|
||||
x1=0
|
||||
x2=480e-9
|
||||
divx=12
|
||||
x1=2.05e-07
|
||||
x2=2.55e-07
|
||||
divx=10
|
||||
node="v(ldcp) v(ldprech)"
|
||||
color="3 11"}
|
||||
B 2 1870 -700 2380 -600 {flags=1
|
||||
y1 = 0
|
||||
y2 = 2
|
||||
divy = 4
|
||||
x1=0
|
||||
x2=480e-9 divx=12
|
||||
x1=2.05e-07
|
||||
x2=2.55e-07 divx=10
|
||||
node="v(lden)"
|
||||
color=12}
|
||||
B 2 1870 -370 2380 -270 {flags=1
|
||||
y1 = 0
|
||||
y2 = 2
|
||||
divy = 4
|
||||
x1=0
|
||||
x2=480e-9
|
||||
divx=12
|
||||
x1=2.05e-07
|
||||
x2=2.55e-07
|
||||
divx=10
|
||||
node="v(ldq[11])"}
|
||||
B 2 1870 -590 2380 -490 {flags=1
|
||||
y1 = 0
|
||||
y2 = 2
|
||||
divy = 4
|
||||
x1=0
|
||||
x2=480e-9
|
||||
divx=12
|
||||
x1=2.05e-07
|
||||
x2=2.55e-07
|
||||
divx=10
|
||||
node="v(ldsal)"
|
||||
color=8}
|
||||
B 2 1870 -480 2380 -380 {flags=1
|
||||
y1 = 0
|
||||
y2 = 2
|
||||
divy = 4
|
||||
x1=0
|
||||
x2=480e-9
|
||||
divx=12
|
||||
x1=2.05e-07
|
||||
x2=2.55e-07
|
||||
divx=10
|
||||
node="v(ldq[12])"}
|
||||
B 2 1870 -1010 2380 -820 {flags=1
|
||||
y1 = 0
|
||||
y2 = 2
|
||||
divy = 5
|
||||
x1=0
|
||||
x2=480e-9
|
||||
divx=12
|
||||
x1=2.05e-07
|
||||
x2=2.55e-07
|
||||
divx=10
|
||||
node="v(ldyms[6]) v(ldyms[9]) v(ldcp)"
|
||||
color="4 7 12"}
|
||||
B 7 950 -250 980 -80 {}
|
||||
|
|
@ -89,7 +89,7 @@ T {was: vss} 880 -980 0 0 0.4 0.4 {}
|
|||
T {16KB ROM Macrocell
|
||||
16 bit Data I/O x 8KWords} 210 -1120 0 0 0.7 0.7 {}
|
||||
T {Select one or more graphs (and no other objects)
|
||||
and use arrow keys to zoom / pan waveforms} 1880 -1050 0 0 0.3 0.3 {}
|
||||
and use arrow keys to zoom / pan waveforms} 1880 -1080 0 0 0.3 0.3 {}
|
||||
N 150 -580 150 -560 {lab=vss}
|
||||
N 150 -420 150 -400 {lab=vss}
|
||||
N 10 -270 10 -250 {lab=vss}
|
||||
|
|
@ -280,7 +280,7 @@ C {lab_pin.sym} 1670 -740 0 0 {name=l2 lab=LDWL[8:0]}
|
|||
C {spice_probe.sym} 1670 -740 0 0 {name=p46 analysis=tran}
|
||||
C {lab_pin.sym} 1670 -790 0 0 {name=l4 lab=LDBL[0,16,32,1,17,33,2,18,34]}
|
||||
C {spice_probe.sym} 1670 -790 0 0 {name=p91 analysis=tran}
|
||||
C {launcher.sym} 1935 -1085 0 0 {name=h2
|
||||
C {launcher.sym} 1935 -1115 0 0 {name=h2
|
||||
descr="Select arrow and
|
||||
Ctrl-Right-Click to load waveforms"
|
||||
tclcommand="xschem raw_read $netlist_dir/[file rootname [xschem get current_name]].raw"}
|
||||
|
|
|
|||
Loading…
Reference in New Issue