From 2aeafac85c256bf0227efeec991ee1a9ad670c03 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 23 Oct 2023 16:03:27 +0200 Subject: [PATCH] if selecting a waweform dataset with `t` key update text floaters that might contain the dataset information. When closing the process list dialog also close the process status sub-dialog. --- src/actions.c | 1 + src/callback.c | 23 +++++++++++++++++------ src/editprop.c | 16 +++++++++------- src/xschem.tcl | 9 ++++++++- xschem_library/ngspice/autozero_comp.sch | 1 + 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/actions.c b/src/actions.c index aafecbb3..0886613a 100644 --- a/src/actions.c +++ b/src/actions.c @@ -85,6 +85,7 @@ int there_are_floaters(void) for(k = 0; k < xctx->texts; k++) { if(xctx->text[k].flags & TEXT_FLOATER) { floaters = 1; + dbg(1, "text %d is a floater\n", k); break; } } diff --git a/src/callback.c b/src/callback.c index 2aaf1dfe..52801657 100644 --- a/src/callback.c +++ b/src/callback.c @@ -358,10 +358,11 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int /* move cursor2 */ /* set cursor position from master graph x-axis */ else if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 32 )) { + int floaters = there_are_floaters(); xctx->graph_cursor2_x = G_X(xctx->mousex); if(tclgetboolvar("live_cursor2_backannotate")) { backannotate_at_cursor_b_pos(r, gr); - if(there_are_floaters()) set_modify(-2); /* update floater caches to reflect actual backannotation */ + if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */ redraw_all_at_end = 1; } } @@ -403,8 +404,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int } /* backannotate node values at cursor b position */ else if(key == 'a' && EQUAL_MODMASK && (xctx->graph_flags & 4)) { + int floaters = there_are_floaters(); backannotate_at_cursor_b_pos(r, gr); - if(there_are_floaters()) set_modify(-2); /* update floater caches to reflect actual backannotation */ + if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */ redraw_all_at_end = 1; } /* x cursor1 toggle */ @@ -415,12 +417,13 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int } /* x cursor2 toggle */ else if((key == 'b') ) { + int floaters = there_are_floaters(); xctx->graph_flags ^= 4; if(xctx->graph_flags & 4) { xctx->graph_cursor2_x = G_X(xctx->mousex); if(tclgetboolvar("live_cursor2_backannotate")) { backannotate_at_cursor_b_pos(r, gr); - if(there_are_floaters()) set_modify(-2); /* update floater caches to reflect actual backannotation */ + if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */ redraw_all_at_end = 1; } else { need_all_redraw = 1; @@ -435,12 +438,13 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int /* swap cursors */ else if((key == 's') ) { double tmp; + int floaters = there_are_floaters(); tmp = xctx->graph_cursor2_x; xctx->graph_cursor2_x = xctx->graph_cursor1_x; xctx->graph_cursor1_x = tmp; if(tclgetboolvar("live_cursor2_backannotate")) { backannotate_at_cursor_b_pos(r, gr); - if(there_are_floaters()) set_modify(-2); /* update floater caches to reflect actual backannotation */ + if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */ redraw_all_at_end = 1; } else need_all_redraw = 1; @@ -673,18 +677,25 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int else if((key == 't') ) { if(track_dset != -2) { const char *unlocked = strstr(get_tok_value(r->prop_ptr, "flags", 0), "unlocked"); + int floaters = there_are_floaters(); if(i == xctx->graph_master || !unlocked) { gr->dataset = track_dset; my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "dataset", my_itoa(track_dset))); + + } + /* do this here to update texts printing current dataset in graph + * tcleval([xschem getprop rect 2 n dataset]) */ + if(i == xctx->graph_master && floaters) { + set_modify(-2); /* update floater caches to reflect actual backannotation */ + redraw_all_at_end = 1; } if((xctx->graph_flags & 4) && tclgetboolvar("live_cursor2_backannotate")) { if(i == xctx->graph_master) { backannotate_at_cursor_b_pos(r, gr); - if(there_are_floaters()) set_modify(-2); /* update floater caches to reflect actual backannotation */ } redraw_all_at_end = 1; } else { - need_redraw = 1; + if(!redraw_all_at_end) need_redraw = 1; } } diff --git a/src/editprop.c b/src/editprop.c index 37ebe921..4cb95d8c 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -860,6 +860,8 @@ static int edit_rect_property(int x) preserve = tclgetboolvar("preserve_unchanged_attrs"); if(strcmp(tclgetvar("rcode"),"") ) { + int floaters = there_are_floaters(); + dbg(1, "floaters=%d\n", floaters); xctx->push_undo(); for(i=0; ilastsel; ++i) { if(xctx->sel_array[i].type != xRECT) continue; @@ -888,21 +890,21 @@ static int edit_rect_property(int x) if( (oldprop && xctx->rect[c][n].prop_ptr && strcmp(oldprop, xctx->rect[c][n].prop_ptr)) || (!oldprop && xctx->rect[c][n].prop_ptr) || (oldprop && !xctx->rect[c][n].prop_ptr)) { if(!drw) { - bbox(START,0.0,0.0,0.0,0.0); + if(!floaters) bbox(START,0.0,0.0,0.0,0.0); drw = 1; } if( xctx->rect[c][n].flags & 1024) { draw_image(0, &xctx->rect[c][n], &xctx->rect[c][n].x1, &xctx->rect[c][n].y1, &xctx->rect[c][n].x2, &xctx->rect[c][n].y2, 0, 0); } - bbox(ADD, xctx->rect[c][n].x1, xctx->rect[c][n].y1, xctx->rect[c][n].x2, xctx->rect[c][n].y2); + if(!floaters) { + bbox(ADD, xctx->rect[c][n].x1, xctx->rect[c][n].y1, xctx->rect[c][n].x2, xctx->rect[c][n].y2); + } } } - if(drw) { - bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); - draw(); - bbox(END , 0.0 , 0.0 , 0.0 , 0.0); - } + if(!floaters && drw) bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); + if(drw) draw(); + if(!floaters && drw) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); modified = 1; } my_free(_ALLOC_ID_, &oldprop); diff --git a/src/xschem.tcl b/src/xschem.tcl index 70dbb963..f8763c94 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -466,7 +466,14 @@ proc list_running_cmds {} { button $frame3.b1 -width 16 -text {Terminate selected} -command "kill_running_cmds $lb -15" -bg yellow button $frame3.b2 -width 16 -text {Kill selected} -command "kill_running_cmds $lb -9" -bg red button $frame3.b3 -width 16 -text {View status} -command "view_process_status $lb" -bg PaleGreen - button $frame3.b4 -width 16 -text {Dismiss} -command "destroy $top" -bg PaleGreen + button $frame3.b4 -width 16 -text {Dismiss} -bg PaleGreen -command " + if {\[winfo exists .pstat\]} { + after cancel [list update_process_status $lb] + destroy .pstat + } + destroy $top + + " pack $frame3.b1 $frame3.b2 $frame3.b3 $frame3.b4 -side left -fill x -expand 1 pack $frame1 -fill x -expand 0 diff --git a/xschem_library/ngspice/autozero_comp.sch b/xschem_library/ngspice/autozero_comp.sch index 95df3af4..d6171aa6 100644 --- a/xschem_library/ngspice/autozero_comp.sch +++ b/xschem_library/ngspice/autozero_comp.sch @@ -127,6 +127,7 @@ Output on SAOUT Gaussian Threshold variation (via delvto parameter) is added to all MOS transistors.} 1110 -240 0 0 0.6 0.6 {} T {.param ABSVAR=0.05 delvto='agauss(0,ABSVAR,3)'} 1390 -120 0 0 0.6 0.6 {layer=8} +T {tcleval(Dataset=\\n[xschem getprop rect 2 0 dataset])} 340 -850 0 0 0.7 0.7 {floater=xxx} N 120 -470 120 -450 {lab=TEMPERAT} N 360 -530 390 -530 {lab=VSS} N 360 -500 360 -480 {lab=VSS}