From 958c5a1525c68647e458f6b1eb3f4f2da823091b Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Sun, 29 Oct 2023 20:02:23 +0100 Subject: [PATCH] set_modify() returns now # of floaters, use this info to redraw all viewport in `xschn setprop` commands --- src/actions.c | 6 ++++-- src/scheduler.c | 22 +++++++++++++--------- src/xschem.h | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/actions.c b/src/actions.c index 99c2cba6..e5712d06 100644 --- a/src/actions.c +++ b/src/actions.c @@ -136,8 +136,9 @@ const char *get_text_floater(int i) /* mod=-1 used to force set title * mod=-2 used to reset floaters cache * if floaters are present set_modify(1) (after a modify opration) must be done before draw() - * to invalidate cached floater string values before redrawing*/ -void set_modify(int mod) + * to invalidate cached floater string values before redrawing + * return 1 if floaters are found (mod==-2 or mod == 1 or mod == -1) */ +int set_modify(int mod) { int i, floaters = 0; @@ -169,6 +170,7 @@ void set_modify(int mod) if(xctx->modified) tcleval("set_tab_names *"); else tcleval("set_tab_names"); } + return floaters; } void print_version() diff --git a/src/scheduler.c b/src/scheduler.c index a6755adc..781459be 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -4179,12 +4179,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg return TCL_ERROR; } else { char *type; - int cond; + int floaters = 0, cond; char *subst = NULL; + floaters = set_modify(1); if(!fast) { - bbox(START,0.0,0.0,0.0,0.0); + if(!floaters) bbox(START,0.0,0.0,0.0,0.0); symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2); - bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2); + if(!floaters) + bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2); xctx->push_undo(); } xctx->prep_hash_inst=0; @@ -4209,16 +4211,18 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg my_strdup2(_ALLOC_ID_, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0)); } else xctx->inst[inst].flags &= ~PIN_OR_LABEL; - - set_modify(1); if(!fast) { /* new symbol bbox after prop changes (may change due to text length) */ symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2); - bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2); - /* redraw symbol with new props */ - bbox(SET,0.0,0.0,0.0,0.0); + if(!floaters) { + bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2); + /* redraw symbol with new props */ + bbox(SET,0.0,0.0,0.0,0.0); + } draw(); - bbox(END,0.0,0.0,0.0,0.0); + if(!floaters) { + bbox(END,0.0,0.0,0.0,0.0); + } } Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE); } diff --git a/src/xschem.h b/src/xschem.h index 24441a04..03ea6f8c 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -1229,7 +1229,7 @@ extern void enable_layers(void); extern void set_snap(double); extern void set_grid(double); extern void create_plot_cmd(void); -extern void set_modify(int mod); +extern int set_modify(int mod); /* return number of floaters */ extern int there_are_floaters(void); extern void dbg(int level, char *fmt, ...); extern unsigned int hash_file(const char *f, int skip_path_lines);