Graph UI improvements. Persistent bold waves. Graph UI bug fixes

This commit is contained in:
Stefan Frederik 2022-01-28 04:44:07 +01:00
parent ee263197d8
commit 0b0e749801
17 changed files with 364 additions and 180 deletions

View File

@ -190,7 +190,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double xx1, xx2, yy1, yy2;
double delta_threshold = 0.25;
double zoom_m = 0.5;
int save_mouse_at_end = 0;
int save_mouse_at_end = 0, clear_graphpan_at_end = 0;
#if HAS_CAIRO==1
cairo_save(xctx->cairo_ctx);
cairo_save(xctx->cairo_save_ctx);
@ -200,9 +200,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
gr = &xctx->graph_struct;
for(i=0; i < xctx->rects[GRIDLAYER]; i++) {
xRect *r;
/* process only graph boxes */
if( (xctx->ui_state & GRAPHPAN) && i != xctx->graph_master) continue;
r = &xctx->rect[GRIDLAYER][i];
/* process only graph boxes */
if(!(r->flags & 1) ) continue;
/* 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 */
@ -220,7 +220,11 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
xctx->graph_cursor2_x = G_X(xctx->mousex);
}
if(xctx->ui_state & GRAPHPAN) break; /* After GRAPHPAN only need to check Motion events for cursors */
if(xctx->mousey_snap < W_Y(gr->gy2)) {
xctx->graph_top = 1;
} else {
xctx->graph_top = 0;
}
if(xctx->mousex_snap < W_X(gr->gx1)) {
xctx->graph_left = 1;
} else {
@ -233,20 +237,16 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
}
xctx->graph_master = i;
zoom_m = (xctx->mousex - gr->x1) / gr->w;
/* dragging cursors when mouse is very close */
if(event == ButtonPress && button == Button1) {
if(edit_wave_attributes(2, i, gr)) {
draw_graph(i, 1 + 8 + (xctx->graph_flags & 6), gr); /* draw data in each graph box */
} else {
if( (xctx->graph_flags & 2) && fabs(xctx->mousex - W_X(xctx->graph_cursor1_x)) < 10) {
xctx->graph_flags |= 16; /* Start move cursor1 */
}
if( (xctx->graph_flags & 4) && fabs(xctx->mousex - W_X(xctx->graph_cursor2_x)) < 10) {
xctx->graph_flags |= 32; /* Start move cursor2 */
}
/* dragging cursors when mouse is very close */
if( (xctx->graph_flags & 2) && fabs(xctx->mousex - W_X(xctx->graph_cursor1_x)) < 10) {
xctx->graph_flags |= 16; /* Start move cursor1 */
}
if( (xctx->graph_flags & 4) && fabs(xctx->mousex - W_X(xctx->graph_cursor2_x)) < 10) {
xctx->graph_flags |= 32; /* Start move cursor2 */
}
}
if(event == -3 && button == Button1) {
else if(event == -3 && button == Button1) {
if(!edit_wave_attributes(1, i, gr)) {
char s[30];
my_snprintf(s, S(s), "%d", i);
@ -276,17 +276,24 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
} /* if( POINTINSIDE(...) */
} /* for(i=0; i < xctx->rects[GRIDLAYER]; i++) */
/* check if user clicked on a wave label -> draw wave in bold */
if(event == ButtonPress && button == Button3 &&
edit_wave_attributes(2, i, gr)) {
draw_graph(i, 1 + 8 + (xctx->graph_flags & 6), gr); /* draw data in graph box */
return 0;
}
/* save mouse position when doing pan operations */
if(
else if(
(
(event == ButtonPress && (button == Button1 || button == Button3)) ||
(event == MotionNotify && (state & (Button1Mask | Button3Mask)))
) &&
!(xctx->ui_state & GRAPHPAN)
!(xctx->ui_state & GRAPHPAN) &&
!xctx->graph_top /* && !xctx->graph_bottom */
) {
xctx->ui_state |= GRAPHPAN;
xctx->mx_double_save = xctx->mousex_snap;
xctx->my_double_save = xctx->mousey_snap;
if(!xctx->graph_left) xctx->mx_double_save = xctx->mousex_snap;
if(xctx->graph_left) xctx->my_double_save = xctx->mousey_snap;
}
gr->master_gx1 = 0;
gr->master_gx2 = 1e-6;
@ -296,6 +303,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
if(val[0]) gr->master_gx2 = atof(val);
if(gr->master_gx1 == gr->master_gx2) gr->master_gx2 += 1e-6;
gr->master_gw = gr->master_gx2 - gr->master_gx1;
/* second loop: after having determined the master graph do the others */
for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
xRect *r;
@ -305,7 +313,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
gr->gx1 = gr->master_gx1;
gr->gx2 = gr->master_gx2;
gr->gw = gr->master_gw;
setup_graph_data(i, xctx->graph_flags, 1, gr);
setup_graph_data(i, xctx->graph_flags, 1, gr); /* skip flag set, no reload x1 and x2 fields */
/* if no dataset given assume 0 for graph scaling calculations */
if(gr->dataset == -1) dataset = 0;
else if(gr->dataset <= xctx->graph_datasets) dataset =gr->dataset;
@ -655,33 +663,41 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
if(xctx->graph_values) {
if(xctx->graph_left) {
if(i == xctx->graph_master) {
int i, j;
double v;
double min=0.0, max=0.0;
int first = 1;
char *saven, *nptr, *ntok, *node = NULL;;
my_strdup2(1426, &node, get_tok_value(r->prop_ptr,"node",0));
nptr = node;
while( (ntok = my_strtok_r(nptr, "\n\t ", &saven)) ) {
nptr = NULL;
j = get_raw_index(ntok);
if(j >= 0) {
for(i = 0; i < xctx->graph_npoints[dataset]; i++) {
v = get_raw_value(dataset, j, i);
if(first || v < min) {min = v; first = 0;}
if(first || v > max) {max = v; first = 0;}
}
if(!gr->digital) {
int i, j;
double v;
double min=0.0, max=0.0;
int first = 1;
char *saven, *nptr, *ntok, *node = NULL;;
my_strdup2(1426, &node, get_tok_value(r->prop_ptr,"node",0));
nptr = node;
while( (ntok = my_strtok_r(nptr, "\n\t ", &saven)) ) {
nptr = NULL;
j = get_raw_index(ntok);
if(j >= 0) {
for(i = 0; i < xctx->graph_npoints[dataset]; i++) {
v = get_raw_value(dataset, j, i);
if(first || v < min) {min = v; first = 0;}
if(first || v > max) {max = v; first = 0;}
}
}
}
if(max == min) max += 0.01;
min = floor_to_n_digits(min, 2);
max = ceil_to_n_digits(max, 2);
my_free(1427, &node);
my_snprintf(s, S(s), "%g", min);
my_strdup(1422, &r->prop_ptr, subst_token(r->prop_ptr, "y1", s));
my_snprintf(s, S(s), "%g", max);
my_strdup(1423, &r->prop_ptr, subst_token(r->prop_ptr, "y2", s));
need_redraw = 1;
} else {
my_strdup(1497, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1",
get_tok_value(r->prop_ptr, "y1", 0) ));
my_strdup(1498, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2",
get_tok_value(r->prop_ptr, "y2", 0) ));
need_redraw = 1;
}
if(max == min) max += 0.01;
min = floor_to_n_digits(min, 2);
max = ceil_to_n_digits(max, 2);
my_free(1427, &node);
my_snprintf(s, S(s), "%g", min);
my_strdup(1422, &r->prop_ptr, subst_token(r->prop_ptr, "y1", s));
my_snprintf(s, S(s), "%g", max);
my_strdup(1423, &r->prop_ptr, subst_token(r->prop_ptr, "y2", s));
need_redraw = 1;
}
} else {
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
@ -723,19 +739,23 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
xctx->ui_state &= ~GRAPHPAN;
xctx->graph_flags &= ~(16 | 32); /* clear move cursor flags */
}
else if(button == Button3) {
/* zoom area by mouse drag */
else if(button == Button3 && (xctx->ui_state & GRAPHPAN) &&
!xctx->graph_left && !xctx->graph_top) {
if(r->sel || !(r->flags & 2) || i == xctx->graph_master) {
double tmp;
xctx->ui_state &= ~GRAPHPAN;
xx1 = G_X(xctx->mx_double_save);
xx2 = G_X(xctx->mousex_snap);
if(xx2 < xx1) { tmp = xx1; xx1 = xx2; xx2 = tmp; }
if(xx1 == xx2) xx2 += 1e-6;
my_snprintf(s, S(s), "%g", xx1);
my_strdup(1440, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
my_snprintf(s, S(s), "%g", xx2);
my_strdup(1441, &r->prop_ptr, subst_token(r->prop_ptr, "x2", s));
need_redraw = 1;
if(xctx->mx_double_save != xctx->mousex_snap) {
double tmp;
clear_graphpan_at_end = 1;
xx1 = G_X(xctx->mx_double_save);
xx2 = G_X(xctx->mousex_snap);
if(xx2 < xx1) { tmp = xx1; xx1 = xx2; xx2 = tmp; }
if(xx1 == xx2) xx2 += 1e-6;
my_snprintf(s, S(s), "%g", xx1);
my_strdup(1440, &r->prop_ptr, subst_token(r->prop_ptr, "x1", s));
my_snprintf(s, S(s), "%g", xx2);
my_strdup(1441, &r->prop_ptr, subst_token(r->prop_ptr, "x2", s));
need_redraw = 1;
}
}
}
} /* else if( event == ButtonRelease) */
@ -746,6 +766,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
} /* for(i=0; i< xctx->rects[GRIDLAYER]; i++ */
if(clear_graphpan_at_end) xctx->ui_state &= ~GRAPHPAN;
/* update saved mouse position after processing all graphs */
if(save_mouse_at_end &&
fabs(xctx->mx_double_save - xctx->mousex_snap) > fabs(gr->cx * gr->gw) * delta_threshold) {

View File

@ -1677,7 +1677,8 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx
double vthl = gr->gy1 * 0.8 + gr->gy2 * 0.2;
int hex_digits = ((n_bits - 1) >> 2) + 1;
if(c1 >= gr->ypos1 && c1 <=gr->ypos2) {
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt)
XSetLineAttributes (display, xctx->gc[wave_col],
3 * INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
drawline(wave_col, NOW, lx1, ylow, lx2, ylow, 0);
drawline(wave_col, NOW, lx1, yhigh, lx2, yhigh, 0);
@ -1711,7 +1712,8 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx
draw_string(wave_col, NOW, old_busval, 2, 0, 1, 0, (xval + xval_old) * 0.5,
yhigh, labsize, labsize);
}
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt)
XSetLineAttributes (display, xctx->gc[wave_col],
INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
}
}
@ -1750,17 +1752,21 @@ static void draw_graph_points(int v, int first, int last,
}
/* plot data */
if(xctx->draw_window) {
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt)
XSetLineAttributes (display, xctx->gc[wave_col],
3 * INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
XDrawLines(display, xctx->window, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt)
XSetLineAttributes (display, xctx->gc[wave_col],
INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
}
if(xctx->draw_pixmap) {
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt)
XSetLineAttributes (display, xctx->gc[wave_col],
3 * INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
XDrawLines(display, xctx->save_pixmap, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);
if(gr->hilight_wave == wcnt) XSetLineAttributes (display, xctx->gc[wave_col],
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt)
XSetLineAttributes (display, xctx->gc[wave_col],
INT_WIDTH(xctx->lw) ,LineSolid, CapRound , JoinRound);
}
} else dbg(1, "skipping wave: %s\n", xctx->graph_names[v]);
@ -1856,8 +1862,8 @@ void setup_graph_data(int i, const int flags, int skip, Graph_ctx *gr)
const char *val;
xRect *r = &xctx->rect[GRIDLAYER][i];
gr->i = i;
/* default values */
gr->hilight_wave = -1;
gr->divx = gr->divy = 5;
gr->subdivx = gr->subdivy = 0;
gr->digital = 0;
@ -2084,12 +2090,28 @@ static void draw_graph_variables(int wcnt, int wave_color, int n_nodes, int swee
yt = s1 * (double)(n_nodes - wcnt) * gr->gh - (gr->gy1 - gr->gh * 0.1) * s2;
if(yt <= gr->ypos2 && yt >= gr->ypos1) {
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) {
cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
}
draw_string(wave_color, NOW, tmpstr, 2, 0, 0, 0,
xt, DW_Y(yt), gr->digtxtsizelab, gr->digtxtsizelab);
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) {
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);
}
}
} else {
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) {
cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
}
draw_string(wave_color, NOW, tmpstr, 0, 0, 0, 0,
gr->rx1 + 2 + gr->rw / n_nodes * wcnt, gr->ry1, gr->txtsizelab, gr->txtsizelab);
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) {
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);
}
}
bbox(END, 0.0, 0.0, 0.0, 0.0);
}
@ -2236,8 +2258,20 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr)
ret = 1;
if(what == 1) {
my_snprintf(s, S(s), "%d %d", i, wcnt);
gr->hilight_wave[0] = i;
gr->hilight_wave[1] = wcnt;
tclvareval("graph_edit_wave ", s, NULL);
} else gr->hilight_wave = wcnt;
gr->hilight_wave[0] = -1;
gr->hilight_wave[1] = -1;
} else {
if(gr->hilight_wave[0] == i && gr->hilight_wave[1] == wcnt) {
gr->hilight_wave[0] = -1;
gr->hilight_wave[1] = -1;
} else {
gr->hilight_wave[0] = i;
gr->hilight_wave[1] = wcnt;
}
}
}
}
} else {
@ -2250,8 +2284,20 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr)
ret = 1;
if(what == 1) {
my_snprintf(s, S(s), "%d %d", i, wcnt);
gr->hilight_wave[0] = i;
gr->hilight_wave[1] = wcnt;
tclvareval("graph_edit_wave ", s, NULL);
} else gr->hilight_wave = wcnt;
gr->hilight_wave[0] = -1;
gr->hilight_wave[1] = -1;
} else {
if(gr->hilight_wave[0] == i && gr->hilight_wave[1] == wcnt) {
gr->hilight_wave[0] = -1;
gr->hilight_wave[1] = -1;
} else {
gr->hilight_wave[0] = i;
gr->hilight_wave[1] = wcnt;
}
}
}
}
wcnt++;
@ -2286,11 +2332,14 @@ void draw_graph(int i, const int flags, Graph_ctx *gr)
double measure_x;
double measure_prev_x;
xRect *r = &xctx->rect[GRIDLAYER][i];
if(RECT_OUTSIDE( gr->sx1, gr->sy1, gr->sx2, gr->sy2,
xctx->areax1, xctx->areay1, xctx->areax2, xctx->areay2)) return;
/*
* dbg(0, "draw_graph(): window: %d %d %d %d\n", xctx->areax1, xctx->areay1, xctx->areax2, xctx->areay2);
* dbg(0, "draw_graph(): graph: %g %g %g %g\n", gr->sx1, gr->sy1, gr->sx2, gr->sy2);
* dbg(0, "draw_graph(): i = %d, flags = %d\n", i, flags);
*/
/* draw stuff */
if(flags & 8) {
/* graph box, gridlines and axes */
@ -2462,7 +2511,7 @@ void draw_graph_all(int flags)
int bbox_set = 0;
const char *tmp;
int save_bbx1, save_bby1, save_bbx2, save_bby2;
dbg(0, "draw_graph_all(): flags=%d\n", flags);
dbg(1, "draw_graph_all(): flags=%d\n", flags);
/* save bbox data, since draw_graph_all() is called from draw() which may be called after a bbox(SET) */
sch_loaded = schematic_waves_loaded();
tmp = tclgetvar("hide_empty_graphs");

View File

@ -415,7 +415,7 @@ int read_rawfile_from_attr(const char *b64s, size_t length)
}
if( (fd = open_tmpfile("rawfile_", &tmp_filename)) ) {
s = base64_decode(b64s, length, &decoded_length);
fwrite(s, decoded_length, 1, fd);
fwrite(s, decoded_length, 1, fd);
fclose(fd);
my_free(1479, &s);
res = read_rawfile(tmp_filename);

View File

@ -632,6 +632,23 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, str, TCL_VOLATILE);
my_free(1161, &str);
}
else if(!strcmp(argv[1], "draw_graph"))
{
int flags;
cmd_found = 1;
if(argc > 2) {
int i = atoi(argv[2]);
if(argc > 3) {
flags = atoi(argv[3]);
} else {
flags = 1 + 8 + (xctx->graph_flags & 6);
}
setup_graph_data(i, xctx->graph_flags, 0, &xctx->graph_struct);
draw_graph(i, flags, &xctx->graph_struct);
}
Tcl_ResetResult(interp);
}
}
else if(argv[1][0] == 'e') {
@ -2098,6 +2115,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
cmd_found = 1;
if(schematic_waves_loaded()) {
free_rawfile(1);
tclsetvar("rawfile_loaded", "0");
} else if(argc > 2) {
free_rawfile(0);
read_rawfile(argv[2]);
@ -2664,7 +2682,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
bbox(START,0.0,0.0,0.0,0.0);
xctx->push_undo();
}
set_modify(1);
if(argc > 6)
my_strdup(1486, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6]));
else

