set_modify() returns now # of floaters, use this info to redraw all viewport in `xschn setprop` commands

This commit is contained in:
Stefan Schippers 2023-10-29 20:02:23 +01:00
parent d776d6a351
commit 958c5a1525
3 changed files with 18 additions and 12 deletions

View File

@ -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()

View File

@ -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);
}

View File

@ -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);