added command <Alt-b> (menu Symbol->Show only instance Bounding boxes) to toggle displaying instance detals / only bounding box.

This commit is contained in:
Stefan Schippers 2020-09-05 00:58:56 +02:00
parent 461e2eae97
commit 8626a8a11b
8 changed files with 83 additions and 54 deletions

View File

@ -105,6 +105,7 @@ ctrl 'a' Select all
shift 'A' Toggle show netlist shift 'A' Toggle show netlist
- 'b' Merge file - 'b' Merge file
ctrl 'b' Toggle show text in symbol ctrl 'b' Toggle show text in symbol
alt 'b' Toggle show symbol details / only bounding boxes
- 'c' Copy selected obj. - 'c' Copy selected obj.
ctrl 'c' Save to clipboard ctrl 'c' Save to clipboard
shift 'C' Start arc placement shift 'C' Start arc placement

View File

@ -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 */ merge_file(0, ""); /* 2nd parameter not used any more for merge 25122002 */
break; 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 */ if(key=='B' && state==ShiftMask) /* delete files */
{ {

View File

@ -459,6 +459,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
register int j; register int j;
register double x0,y0,x1,y1,x2,y2; register double x0,y0,x1,y1,x2,y2;
int flip; int flip;
int hide = 0;
Line line; Line line;
Box box; Box box;
xArc arc; 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 #ifdef HAS_CAIRO
char *textfont; char *textfont;
#endif #endif
if(inst_ptr[n].ptr == -1) return; if(inst_ptr[n].ptr == -1) return;
if( (layer != PINLAYER && !enable_layer[layer]) ) return; if( (layer != PINLAYER && !enable_layer[layer]) ) return;
if(!has_x) 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) { if(layer==0) {
x1=X_TO_SCREEN(inst_ptr[n].x1+xoffset); /* 20150729 added xoffset, yoffset */ x1=X_TO_SCREEN(inst_ptr[n].x1+xoffset); /* 20150729 added xoffset, yoffset */
x2=X_TO_SCREEN(inst_ptr[n].x2+xoffset); x2=X_TO_SCREEN(inst_ptr[n].x2+xoffset);
y1=Y_TO_SCREEN(inst_ptr[n].y1+yoffset); y1=Y_TO_SCREEN(inst_ptr[n].y1+yoffset);
y2=Y_TO_SCREEN(inst_ptr[n].y2+yoffset); y2=Y_TO_SCREEN(inst_ptr[n].y2+yoffset);
if(!only_probes && (x2-x1)< 0.3 && (y2-y1)< 0.3) { if(!only_probes && (x2-x1)< 0.3 && (y2-y1)< 0.3) {
inst_ptr[n].flags|=1; inst_ptr[n].flags|=1;
return; /* 20171210 */ return; /* 20171210 */
@ -492,13 +499,10 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
} }
else inst_ptr[n].flags&=~1; else inst_ptr[n].flags&=~1;
/* following code handles different text color for labels/pins 06112002 */
} else if(inst_ptr[n].flags&1) { } else if(inst_ptr[n].flags&1) {
dbg(2, "draw_symbol(): skipping inst %d\n", n); dbg(2, "draw_symbol(): skipping inst %d\n", n);
return; return;
} }
flip = inst_ptr[n].flip; flip = inst_ptr[n].flip;
if(tmp_flip) flip = !flip; if(tmp_flip) flip = !flip;
rot = (inst_ptr[n].rot + rot ) & 0x3; rot = (inst_ptr[n].rot + rot ) & 0x3;
@ -506,6 +510,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
x0=inst_ptr[n].x0 + xoffset; x0=inst_ptr[n].x0 + xoffset;
y0=inst_ptr[n].y0 + yoffset; y0=inst_ptr[n].y0 + yoffset;
symptr = (inst_ptr[n].ptr+instdef); symptr = (inst_ptr[n].ptr+instdef);
if(!hide) {
for(j=0;j< symptr->lines[layer];j++) for(j=0;j< symptr->lines[layer];j++)
{ {
line = (symptr->lineptr[layer])[j]; line = (symptr->lineptr[layer])[j];
@ -555,6 +560,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, box.dash); drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, box.dash);
filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2); filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2);
} }
} /*if (!hide) */
if( (layer==TEXTWIRELAYER && !(inst_ptr[n].flags&2) ) || if( (layer==TEXTWIRELAYER && !(inst_ptr[n].flags&2) ) ||
(sym_txt && (layer==TEXTLAYER) && (inst_ptr[n].flags&2) ) ) { (sym_txt && (layer==TEXTLAYER) && (inst_ptr[n].flags&2) ) ) {
const char *txtptr; 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]; text = symptr->txtptr[j];
if(text.xscale*FONTWIDTH*mooz<1) continue; 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); txtptr= translate(n, text.txt_ptr);
ROTATION(0.0,0.0,text.x0,text.y0,x1,y1); ROTATION(0.0,0.0,text.x0,text.y0,x1,y1);

View File

@ -269,6 +269,7 @@ struct instentry *insttable[NBOXES][NBOXES];
size_t get_tok_value_size; size_t get_tok_value_size;
size_t get_tok_size; size_t get_tok_size;
int batch_mode = 0; /* no tcl console if set; batch mode */ 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 #ifdef HAS_CAIRO
cairo_surface_t *sfc, *save_sfc; cairo_surface_t *sfc, *save_sfc;

View File

@ -64,6 +64,7 @@ ctrl 'a' Select all
shift 'A' Toggle show netlist shift 'A' Toggle show netlist
- 'b' Merge file - 'b' Merge file
ctrl 'b' Toggle show text in symbol ctrl 'b' Toggle show text in symbol
alt 'b' Toggle show symbol details / only bounding boxes
shift 'B' Delete files shift 'B' Delete files
- 'c' Copy selected obj. - 'c' Copy selected obj.
ctrl 'c' Save to clipboard ctrl 'c' Save to clipboard

View File

@ -1828,6 +1828,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
int s = atoi(argv[3]); int s = atoi(argv[3]);
no_draw=s; 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 */ else if(!strcmp(argv[2],"user_top_netl_name")) { /* 20171204 */
my_strncpy(user_top_netl_name, argv[3], S(user_top_netl_name)); my_strncpy(user_top_netl_name, argv[3], S(user_top_netl_name));
} }

View File

@ -679,6 +679,8 @@ extern struct instentry *insttable[NBOXES][NBOXES];
extern size_t get_tok_value_size; extern size_t get_tok_value_size;
extern size_t get_tok_size; extern size_t get_tok_size;
extern int batch_mode; /* no TCL console */ extern int batch_mode; /* no TCL console */
extern int hide_symbols; /* draw only a bounding box for component instances and @symname, @name texts */
/* functions */ /* functions */
extern void dbg(int level, char *fmt, ...); extern void dbg(int level, char *fmt, ...);
extern void here(void); extern void here(void);

View File

@ -3059,6 +3059,8 @@ set_ne computerfarm {} ;# 20151007
# set a port number in xschemrc if you want accept remote connections. # set a port number in xschemrc if you want accept remote connections.
set_ne xschem_listen_port {} set_ne xschem_listen_port {}
# hide instance details (show only bbox)
set_ne hide_symbols 0
# gaw tcp {host port} # gaw tcp {host port}
set_ne gaw_tcp_address {localhost 2020} 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 -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.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 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 "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 .menubar.sym.menu add command -label "Attach pins to component instance" -command "xschem attach_pins" -accelerator Shift+H