View File

@ -443,8 +443,11 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->graph_cursor1_x = 0;
xctx->graph_unlock_x = 0;
xctx->graph_flags = 0;
xctx->graph_top = 0;
xctx->graph_bottom = 0;
xctx->graph_left = 0;
xctx->graph_struct.hilight_wave[0] = -1; /* graph index of hilight wave */
xctx->graph_struct.hilight_wave[1] = -1; /* index of wave */
xctx->raw_schname = NULL;
xctx->wires = 0;
xctx->instances = 0;

View File

@ -676,6 +676,7 @@ typedef struct
/* context struct for waveform graphs */
typedef struct {
int i; /* index number of container rectangle */
double digital;
double rx1, ry1, rx2, ry2, rw, rh; /* container rectangle */
double sx1, sy1, sx2, sy2; /* screen coordinates of above */
@ -704,7 +705,7 @@ typedef struct {
int unity_suffix;
double txtsizelab, digtxtsizelab, txtsizey, txtsizex;
int dataset;
int hilight_wave;
int hilight_wave[2]; /* [0] : graph index, [1] : wave index */
} Graph_ctx;
typedef struct {
@ -890,8 +891,9 @@ typedef struct {
*/
int graph_flags;
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_left; /* graph where mouse operations are started, used to lock x-axis */
int graph_top; /* regions of graph where mouse events occur */
int graph_bottom;
int graph_left;
Int_hashentry **raw_table;
char *raw_schname;
/* */

View File

@ -1300,8 +1300,10 @@ proc graph_edit_wave {n n_wave} {
if {[lindex $col $i] eq {}} { lappend col $graph_sel_color}
incr i
}
set col [lrange $col 0 [expr {$i - 1}]]
set graph_sel_color [lindex $col $graph_sel_wave]
xschem setprop rect 2 $graph_selected color $col fast
xschem draw_graph $graph_selected
# puts "graph: $graph_selected , wave: $n_wave, n_nodes: $n_nodes"
# puts " node: $node, col: $col"
# puts "------"
@ -1322,6 +1324,7 @@ proc graph_edit_wave {n n_wave} {
tkwait window .dialog
}
# add nodes from left listbox
proc graph_add_nodes {} {
global graph_bus
set sel_idx [.dialog.center.left.list1 curselection]
@ -1360,6 +1363,9 @@ proc graph_get_signal_list {siglist pattern } {
return $result
}
# change color of selected wave in text widget and redraw graph
# OR
# change color attribute of wave given as parameter, redraw graph
proc graph_change_wave_color {{wave {}}} {
global graph_sel_color graph_selected
# get tag the cursor is on:
@ -1376,10 +1382,13 @@ proc graph_change_wave_color {{wave {}}} {
} else {
set col [xschem getprop rect 2 $graph_selected color]
set col [lreplace $col $wave $wave $graph_sel_color]
xschem setprop rect 2 $graph_selected color $col
xschem setprop rect 2 $graph_selected color $col fast
xschem draw_graph $graph_selected
}
}
# tag nodes in text widget with assigned colors
# redraw graph
proc graph_update_nodelist {} {
global graph_selected colors graph_sel_color
set nodelist [.dialog.center.right.text1 get 1.0 end]
@ -1390,24 +1399,28 @@ proc graph_update_nodelist {} {
set col [string trim $col " \n"]
set tt [.dialog.center.right.text1 search -all -nolinestop -regexp -count cc {[^ \n]+} 1.0]
set n 0
foreach t $tt c $cc {
set col_idx [lindex $col $n]
if {$col_idx eq {}} {
set col_idx $graph_sel_color
lappend col $graph_sel_color
if { [info exists cc] && ($tt ne {}) } {
foreach t $tt c $cc {
set col_idx [lindex $col $n]
if {$col_idx eq {}} {
set col_idx $graph_sel_color
lappend col $graph_sel_color
}
set b [lindex $colors $col_idx]
.dialog.center.right.text1 tag add t$n $t "$t + $c chars"
.dialog.center.right.text1 tag configure t$n -background $b
if { $col_idx == 8 || $col_idx == 9 || $col_idx == 16 || $col_idx == 19} {
.dialog.center.right.text1 tag configure t$n -foreground black}
incr n
}
set b [lindex $colors $col_idx]
.dialog.center.right.text1 tag add t$n $t "$t + $c chars"
.dialog.center.right.text1 tag configure t$n -background $b
if { $col_idx == 8 || $col_idx == 9 || $col_idx == 16 || $col_idx == 19} {
.dialog.center.right.text1 tag configure t$n -foreground black}
incr n
set col [lrange $col 0 [expr {$n - 1}]]
xschem setprop rect 2 $graph_selected color $col fast
}
xschem setprop rect 2 $graph_selected color $col fast
xschem draw_graph $graph_selected
}
proc fill_graph_listbox {} {
set retval [.dialog.top.e1 get]
set retval [.dialog.top.search get]
set retval [graph_get_signal_list [xschem raw_query list] $retval]
.dialog.center.left.list1 delete 0 end
eval .dialog.center.left.list1 insert 0 $retval
@ -1435,17 +1448,21 @@ proc graph_edit_properties {n} {
# center-left frame
label .dialog.center.left.lab1 -text {Signal list}
button .dialog.center.left.add -text Add -command {
graph_add_nodes; graph_update_nodelist
}
listbox .dialog.center.left.list1 -width 20 -height 10 -selectmode extended \
-yscrollcommand {.dialog.center.left.yscroll set} \
-xscrollcommand {.dialog.center.left.xscroll set}
scrollbar .dialog.center.left.yscroll -command {.dialog.center.left.list1 yview}
scrollbar .dialog.center.left.xscroll -orient horiz -command {.dialog.center.left.list1 xview}
grid .dialog.center.left.lab1
grid .dialog.center.left.list1 .dialog.center.left.yscroll -sticky nsew
grid .dialog.center.left.xscroll -sticky nsew
grid .dialog.center.left.lab1 .dialog.center.left.add
grid .dialog.center.left.list1 - .dialog.center.left.yscroll -sticky nsew
grid .dialog.center.left.xscroll - -sticky nsew
grid rowconfig .dialog.center.left 0 -weight 0
grid rowconfig .dialog.center.left 1 -weight 1 -minsize 100
grid columnconfig .dialog.center.left 0 -weight 1
grid columnconfig .dialog.center.left 1 -weight 1
# center right frame
label .dialog.center.right.lab1 -text {Signals in graph}
@ -1468,14 +1485,25 @@ proc graph_edit_properties {n} {
destroy .dialog
}
button .dialog.bottom.ok -text OK -command {
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"]
graph_update_nodelist
xschem setprop rect 2 $graph_selected y1 [.dialog.top.e2 get] fast
xschem setprop rect 2 $graph_selected y2 [.dialog.top.e3 get] fast
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"]
xschem setprop rect 2 $graph_selected y1 [.dialog.top.min get] fast
xschem setprop rect 2 $graph_selected y2 [.dialog.top.max get] fast
xschem setprop rect 2 $graph_selected node $node fast
destroy .dialog
xschem draw_graph $graph_selected
}
button .dialog.bottom.apply -text Apply -command {
graph_update_nodelist
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"]
xschem setprop rect 2 $graph_selected y1 [.dialog.top.min get] fast
xschem setprop rect 2 $graph_selected y2 [.dialog.top.max get] fast
xschem setprop rect 2 $graph_selected node $node fast
xschem draw_graph $graph_selected
}
pack .dialog.bottom.ok -side left
pack .dialog.bottom.apply -side left
pack .dialog.bottom.cancel -side left
for {set i 4} {$i < 22} {incr i} {
@ -1485,41 +1513,55 @@ proc graph_edit_properties {n} {
}
# top frame
label .dialog.top.l1 -text Search:
entry .dialog.top.e1 -width 10
checkbutton .dialog.top.c1 -text bus -padx 2 -variable graph_bus
checkbutton .dialog.top.c2 -text {Incr. sort} -variable graph_sort -indicatoron 1 \
label .dialog.top.labsearch -text Search:
entry .dialog.top.search -width 10
checkbutton .dialog.top.bus -text Bus -padx 2 -variable graph_bus
checkbutton .dialog.top.incr -text {Incr. sort} -variable graph_sort -indicatoron 1 \
-command fill_graph_listbox
checkbutton .dialog.top.c3 -text {Digital} -variable graph_digital -indicatoron 1 \
checkbutton .dialog.top.dig -text {Digital} -variable graph_digital -indicatoron 1 \
-command {
xschem setprop rect 2 $graph_selected digital $graph_digital fast
xschem setprop rect 2 $graph_selected digital $graph_digital fast
xschem draw_graph $graph_selected
}
label .dialog.top.l2 -text { Min Value:}
entry .dialog.top.e2 -width 5
label .dialog.top.l3 -text { Max Value:}
entry .dialog.top.e3 -width 5
label .dialog.top.labmin -text { Min Value:}
entry .dialog.top.min -width 5
label .dialog.top.labmax -text { Max Value:}
entry .dialog.top.max -width 5
button .dialog.top.b1 -text Clear -padx 2 -command {
.dialog.top.e1 delete 0 end
button .dialog.top.clear -text Clear -padx 2 -command {
.dialog.top.search delete 0 end
fill_graph_listbox
}
button .dialog.top.b2 -text Add -padx 2 -command {graph_add_nodes; graph_update_nodelist}
pack .dialog.top.l1 .dialog.top.e1 -side left
pack .dialog.top.c2 .dialog.top.c3 -side left
pack .dialog.top.l2 .dialog.top.e2 .dialog.top.l3 .dialog.top.e3 -side left
pack .dialog.top.b1 .dialog.top.b2 .dialog.top.c1 -side left
.dialog.top.e2 insert 0 [xschem getprop rect 2 $graph_selected y1]
.dialog.top.e3 insert 0 [xschem getprop rect 2 $graph_selected y2]
pack .dialog.top.labsearch .dialog.top.search -side left
pack .dialog.top.clear -side left
pack .dialog.top.incr -side left
pack .dialog.top.bus -side left
pack .dialog.top.dig -side left
pack .dialog.top.labmin .dialog.top.min .dialog.top.labmax .dialog.top.max -side left
.dialog.top.min insert 0 [xschem getprop rect 2 $graph_selected y1]
.dialog.top.max insert 0 [xschem getprop rect 2 $graph_selected y2]
# binding
bind .dialog.top.e1 <KeyRelease> {
bind .dialog.top.search <KeyRelease> {
fill_graph_listbox
}
bind .dialog.center.left.list1 <Double-Button-1> {
.dialog.top.b2 invoke
graph_add_nodes;
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"]
xschem setprop rect 2 $graph_selected node $node fast
graph_update_nodelist
}
bind .dialog.center.right.text1 <KeyRelease> {
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"]
xschem setprop rect 2 $graph_selected node $node fast
graph_update_nodelist
}
bind .dialog <Control-Return> {
.dialog.bottom.ok invoke
}
bind .dialog <Escape> {
.dialog.bottom.cancel invoke
}
# fill data in left listbox
eval .dialog.center.left.list1 insert 0 [graph_get_signal_list [xschem raw_query list] {}]

View File

@ -22,7 +22,9 @@ subdivy=1
x1=-8.50378e-06
x2=0.000191496
divx=9
node="led panel sw"
node="led
panel
sw"
color="11 18 6" unitx=m subdivx=4}
B 2 1200 -400 1490 -270 {flags=graph
y1 = 0.360479
@ -32,7 +34,8 @@ subdivy=1
x1=-8.50378e-06
x2=0.000191496
divx=8
node="i(vpanel)" unitx=m}
node=i(vpanel) unitx=m
color=4}
B 4 890 -630 910 -570 {}
B 7 850 -610 920 -590 {dash=4}
B 8 860 -630 880 -570 {}

View File

@ -27,7 +27,9 @@ divy = 6
x1=-0.0234922
x2=3.11495
divx=6
node="v(a) v(zz) v(zzz)"
node="a
zz
zzz"
color="4 6 8"
sweep="v(a)"}
B 2 10 -930 570 -700 {flags=graph
@ -37,8 +39,9 @@ divy = 6
x1=-0.0339625
x2=3.10448
divx=6
node="v(a) v(z)"
color="4 6 8"
node="a
z"
color="4 6"
sweep="v(z) v(a)"}
P 4 5 560 -700 560 -510 1350 -510 1350 -700 560 -700 {dash=3}
P 4 5 820 -920 820 -730 1350 -730 1350 -920 820 -920 {dash=3}

View File

@ -13,8 +13,10 @@ x1=2.3
x2=2.7
divx=6
subdivx=1
node="v(diffout) v(plus) v(minus)"
color="7 8 10 11 12 13 14 15 16 17"
node="v(diffout)
v(plus)
v(minus)"
color="7 8 10"
dataset=0
}
B 2 1230 -1050 1807 -523 {flags=image,unscaled

View File

@ -15,8 +15,11 @@ x1=0.0157556
x2=0.0164125
divx=8
subdivx=1
node="tcleval($\{path\}ga $\{path\}gb $\{path\}outi vnn)"
color="7 8 10 11 12 13 14 15 16 17"
node="x1.ga
x1.gb
x1.outi
vnn"
color="7 8 10 11"
dataset=0
unitx=m
}

View File

@ -15,14 +15,14 @@ L 18 880 -530 900 -580 {}
L 18 880 -530 880 -450 {}
L 18 900 -580 900 -400 {}
B 2 1200 -330 1880 -140 {flags=graph
y1 = 0
y2 = .05
y1 = 0.0391503
y2 = 0.0391634
divy = 5
x1=0.0145887
x2=0.0152398
divx=10
node="i(v.x1.v3)"
color="11 12 13 14" unitx=m unity=m}
node=i(v.x1.v3)
color=11 unitx=m unity=m}
B 2 1200 -530 1880 -340 {flags=graph
y1 = 0
y2 = 12
@ -30,8 +30,11 @@ divy = 6
x1=0.0145887
x2=0.0152398
divx=10
node="i(v.x1.vu) i(v.x0.vu) i(v.x1.vd) i(v.x0.vd)"
color="11 12 13 14" unitx=m}
node="i(v.x1.vu)
i(v.x0.vu)
i(v.x1.vd)
i(v.x0.vd)"
color="11 13 12 7" unitx=m}
B 2 1200 -860 1880 -550 {flags=graph
y1 = -60
@ -40,8 +43,13 @@ divy = 12
x1=0.0145887
x2=0.0152398
divx=10
node="outp outm vpp vnn x1.vboost x0.vboost"
color="4 5 6 12 8 10" unitx=m}
node="outp
outm
vpp
vnn
x1.vboost
x0.vboost"
color="4 15 6 12 7 4" unitx=m}
T {actual value
50u} 400 -820 0 0 0.4 0.4 {}
T {actual value

View File

@ -22,24 +22,26 @@ B 2 260 -1080 720 -920 {flags=graph
y1 = 0
y2 = 0.93
divy = 5
x1=7.96491e-08
x2=4.07704e-07
x1=1.0603e-07
x2=4.34086e-07
divx=5
subdivx=4
unitx=n
node="cal saout"
node="cal
saout"
color="4 5"
}
B 2 260 -1220 720 -1090 {flags=graph
y1 = 0.647719
y2 = 0.652802
divy = 5
x1=7.96491e-08
x2=4.07704e-07
x1=1.0603e-07
x2=4.34086e-07
unitx=n
divx=5
subdivx=4
node="plus minus"
node="plus
minus"
color="4 5"}
T {CAL} 140 -180 0 1 0.4 0.4 {}
T {EN} 140 -130 0 1 0.4 0.4 {}

View File

@ -46,7 +46,8 @@ subdivy=1
x1=0
x2=0.0002
divx=9
node="v(led) v(sw)"
node="v(led)
v(sw)"
color="11 18" unitx=m subdivx=4}
B 2 1110 -790 1530 -660 {flags=graph
y1 = 0
@ -56,7 +57,8 @@ subdivy=1
x1=0
x2=0.0002
divx=8
node="v(panel)" unitx=m}
node="v(panel)" unitx=m
color=13}
B 2 1110 -650 1530 -520 {flags=graph
y1 = 0
y2 = 4

View File

@ -6,37 +6,41 @@ S {}
E {}
B 2 580 -140 1200 -30 {flags=graph
y1 = 0
y2 = 2
y2 = 1.6
divy = 2
x1=1.11978e-07
x2=2.09815e-07
divx=8
comm="example of using tcl to replace the path
with $path variable automatically"
node="tcleval(v($\{path\}ldcp_ref) v($\{path\}ldprechref))"
color=12\\ 5\\ 13}
node="v(xctrl.ldcp_ref)
v(xctrl.ldprechref)"
color="12 11"}
B 2 580 -280 1200 -140 {flags=graph
y1 = 0
y2 = 2
y2 = 1.6
divy = 2
x1=1.36438e-07
x2=2.34275e-07
divx=8
comm="example of using tcl to replace the path
with $path variable automatically"
node="tcleval(v($\{path\}ldcp_ref) v($\{path\}ldcpb))"
color=12\\ 5\\ 8}
node="v(xctrl.ldcp_ref)
v(xctrl.ldcpb)"
color="12 11"}
B 2 580 -400 1200 -280 {flags=graph
y1 = 0
y2 = 2
y2 = 1.6
divy = 2
x1=1.11978e-07
x2=2.09815e-07
divx=8
comm="example of using tcl to replace the path
with $path variable automatically"
node="tcleval(v($\{path\}ldcp_ref) v($\{path\}ldouti) v($\{path\}ldoutib))"
color=12\\ 5\\ 8}
node="v(xctrl.ldcp_ref)
v(xctrl.ldouti)
v(xctrl.ldoutib)"
color="12 5 11"}
N 360 -670 500 -670 {lab=LDCPB}
N 240 -760 250 -760 {lab=LDCPB}
N 240 -760 240 -670 {lab=LDCPB}

View File

@ -11,8 +11,10 @@ divy = 4
x1=2.6e-07
x2=3.4e-07
divx=8
node="v(xsa[0].ldqi) v(xsa[0].ldqib) v(xsa[0].ldsali)"
color="12\\ 5\\ 8\\ 11"}
node="v(xsa[0].ldqi)
v(xsa[0].ldqib)
v(xsa[0].ldsali)"
color="12 5 10"}
B 2 380 -940 1060 -830 {flags=graph
y1 = 0
y2 = 2
@ -20,8 +22,9 @@ divy = 2
x1=2.6e-07
x2=3.4e-07
divx=8
node="v(ldcp) v(ldprech)"
color=12\\ 5\\ 8}
node="v(ldcp)
v(ldprech)"
color="12 10"}
B 2 380 -650 1060 -510 {flags=graph
y1 = 0
y2 = 2
@ -29,8 +32,10 @@ divy = 2
x1=2.6e-07
x2=3.4e-07
divx=8
node="v(xsa[0].ldqiii) v(xsa[0].ldqii) v(xsa[0].ldsali)"
color=12\\ 5\\ 8}
node="v(xsa[0].ldqiii)
v(xsa[0].ldqii)
v(xsa[0].ldsali)"
color="12 5 4"}
T {Was:
60/24} 1420 -310 0 0 0.4 0.4 {}
T {was: LDCP_B} 510 -410 0 0 0.4 0.4 {}

