flat_netlist and only_probes moved into xctx struct

This commit is contained in:
Stefan Frederik 2021-11-17 23:12:17 +01:00
parent daf90b0645
commit eecc81437c
9 changed files with 35 additions and 32 deletions

View File

@ -203,8 +203,8 @@ void toggle_only_probes()
{
static double save_lw;
only_probes = tclgetboolvar("only_probes");
if(only_probes) {
xctx->only_probes = tclgetboolvar("only_probes");
if(xctx->only_probes) {
save_lw = xctx->lw;
xctx->lw=3.0;
} else {

View File

@ -677,8 +677,8 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
break;
}
if(key=='5' && state == 0) { /* 20110112 display only probes */
only_probes = !only_probes;
tclsetboolvar("only_probes", only_probes);
xctx->only_probes = !xctx->only_probes;
tclsetboolvar("only_probes", xctx->only_probes);
toggle_only_probes();
break;
} /* /20110112 */
@ -1363,8 +1363,8 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key==':') /* toggle flat netlist (only spice) */
{
flat_netlist = !flat_netlist;
if(flat_netlist) {
xctx->flat_netlist = !xctx->flat_netlist;
if(xctx->flat_netlist) {
tcleval("alert_ { enabling flat netlist} {}");
tclsetvar("flat_netlist","1");
}

View File

@ -394,7 +394,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
xctx->inst[n].flags|=1; /* ... then SKIP instance now and for following layers */
return;
}
else if(!only_probes && (xctx->inst[n].x2 - xctx->inst[n].x1) * xctx->mooz < 3 &&
else if(!xctx->only_probes && (xctx->inst[n].x2 - xctx->inst[n].x1) * xctx->mooz < 3 &&
(xctx->inst[n].y2 - xctx->inst[n].y1) * xctx->mooz < 3) {
drawrect(4, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 0);
xctx->inst[n].flags|=1;
@ -564,7 +564,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
xctx->inst[n].flags|=1;
return;
}
else if(!only_probes && (xctx->inst[n].x2 - xctx->inst[n].x1) * xctx->mooz < 3 &&
else if(!xctx->only_probes && (xctx->inst[n].x2 - xctx->inst[n].x1) * xctx->mooz < 3 &&
(xctx->inst[n].y2 - xctx->inst[n].y1) * xctx->mooz < 3) {
drawtemprect(gc, what, xctx->inst[n].xx1 + xoffset, xctx->inst[n].yy1 + yoffset,
xctx->inst[n].xx2 + xoffset, xctx->inst[n].yy2 + yoffset);
@ -763,7 +763,7 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub
y1=Y_TO_SCREEN(liney1);
x2=X_TO_SCREEN(linex2);
y2=Y_TO_SCREEN(liney2);
/* if(!only_probes && (x2-x1)< 3.0 && fabs(y2-y1) < 3.0) return; */
/* if(!xctx->only_probes && (x2-x1)< 3.0 && fabs(y2-y1) < 3.0) return; */
if( clip(&x1,&y1,&x2,&y2) )
{
rr[i].x1=(short)x1;
@ -779,7 +779,7 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub
y1=Y_TO_SCREEN(liney1);
x2=X_TO_SCREEN(linex2);
y2=Y_TO_SCREEN(liney2);
/* if(!only_probes && (x2-x1)< 3.0 && fabs(y2-y1)< 3.0) return; */
/* if(!xctx->only_probes && (x2-x1)< 3.0 && fabs(y2-y1)< 3.0) return; */
if( clip(&x1,&y1,&x2,&y2) )
{
if(dash) {
@ -802,7 +802,7 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub
y1=Y_TO_SCREEN(liney1);
x2=X_TO_SCREEN(linex2);
y2=Y_TO_SCREEN(liney2);
/* if(!only_probes && (x2-x1)< 3.0 && fabs(y2-y1)< 3.0) return; */
/* if(!xctx->only_probes && (x2-x1)< 3.0 && fabs(y2-y1)< 3.0) return; */
if( clip(&x1,&y1,&x2,&y2) )
{
if(dash) {
@ -1173,7 +1173,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl
y1=Y_TO_SCREEN(recty1);
x2=X_TO_SCREEN(rectx2);
y2=Y_TO_SCREEN(recty2);
if(!only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return;
if(!xctx->only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return;
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
{
if(xctx->draw_window) XFillRectangle(display, xctx->window, xctx->gcstipple[c], (int)x1, (int)y1,
@ -1199,7 +1199,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl
y1=Y_TO_SCREEN(recty1);
x2=X_TO_SCREEN(rectx2);
y2=Y_TO_SCREEN(recty2);
if(!only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return;
if(!xctx->only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return;
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
{
r[i].x=(short)x1;
@ -1303,7 +1303,7 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
if( !rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) {
return;
}
if( !only_probes && (x2-x1)<3.0 && (y2-y1)<3.0) return;
if( !xctx->only_probes && (x2-x1)<3.0 && (y2-y1)<3.0) return;
p = my_malloc(38, sizeof(XPoint) * points);
for(i=0;i<points; i++) {
@ -1373,7 +1373,7 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double
y1=Y_TO_SCREEN(recty1);
x2=X_TO_SCREEN(rectx2);
y2=Y_TO_SCREEN(recty2);
/* if(!only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return; */
/* if(!xctx->only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return; */
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
{
if(dash) {
@ -1409,7 +1409,7 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double
y1=Y_TO_SCREEN(recty1);
x2=X_TO_SCREEN(rectx2);
y2=Y_TO_SCREEN(recty2);
/* if(!only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return; */
/* if(!xctx->only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return; */
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
{
r[i].x=(short)x1;
@ -1511,7 +1511,7 @@ void draw(void)
hash_instances();
hash_wires();
}
if(!only_probes) {
if(!xctx->only_probes) {
struct iterator_ctx ctx;
dbg(3, "draw(): check4\n");
for(c=0;c<cadlayers;c++) {
@ -1630,7 +1630,7 @@ void draw(void)
#endif
}
}
} /* !only_probes, 20110112 */
} /* !xctx->only_probes, 20110112 */
draw_hilight_net(xctx->draw_window);
if(!xctx->draw_window) {
XCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gctiled, xctx->xrect[0].x, xctx->xrect[0].y,

View File

@ -120,10 +120,8 @@ xcb_visualtype_t *visual_xcb;
int cadlayers=0;
int has_x=1;
int rainbow_colors = 0;
int flat_netlist = 0;
char *netlist_dir = NULL;
int color_ps=-1;
int only_probes = 0;
double nocairo_vert_correct=0.0;
/* lift up the text by 'n' pixels (zoom corrected) within the bbox. */
/* This correction is used to better align existing schematics */
@ -179,6 +177,7 @@ char old_winpath[PATH_MAX] = ".drw";
/* Cmdline options (used at xinit, and then not used anymore) */
/* ---------------------------------------------------------- */
int cli_opt_netlist_type = 0;
int cli_opt_flat_netlist = 0;
char cli_opt_plotfile[PATH_MAX] = "";

View File

@ -44,7 +44,7 @@ void check_opt(char *opt, char *optval, int type)
} else if( (type == SHORT && *opt == 'f') || (type == LONG && !strcmp("flat_netlist", opt)) ) {
dbg(1, "process_options(): set flat netlist\n");
flat_netlist=1;
cli_opt_flat_netlist=1;
} else if( (type == SHORT && *opt == 'r') || (type == LONG && !strcmp("no_readline", opt)) ) {
no_readline=1;

View File

@ -554,7 +554,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"flat_netlist")) {
if( flat_netlist != 0 )
if( xctx->flat_netlist != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
@ -2134,7 +2134,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xctx->draw_window=atoi(argv[3]);
}
else if(!strcmp(argv[2],"flat_netlist")) {
flat_netlist=atoi(argv[3]);
xctx->flat_netlist=atoi(argv[3]);
}
else if(!strcmp(argv[2],"hide_symbols")) {
xctx->hide_symbols=atoi(argv[3]);

View File

@ -440,6 +440,7 @@ void alloc_xschem_data(const char *top_path)
xctx->semaphore = 0;
xctx->get_tok_size = 0;
xctx->netlist_name[0] = '\0';
xctx->flat_netlist = 0;
xctx->plotfile[0] = '\0';
xctx->netlist_unconn_cnt = 0; /* unique count of unconnected pins while netlisting */
xctx->current_dirname[0] = '\0';
@ -552,6 +553,7 @@ void alloc_xschem_data(const char *top_path)
xctx->no_undo = 0;
xctx->draw_single_layer = -1;
xctx->draw_dots = 1;
xctx->only_probes = 0;
xctx->no_draw = 0;
xctx->draw_pixmap = 1;
xctx->gc=my_calloc(638, cadlayers, sizeof(GC));
@ -1466,7 +1468,6 @@ int Tcl_AppInit(Tcl_Interp *inter)
cairo_vert_correct = tclgetdoublevar("cairo_vert_correct");
nocairo_vert_correct = tclgetdoublevar("nocairo_vert_correct");
cairo_font_scale = tclgetdoublevar("cairo_font_scale");
only_probes = tclgetdoublevar("only_probes");
/* */
/* [m]allocate dynamic memory */
@ -1481,7 +1482,8 @@ int Tcl_AppInit(Tcl_Interp *inter)
pixmap=my_calloc(636, cadlayers, sizeof(Pixmap));
my_strncpy(xctx->plotfile, cli_opt_plotfile, S(xctx->plotfile));
xctx->draw_window=atoi(tclgetvar("draw_window"));
xctx->draw_window = tclgetintvar("draw_window");
xctx->only_probes = tclgetintvar("only_probes");
/* set global variables fetching data from tcl code */
if(cli_opt_netlist_type) {
@ -1501,8 +1503,10 @@ int Tcl_AppInit(Tcl_Interp *inter)
my_snprintf(tmp, S(tmp), "%d",debug_var);
tclsetvar("debug_var",tmp );
tclsetvar("menu_debug_var",debug_var ? "1" : "0" );
if(flat_netlist) tclsetvar("flat_netlist","1");
if(cli_opt_flat_netlist) {
tclsetvar("flat_netlist","1");
xctx->flat_netlist = 1;
}
xctx->xschem_w = CADWIDTH;
xctx->xschem_h = CADHEIGHT;
xctx->areaw = CADWIDTH+4*INT_WIDTH(xctx->lw); /* clip area extends 1 pixel beyond physical xctx->window area */
@ -1728,7 +1732,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
xctx->pending_fullzoom=1;
if(do_netlist) {
if(debug_var>=1) {
if(flat_netlist)
if(xctx->flat_netlist)
fprintf(errfp, "xschem: flat netlist requested\n");
}
if(!filename) {

View File

@ -567,6 +567,7 @@ typedef struct {
int semaphore;
int get_tok_size;
char netlist_name[PATH_MAX];
int flat_netlist;
char current_dirname[PATH_MAX];
int netlist_unconn_cnt; /* unique count of unconnected pins while netlisting */
struct instpinentry *instpintable[NBOXES][NBOXES];
@ -637,6 +638,7 @@ typedef struct {
int no_undo;
int draw_single_layer;
int draw_dots;
int only_probes;
int no_draw;
int draw_pixmap; /* pixmap used as 2nd buffer */
int netlist_count; /* netlist counter incremented at any cell being netlisted */
@ -755,10 +757,8 @@ extern xcb_visualtype_t *visual_xcb;
extern int cadlayers;
extern int has_x;
extern int rainbow_colors;
extern int flat_netlist;
extern char *netlist_dir;
extern int color_ps;
extern int only_probes;
extern double nocairo_vert_correct;
extern double cairo_vert_correct;
extern int constrained_move;
@ -800,6 +800,7 @@ extern char old_winpath[PATH_MAX]; /* previous focused schematic window (used to
/*********** Cmdline options (used at xinit, and then not used anymore) ***********/
extern int cli_opt_netlist_type;
extern int cli_opt_flat_netlist;
extern char cli_opt_plotfile[PATH_MAX];
/*********** Following data is relative to the current schematic ***********/

View File

@ -3650,8 +3650,7 @@ proc save_ctx {context} {
proc housekeeping_ctx {} {
uplevel #0 {
# puts housekeeping_ctx
xschem set flat_netlist $flat_netlist
# puts housekeeping_ctx
}
}