diff --git a/doc/xschem_man/commands.html b/doc/xschem_man/commands.html index ec80bfef..99a486dc 100644 --- a/doc/xschem_man/commands.html +++ b/doc/xschem_man/commands.html @@ -105,6 +105,7 @@ ctrl 'a' Select all shift 'A' Toggle show netlist - 'b' Merge file ctrl 'b' Toggle show text in symbol +alt 'b' Toggle show symbol details / only bounding boxes - 'c' Copy selected obj. ctrl 'c' Save to clipboard shift 'C' Start arc placement diff --git a/src/callback.c b/src/callback.c index c045cf0d..2b308c61 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1283,6 +1283,15 @@ int callback(int event, int mx, int my, KeySym key, merge_file(0, ""); /* 2nd parameter not used any more for merge 25122002 */ break; } + if(key=='b' && state==Mod1Mask) /* hide/show instance details */ + { + if(semaphore >= 2) break; + hide_symbols = !hide_symbols; + if(hide_symbols) tclsetvar("hide_symbols", "1"); + else tclsetvar("hide_symbols", "0"); + draw(); + break; + } if(key=='B' && state==ShiftMask) /* delete files */ { diff --git a/src/draw.c b/src/draw.c index e46ba6c8..a6393604 100644 --- a/src/draw.c +++ b/src/draw.c @@ -459,6 +459,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, register int j; register double x0,y0,x1,y1,x2,y2; int flip; + int hide = 0; Line line; Box box; xArc arc; @@ -470,17 +471,23 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, #ifdef HAS_CAIRO char *textfont; #endif - if(inst_ptr[n].ptr == -1) return; if( (layer != PINLAYER && !enable_layer[layer]) ) return; if(!has_x) return; + if(hide_symbols && (inst_ptr[n].ptr+instdef)->prop_ptr && + !strcmp(get_tok_value( (inst_ptr[n].ptr+instdef)->prop_ptr, "type",0 ), "subcircuit") ) { + hide = 1; + } else { + hide = 0; + } + if(hide && layer == 0) { + drawrect(PINLAYER, what, inst_ptr[n].xx1, inst_ptr[n].yy1, inst_ptr[n].xx2, inst_ptr[n].yy2, 2); + } if(layer==0) { x1=X_TO_SCREEN(inst_ptr[n].x1+xoffset); /* 20150729 added xoffset, yoffset */ x2=X_TO_SCREEN(inst_ptr[n].x2+xoffset); y1=Y_TO_SCREEN(inst_ptr[n].y1+yoffset); y2=Y_TO_SCREEN(inst_ptr[n].y2+yoffset); - - if(!only_probes && (x2-x1)< 0.3 && (y2-y1)< 0.3) { inst_ptr[n].flags|=1; return; /* 20171210 */ @@ -491,70 +498,69 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, return; } else inst_ptr[n].flags&=~1; - - /* following code handles different text color for labels/pins 06112002 */ - + } else if(inst_ptr[n].flags&1) { dbg(2, "draw_symbol(): skipping inst %d\n", n); return; } - flip = inst_ptr[n].flip; if(tmp_flip) flip = !flip; rot = (inst_ptr[n].rot + rot ) & 0x3; - + x0=inst_ptr[n].x0 + xoffset; y0=inst_ptr[n].y0 + yoffset; symptr = (inst_ptr[n].ptr+instdef); - for(j=0;j< symptr->lines[layer];j++) - { - line = (symptr->lineptr[layer])[j]; - ROTATION(0.0,0.0,line.x1,line.y1,x1,y1); - ROTATION(0.0,0.0,line.x2,line.y2,x2,y2); - ORDER(x1,y1,x2,y2); - drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2, line.dash); - } - for(j=0;j< symptr->polygons[layer];j++) /* 20171115 */ - { - polygon = (symptr->polygonptr[layer])[j]; - { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ - int k; - double *x = my_malloc(34, sizeof(double) * polygon.points); - double *y = my_malloc(35, sizeof(double) * polygon.points); - for(k=0;klines[layer];j++) + { + line = (symptr->lineptr[layer])[j]; + ROTATION(0.0,0.0,line.x1,line.y1,x1,y1); + ROTATION(0.0,0.0,line.x2,line.y2,x2,y2); + ORDER(x1,y1,x2,y2); + drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2, line.dash); + } + for(j=0;j< symptr->polygons[layer];j++) /* 20171115 */ + { + polygon = (symptr->polygonptr[layer])[j]; + { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ + int k; + double *x = my_malloc(34, sizeof(double) * polygon.points); + double *y = my_malloc(35, sizeof(double) * polygon.points); + for(k=0;karcs[layer];j++) - { - - arc = (symptr->arcptr[layer])[j]; - if(flip) { - angle = 270.*rot+180.-arc.b-arc.a; - } else { - angle = arc.a+rot*270.; + for(j=0;j< symptr->arcs[layer];j++) + { + + arc = (symptr->arcptr[layer])[j]; + if(flip) { + angle = 270.*rot+180.-arc.b-arc.a; + } else { + angle = arc.a+rot*270.; + } + angle = fmod(angle, 360.); + if(angle<0.) angle+=360.; + ROTATION(0.0,0.0,arc.x,arc.y,x1,y1); + drawarc(c,what, x0+x1, y0+y1, arc.r, angle, arc.b, arc.fill, arc.dash); } - angle = fmod(angle, 360.); - if(angle<0.) angle+=360.; - ROTATION(0.0,0.0,arc.x,arc.y,x1,y1); - drawarc(c,what, x0+x1, y0+y1, arc.r, angle, arc.b, arc.fill, arc.dash); - } - - if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< symptr->rects[layer];j++) - { - box = (symptr->boxptr[layer])[j]; - ROTATION(0.0,0.0,box.x1,box.y1,x1,y1); - ROTATION(0.0,0.0,box.x2,box.y2,x2,y2); - RECTORDER(x1,y1,x2,y2); - drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, box.dash); - filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2); - } + + if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< symptr->rects[layer];j++) + { + box = (symptr->boxptr[layer])[j]; + ROTATION(0.0,0.0,box.x1,box.y1,x1,y1); + ROTATION(0.0,0.0,box.x2,box.y2,x2,y2); + RECTORDER(x1,y1,x2,y2); + drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, box.dash); + filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2); + } + } /*if (!hide) */ if( (layer==TEXTWIRELAYER && !(inst_ptr[n].flags&2) ) || (sym_txt && (layer==TEXTLAYER) && (inst_ptr[n].flags&2) ) ) { const char *txtptr; @@ -562,6 +568,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, { text = symptr->txtptr[j]; if(text.xscale*FONTWIDTH*mooz<1) continue; + if( hide && text.txt_ptr && strcmp(text.txt_ptr, "@symname") && strcmp(text.txt_ptr, "@name") ) continue; txtptr= translate(n, text.txt_ptr); ROTATION(0.0,0.0,text.x0,text.y0,x1,y1); diff --git a/src/globals.c b/src/globals.c index a4783ef5..798a5f5f 100644 --- a/src/globals.c +++ b/src/globals.c @@ -269,6 +269,7 @@ struct instentry *insttable[NBOXES][NBOXES]; size_t get_tok_value_size; size_t get_tok_size; int batch_mode = 0; /* no tcl console if set; batch mode */ +int hide_symbols = 0; /* draw only a bounding box for component instances and @symname, @name texts */ #ifdef HAS_CAIRO cairo_surface_t *sfc, *save_sfc; diff --git a/src/keys.help b/src/keys.help index e8a0db47..b50362b7 100644 --- a/src/keys.help +++ b/src/keys.help @@ -64,6 +64,7 @@ ctrl 'a' Select all shift 'A' Toggle show netlist - 'b' Merge file ctrl 'b' Toggle show text in symbol +alt 'b' Toggle show symbol details / only bounding boxes shift 'B' Delete files - 'c' Copy selected obj. ctrl 'c' Save to clipboard diff --git a/src/scheduler.c b/src/scheduler.c index 1fef5f26..6311768a 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1828,6 +1828,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg int s = atoi(argv[3]); no_draw=s; } + else if(!strcmp(argv[2],"hide_symbols")) { /* 20171204 */ + int s = atoi(argv[3]); + hide_symbols=s; + } else if(!strcmp(argv[2],"user_top_netl_name")) { /* 20171204 */ my_strncpy(user_top_netl_name, argv[3], S(user_top_netl_name)); } diff --git a/src/xschem.h b/src/xschem.h index a9a001a8..9c7adfb6 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -679,6 +679,8 @@ extern struct instentry *insttable[NBOXES][NBOXES]; extern size_t get_tok_value_size; extern size_t get_tok_size; extern int batch_mode; /* no TCL console */ +extern int hide_symbols; /* draw only a bounding box for component instances and @symname, @name texts */ + /* functions */ extern void dbg(int level, char *fmt, ...); extern void here(void); diff --git a/src/xschem.tcl b/src/xschem.tcl index 7223b022..a7250dbc 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3059,6 +3059,8 @@ set_ne computerfarm {} ;# 20151007 # set a port number in xschemrc if you want accept remote connections. set_ne xschem_listen_port {} +# hide instance details (show only bbox) +set_ne hide_symbols 0 # gaw tcp {host port} set_ne gaw_tcp_address {localhost 2020} @@ -3571,6 +3573,8 @@ font configure Underline-Font -underline true -size 24 .menubar.prop.menu add command -label "View" -command "xschem view_prop" -accelerator Ctrl+Q .menubar.prop.menu add command -background red -label "Edit file (danger!)" -command "xschem edit_file" -accelerator Alt+Q + .menubar.sym.menu add checkbutton -label "Show only instance Bounding boxes" -variable hide_symbols \ + -command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B .menubar.sym.menu add command -label "Make symbol from schematic" -command "xschem make_symbol" -accelerator A .menubar.sym.menu add command -label "Make schematic from symbol" -command "xschem make_sch" -accelerator Ctrl+L .menubar.sym.menu add command -label "Attach pins to component instance" -command "xschem attach_pins" -accelerator Shift+H