View File

@ -34,25 +34,33 @@ divy = 3
subdivy=1
x1=1.48222e-07
x2=1.94606e-07 divx=10
node="
ldbl[0] ldbl[16] ldbl[32]
ldbl[1] ldbl[17] ldbl[33]
ldbl[2] ldbl[18] ldbl[34]
"
color="8 9 10 11 12 13 14 15 16 17 18" unitx=n
node="ldbl[0]
ldbl[16]
ldbl[32]
ldbl[1]
ldbl[17]
ldbl[33]
ldbl[2]
ldbl[18]
ldbl[34]"
color="8 9 10 11 12 13 14 15 11" unitx=n
}
B 2 1840 -1160 2890 -1000 {flags=graph_unlocked
digital=0
y1 = -0.021
y2 = 1.5
y1 = 0
y2 = 1.6
subdivy=1
divy = 4
x1=1.48222e-07
x2=1.94606e-07
divx=10
subdivx=4
node="ldcp ldyms[4] ldyms[5] ldyms[6] ldymsref"
color="6 12 13 14 15"
node="ldcp
ldyms[4]
ldyms[5]
ldyms[6]
ldymsref"
color="6 12 13 14 11"
unitx=n
}
B 2 1840 -400 2890 -240 {flags=graph_unlocked
@ -63,11 +71,18 @@ subdivy=0
subdivx = 1
x1=1.48222e-07
x2=1.94606e-07 divx=10
node="
ldwl[0] ldwl[1] ldwl[2] ldwl[3]
ldwl[4] ldwl[5] ldwl[6] ldwl[16]
ldwl[7] ldwl[8] ldwl[9]"
color="4 5 4 5 4 5 4 5 4 5 4 5"
node="ldwl[0]
ldwl[1]
ldwl[2]
ldwl[3]
ldwl[4]
ldwl[5]
ldwl[6]
ldwl[16]
ldwl[7]
ldwl[8]
ldwl[9]"
color="4 5 4 5 4 5 4 5 4 5 4"
unitx=n
}
B 2 1840 -1000 2890 -540 {flags=graph,unlocked
@ -81,8 +96,7 @@ x1=1.48222e-07
x2=1.94606e-07
divx=12
subdivx=4
node="
---In/Out---
node="---In/Out---
ldcp
ldq[15]
ldq[14]
@ -91,28 +105,31 @@ ldq[12]
LDA,lda[12],lda[11],lda[10],lda[9],lda[8],lda[7],lda[6],lda[5],lda[4],lda[3],lda[2],lda[1],lda[0]
LDQ,ldq[15],ldq[14],ldq[13],ldq[12],ldq[11],ldq[10],ldq[9],ldq[8],ldq[7],ldq[6],ldq[5],ldq[4],ldq[3],ldq[2],ldq[1],ldq[0]
---Timing---
lden ldprech
lden
ldprech
---Decoders---
LDL3X,ldl3x[7],ldl3x[6],ldl3x[5],ldl3x[4],ldl3x[3],ldl3x[2],ldl3x[1],ldl3x[0]
LDL2X,ldl2x[3],ldl2x[2],ldl2x[1],ldl2x[0]
LDL1X,ldl1x[15],ldl1x[14],ldl1x[13],ldl1x[12],ldl1x[11],ldl1x[10],ldl1x[9],ldl1x[8],ldl1x[7],ldl1x[6],ldl1x[5],ldl1x[4],ldl1x[3],ldl1x[2],ldl1x[1],ldl1x[0]
LDY1,ldy1[3],ldy1[2],ldy1[1],ldy1[0]
WL[15:0],ldwl[15],ldwl[14],ldwl[13],ldwl[12],ldwl[11],ldwl[10],ldwl[9],ldwl[8],ldwl[7],ldwl[6],ldwl[5],ldwl[4],ldwl[3],ldwl[2],ldwl[1],ldwl[0]
"
color="18 4 15 4 15 4 15 4 18 15 4 18 4 15 4 15 4 15 4 15 4 15 4 15 4 15"
WL[15:0],ldwl[15],ldwl[14],ldwl[13],ldwl[12],ldwl[11],ldwl[10],ldwl[9],ldwl[8],ldwl[7],ldwl[6],ldwl[5],ldwl[4],ldwl[3],ldwl[2],ldwl[1],ldwl[0]"
color="18 4 15 4 15 4 15 4 18 15 4 18 4 15 4 15 11"
unitx=n
ypos1=-2.20115 ypos2=2.79884
}
B 2 1840 -1300 2890 -1160 {flags=graph_unlocked
y1 = -0.022
y1 = 0
y2 = 1.6
divy = 4
x1=1.48222e-07
x2=1.94606e-07
divx=8
unitx=n
node="xsa[0].ldqib xsa[5].ldqib xsa[0].ldsali xctrl.ldq_b"
color="4 4 5 12 "
node="xsa[0].ldqib
xsa[5].ldqib
xsa[0].ldsali
xctrl.ldq_b"
color="4 12 5 10"
}
B 2 1840 -240 2890 0 {flags=graph_unlocked
y1 = -0.0559946
@ -123,7 +140,7 @@ x2=1.94606e-07
unity=m
divx=10
subdivx=1
node="i(vvcc)"
node=i(vvcc)
color=3 unitx=n subdivy=4
}
B 7 950 -250 980 -80 {}