removed a whole bunch of global UI-related variables and tcl/C redundancies

This commit is contained in:
Stefan Frederik 2021-11-10 13:43:08 +01:00
parent c3c1b39cb5
commit 59198f2dda
24 changed files with 489 additions and 670 deletions

View File

@ -108,41 +108,41 @@ void print_version()
void set_snap(double newsnap) /* 20161212 set new snap factor and just notify new value */
{
char str[256];
static double default_snap = -1.0;
int cs;
cs = tclgetdoublevar("cadsnap");
if(default_snap == -1.0) {
default_snap = atof(tclgetvar("cadsnap"));
default_snap = cs;
if(default_snap==0.0) default_snap = CADSNAP;
}
cadsnap = newsnap ? newsnap : default_snap;
sprintf(str, "%.16g", cadsnap);
if(cadsnap == default_snap) {
cs = newsnap ? newsnap : default_snap;
if(cs == default_snap) {
tcleval(".statusbar.3 configure -background PaleGreen");
} else {
tcleval(".statusbar.3 configure -background OrangeRed");
}
tclsetvar("cadsnap", str);
tclsetdoublevar("cadsnap", cs);
}
void set_grid(double newgrid)
{
char str[256];
static double default_grid = -1.0;
double cg;
cg = tclgetdoublevar("cadgrid");
if(default_grid == -1.0) {
default_grid = atof(tclgetvar("cadgrid"));
default_grid = cg;
if(default_grid==0.0) default_grid = CADGRID;
}
cadgrid = newgrid ? newgrid : default_grid;
sprintf(str, "%.16g", cadgrid);
dbg(1, "set_grid(): default_grid = %.16g, cadgrid=%.16g\n", default_grid, cadgrid);
if(cadgrid == default_grid) {
cg = newgrid ? newgrid : default_grid;
dbg(1, "set_grid(): default_grid = %.16g, cadgrid=%.16g\n", default_grid, cg);
if(cg == default_grid) {
tcleval(".statusbar.5 configure -background PaleGreen");
} else {
tcleval(".statusbar.5 configure -background OrangeRed");
}
tclsetvar("cadgrid", str);
tclsetdoublevar("cadgrid", cg);
}
int set_netlist_dir(int force, char *dir)
@ -199,19 +199,14 @@ const char *add_ext(const char *f, const char *ext)
void toggle_only_probes()
{
static double save_lw;
if(!only_probes) {
only_probes = tclgetboolvar("only_probes");
if(only_probes) {
save_lw = xctx->lw;
xctx->lw=3.0;
} else {
xctx->lw= save_lw;
}
only_probes =!only_probes;
if(only_probes) {
tclsetvar("only_probes","1");
}
else {
tclsetvar("only_probes","0");
}
change_linewidth(xctx->lw);
draw();
}
@ -226,7 +221,7 @@ void toggle_fullscreen(const char *topwin)
Window rootwindow, parent_id;
Window *framewin_child_ptr;
unsigned int framewindow_nchildren;
int fs;
if(!strcmp(topwin, ".drw")) {
@ -243,27 +238,27 @@ void toggle_fullscreen(const char *topwin)
XQueryTree(display, topwin_id, &rootwindow, &parent_id, &framewin_child_ptr, &framewindow_nchildren);
fullscreen = (fullscreen+1)%2;
if(fullscreen==1) tclsetvar("fullscreen","1");
else if(fullscreen==2) tclsetvar("fullscreen","2");
fs = tclgetintvar("fullscreen");
fs = (fs+1)%2;
if(fs==1) tclsetvar("fullscreen","1");
else if(fs==2) tclsetvar("fullscreen","2");
else tclsetvar("fullscreen","0");
dbg(1, "toggle_fullscreen(): fullscreen=%d\n", fullscreen);
if(fullscreen==2) {
dbg(1, "toggle_fullscreen(): fullscreen=%d\n", fs);
if(fs==2) {
Tcl_VarEval(interp, "pack forget ", mytopwin, ".menubar ", mytopwin, ".statusbar; update", NULL);
menu_removed = 1;
}
if(fullscreen !=2 && menu_removed) {
if(fs !=2 && menu_removed) {
Tcl_VarEval(interp, "pack ", mytopwin, ".menubar -anchor n -side top -fill x -before ", mytopwin, ".drw\n\
pack ", mytopwin, ".statusbar -after ", mytopwin, ".drw -anchor sw -fill x; update", NULL);
menu_removed=0;
}
if(fullscreen == 1) {
if(fs == 1) {
window_state(display , parent_id,fullscr);
} else if(fullscreen == 2) {
} else if(fs == 2) {
window_state(display , parent_id,normal);
window_state(display , parent_id,fullscr);
} else {
@ -885,7 +880,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot
dbg(1, "place_symbol() :all inst_ptr members set\n"); /* 03-02-2000 */
if(first_call) hash_all_names(n);
if(inst_props) {
new_prop_string(n, inst_props,!first_call, disable_unique_names); /* 20171214 first_call */
new_prop_string(n, inst_props,!first_call, tclgetboolvar("disable_unique_names")); /* 20171214 first_call */
}
else {
set_inst_prop(n); /* no props, get from sym template, also calls new_prop_string() */
@ -1361,7 +1356,7 @@ void zoom_full(int dr, int sel, int flags, double shrink)
double bboxw, bboxh, schw, schh;
if(flags & 1) {
if(change_lw) {
if(tclgetboolvar("change_lw")) {
xctx->lw = 1.;
}
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
@ -1381,7 +1376,7 @@ void zoom_full(int dr, int sel, int flags, double shrink)
if(yzoom > xctx->zoom) xctx->zoom = yzoom;
xctx->zoom /= shrink;
/* we do this here since change_linewidth may not be called if flags & 1 == 0*/
cadhalfdotsize = CADHALFDOTSIZE + 0.04 * (cadsnap-10);
cadhalfdotsize = CADHALFDOTSIZE + 0.04 * (tclgetdoublevar("cadsnap")-10);
xctx->mooz = 1 / xctx->zoom;
if(flags & 2) {
@ -1424,7 +1419,7 @@ void view_unzoom(double z)
xctx->mooz=1/xctx->zoom;
/* 20181022 make unzoom and zoom symmetric */
/* keeping the mouse pointer as the origin */
if(unzoom_nodrift) {
if(tclgetboolvar("unzoom_nodrift")) {
xctx->xorigin=-xctx->mousex_snap+(xctx->mousex_snap+xctx->xorigin)*factor;
xctx->yorigin=-xctx->mousey_snap+(xctx->mousey_snap+xctx->yorigin)*factor;
} else {
@ -1630,6 +1625,8 @@ void restore_selection(double x1, double y1, double x2, double y2)
void new_wire(int what, double mx_snap, double my_snap)
{
int big = xctx->wires> 2000 || xctx->instances > 2000 ;
int s_pnetname;
s_pnetname = tclgetboolvar("show_pin_net_names");
if( (what & PLACE) ) {
if( (xctx->ui_state & STARTWIRE) && (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) ) {
push_undo();
@ -1676,12 +1673,12 @@ void new_wire(int what, double mx_snap, double my_snap)
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0);
}
xctx->prep_hi_structs = 0;
if(autotrim_wires) trim_wires();
if(show_pin_net_names || xctx->hilight_nets) {
if(tclgetboolvar("autotrim_wires")) trim_wires();
if(s_pnetname || xctx->hilight_nets) {
prepare_netlist_structs(0);
if(!big) {
bbox(START , 0.0 , 0.0 , 0.0 , 0.0);
if(show_pin_net_names || xctx->hilight_nets) {
if(s_pnetname || xctx->hilight_nets) {
int_hash_lookup(xctx->node_redraw_table, xctx->wire[xctx->wires-1].node, 0, XINSERT_NOREPLACE);
find_inst_to_be_redrawn();
}
@ -2119,7 +2116,7 @@ int text_bbox(const char *str, double xscale, double yscale,
cairo_text_extents_t ext;
cairo_font_extents_t fext;
double ww, hh, maxw;
/* will not match exactly font metrics when doing ps/svg output , but better than nothing */
if(!has_x) return text_bbox_nocairo(str, xscale, yscale, rot, flip, hcenter, vcenter, x1, y1,
rx1, ry1, rx2, ry2, cairo_lines, cairo_longest_line);
@ -2158,7 +2155,7 @@ int text_bbox(const char *str, double xscale, double yscale,
if(maxw > ww) ww= maxw;
}
my_free(1159, &s);
hh = hh*fext.height*cairo_font_line_spacing;
hh = hh*fext.height * cairo_font_line_spacing;
*cairo_longest_line = ww;
*rx1=x1;*ry1=y1;
@ -2205,7 +2202,7 @@ int text_bbox(const char *str,double xscale, double yscale,
{
register int c=0, length =0;
double w, h;
w=0;h=1;
*cairo_lines = 1;
if(str!=NULL) while( str[c] )
@ -2215,9 +2212,9 @@ int text_bbox(const char *str,double xscale, double yscale,
if(length > w)
w = length;
}
w *= (FONTWIDTH+FONTWHITESPACE)*xscale*nocairo_font_xscale;
w *= (FONTWIDTH+FONTWHITESPACE)*xscale* tclgetdoublevar("nocairo_font_xscale");
*cairo_longest_line = w;
h *= (FONTHEIGHT+FONTDESCENT+FONTWHITESPACE)*yscale*nocairo_font_yscale;
h *= (FONTHEIGHT+FONTDESCENT+FONTWHITESPACE)*yscale* tclgetdoublevar("nocairo_font_yscale");
*rx1=x1;*ry1=y1;
if( rot==0) *ry1-=nocairo_vert_correct;
else if(rot==1) *rx1+=nocairo_vert_correct;
@ -2260,7 +2257,7 @@ int place_text(int draw_text, double mx, double my)
int save_draw;
xText *t = &xctx->text[xctx->texts];
#if HAS_CAIRO==1
char *textfont;
const char *textfont;
#endif
tclsetvar("props","");
@ -2318,7 +2315,7 @@ int place_text(int draw_text, double mx, double my)
if((textfont && textfont[0]) || t->flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (t->font && t->font[0]) ? t->font : cairo_font_name;
textfont = (t->font && t->font[0]) ? t->font : tclgetvar("cairo_font_name");
weight = ( t->flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(t->flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;

View File

@ -144,17 +144,18 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
char str[PATH_MAX + 100]; /* overflow safe 20161122 */
struct stat buf;
unsigned short sel;
int c_snap;
#ifndef __unix__
short cstate = GetKeyState(VK_CAPITAL);
short nstate = GetKeyState(VK_NUMLOCK);
short cstate = GetKeyState(VK_CAPITAL);
short nstate = GetKeyState(VK_NUMLOCK);
if(cstate & 0x0001) { /* caps lock */
tcleval(".statusbar.8 configure -state active -text {CAPS LOCK SET! }");
} else if (nstate & 0x0001) { /* num lock */
tcleval(".statusbar.8 configure -state active -text {NUM LOCK SET! }");
} else { /* normal state */
tcleval(".statusbar.8 configure -state normal -text {}");
}
if(cstate & 0x0001) { /* caps lock */
tcleval(".statusbar.8 configure -state active -text {CAPS LOCK SET! }");
} else if (nstate & 0x0001) { /* num lock */
tcleval(".statusbar.8 configure -state active -text {NUM LOCK SET! }");
} else { /* normal state */
tcleval(".statusbar.8 configure -state normal -text {}");
}
#else
XKeyboardState kbdstate;
XGetKeyboardControl(display, &kbdstate);
@ -167,6 +168,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
tcleval(".statusbar.8 configure -state normal -text {}");
}
#endif
c_snap = tclgetdoublevar("cadsnap");
state &=~Mod2Mask; /* 20170511 filter out NumLock status */
if(xctx->semaphore)
{
@ -184,8 +186,8 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
xctx->semaphore++; /* used to debug Tcl-Tk frontend */
xctx->mousex=X_TO_XSCHEM(mx);
xctx->mousey=Y_TO_XSCHEM(my);
xctx->mousex_snap=ROUND(xctx->mousex / cadsnap) * cadsnap;
xctx->mousey_snap=ROUND(xctx->mousey / cadsnap) * cadsnap;
xctx->mousex_snap=ROUND(xctx->mousex / c_snap) * c_snap;
xctx->mousey_snap=ROUND(xctx->mousey / c_snap) * c_snap;
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s",
xctx->mousex_snap, xctx->mousey_snap, xctx->lastsel, xctx->sch_path[xctx->currsch] );
statusmsg(str,1);
@ -354,8 +356,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key == '_' ) /* toggle change line width */
{
change_lw =!change_lw;
if(change_lw) {
if(!tclgetboolvar("change_lw")) {
tcleval("alert_ { enabling change line width} {}");
tclsetvar("change_lw","1");
}
@ -382,8 +383,10 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key == '%' ) /* toggle draw grid */
{
draw_grid =!draw_grid;
if(draw_grid) {
int dr_gr;
dr_gr = tclgetboolvar("draw_grid");
dr_gr =!dr_gr;
if(dr_gr) {
/* tcleval("alert_ { enabling draw grid} {}"); */
tclsetvar("draw_grid","1");
draw();
@ -559,8 +562,8 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(xctx->semaphore >= 2) break;
if(!(xctx->ui_state & STARTWIRE)){
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
xctx->mx_double_save = ROUND(x / cadsnap) * cadsnap;
xctx->my_double_save = ROUND(y / cadsnap) * cadsnap;
xctx->mx_double_save = ROUND(x / c_snap) * c_snap;
xctx->my_double_save = ROUND(y / c_snap) * c_snap;
new_wire(PLACE, x, y);
}
else {
@ -639,6 +642,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);
toggle_only_probes();
break;
} /* /20110112 */
@ -796,9 +801,11 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key=='y' && state == 0) /* toggle stretching */
{
enable_stretch=!enable_stretch;
int en_s;
en_s = tclgetboolvar("enable_stretch");
en_s = !en_s;
if(enable_stretch) {
if(en_s) {
tcleval("alert_ { enabling stretch mode } {}");
tclsetvar("enable_stretch","1");
}
@ -852,10 +859,12 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key=='O' && state == ShiftMask) /* toggle light/dark colorscheme 20171113 */
{
dark_colorscheme=!dark_colorscheme;
tclsetvar("dark_colorscheme", dark_colorscheme ? "1" : "0");
color_dim=0.0;
build_colors(color_dim);
int d_c;
d_c = tclgetboolvar("dark_colorscheme");
d_c = !d_c;
tclsetboolvar("dark_colorscheme", d_c);
tclsetdoublevar("color_dim", 0.0);
build_colors(0.0);
draw();
break;
}
@ -1012,20 +1021,20 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key=='g' && state==0) /* half snap factor */
{
set_snap(cadsnap / 2.0);
set_snap(c_snap / 2.0);
break;
}
if(key=='g' && state==ControlMask) /* set snap factor 20161212 */
{
my_snprintf(str, S(str),
"input_line {Enter snap value (default: %.16g current: %.16g)} {xschem set cadsnap} {%g} 10",
CADSNAP, cadsnap, cadsnap);
CADSNAP, c_snap, c_snap);
tcleval(str);
break;
}
if(key=='G' && state==ShiftMask) /* double snap factor */
{
set_snap(cadsnap * 2.0);
set_snap(c_snap * 2.0);
break;
}
if(key=='*' && state==(Mod1Mask|ShiftMask) ) /* svg print , 20121108 */
@ -1050,9 +1059,9 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
{
if(xctx->semaphore >= 2) break;
push_undo();
round_schematic_to_grid(cadsnap);
round_schematic_to_grid(c_snap);
set_modify(1);
if(autotrim_wires) trim_wires();
if(tclgetboolvar("autotrim_wires")) trim_wires();
xctx->prep_hash_inst=0;
xctx->prep_hash_wires=0;
xctx->prep_net_structs=0;
@ -1280,8 +1289,10 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key=='A' && state==ShiftMask) /* toggle show netlist */
{
netlist_show = !netlist_show;
if(netlist_show) {
int net_s;
net_s = tclgetboolvar("netlist_show");
net_s = !net_s;
if(net_s) {
tcleval("alert_ { enabling show netlist window} {}");
tclsetvar("netlist_show","1");
}
@ -1327,7 +1338,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(xctx->semaphore >= 2) break;
hide_symbols++;
if(hide_symbols >= 3) hide_symbols = 0;
tclsetvar("hide_symbols", hide_symbols == 2 ? "2" : hide_symbols == 1 ? "1" : "0");
tclsetintvar("hide_symbols", hide_symbols);
draw();
break;
}
@ -1607,7 +1618,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
else if(button==Button1)
{
if(persistent_command && xctx->last_command) {
if(tclgetboolvar("persistent_command") && xctx->last_command) {
if(xctx->last_command == STARTLINE) start_line(mx, my);
if(xctx->last_command == STARTWIRE) start_wire(mx, my);
break;
@ -1623,8 +1634,8 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
double x, y;
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
xctx->mx_double_save = ROUND(x / cadsnap) * cadsnap;
xctx->my_double_save = ROUND(y / cadsnap) * cadsnap;
xctx->mx_double_save = ROUND(x / c_snap) * c_snap;
xctx->my_double_save = ROUND(y / c_snap) * c_snap;
new_wire(PLACE, x, y);
xctx->ui_state &=~MENUSTARTSNAPWIRE;
break;
@ -1678,7 +1689,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
break;
}
if(xctx->ui_state & STARTWIRE) {
if(persistent_command) {
if(tclgetboolvar("persistent_command")) {
if(constrained_move != 2) {
xctx->mx_double_save=xctx->mousex_snap;
}
@ -1701,7 +1712,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
break;
}
if(xctx->ui_state & STARTLINE) {
if(persistent_command) {
if(tclgetboolvar("persistent_command")) {
if(constrained_move != 2) {
xctx->mx_double_save=xctx->mousex_snap;
}
@ -1766,13 +1777,13 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
launcher();
}
if( !(state & ShiftMask) ) {
if(auto_hilight && xctx->hilight_nets && sel == 0 ) { /* 20160413 20160503 */
if(tclgetboolvar("auto_hilight") && xctx->hilight_nets && sel == 0 ) { /* 20160413 20160503 */
if(!prev_last_sel) {
redraw_hilights(1); /* 1: clear all hilights, then draw */
}
}
}
if(auto_hilight) {
if(tclgetboolvar("auto_hilight")) {
hilight_net(0);
if(xctx->lastsel) {
redraw_hilights(0);
@ -1796,9 +1807,9 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(xctx->semaphore >= 2) break;
if(xctx->ui_state & STARTSELECT) {
if(state & ControlMask) {
enable_stretch=1;
tclsetvar("enable_stretch", "1");
select_rect(END,-1);
enable_stretch=0;
tclsetvar("enable_stretch", "0");
break;
} else {
/* 20150927 filter out button4 and button5 events */

View File

@ -74,8 +74,8 @@ void print_image()
* }
* XSetClipRectangles(display, xctx->gctiled, 0,0, xctx->xrect, 1, Unsorted);
#endif
save_draw_grid = draw_grid;
draw_grid=0;
save_draw_grid = tclgetboolvar("draw_grid");
tclsetvar("draw_grid", "0");
xctx->draw_pixmap=1;
draw();
#ifdef __unix__
@ -94,7 +94,7 @@ void print_image()
} else tcleval( "convert_to_png {%s} plot.png", psfile);
#endif
my_strncpy(xctx->plotfile,"", S(xctx->plotfile));
draw_grid=save_draw_grid;
tclsetboolvar("draw_grid", save_draw_grid);
xctx->draw_pixmap=1;
}
@ -114,13 +114,13 @@ void set_cairo_color(int layer)
/* remember to call cairo_restore(xctx->cairo_ctx) when done !! */
int set_text_custom_font(xText *txt) /* 20171122 for correct text_bbox calculation */
{
char *textfont;
const char *textfont;
textfont = txt->font;
if((textfont && textfont[0]) || txt->flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (txt->font && txt->font[0]) ? txt->font : cairo_font_name;
textfont = (txt->font && txt->font[0]) ? txt->font : tclgetvar("cairo_font_name");
weight = ( txt->flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(txt->flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
@ -150,6 +150,7 @@ static void cairo_draw_string_line(cairo_t *c_ctx, char *s,
int line_delta;
double lines;
double vc; /* 20171121 vert correct */
if(s==NULL) return;
if(llength==0) return;
@ -283,8 +284,8 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in
else {
text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1,
&textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line);
xscale*=nocairo_font_xscale;
yscale*=nocairo_font_yscale;
xscale*=tclgetdoublevar("nocairo_font_xscale");
yscale*=tclgetdoublevar("nocairo_font_yscale");
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,
textx1,texty1,textx2,texty2)) return;
x1=textx1;y1=texty1;
@ -357,7 +358,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
double angle;
char *type;
#if HAS_CAIRO==1
char *textfont;
const char *textfont;
#endif
if(xctx->inst[n].ptr == -1) return;
@ -495,7 +496,8 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
if((textfont && textfont[0]) || symptr->text[j].flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (symptr->text[j].font && symptr->text[j].font[0]) ? symptr->text[j].font : cairo_font_name;
textfont = (symptr->text[j].font && symptr->text[j].font[0]) ?
symptr->text[j].font : tclgetvar("cairo_font_name");
weight = ( symptr->text[j].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(symptr->text[j].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
@ -658,8 +660,11 @@ void drawgrid()
double x,y;
double delta,tmp;
int i=0;
if( !draw_grid || !has_x) return;
delta=cadgrid*xctx->mooz;
int big_gr;
big_gr = tclgetboolvar("big_grid_points");
if( !tclgetboolvar("draw_grid") || !has_x) return;
delta=tclgetdoublevar("cadgrid")*xctx->mooz;
while(delta < CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
x = xctx->xorigin*xctx->mooz; y = xctx->yorigin*xctx->mooz;
if(y>xctx->areay1 && y < xctx->areay2) {
@ -677,14 +682,14 @@ void drawgrid()
for(y=tmp; y < xctx->areay2; y += delta) {
if(i>=CADMAXGRIDPOINTS) {
if(draw_window) {
if(big_grid_points) {
if(big_gr) {
XDrawSegments(display,xctx->window,gc[GRIDLAYER],xctx->biggridpoint,i);
} else {
XDrawPoints(display,xctx->window,gc[GRIDLAYER],xctx->gridpoint,i,CoordModeOrigin);
}
}
if(xctx->draw_pixmap) {
if(big_grid_points) {
if(big_gr) {
XDrawSegments(display,xctx->save_pixmap,gc[GRIDLAYER],xctx->biggridpoint,i);
} else {
XDrawPoints(display,xctx->save_pixmap,gc[GRIDLAYER],xctx->gridpoint,i,CoordModeOrigin);
@ -692,7 +697,7 @@ void drawgrid()
}
i=0;
}
if(big_grid_points) {
if(big_gr) {
xctx->biggridpoint[i].x1 = xctx->biggridpoint[i].x2 = (short)(x);
xctx->biggridpoint[i].y1 = xctx->biggridpoint[i].y2 = (short)(y);
i++;
@ -704,14 +709,14 @@ void drawgrid()
}
}
if(draw_window) {
if(big_grid_points) {
if(big_gr) {
XDrawSegments(display,xctx->window,gc[GRIDLAYER],xctx->biggridpoint,i);
} else {
XDrawPoints(display,xctx->window,gc[GRIDLAYER],xctx->gridpoint,i,CoordModeOrigin);
}
}
if(xctx->draw_pixmap) {
if(big_grid_points) {
if(big_gr) {
XDrawSegments(display,xctx->save_pixmap,gc[GRIDLAYER],xctx->biggridpoint,i);
} else {
XDrawPoints(display,xctx->save_pixmap,gc[GRIDLAYER],xctx->gridpoint,i,CoordModeOrigin);
@ -1483,7 +1488,7 @@ void draw(void)
int textlayer;
#if HAS_CAIRO==1
char *textfont;
const char *textfont;
#endif
if(xctx->no_draw) return;
rebuild_selected_array();
@ -1595,7 +1600,8 @@ void draw(void)
if( (textfont && textfont[0]) || xctx->text[i].flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (xctx->text[i].font && xctx->text[i].font[0]) ? xctx->text[i].font : cairo_font_name;
textfont = (xctx->text[i].font && xctx->text[i].font[0]) ?
xctx->text[i].font : tclgetvar("cairo_font_name");
weight = ( xctx->text[i].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(xctx->text[i].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;

View File

@ -387,7 +387,7 @@ void set_inst_prop(int i)
my_strdup2(70, &xctx->inst[i].instname, get_tok_value(ptr, "name",0));
if(xctx->inst[i].instname[0]) {
my_strdup(101, &tmp, xctx->inst[i].prop_ptr);
new_prop_string(i, tmp, 0, disable_unique_names);
new_prop_string(i, tmp, 0, tclgetboolvar("disable_unique_names"));
my_free(724, &tmp);
}
}
@ -766,6 +766,8 @@ void edit_text_property(int x)
tclgetvar("props"),
tclgetvar("retval") );
if(text_changed) {
double cg;
cg = tclgetdoublevar("cadgrid");
c = xctx->rects[PINLAYER];
for(l=0;l<c;l++) {
if(!strcmp( (get_tok_value(xctx->rect[PINLAYER][l].prop_ptr, "name",0)),
@ -784,11 +786,11 @@ void edit_text_property(int x)
pcy = (xctx->rect[PINLAYER][l].y1+xctx->rect[PINLAYER][l].y2)/2.0;
if(
/* 20171206 20171221 */
(fabs( (yy1+yy2)/2 - pcy) < cadgrid/2 &&
(fabs(xx1 - pcx) < cadgrid*3 || fabs(xx2 - pcx) < cadgrid*3) )
(fabs( (yy1+yy2)/2 - pcy) < cg/2 &&
(fabs(xx1 - pcx) < cg*3 || fabs(xx2 - pcx) < cg*3) )
||
(fabs( (xx1+xx2)/2 - pcx) < cadgrid/2 &&
(fabs(yy1 - pcy) < cadgrid*3 || fabs(yy2 - pcy) < cadgrid*3) )
(fabs( (xx1+xx2)/2 - pcx) < cg/2 &&
(fabs(yy1 - pcy) < cg*3 || fabs(yy2 - pcy) < cg*3) )
) {
if(x==0)
my_strdup(71, &xctx->rect[PINLAYER][l].prop_ptr,
@ -915,7 +917,9 @@ void update_symbol(const char *result, int x)
char *type;
int cond;
int pushed=0;
int s_pnetname;
s_pnetname = tclgetboolvar("show_pin_net_names");
dbg(1, "update_symbol(): entering\n");
i=xctx->sel_array[0].n;
if(!result) {
@ -965,7 +969,7 @@ void update_symbol(const char *result, int x)
if(xctx->sel_array[k].type!=ELEMENT) continue;
i=xctx->sel_array[k].n;
if(show_pin_net_names || xctx->hilight_nets) {
if(s_pnetname || xctx->hilight_nets) {
int j;
prepare_netlist_structs(0);
for(j = 0; j < (xctx->inst[i].ptr + xctx->sym)->rects[PINLAYER]; j++) {
@ -1031,7 +1035,7 @@ void update_symbol(const char *result, int x)
/* set name of current inst */
if(!pushed) { push_undo(); pushed=1;}
if(!k) hash_all_names(i);
new_prop_string(i, ptr, k, disable_unique_names); /* set new prop_ptr */
new_prop_string(i, ptr, k, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */
}
my_strdup2(90, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name",0));
@ -1051,14 +1055,14 @@ void update_symbol(const char *result, int x)
xctx->prep_hash_inst=0;
xctx->prep_net_structs=0;
xctx->prep_hi_structs=0;
if(show_pin_net_names || xctx->hilight_nets) prepare_netlist_structs(0);
if(s_pnetname || xctx->hilight_nets) prepare_netlist_structs(0);
for(k=0;k<xctx->lastsel;k++) {
if(xctx->sel_array[k].type!=ELEMENT) continue;
i=xctx->sel_array[k].n;
type=xctx->sym[xctx->inst[i].ptr].type;
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
if((show_pin_net_names || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
if((s_pnetname || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
for(j = 0; j < (xctx->inst[i].ptr + xctx->sym)->rects[PINLAYER]; j++) { /* <<< only .node[0] ? */
if( xctx->inst[i].node && xctx->inst[i].node[j]) {
int_hash_lookup(xctx->node_redraw_table, xctx->inst[i].node[j], 0, XINSERT_NOREPLACE);
@ -1069,7 +1073,7 @@ void update_symbol(const char *result, int x)
if(xctx->hilight_nets) {
propagate_hilights(1, 1, XINSERT_NOREPLACE);
}
if(show_pin_net_names || xctx->hilight_nets) find_inst_to_be_redrawn();
if(s_pnetname || xctx->hilight_nets) find_inst_to_be_redrawn();
}
/* redraw symbol with new props */
bbox(SET,0.0,0.0,0.0,0.0);

View File

@ -31,7 +31,10 @@ void find_closest_net(double mx,double my)
{
double tmp;
int i,w=-1;
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
double threshold;
double cg;
cg = tclgetdoublevar("cadgrid");
threshold = CADWIREMINDIST * CADWIREMINDIST * cg * cg / 400;
for(i=0;i<xctx->wires;i++)
{
@ -53,7 +56,10 @@ void find_closest_polygon(double mx,double my)
double tmp;
int i, c, j, l=-1, col = 0;
double x1, y1, x2, y2;
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
double threshold;
double cg;
cg = tclgetdoublevar("cadgrid");
threshold = CADWIREMINDIST * CADWIREMINDIST * cg * cg / 400;
for(c=0;c<cadlayers;c++)
{
if(!enable_layer[c]) continue;
@ -87,7 +93,10 @@ void find_closest_line(double mx,double my)
{
double tmp;
int i,c,l=-1, col = 0;
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
double threshold;
double cg;
cg = tclgetdoublevar("cadgrid");
threshold = CADWIREMINDIST * CADWIREMINDIST * cg * cg / 400;
for(c=0;c<cadlayers;c++)
{
if(!enable_layer[c]) continue;
@ -170,10 +179,13 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
void find_closest_arc(double mx,double my)
{
double thres = CADWIREMINDIST * CADWIREMINDIST * cadgrid*cadgrid/400;
double dist, angle, angle1, angle2;
int i,c,r=-1, col;
int match;
double threshold;
double cg;
cg = tclgetdoublevar("cadgrid");
threshold = CADWIREMINDIST * CADWIREMINDIST * cg * cg / 400;
for(c=0;c<cadlayers;c++)
{
@ -211,7 +223,7 @@ void find_closest_arc(double mx,double my)
}
} /* end for i */
} /* end for c */
if( r!=-1 && distance <= thres ) /* * pow(xctx->arc[col][r].r,2)) */
if( r!=-1 && distance <= threshold ) /* * pow(xctx->arc[col][r].r,2)) */
{
sel.n = r; sel.type = ARC; sel.col = col;
}
@ -274,10 +286,13 @@ void find_closest_text(double mx,double my)
short rot,flip;
double xx1,xx2,yy1,yy2;
int i,r=-1, tmp;
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
double threshold;
double cg;
#if HAS_CAIRO==1
int customfont;
#endif
cg = tclgetdoublevar("cadgrid");
threshold = CADWIREMINDIST * CADWIREMINDIST * cg * cg / 400;
for(i=0;i<xctx->texts;i++)
{
rot = xctx->text[i].rot;

View File

@ -114,52 +114,22 @@ xcb_visualtype_t *visual_xcb;
#endif /*HAS_XCB */
/* these variables are mirrored in tcl code */
int fullscreen=0;
char *netlist_dir=NULL; /* user set netlist directory via cmd-option or menu or xschemrc */
char initial_netlist_name[PATH_MAX]={0};
int top_subckt = 0;
int spiceprefix = 1;
int unzoom_nodrift=1;
int change_lw=0; /* allow change lw */
int incr_hilight=1;
unsigned short enable_stretch=0;
int auto_hilight=0;
int has_x=1;
int split_files=0; /* split netlist files 20081202 */
double cadgrid = CADGRID;
double cadsnap = CADSNAP;
int draw_grid=1;
int big_grid_points=0;
int rainbow_colors=0;
int disable_unique_names=0; /* if set allow instances with duplicate names */
int persistent_command=0; /* remember last command 20181022 */
int autotrim_wires = 0;
int color_ps=-1;
int transparent_svg=-1;
int only_probes=0;
int netlist_show=0;
int flat_netlist=0;
int flat_netlist = 0;
int cadlayers=0;
int hide_symbols = 0; /* draw only a bounding box for component instances and @symname, @name texts */
int dark_colorscheme=1;
char cairo_font_name[80]="Sans-Serif";
char svg_font_name[80]="Sans-Serif";
int rainbow_colors = 0;
double cairo_font_scale=1.0; /* default: 1.0, allows to adjust font size */
double nocairo_font_xscale=0.85; /* match with cairo sizing */
double nocairo_font_yscale=0.88; /* match with cairo sizing */
double cairo_font_line_spacing=1.0; /* allows to change line spacing: default: 1.0 */
/* lift up the text by 'n' pixels (zoom corrected) within the bbox. */
/* This correction is used to better align existing schematics */
/* compared to the nocairo xschem version. */
/* allowed values should be in the range [-4, 4] */
double cairo_vert_correct=0.0;
double nocairo_vert_correct=0.0;
int sym_txt=1;
double cairo_font_line_spacing = 1.0; /* value taken from xschemrc / xschem.tcl */
int netlist_type=-1;
int show_pin_net_names = 0;
/* enable hilight instances attached to hilighted nets if they have the "highlight=true attr set */
int en_hilight_conn_inst = 0;
int help=0; /* help option set to global scope, printing help is deferred */
/* when configuration ~/.schem has been read 20140406 */
@ -184,6 +154,9 @@ int tcp_port = 0;
int do_print=0;
int no_readline=0;
int draw_window=0;
int only_probes = 0;
int hide_symbols = 0;
int sym_txt = 1;
int text_svg=1; /* use <text> svg element for text instead of xschem's internal vector font */
int text_ps=1; /* use ps font for text instead of xschem's internal vector font */
double cadhalfdotsize = CADHALFDOTSIZE;
@ -196,7 +169,6 @@ int screendepth;
char **color_array;
int *fill_type;
int fill_pattern = 1;
double color_dim = 0.0;
char *xschem_executable=NULL;
double *character[256]; /* array or per-char coordinates of xschem internal vector font */
Tcl_Interp *interp;

View File

@ -410,7 +410,9 @@ void hilight_net_pin_mismatches(void)
char *netname=NULL;
int mult;
xRect *rct;
int incr_hi;
incr_hi = tclgetboolvar("incr_hilight");
rebuild_selected_array();
prepare_netlist_structs(0);
for(k=0; k<xctx->lastsel; k++) {
@ -430,7 +432,7 @@ void hilight_net_pin_mismatches(void)
if(netname && strcmp(lab, netname)) {
dbg(1, "hilight_net_pin_mismatches(): hilight: %s\n", netname);
bus_hilight_lookup(netname, xctx->hilight_color, XINSERT_NOREPLACE);
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
}
}
@ -586,7 +588,7 @@ int search(const char *tok, const char *val, int sub, int sel)
dbg(1, "search():val=%s\n", val);
if(!sel) {
col=xctx->hilight_color;
if(incr_hilight) incr_hilight_color();
if(tclgetboolvar("incr_hilight")) incr_hilight_color();
}
has_token = 0;
prepare_netlist_structs(0);
@ -766,7 +768,9 @@ void drill_hilight(int mode)
char *propagate_str = NULL;
int propagate, hilight_connected_inst;
struct hilight_hashentry *entry, *propag_entry;
int en_hi;
en_hi = tclgetboolvar("en_hilight_conn_inst");
prepare_netlist_structs(0);
while(1) {
found=0;
@ -774,7 +778,7 @@ void drill_hilight(int mode)
symbol = xctx->inst[i].ptr+xctx->sym;
npin = symbol->rects[PINLAYER];
rct=symbol->rect[PINLAYER];
hilight_connected_inst = en_hilight_conn_inst &&
hilight_connected_inst = en_hi &&
( (xctx->inst[i].flags & 4) || ((xctx->inst[i].ptr+ xctx->sym)->flags & 4) );
for(j=0; j<npin;j++) {
my_strdup(143, &netname, net_name(i, j, &mult, 1, 0));
@ -824,7 +828,7 @@ int hilight_netname(const char *name)
node_entry = bus_hash_lookup(name, "", XLOOKUP, 0, "", "", "", "");
/* sets xctx->hilight_nets=1 */
if(node_entry && !bus_hilight_lookup(name, xctx->hilight_color, XINSERT_NOREPLACE)) {
if(incr_hilight) incr_hilight_color();
if(tclgetboolvar("incr_hilight")) incr_hilight_color();
propagate_hilights(1, 0, XINSERT_NOREPLACE);
redraw_hilights(0);
}
@ -1045,7 +1049,9 @@ void propagate_hilights(int set, int clear, int mode)
int i, hilight_connected_inst;
struct hilight_hashentry *entry;
char *type;
int en_hi;
en_hi = tclgetboolvar("en_hilight_conn_inst");
prepare_netlist_structs(0);
for(i = 0; i < xctx->instances; i++) {
if(xctx->inst[i].ptr < 0 ) {
@ -1053,7 +1059,7 @@ void propagate_hilights(int set, int clear, int mode)
continue;
}
type = (xctx->inst[i].ptr+ xctx->sym)->type;
hilight_connected_inst = en_hilight_conn_inst &&
hilight_connected_inst = en_hi &&
( (xctx->inst[i].flags & 4) || ((xctx->inst[i].ptr+ xctx->sym)->flags & 4) );
if(hilight_connected_inst && type && !IS_LABEL_SH_OR_PIN(type)) {
int rects, j, nohilight_pins;
@ -1528,7 +1534,9 @@ void hilight_net(int viewer)
int i, n;
char *type;
int sim_is_xyce;
int incr_hi;
incr_hi = tclgetboolvar("incr_hilight");
prepare_netlist_structs(0);
dbg(1, "hilight_net(): entering\n");
rebuild_selected_array();
@ -1542,7 +1550,7 @@ void hilight_net(int viewer)
if(!bus_hilight_lookup(xctx->wire[n].node, xctx->hilight_color, XINSERT_NOREPLACE)) {
if(viewer == GAW) send_net_to_gaw(sim_is_xyce, xctx->wire[n].node);
if(viewer == BESPICE) send_net_to_bespice(sim_is_xyce, xctx->wire[n].node);
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
}
break;
case ELEMENT:
@ -1552,7 +1560,7 @@ void hilight_net(int viewer)
if(!bus_hilight_lookup(xctx->inst[n].node[0], xctx->hilight_color, XINSERT_NOREPLACE)) {
if(viewer == GAW) send_net_to_gaw(sim_is_xyce, xctx->inst[n].node[0]);
if(viewer == BESPICE) send_net_to_bespice(sim_is_xyce, xctx->inst[n].node[0]);
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
}
} else {
dbg(1, "hilight_net(): setting hilight flag on inst %d\n",n);
@ -1562,14 +1570,14 @@ void hilight_net(int viewer)
if(viewer == GAW) send_current_to_gaw(sim_is_xyce, xctx->inst[n].instname);
if(viewer == BESPICE) send_current_to_bespice(sim_is_xyce, xctx->inst[n].instname);
}
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
}
break;
default:
break;
}
}
if(!incr_hilight) incr_hilight_color();
if(!incr_hi) incr_hilight_color();
propagate_hilights(1, 0, XINSERT_NOREPLACE);
tcleval("if { [info exists gaw_fd] } {close $gaw_fd; unset gaw_fd}\n");
}
@ -1638,8 +1646,10 @@ void select_hilight_net(void)
int i;
struct hilight_hashentry *entry;
int hilight_connected_inst;
int en_hi;
if(!xctx->hilight_nets) return;
en_hi = tclgetboolvar("en_hilight_conn_inst");
prepare_netlist_structs(0);
for(i=0;i<xctx->wires;i++) {
if( (entry = bus_hilight_lookup(xctx->wire[i].node, 0, XLOOKUP)) ) {
@ -1649,7 +1659,7 @@ void select_hilight_net(void)
for(i=0;i<xctx->instances;i++) {
type = (xctx->inst[i].ptr+ xctx->sym)->type;
hilight_connected_inst = en_hilight_conn_inst &&
hilight_connected_inst = en_hi &&
( (xctx->inst[i].flags & 4) || ((xctx->inst[i].ptr+ xctx->sym)->flags & 4) );
if( xctx->inst[i].color != -10000) {
dbg(1, "select_hilight_net(): instance %d flags &4 true\n", i);

View File

@ -528,9 +528,10 @@ void copy_objects(int what)
#if HAS_CAIRO==1
int customfont;
#endif
xInstance * const inst = xctx->inst;
int s_pnetname;
s_pnetname = tclgetboolvar("show_pin_net_names");
if(what & START)
{
xctx->rotatelocal=0;
@ -597,7 +598,7 @@ void copy_objects(int what)
symbol_bbox(n, &inst[n].x1, &inst[n].y1, &inst[n].x2, &inst[n].y2 );
bbox(ADD, inst[n].x1, inst[n].y1, inst[n].x2, inst[n].y2 );
/* hash all nodes of copied objects before the copy, they might need update if net_name=true */
if((show_pin_net_names || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
if((s_pnetname || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
for(p = 0; p < (inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) {
if( inst[n].node && inst[n].node[p]) {
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
@ -605,12 +606,12 @@ void copy_objects(int what)
}
}
}
if((show_pin_net_names || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE) {
if((s_pnetname || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE) {
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
}
draw_selection(xctx->gctiled,0);
if(show_pin_net_names || xctx->hilight_nets) find_inst_to_be_redrawn();
if(s_pnetname || xctx->hilight_nets) find_inst_to_be_redrawn();
for(i=0;i<xctx->lastsel;i++)
{
@ -932,7 +933,8 @@ void copy_objects(int what)
/* the newpropcnt argument is zero for the 1st call and used in */
/* new_prop_string() for cleaning some internal caches. */
if(!newpropcnt) hash_all_names(xctx->instances);
new_prop_string(xctx->instances, xctx->inst[n].prop_ptr,newpropcnt++, disable_unique_names);
new_prop_string(xctx->instances, xctx->inst[n].prop_ptr,newpropcnt++,
tclgetboolvar("disable_unique_names"));
my_strdup2(235, &xctx->inst[xctx->instances].instname,
get_tok_value(xctx->inst[xctx->instances].prop_ptr, "name", 0));
xctx->instances++;
@ -947,7 +949,7 @@ void copy_objects(int what)
xctx->prep_net_structs=0;
xctx->prep_hi_structs=0;
}
if(show_pin_net_names || xctx->hilight_nets) {
if(s_pnetname || xctx->hilight_nets) {
prepare_netlist_structs(0);
}
for(i = 0; i < xctx->lastsel; i++) {
@ -957,7 +959,7 @@ void copy_objects(int what)
char *type=xctx->sym[xctx->inst[n].ptr].type;
symbol_bbox(n, &xctx->inst[n].x1, &xctx->inst[n].y1, &xctx->inst[n].x2, &xctx->inst[n].y2 );
bbox(ADD, xctx->inst[n].x1, xctx->inst[n].y1, xctx->inst[n].x2, xctx->inst[n].y2 );
if((show_pin_net_names || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
if((s_pnetname || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
for(p = 0; p < (xctx->inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) {
if( xctx->inst[n].node && xctx->inst[n].node[p]) {
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
@ -965,13 +967,13 @@ void copy_objects(int what)
}
}
}
if((show_pin_net_names || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE) {
if((s_pnetname || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE) {
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
} /* for(i = 0; i < xctx->lastsel; i++) */
if(show_pin_net_names || xctx->hilight_nets) find_inst_to_be_redrawn();
if(s_pnetname || xctx->hilight_nets) find_inst_to_be_redrawn();
check_collapsing_objects();
if(autotrim_wires) trim_wires();
if(tclgetboolvar("autotrim_wires")) trim_wires();
/* update_conn_cues(1, 1); */
xctx->ui_state &= ~STARTCOPY;
xctx->x1=xctx->y_1=xctx->x2=xctx->y_2=xctx->move_rot=xctx->move_flip=xctx->deltax=xctx->deltay=0;
@ -994,11 +996,12 @@ void move_objects(int what, int merge, double dx, double dy)
#if HAS_CAIRO==1
int customfont;
#endif
xInstance * const inst = xctx->inst;
xLine ** const line = xctx->line;
xWire * const wire = xctx->wire;
int s_pnetname;
s_pnetname = tclgetboolvar("show_pin_net_names");
if(what & START)
{
xctx->rotatelocal=0;
@ -1071,7 +1074,7 @@ void move_objects(int what, int merge, double dx, double dy)
bbox(ADD, inst[n].x1, inst[n].y1, inst[n].x2, inst[n].y2 );
/* hash all nodes of copied objects before the copy, they might need update if net_name=true */
if((show_pin_net_names || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
if((s_pnetname || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
for(p = 0; p < (inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) {
if( inst[n].node && inst[n].node[p]) {
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
@ -1079,12 +1082,12 @@ void move_objects(int what, int merge, double dx, double dy)
}
}
}
if((show_pin_net_names || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE) {
if((s_pnetname || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE) {
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
}
draw_selection(xctx->gctiled,0);
if(show_pin_net_names || xctx->hilight_nets) find_inst_to_be_redrawn();
if(s_pnetname || xctx->hilight_nets) find_inst_to_be_redrawn();
for(k=0;k<cadlayers;k++)
{
for(i=0;i<xctx->lastsel;i++)
@ -1486,7 +1489,7 @@ void move_objects(int what, int merge, double dx, double dy)
xctx->prep_net_structs=0;
xctx->prep_hi_structs=0;
}
if(show_pin_net_names || xctx->hilight_nets) {
if(s_pnetname || xctx->hilight_nets) {
prepare_netlist_structs(0);
}
for(i = 0; i < xctx->lastsel; i++) {
@ -1496,7 +1499,7 @@ void move_objects(int what, int merge, double dx, double dy)
char *type=xctx->sym[xctx->inst[n].ptr].type;
symbol_bbox(n, &inst[n].x1, &inst[n].y1, &inst[n].x2, &inst[n].y2 );
bbox(ADD, inst[n].x1, inst[n].y1, inst[n].x2, inst[n].y2 );
if((show_pin_net_names || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
if((s_pnetname || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type)) {
for(p = 0; p < (inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) {
if( inst[n].node && inst[n].node[p]) {
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
@ -1504,13 +1507,13 @@ void move_objects(int what, int merge, double dx, double dy)
}
}
}
if((show_pin_net_names || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE) {
if((s_pnetname || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE) {
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
}
if(show_pin_net_names || xctx->hilight_nets) find_inst_to_be_redrawn();
if(s_pnetname || xctx->hilight_nets) find_inst_to_be_redrawn();
check_collapsing_objects();
if(autotrim_wires) trim_wires();
if(tclgetboolvar("autotrim_wires")) trim_wires();
/* update_conn_cues(1, 1); */
if(xctx->hilight_nets) {

View File

@ -394,15 +394,15 @@ void netlist_options(int i)
str = get_tok_value(xctx->inst[i].prop_ptr, "top_subckt", 0);
if(str[0]) {
top_subckt = 0;
/* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx->inst[i].prop_ptr); */
if(!strcmp(str, "true")) top_subckt = 1;
if(!strcmp(str, "true")) tclsetintvar("top_subckt", 1);
else tclsetintvar("top_subckt", 0);
}
str = get_tok_value(xctx->inst[i].prop_ptr, "spiceprefix", 0);
if(str[0]) {
spiceprefix = 1;
/* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx->inst[i].prop_ptr); */
if(!strcmp(str, "false")) spiceprefix = 0;
if(!strcmp(str, "false")) tclsetvar("spiceprefix", "0");
else tclsetvar("spiceprefix", "1");
}
str = get_tok_value(xctx->inst[i].prop_ptr, "hiersep", 0);
@ -450,9 +450,9 @@ static void signal_short( char *n1, char *n2)
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
if(!xctx->netlist_count) {
bus_hilight_lookup(n1, xctx->hilight_color, XINSERT);
if(incr_hilight) incr_hilight_color();
if(tclgetboolvar("incr_hilight")) incr_hilight_color();
bus_hilight_lookup(n2, xctx->hilight_color, XINSERT);
if(incr_hilight) incr_hilight_color();
if(tclgetboolvar("incr_hilight")) incr_hilight_color();
}
}
}

View File

@ -292,7 +292,9 @@ void traverse_node_hash()
int i;
struct node_hashentry *entry;
char str[2048]; /* 20161122 overflow safe */
int incr_hi;
incr_hi = tclgetboolvar("incr_hilight");
for(i=0;i<HASHSIZE;i++)
{
entry = xctx->node_table[i];
@ -303,14 +305,14 @@ void traverse_node_hash()
{
my_snprintf(str, S(str), "open net: %s", entry->token);
if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE);
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
statusmsg(str,2);
}
else if(entry->d.out ==0 && entry->d.inout == 0)
{
my_snprintf(str, S(str), "undriven node: %s", entry->token);
if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE);
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
statusmsg(str,2);
tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */
}
@ -318,21 +320,21 @@ void traverse_node_hash()
{
my_snprintf(str, S(str), "shorted output node: %s", entry->token);
if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE);
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
statusmsg(str,2);
}
else if(entry->d.in ==0 && entry->d.inout == 0)
{
my_snprintf(str, S(str), "node: %s goes nowhere", entry->token);
if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE);
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
statusmsg(str,2);
}
else if(entry->d.out >=2 && entry->d.inout == 0 && entry->d.port>=0) /* era d.port>=2 03102001 */
{
my_snprintf(str, S(str), "shorted output node: %s", entry->token);
if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE);
if(incr_hilight) incr_hilight_color();
if(incr_hi) incr_hilight_color();
statusmsg(str,2);
}
}

View File

@ -263,7 +263,7 @@ void merge_inst(int k,FILE *fd)
ptr[i].node=NULL;
load_ascii_string(&prop_ptr,fd);
if(!k) hash_all_names(i);
new_prop_string(i, prop_ptr, k, disable_unique_names);
new_prop_string(i, prop_ptr, k, tclgetboolvar("disable_unique_names"));
/* the final tmp argument is zero for the 1st call and used in */
/* new_prop_string() for cleaning some internal caches. */
my_strdup2(306, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name", 0));

View File

@ -417,8 +417,8 @@ static void old_ps_draw_string(int gctext, const char *str,
text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter,
x1,y1, &rx1,&ry1,&rx2,&ry2, &no_of_lines, &longest_line);
#endif
xscale*=nocairo_font_xscale;
yscale*=nocairo_font_yscale;
xscale*=tclgetdoublevar("nocairo_font_xscale");
yscale*=tclgetdoublevar("nocairo_font_yscale");
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) return;
set_ps_colors(gctext);
@ -457,8 +457,8 @@ static void ps_drawgrid()
{
double x,y;
double delta,tmp;
if(!draw_grid) return;
delta=cadgrid* xctx->mooz;
if( !tclgetboolvar("draw_grid")) return;
delta=tclgetdoublevar("cadgrid")* xctx->mooz;
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
x = xctx->xorigin* xctx->mooz;y = xctx->yorigin* xctx->mooz;
set_ps_colors(GRIDLAYER);
@ -676,8 +676,9 @@ void create_ps(char **psfile, int what)
}
fill_ps_colors();
old_grid=draw_grid;
draw_grid=0;
old_grid=tclgetboolvar("draw_grid");
tclsetvar("draw_grid", "0");
boundbox.x1 = xctx->areax1;
boundbox.x2 = xctx->areax2;
@ -870,7 +871,7 @@ void create_ps(char **psfile, int what)
fprintf(fd, "%%%%EOF\n");
fclose(fd);
}
draw_grid=old_grid;
tclsetboolvar("draw_grid", old_grid);
my_free(879, &ps_colors);
}

View File

@ -1107,7 +1107,7 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2
tcleval( "wm iconname . \"xschem - [file tail [xschem get schname]]\"");
}
}
if(autotrim_wires) trim_wires();
if(tclgetboolvar("autotrim_wires")) trim_wires();
update_conn_cues(0, 0);
}
@ -2372,8 +2372,8 @@ void descend_symbol(void)
}
/* 20111023 align selected object to current grid setting */
#define SNAP_TO_GRID(a) (a=ROUND(( a)/cadsnap)*cadsnap )
void round_schematic_to_grid(double cadsnap)
#define SNAP_TO_GRID(a) (a=ROUND(( a)/c_snap)*c_snap )
void round_schematic_to_grid(double c_snap)
{
int i, c, n, p;
rebuild_selected_array();

View File

@ -109,8 +109,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
{
cmd_found = 1;
push_undo();
round_schematic_to_grid(cadsnap);
if(autotrim_wires) trim_wires();
round_schematic_to_grid(tclgetdoublevar("cadsnap"));
if(tclgetvar("autotrim_wires")) trim_wires();
set_modify(1);
xctx->prep_hash_inst=0;
xctx->prep_hash_wires=0;
@ -170,7 +170,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"change_colors"))
{
cmd_found = 1;
build_colors(color_dim);
build_colors(tclgetdoublevar("color_dim"));
draw();
Tcl_ResetResult(interp);
}
@ -263,7 +263,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(argc==3) {
d = atof(argv[2]);
build_colors(d);
color_dim = d;
draw();
Tcl_ResetResult(interp);
}
@ -457,7 +456,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"fullscreen"))
{
cmd_found = 1;
dbg(1, "scheduler(): xschem fullscreen, fullscreen=%d\n", fullscreen);
toggle_fullscreen(argv[2]);
Tcl_ResetResult(interp);
}
@ -496,13 +494,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"get") && argc==3)
{
cmd_found = 1;
if(!strcmp(argv[2],"auto_hilight")) {
if( auto_hilight != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"backlayer")) {
if(!strcmp(argv[2],"backlayer")) {
char s[30]; /* overflow safe 20161122 */
my_snprintf(s, S(s), "%d",BACKLAYER);
Tcl_SetResult(interp, s,TCL_VOLATILE);
@ -521,27 +513,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(res, S(res), "%g %g %g %g", boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2);
Tcl_SetResult(interp, res, TCL_VOLATILE);
}
else if(!strcmp(argv[2],"big_grid_points")) {
if( big_grid_points != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"cadlayers")) {
char s[30]; /* overflow safe 20161212 */
my_snprintf(s, S(s), "%d",cadlayers);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"cadsnap")) {
char s[30]; /* overflow safe 20161212 */
my_snprintf(s, S(s), "%.9g",cadsnap);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"change_lw")) {
char s[30]; /* overflow safe 20161122 */
my_snprintf(s, S(s), "%d",change_lw);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"color_ps")) {
if( color_ps != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
@ -561,28 +537,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(s, S(s), "%d",debug_var);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"dim")) {
char s[40];
my_snprintf(s, S(s), "%.2g", color_dim);
Tcl_SetResult(interp, s, TCL_VOLATILE);
}
else if(!strcmp(argv[2],"draw_grid")) {
if( draw_grid != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"draw_window")) {
char s[30]; /* overflow safe 20161122 */
my_snprintf(s, S(s), "%d",draw_window);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"enable_stretch")) {
if( enable_stretch != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"flat_netlist")) {
if( flat_netlist != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
@ -600,12 +559,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"incr_hilight")) {
if( incr_hilight != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"instances")) {
char s[30]; /* overflow safe 20161122 */
my_snprintf(s, S(s), "%d",xctx->instances);
@ -629,24 +582,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[2],"netlist_name")) {
Tcl_SetResult(interp, xctx->netlist_name, TCL_VOLATILE);
}
else if(!strcmp(argv[2],"netlist_show")) {
if( netlist_show != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"no_draw")) {
if( xctx->no_draw != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"only_probes")) {
if( only_probes != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"pinlayer")) {
char s[30]; /* overflow safe 20161122 */
my_snprintf(s, S(s), "%d",PINLAYER);
@ -667,24 +608,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(s, S(s), "%d",xctx->semaphore);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"show_pin_net_names")) {
if( show_pin_net_names != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"split_files")) {
if( split_files != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"sym_txt")) {
if( sym_txt != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
#ifndef __unix__
else if(!strcmp(argv[2], "temp_dir")) {
if(win_temp_dir[0] != '\0') Tcl_SetResult(interp, win_temp_dir, TCL_VOLATILE);
@ -728,17 +651,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(s, S(s), "%d",TEXTLAYER);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"transparent_svg")) {
if( transparent_svg != 0 )
Tcl_SetResult(interp, "1",TCL_STATIC);
else
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"ui_state")) {
char s[30]; /* overflow safe 20161122 */
my_snprintf(s, S(s), "%d",xctx->ui_state);
Tcl_SetResult(interp, s,TCL_VOLATILE);
}
else if(!strcmp(argv[2],"version")) {
char s[30]; /* overflow safe 20161122 */
my_snprintf(s, S(s), "XSCHEM V%s",XSCHEM_VERSION);
@ -960,8 +872,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
printf(" perform a global netlist on current schematic\n");
printf(" xschem netlist_type type\n");
printf(" set netlist type to <type>, currently spice, vhdl, verilog or tedax\n");
printf(" xschem netlist_show yes|no\n");
printf(" show or not netlist in a window\n");
printf(" xschem save [library/name]\n");
printf(" save current schematic, optionally a lib/name can be given\n");
printf(" xschem saveas\n");
@ -1961,7 +1871,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_strdup(371, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) );
hash_all_names(inst);
new_prop_string(inst, ptr,0, disable_unique_names); /* set new prop_ptr */
new_prop_string(inst, ptr,0, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */
my_strdup2(517, &newname, get_tok_value(xctx->inst[inst].prop_ptr, "name",0));
my_strdup2(372, &xctx->inst[inst].instname, newname);
@ -2180,146 +2090,43 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* ********** xschem set subcommands
*/
cmd_found = 1;
if(!strcmp(argv[2],"svg_font_name")) {
if( strlen(argv[3]) < sizeof(svg_font_name) ) {
my_strncpy(svg_font_name, argv[3], S(svg_font_name));
}
} else
#if HAS_CAIRO==1
if(!strcmp(argv[2],"cairo_font_name")) {
if( strlen(argv[3]) < sizeof(cairo_font_name) ) {
my_strncpy(cairo_font_name, argv[3], S(cairo_font_name));
}
} else
#endif
if(!strcmp(argv[2],"no_undo")) {
int s = atoi(argv[3]);
xctx->no_undo=s;
if(!strcmp(argv[2],"cadgrid")) {
set_grid( atof(argv[3]) );
}
else if(!strcmp(argv[2],"cadsnap")) {
set_snap( atof(argv[3]) );
}
else if(!strcmp(argv[2],"color_ps")) {
color_ps=atoi(argv[3]);
}
else if(!strcmp(argv[2],"constrained_move")) {
constrained_move = atoi(argv[3]);
}
else if(!strcmp(argv[2],"dim")) {
double s = atof(argv[3]);
build_colors(s);
draw();
Tcl_ResetResult(interp);
}
else if(!strcmp(argv[2],"draw_window")) {
draw_window=atoi(argv[3]);
}
else if(!strcmp(argv[2],"flat_netlist")) {
flat_netlist=atoi(argv[3]);
}
else if(!strcmp(argv[2],"hide_symbols")) {
hide_symbols=atoi(argv[3]);
}
else if(!strcmp(argv[2],"netlist_name")) {
my_strncpy(xctx->netlist_name, argv[3], S(xctx->netlist_name));
}
else if(!strcmp(argv[2],"no_draw")) {
int s = atoi(argv[3]);
xctx->no_draw=s;
}
else if(!strcmp(argv[2],"hide_symbols")) {
else if(!strcmp(argv[2],"no_undo")) {
int s = atoi(argv[3]);
hide_symbols=s;
}
else if(!strcmp(argv[2],"show_pin_net_names")) {
int i, s = atoi(argv[3]);
show_pin_net_names=s;
for(i = 0; i < xctx->instances; i++) {
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
}
}
else if(!strcmp(argv[2],"netlist_name")) {
my_strncpy(xctx->netlist_name, argv[3], S(xctx->netlist_name));
}
else if(!strcmp(argv[2],"dim")) {
double s = atof(argv[3]);
build_colors(s);
color_dim = s;
draw();
Tcl_ResetResult(interp);
}
else if(!strcmp(argv[2],"en_hilight_conn_inst")) {
en_hilight_conn_inst=atoi(argv[3]);
}
else if(!strcmp(argv[2],"big_grid_points")) {
big_grid_points=atoi(argv[3]);
}
else if(!strcmp(argv[2],"cairo_font_scale")) {
double s = atof(argv[3]);
if(s>0.1 && s<10.0) cairo_font_scale = s;
}
else if(!strcmp(argv[2],"nocairo_font_xscale")) {
double s = atof(argv[3]);
if(s>0.1 && s<10.0) nocairo_font_xscale = s;
}
else if(!strcmp(argv[2],"nocairo_font_yscale")) {
double s = atof(argv[3]);
if(s>0.1 && s<10.0) nocairo_font_yscale = s;
}
else if(!strcmp(argv[2],"cairo_font_line_spacing")) {
double s = atof(argv[3]);
if(s>0.1 && s<10.0) cairo_font_line_spacing = s;
}
else if(!strcmp(argv[2],"cairo_vert_correct")) {
double s = atof(argv[3]);
if(s>-20. && s<20.) cairo_vert_correct = s;
}
else if(!strcmp(argv[2],"nocairo_vert_correct")) {
double s = atof(argv[3]);
if(s>-20. && s<20.) nocairo_vert_correct = s;
}
else if(!strcmp(argv[2],"persistent_command")) {
if(!strcmp(argv[3],"1")) {
persistent_command=1;
} else {
persistent_command=0;
}
}
else if(!strcmp(argv[2],"autotrim_wires")) {
if(!strcmp(argv[3],"1")) {
autotrim_wires=1;
} else {
autotrim_wires=0;
}
}
else if(!strcmp(argv[2],"disable_unique_names")) {
if(!strcmp(argv[3],"1")) {
disable_unique_names=1;
} else {
disable_unique_names=0;
}
}
else if(!strcmp(argv[2],"incr_hilight")) {
incr_hilight=atoi(argv[3]);
}
else if(!strcmp(argv[2],"auto_hilight")) {
auto_hilight=atoi(argv[3]);
}
else if(!strcmp(argv[2],"netlist_show")) {
netlist_show=atoi(argv[3]);
tclsetvar("netlist_show", netlist_show ? "1" : "0");
}
else if(!strcmp(argv[2],"semaphore")) {
xctx->semaphore=atoi(argv[3]);
}
else if(!strcmp(argv[2],"cadsnap")) {
set_snap( atof(argv[3]) );
}
else if(!strcmp(argv[2],"spiceprefix")) {
spiceprefix=atoi(argv[3]);
}
else if(!strcmp(argv[2],"cadgrid")) {
set_grid( atof(argv[3]) );
}
else if(!strcmp(argv[2],"flat_netlist")) {
flat_netlist=atoi(argv[3]);
}
else if(!strcmp(argv[2],"split_files")) {
split_files=atoi(argv[3]);
}
else if(!strcmp(argv[2],"enable_stretch")) {
enable_stretch=atoi(argv[3]);
}
else if(!strcmp(argv[2],"color_ps")) {
color_ps=atoi(argv[3]);
}
else if(!strcmp(argv[2],"transparent_svg")) {
transparent_svg=atoi(argv[3]);
}
else if(!strcmp(argv[2],"only_probes")) {
only_probes=atoi(argv[3]);
}
else if(!strcmp(argv[2],"draw_grid")) {
draw_grid=atoi(argv[3]);
}
else if(!strcmp(argv[2],"text_svg")) {
text_svg=atoi(argv[3]);
}
else if(!strcmp(argv[2],"sym_txt")) {
sym_txt=atoi(argv[3]);
xctx->no_undo=s;
}
else if(!strcmp(argv[2],"rectcolor")) {
xctx->rectcolor=atoi(argv[3]);
@ -2328,17 +2135,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
change_layer();
}
}
else if(!strcmp(argv[2],"constrained_move")) {
constrained_move = atoi(argv[3]);
else if(!strcmp(argv[2],"text_svg")) {
text_svg=atoi(argv[3]);
}
else if(!strcmp(argv[2],"change_lw")) {
change_lw=atoi(argv[3]);
else if(!strcmp(argv[2],"semaphore")) {
xctx->semaphore=atoi(argv[3]);
}
else if(!strcmp(argv[2],"draw_window")) {
draw_window=atoi(argv[3]);
}
else if(!strcmp(argv[2],"ui_state")) {
xctx->ui_state=atoi(argv[3]);
else if(!strcmp(argv[2],"sym_txt")) {
sym_txt=atoi(argv[3]);
}
else {
Tcl_AppendResult(interp, "xschem set ", argv[1], argv[3], ": invalid command.", NULL);
@ -2413,9 +2217,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xctx->prep_hi_structs=0;
if(!strcmp(argv[3], "name")) hash_all_names(inst);
if(argc >= 5) {
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], argv[4]),fast, disable_unique_names);
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], argv[4]),fast,
tclgetboolvar("disable_unique_names"));
} else {/* assume argc == 4 , delete attribute */
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], NULL),fast, disable_unique_names);
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], NULL),fast,
tclgetboolvar("disable_unique_names"));
}
my_strdup2(367, &xctx->inst[inst].instname, get_tok_value(xctx->inst[inst].prop_ptr, "name",0));
@ -2439,7 +2245,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE);
}
else if(!strcmp(argv[1],"show_pin_net_names")) {
int i;
cmd_found = 1;
for(i = 0; i < xctx->instances; i++) {
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
}
}
else if(!strcmp(argv[1],"simulate") )
{
cmd_found = 1;
@ -2493,11 +2305,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"toggle_colorscheme"))
{
int d_c;
cmd_found = 1;
dark_colorscheme=!dark_colorscheme;
tclsetvar("dark_colorscheme", dark_colorscheme ? "1" : "0");
color_dim=0.0;
build_colors(color_dim);
d_c = tclgetboolvar("dark_colorscheme");
d_c = !d_c;
tclsetboolvar("dark_colorscheme", d_c);
tclsetdoublevar("color_dim", 0.0);
build_colors(0.0);
draw();
Tcl_ResetResult(interp);
}
@ -2608,7 +2422,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
save = draw_window; draw_window = 1;
drawline(WIRELAYER,NOW, x1,y1,x2,y2, 0);
draw_window = save;
if(autotrim_wires) trim_wires();
if(tclgetvar("autotrim_wires")) trim_wires();
}
else xctx->ui_state |= MENUSTARTWIRE;
}
@ -2696,6 +2510,24 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
return TCL_OK;
}
double tclgetdoublevar(const char *s)
{
dbg(2, "tclgetdoublevar(): %s\n", s);
return atof(Tcl_GetVar(interp,s, TCL_GLOBAL_ONLY));
}
int tclgetintvar(const char *s)
{
dbg(2, "tclgetintvar(): %s\n", s);
return atoi(Tcl_GetVar(interp,s, TCL_GLOBAL_ONLY));
}
int tclgetboolvar(const char *s)
{
dbg(2, "tclgetboolvar(): %s\n", s);
return Tcl_GetVar(interp,s, TCL_GLOBAL_ONLY)[0] == '1' ? 1 : 0;
}
const char *tclgetvar(const char *s)
{
dbg(2, "tclgetvar(): %s\n", s);
@ -2722,3 +2554,33 @@ void tclsetvar(const char *s, const char *value)
fprintf(errfp, "tclsetvar(): error setting variable %s to %s\n", s, value);
}
}
void tclsetdoublevar(const char *s, const double value)
{
char str[80];
dbg(2, "tclsetdoublevar(): %s to %g\n", s, value);
sprintf(str, "%.16g", value);
if(!Tcl_SetVar(interp, s, str, TCL_GLOBAL_ONLY)) {
fprintf(errfp, "tclsetdoublevar(): error setting variable %s to %g\n", s, value);
}
}
void tclsetintvar(const char *s, const int value)
{
char str[80];
dbg(2, "tclsetintvar(): %s to %d\n", s, value);
sprintf(str, "%d", value);
if(!Tcl_SetVar(interp, s, str, TCL_GLOBAL_ONLY)) {
fprintf(errfp, "tclsetintvar(): error setting variable %s to %d\n", s, value);
}
}
void tclsetboolvar(const char *s, const int value)
{
dbg(2, "tclsetboolvar(): %s to %d\n", s, value);
if(!Tcl_SetVar(interp, s, (value ? "1" : "0"), TCL_GLOBAL_ONLY)) {
fprintf(errfp, "tclsetboolvar(): error setting variable %s to %d\n", s, value);
}
}

View File

@ -323,15 +323,14 @@ void delete(int to_push_undo)
#if HAS_CAIRO==1
int customfont;
#endif
int s_pnetname;
s_pnetname = tclgetboolvar("show_pin_net_names");
dbg(3, "delete(): start\n");
j = 0;
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
rebuild_selected_array();
if(to_push_undo && xctx->lastsel) push_undo();
/* first calculate bbox, because symbol_bbox() needs translate (@#0:net_name) which
* needs prepare_netlist_structs which needs a consistent xctx->inst[] data structure */
@ -339,7 +338,7 @@ void delete(int to_push_undo)
* xctx->prep_net_structs=0;
* xctx->prep_hi_structs=0;
*/
if((show_pin_net_names || xctx->hilight_nets)) prepare_netlist_structs(0);
if((s_pnetname || xctx->hilight_nets)) prepare_netlist_structs(0);
for(i = 0; i < xctx->lastsel; i++) {
n = xctx->sel_array[i].n;
if(xctx->sel_array[i].type == ELEMENT) {
@ -347,7 +346,7 @@ void delete(int to_push_undo)
char *type = (xctx->inst[n].ptr + xctx->sym)->type;
symbol_bbox(n, &xctx->inst[n].x1, &xctx->inst[n].y1, &xctx->inst[n].x2, &xctx->inst[n].y2 );
bbox(ADD, xctx->inst[n].x1, xctx->inst[n].y1, xctx->inst[n].x2, xctx->inst[n].y2 );
if((show_pin_net_names || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type) ) {
if((s_pnetname || xctx->hilight_nets) && type && IS_LABEL_OR_PIN(type) ) {
for(p = 0; p < (xctx->inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) { /* only .node[0] ? */
if( xctx->inst[n].node && xctx->inst[n].node[p]) {
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
@ -355,11 +354,11 @@ void delete(int to_push_undo)
}
}
}
if((show_pin_net_names || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE && xctx->wire[n].node) {
if((s_pnetname || xctx->hilight_nets) && xctx->sel_array[i].type == WIRE && xctx->wire[n].node) {
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
}
if(show_pin_net_names || xctx->hilight_nets) find_inst_to_be_redrawn();
if(s_pnetname || xctx->hilight_nets) find_inst_to_be_redrawn();
/* already done above
@ -470,7 +469,7 @@ void delete(int to_push_undo)
xctx->prep_net_structs=0;
xctx->prep_hi_structs=0;
}
if(autotrim_wires) trim_wires();
if(tclgetboolvar("autotrim_wires")) trim_wires();
del_rect_line_arc_poly();
update_conn_cues(0, 0);
if(xctx->hilight_nets) {
@ -1012,10 +1011,12 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
int c,i, tmpint;
double x, y, r, a, b, xa, ya, xb, yb; /* arc */
xRect tmp;
int en_s;
#if HAS_CAIRO==1
int customfont;
#endif
en_s = tclgetboolvar("enable_stretch");
for(i=0;i<xctx->wires;i++)
{
if(RECTINSIDE(xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2))
@ -1023,12 +1024,12 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
sel ? select_wire(i,SELECTED, 1): select_wire(i,0, 1);
}
else if( sel && enable_stretch && POINTINSIDE(xctx->wire[i].x1,xctx->wire[i].y1, x1,y1,x2,y2) )
else if( sel && en_s && POINTINSIDE(xctx->wire[i].x1,xctx->wire[i].y1, x1,y1,x2,y2) )
{
xctx->ui_state |= SELECTION;
select_wire(i,SELECTED1, 1);
}
else if( sel && enable_stretch && POINTINSIDE(xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2) )
else if( sel && en_s && POINTINSIDE(xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2) )
{
xctx->ui_state |= SELECTION;
select_wire(i,SELECTED2, 1);
@ -1090,7 +1091,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
select_polygon(c, i, SELECTED, 1);
} else if(selected_points) {
/* for polygon, SELECTED1 means partial sel */
if(sel && enable_stretch) select_polygon(c, i, SELECTED1,1);
if(sel && en_s) select_polygon(c, i, SELECTED1,1);
}
}
@ -1102,12 +1103,12 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
xctx->ui_state |= SELECTION;
sel? select_line(c,i,SELECTED,1): select_line(c,i,0,1);
}
else if( sel && enable_stretch && POINTINSIDE(xctx->line[c][i].x1,xctx->line[c][i].y1, x1,y1,x2,y2) )
else if( sel && en_s && POINTINSIDE(xctx->line[c][i].x1,xctx->line[c][i].y1, x1,y1,x2,y2) )
{
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
select_line(c, i,SELECTED1,1);
}
else if( sel && enable_stretch && POINTINSIDE(xctx->line[c][i].x2,xctx->line[c][i].y2, x1,y1,x2,y2) )
else if( sel && en_s && POINTINSIDE(xctx->line[c][i].x2,xctx->line[c][i].y2, x1,y1,x2,y2) )
{
xctx->ui_state |= SELECTION;
select_line(c, i,SELECTED2,1);
@ -1128,17 +1129,17 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
sel? select_arc(c, i, SELECTED,1): select_arc(c, i, 0,1);
}
else if( sel && enable_stretch && POINTINSIDE(x, y, x1, y1, x2, y2) )
else if( sel && en_s && POINTINSIDE(x, y, x1, y1, x2, y2) )
{
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
select_arc(c, i,SELECTED1,1);
}
else if( sel && enable_stretch && POINTINSIDE(xb, yb, x1, y1, x2, y2) )
else if( sel && en_s && POINTINSIDE(xb, yb, x1, y1, x2, y2) )
{
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
select_arc(c, i,SELECTED3,1);
}
else if( sel && enable_stretch && POINTINSIDE(xa, ya, x1, y1, x2, y2) )
else if( sel && en_s && POINTINSIDE(xa, ya, x1, y1, x2, y2) )
{
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
select_arc(c, i,SELECTED2,1);
@ -1152,22 +1153,22 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
sel? select_box(c,i, SELECTED, 1): select_box(c,i, 0, 1);
}
else {
if( sel && enable_stretch && POINTINSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y1, x1,y1,x2,y2) )
if( sel && en_s && POINTINSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y1, x1,y1,x2,y2) )
{ /*20070302 added stretch select */
xctx->ui_state |= SELECTION;
select_box(c, i,SELECTED1,1);
}
if( sel && enable_stretch && POINTINSIDE(xctx->rect[c][i].x2,xctx->rect[c][i].y1, x1,y1,x2,y2) )
if( sel && en_s && POINTINSIDE(xctx->rect[c][i].x2,xctx->rect[c][i].y1, x1,y1,x2,y2) )
{
xctx->ui_state |= SELECTION;
select_box(c, i,SELECTED2,1);
}
if( sel && enable_stretch && POINTINSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y2, x1,y1,x2,y2) )
if( sel && en_s && POINTINSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y2, x1,y1,x2,y2) )
{
xctx->ui_state |= SELECTION;
select_box(c, i,SELECTED3,1);
}
if( sel && enable_stretch && POINTINSIDE(xctx->rect[c][i].x2,xctx->rect[c][i].y2, x1,y1,x2,y2) )
if( sel && en_s && POINTINSIDE(xctx->rect[c][i].x2,xctx->rect[c][i].y2, x1,y1,x2,y2) )
{
xctx->ui_state |= SELECTION;
select_box(c, i,SELECTED4,1);

View File

@ -116,7 +116,11 @@ void global_spice_netlist(int global) /* netlister driver */
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
char *subckt_name;
char *abs_path = NULL;
int top_sub;
int split_f;
split_f = tclgetboolvar("split_files");
top_sub = tclgetboolvar("top_subckt");
xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */
statusmsg("",2); /* clear infowindow */
if(xctx->modified) {
@ -126,8 +130,8 @@ void global_spice_netlist(int global) /* netlister driver */
free_hash(subckt_table);
free_hash(model_table);
record_global_node(2, NULL, NULL); /* delete list of global nodes */
top_subckt = 0;
spiceprefix=1;
top_sub = 0;
tclsetvar("spiceprefix", "1");
bus_char[0] = bus_char[1] = '\0';
xctx->hiersep[0]='.'; xctx->hiersep[1]='\0';
str_tmp = tclgetvar("bus_replacement_char");
@ -184,10 +188,9 @@ void global_spice_netlist(int global) /* netlister driver */
netlist_options(i);
}
}
if(!strcmp(tclgetvar("top_subckt"), "1")) top_subckt = 1;
if(!strcmp(tclgetvar("spiceprefix"), "0")) spiceprefix = 0;
top_sub = tclgetboolvar("top_subckt");
if(!top_subckt) fprintf(fd,"**");
if(!top_sub) fprintf(fd,"**");
fprintf(fd,".subckt %s", skip_dir( xctx->sch[xctx->currsch]) );
/* print top subckt ipin/opins */
@ -245,11 +248,11 @@ void global_spice_netlist(int global) /* netlister driver */
if(first) fprintf(fd,"**** end user architecture code\n");
/* /20100217 */
if(!top_subckt) fprintf(fd,"**");
if(!top_sub) fprintf(fd,"**");
fprintf(fd, ".ends\n");
if(split_files) {
if(split_f) {
fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_SPICE_NETLIST);
@ -288,9 +291,9 @@ void global_spice_netlist(int global) /* netlister driver */
if (str_hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
{
str_hash_lookup(subckt_table, subckt_name, "", XINSERT);
if( split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
if( split_f && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
vhdl_block_netlist(fd, i);
else if(split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
else if(split_f && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
verilog_block_netlist(fd, i);
else
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_primitive",0),"true") )
@ -323,7 +326,7 @@ void global_spice_netlist(int global) /* netlister driver */
/* =================================== 20121223 */
first = 0;
if(!split_files) {
if(!split_f) {
for(i=0;i<xctx->instances;i++) /* print netlist_commands of top level cell with 'place=end' property */
{
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
@ -365,14 +368,14 @@ void global_spice_netlist(int global) /* netlister driver */
/* 20150922 added split_files check */
if(!split_files) fprintf(fd, ".end\n");
if(!split_f) fprintf(fd, ".end\n");
dbg(1, "global_spice_netlist(): starting awk on netlist!\n");
if(!split_files) {
if(!split_f) {
fclose(fd);
if(netlist_show) {
if(tclgetboolvar("netlist_show")) {
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} show {%s}", netl_filename, cellname);
tcleval(tcl_cmd_netlist);
}
@ -422,6 +425,9 @@ void spice_block_netlist(FILE *fd, int i)
/* int multip; */
char *extra=NULL;
char *sch = NULL;
int split_f;
split_f = tclgetboolvar("split_files");
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"spice_stop",0),"true") )
spice_stop=1;
@ -434,7 +440,7 @@ void spice_block_netlist(FILE *fd, int i)
} else {
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
}
if(split_files) {
if(split_f) {
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sym[i].name), getpid());
dbg(1, "spice_block_netlist(): split_files: netl_filename=%s\n", netl_filename);
fd=fopen(netl_filename, "w");
@ -468,7 +474,7 @@ void spice_block_netlist(FILE *fd, int i)
fprintf(fd,"**** end user architecture code\n");
}
fprintf(fd, ".ends\n\n");
if(split_files) {
if(split_f) {
fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_SPICE_NETLIST);
@ -482,7 +488,9 @@ void spice_netlist(FILE *fd, int spice_stop )
{
int i, flag = 0;
char *type=NULL;
int top_sub;
top_sub = tclgetboolvar("top_subckt");
if(!spice_stop) {
xctx->prep_net_structs = 0;
prepare_netlist_structs(1);
@ -496,11 +504,11 @@ void spice_netlist(FILE *fd, int spice_stop )
}
my_strdup(388, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && IS_PIN(type) ) {
if(top_subckt && !flag) {
if(top_sub && !flag) {
fprintf(fd, "*.PININFO ");
flag = 1;
}
if(top_subckt) {
if(top_sub) {
int d = 'X';
if(!strcmp(type, "ipin")) d = 'I';
if(!strcmp(type, "opin")) d = 'O';
@ -511,7 +519,7 @@ void spice_netlist(FILE *fd, int spice_stop )
}
}
}
if(top_subckt) fprintf(fd, "\n");
if(top_sub) fprintf(fd, "\n");
for(i=0;i<xctx->instances;i++) /* ... then print other lines */
{
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;

View File

@ -197,7 +197,7 @@ static void svg_draw_string_line(int layer, char *s, double x, double y, double
if(color_ps)
my_snprintf(col, S(col), "#%02x%02x%02x",
svg_colors[layer].red, svg_colors[layer].green, svg_colors[layer].blue);
else if(dark_colorscheme)
else if(tclgetboolvar("dark_colorscheme"))
my_snprintf(col, S(col), "#%02x%02x%02x", 255, 255, 255);
else
my_snprintf(col, S(col), "#%02x%02x%02x", 0, 0, 0);
@ -225,7 +225,7 @@ static void svg_draw_string_line(int layer, char *s, double x, double y, double
fprintf(fd,"<text fill=\"%s\" xml:space=\"preserve\" font-size=\"%g\" ", col, size*xctx->mooz);
if(strcmp(svg_font_weight, "normal")) fprintf(fd, "font-weight=\"%s\" ", svg_font_weight);
if(strcmp(svg_font_style, "normal")) fprintf(fd, "font-style=\"%s\" ", svg_font_style);
if(strcmp(svg_font_family, svg_font_name)) fprintf(fd, "style=\"font-family:%s;\" ", svg_font_family);
if(strcmp(svg_font_family, tclgetvar("svg_font_name"))) fprintf(fd, "style=\"font-family:%s;\" ", svg_font_family);
if(rot1) fprintf(fd, "transform=\"translate(%g, %g) rotate(%d)\" ", ix, iy, rot1*90);
else fprintf(fd, "transform=\"translate(%g, %g)\" ", ix, iy);
fprintf(fd, ">");
@ -329,8 +329,8 @@ static void old_svg_draw_string(int layer, const char *str,
text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, x,y,
&rx1,&ry1,&rx2,&ry2, &no_of_lines, &longest_line);
#endif
xscale*=nocairo_font_xscale;
yscale*=nocairo_font_yscale;
xscale*=tclgetdoublevar("nocairo_font_xscale");
yscale*=tclgetdoublevar("nocairo_font_yscale");
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) return;
x=rx1;y=ry1;
if(rot&1) {y=ry2;rot=3;}
@ -367,8 +367,8 @@ static void svg_drawgrid()
{
double x,y;
double delta,tmp;
if(!draw_grid) return;
delta=cadgrid* xctx->mooz;
if(!tclgetboolvar("draw_grid")) return;
delta=tclgetdoublevar("cadgrid")* xctx->mooz;
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
x = xctx->xorigin* xctx->mooz;y = xctx->yorigin* xctx->mooz;
if(y>xctx->areay1 && y<xctx->areay2)
@ -490,7 +490,7 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
}
/* display PINLAYER colored instance texts even if PINLAYER disabled */
if(xctx->inst[n].color == PINLAYER || enable_layer[textlayer]) {
my_snprintf(svg_font_family, S(svg_font_family), svg_font_name);
my_snprintf(svg_font_family, S(svg_font_family), tclgetvar("svg_font_name"));
my_snprintf(svg_font_style, S(svg_font_style), "normal");
my_snprintf(svg_font_weight, S(svg_font_weight), "normal");
textfont = symptr->text[j].font;
@ -534,7 +534,7 @@ static void fill_svg_colors()
svg_colors[i].red = (c & 0xff0000) >> 16;
svg_colors[i].green = (c & 0x00ff00) >> 8;
svg_colors[i].blue = (c & 0x0000ff);
} else if(dark_colorscheme) {
} else if(tclgetboolvar("dark_colorscheme")) {
svg_colors[i].red = 255;
svg_colors[i].green = 255;
svg_colors[i].blue = 255;
@ -579,8 +579,8 @@ void svg_draw(void)
fprintf(errfp, "svg_draw(): calloc error\n");tcleval( "exit");
}
fill_svg_colors();
old_grid=draw_grid;
draw_grid=0;
old_grid=tclgetboolvar("draw_grid");
tclsetvar("draw_grid", "0");
dx=xctx->xschem_w;
dy=xctx->xschem_h;
dbg(1, "svg_draw(): dx=%g dy=%g\n", dx, dy);
@ -662,14 +662,14 @@ void svg_draw(void)
fprintf(fd, " stroke-linecap:round;\n");
fprintf(fd, " stroke-linejoin:round;\n");
fprintf(fd, " stroke-width: %g;\n", svg_linew);
if(i == 0 && transparent_svg) {
if(i == 0 && tclgetboolvar("transparent_svg")) {
fprintf(fd, " fill-opacity: 0;\n");
fprintf(fd, " stroke-opacity: 0;\n");
}
fprintf(fd, "}\n");
}
fprintf(fd, "text {font-family: %s;}\n", svg_font_name);
fprintf(fd, "text {font-family: %s;}\n", tclgetvar("svg_font_name"));
fprintf(fd, "</style>\n");
/* background */
@ -679,7 +679,7 @@ void svg_draw(void)
{
textlayer = xctx->text[i].layer;
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
my_snprintf(svg_font_family, S(svg_font_family), svg_font_name);
my_snprintf(svg_font_family, S(svg_font_family), tclgetvar("svg_font_name"));
my_snprintf(svg_font_style, S(svg_font_style), "normal");
my_snprintf(svg_font_weight, S(svg_font_weight), "normal");
textfont = xctx->text[i].font;
@ -767,8 +767,7 @@ void svg_draw(void)
dbg(1, "svg_draw(): INT_WIDTH(lw)=%d\n",INT_WIDTH(xctx->lw));
fprintf(fd, "</svg>\n");
fclose(fd);
draw_grid=old_grid;
tclsetboolvar("draw_grid", old_grid);
my_free(964, &svg_colors);
my_free(1217, &unused_layer);
Tcl_SetResult(interp,"",TCL_STATIC);

View File

@ -135,7 +135,7 @@ void global_tedax_netlist(int global) /* netlister driver */
dbg(1, "global_tedax_netlist(): starting awk on netlist!\n");
fclose(fd);
if(netlist_show) {
if(tclgetboolvar("netlist_show")) {
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} show {%s}", netl_filename, cellname);
tcleval(tcl_cmd_netlist);
}

View File

@ -658,7 +658,7 @@ char *get_pin_attr_from_inst(int inst, int pin, const char *attr)
return pin_attr_value; /* caller is responsible for freeing up storage for pin_attr_value */
}
void new_prop_string(int i, const char *old_prop, int fast, int disable_unique_names)
void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
{
/* given a old_prop property string, return a new */
/* property string in xctx->inst[i].prop_ptr such that the element name is */
@ -696,7 +696,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int disable_unique_n
}
prefix=old_name[0];
/* don't change old_prop if name does not conflict. */
if(disable_unique_names || (entry = inst_hash_lookup(table, old_name, i, XLOOKUP, old_name_len))==NULL ||
if(dis_uniq_names || (entry = inst_hash_lookup(table, old_name, i, XLOOKUP, old_name_len))==NULL ||
entry->value == i)
{
inst_hash_lookup(table, old_name, i, XINSERT, old_name_len);
@ -1633,7 +1633,7 @@ int print_spice_element(FILE *fd, int inst)
token_pos=0;
/* if spiceprefix==0 and token == @spiceprefix then set empty value */
if (!spiceprefix && !strcmp(token, "@spiceprefix")) {
if (!tclgetboolvar("spiceprefix") && !strcmp(token, "@spiceprefix")) {
value=NULL;
} else {
int tok_val_len;
@ -2774,7 +2774,11 @@ const char *translate(int inst, const char* s)
int escape=0;
char date[200];
char *sch = NULL;
int sp_prefix;
int s_pnetname;
s_pnetname = tclgetboolvar("show_pin_net_names");
sp_prefix = tclgetboolvar("spiceprefix");
if(!s) {
my_free(1063, &result);
return empty;
@ -2814,7 +2818,7 @@ const char *translate(int inst, const char* s)
/* dbg(2, "translate(): token=%s\n", token);*/
/* if spiceprefix==0 and token == @spiceprefix then set empty value */
if(!spiceprefix && !strcmp(token, "@spiceprefix")) {
if(!sp_prefix && !strcmp(token, "@spiceprefix")) {
value = NULL;
xctx->get_tok_size = 0;
} else {
@ -2900,7 +2904,7 @@ const char *translate(int inst, const char* s)
if( !pin_attr_value && !strcmp(pin_attr, "net_name")) {
char *instprop = xctx->inst[inst].prop_ptr;
char *symprop = (xctx->inst[inst].ptr + xctx->sym)->prop_ptr;
if(show_pin_net_names && (!strcmp(get_tok_value(instprop, "net_name", 0), "true") ||
if(s_pnetname && (!strcmp(get_tok_value(instprop, "net_name", 0), "true") ||
!strcmp(get_tok_value(symprop, "net_name", 0), "true"))) {
prepare_netlist_structs(0);
my_strdup2(1175, &pin_attr_value,
@ -3085,7 +3089,7 @@ const char *translate2(struct Lcc *lcc, int level, char* s)
token_pos = 0;
/* if spiceprefix==0 and token == @spiceprefix then set empty value */
if(!spiceprefix && !strcmp(token, "@spiceprefix")) {
if(!tclgetboolvar("spiceprefix") && !strcmp(token, "@spiceprefix")) {
my_free(1069, &value1);
xctx->get_tok_size = 0;
} else {

View File

@ -39,7 +39,9 @@ void global_verilog_netlist(int global) /* netlister driver */
struct stat buf;
char *subckt_name;
char *abs_path = NULL;
int split_f;
split_f = tclgetboolvar("split_files");
xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */
statusmsg("",2); /* clear infowindow */
if(xctx->modified) {
@ -262,7 +264,7 @@ void global_verilog_netlist(int global) /* netlister driver */
fprintf(fd,"---- end user architecture code\n");
fprintf(fd, "endmodule\n");
if(split_files) {
if(split_f) {
fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_VERILOG_NETLIST);
@ -301,9 +303,9 @@ void global_verilog_netlist(int global) /* netlister driver */
if (str_hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
{
str_hash_lookup(subckt_table, subckt_name, "", XINSERT);
if( split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
if( split_f && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
vhdl_block_netlist(fd, i);
else if(split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
else if(split_f && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
spice_block_netlist(fd, i);
else
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_primitive",0), "true"))
@ -331,9 +333,9 @@ void global_verilog_netlist(int global) /* netlister driver */
my_free(1074, &stored_flags);
dbg(1, "global_verilog_netlist(): starting awk on netlist!\n");
if(!split_files) {
if(!split_f) {
fclose(fd);
if(netlist_show) {
if(tclgetboolvar("netlist_show")) {
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} show {%s}", netl_filename, cellname);
tcleval(tcl_cmd_netlist);
}
@ -366,7 +368,9 @@ void verilog_block_netlist(FILE *fd, int i)
char cellname[PATH_MAX];
const char *str_tmp;
char *sch = NULL;
int split_f;
split_f = tclgetboolvar("split_files");
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"verilog_stop",0),"true") )
verilog_stop=1;
else
@ -378,7 +382,7 @@ void verilog_block_netlist(FILE *fd, int i)
} else {
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
}
if(split_files) {
if(split_f) {
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
netlist_dir, skip_dir(xctx->sym[i].name), getpid());
dbg(1, "global_vhdl_netlist(): split_files: netl_filename=%s\n", netl_filename);
@ -491,7 +495,7 @@ void verilog_block_netlist(FILE *fd, int i)
}
fprintf(fd,"---- end user architecture code\n");
fprintf(fd, "endmodule\n");
if(split_files) {
if(split_f) {
fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_VERILOG_NETLIST);

View File

@ -39,7 +39,9 @@ void global_vhdl_netlist(int global) /* netlister driver */
struct stat buf;
char *subckt_name;
char *abs_path = NULL;
int split_f;
split_f = tclgetboolvar("split_files");
xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */
statusmsg("",2); /* clear infowindow */
/* top sch properties used for library use declarations and type definitions */
@ -316,7 +318,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
}
fprintf(fd, "end arch_%s ;\n\n", skip_dir( xctx->sch[xctx->currsch]) );
if(split_files) {
if(split_f) {
fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_VHDL_NETLIST);
@ -356,9 +358,9 @@ void global_vhdl_netlist(int global) /* netlister driver */
if (str_hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
{
str_hash_lookup(subckt_table, subckt_name, "", XINSERT);
if( split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
if( split_f && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
verilog_block_netlist(fd, i);
else if( split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
else if( split_f && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
spice_block_netlist(fd, i);
else
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_primitive",0),"true"))
@ -386,9 +388,9 @@ void global_vhdl_netlist(int global) /* netlister driver */
draw_hilight_net(1);
my_free(1088, &stored_flags);
dbg(1, "global_vhdl_netlist(): starting awk on netlist!\n");
if(!split_files) {
if(!split_f) {
fclose(fd);
if(netlist_show) {
if(tclgetboolvar("netlist_show")) {
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} show {%s}", netl_filename, cellname);
tcleval(tcl_cmd_netlist);
}
@ -420,7 +422,9 @@ void vhdl_block_netlist(FILE *fd, int i)
const char *str_tmp;
char *abs_path = NULL;
char *sch = NULL;
int split_f;
split_f = tclgetboolvar("split_files");
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"vhdl_stop",0),"true") )
vhdl_stop=1;
else
@ -432,7 +436,7 @@ void vhdl_block_netlist(FILE *fd, int i)
} else {
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
}
if(split_files) {
if(split_f) {
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sym[i].name), getpid());
dbg(1, "vhdl_block_netlist(): split_files: netl_filename=%s\n", netl_filename);
fd=fopen(netl_filename, "w");
@ -606,7 +610,7 @@ void vhdl_block_netlist(FILE *fd, int i)
if(xctx->schvhdlprop && xctx->schvhdlprop[0]) fprintf(fd, "%s\n", xctx->schvhdlprop);
fprintf(fd, "end arch_%s ;\n\n", skip_dir(xctx->sym[i].name) ); /* skip_dir( xctx->sch[xctx->currsch]) ); */
if(split_files) {
if(split_f) {
fclose(fd);
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
override_netlist_type(CAD_VHDL_NETLIST);

View File

@ -267,7 +267,7 @@ void init_color_array(double dim)
double rr, gg, bb;
static int done=0;
dim_bg = tclgetvar("color_dim")[0] == '1' ? 1: 0;
dim_bg = tclgetboolvar("color_dim");
for(i=0;i<cadlayers;i++) {
my_snprintf(s, S(s), "lindex $colors %d",i);
tcleval(s);
@ -667,7 +667,7 @@ void xwin_exit(void)
int build_colors(double dim)
{
int i;
if(dark_colorscheme) {
if(tclgetboolvar("dark_colorscheme")) {
tcleval("llength $dark_colors");
if(atoi(tclresult())>=cadlayers){
tcleval("set colors $dark_colors");
@ -920,9 +920,11 @@ void change_linewidth(double w)
changed=0;
/* choose line width automatically based on zoom */
if(w<0.) {
if(change_lw) {
xctx->lw=xctx->mooz * 0.09 * cadsnap;
cadhalfdotsize = CADHALFDOTSIZE + 0.04 * (cadsnap-10);
int cs;
cs = tclgetdoublevar("cadsnap");
if(tclgetboolvar("change_lw")) {
xctx->lw=xctx->mooz * 0.09 * cs;
cadhalfdotsize = CADHALFDOTSIZE + 0.04 * (cs-10);
changed=1;
}
/* explicitly set line width */
@ -979,7 +981,8 @@ void resetcairo(int create, int clear, int force_or_resize)
fprintf(errfp, "ERROR: invalid cairo xcb surface\n");
}
xctx->cairo_save_ctx = cairo_create(xctx->cairo_save_sfc);
cairo_select_font_face(xctx->cairo_save_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face(xctx->cairo_save_ctx, tclgetvar("cairo_font_name"),
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(xctx->cairo_save_ctx, 20);
cairo_set_line_width(xctx->cairo_save_ctx, 1);
cairo_set_line_join(xctx->cairo_save_ctx, CAIRO_LINE_JOIN_ROUND);
@ -1001,7 +1004,8 @@ void resetcairo(int create, int clear, int force_or_resize)
fprintf(errfp, "ERROR: invalid cairo surface\n");
}
xctx->cairo_ctx = cairo_create(xctx->cairo_sfc);
cairo_select_font_face(xctx->cairo_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face(xctx->cairo_ctx, tclgetvar("cairo_font_name"),
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(xctx->cairo_ctx, 20);
cairo_set_line_width(xctx->cairo_ctx, 1);
cairo_set_line_join(xctx->cairo_ctx, CAIRO_LINE_JOIN_ROUND);
@ -1108,6 +1112,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
struct stat buf;
const char *home_buff;
int running_in_src_dir;
int fs;
/* XVisualInfo vinfo; */
#if HAS_XCB==1
@ -1399,8 +1404,6 @@ int Tcl_AppInit(Tcl_Interp *inter)
dbg(1, "Tcl_AppInit(): resolved xschem_executable=%s\n", xschem_executable);
/* set global variables fetching data from tcl code 25122002 */
if(tclgetvar("dark_colorscheme")[0] == '1') dark_colorscheme = 1;
else dark_colorscheme = 0;
if(netlist_type==-1) {
if(!strcmp(tclgetvar("netlist_type"),"vhdl") ) netlist_type=CAD_VHDL_NETLIST;
else if(!strcmp(tclgetvar("netlist_type"),"verilog") ) netlist_type=CAD_VERILOG_NETLIST;
@ -1411,33 +1414,26 @@ int Tcl_AppInit(Tcl_Interp *inter)
override_netlist_type(-1); /* set tcl netlist_type */
}
split_files=atoi(tclgetvar("split_files"));
netlist_show=atoi(tclgetvar("netlist_show"));
unzoom_nodrift=atoi(tclgetvar("unzoom_nodrift"));
show_pin_net_names = atoi(tclgetvar("show_pin_net_names"));
cairo_font_line_spacing = tclgetdoublevar("cairo_font_line_spacing");
if(color_ps==-1)
color_ps=atoi(tclgetvar("color_ps"));
else {
my_snprintf(tmp, S(tmp), "%d",color_ps);
tclsetvar("color_ps",tmp);
}
if(transparent_svg==-1)
transparent_svg=atoi(tclgetvar("transparent_svg"));
else {
my_snprintf(tmp, S(tmp), "%d",transparent_svg);
tclsetvar("transparent_svg",tmp);
}
change_lw=atoi(tclgetvar("change_lw"));
l_width=atoi(tclgetvar("line_width"));
if(change_lw == 1) l_width = 0.0;
if(tclgetboolvar("change_lw")) l_width = 0.0;
draw_window=atoi(tclgetvar("draw_window"));
incr_hilight=atoi(tclgetvar("incr_hilight"));
enable_stretch=atoi(tclgetvar("enable_stretch"));
big_grid_points=atoi(tclgetvar("big_grid_points"));
draw_grid=atoi(tclgetvar("draw_grid"));
cadlayers=atoi(tclgetvar("cadlayers"));
if(debug_var==-10) debug_var=0;
my_snprintf(tmp, S(tmp), "%.16g",CADGRID);
Tcl_VarEval(interp, "set_ne cadgrid ", tmp, NULL);
my_snprintf(tmp, S(tmp), "%.16g",CADSNAP);
Tcl_VarEval(interp, "set_ne cadsnap ", tmp, NULL);
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 */
@ -1571,8 +1567,6 @@ int Tcl_AppInit(Tcl_Interp *inter)
resetwin(1, 0, 1, 0, 0);
#if HAS_CAIRO==1
/* load font from tcl 20171112 */
tcleval("xschem set svg_font_name $svg_font_name");
tcleval("xschem set cairo_font_name $cairo_font_name");
tclsetvar("has_cairo","1");
#endif
@ -1618,9 +1612,9 @@ int Tcl_AppInit(Tcl_Interp *inter)
/* */
if(has_x) tcleval("pack_widgets");
fullscreen=atoi(tclgetvar("fullscreen"));
if(fullscreen) {
fullscreen = 0;
fs=tclgetintvar("fullscreen");
if(fs) {
tclsetvar("fullscreen", "0");
tcleval("update");
toggle_fullscreen(".");
}

View File

@ -712,47 +712,21 @@ extern Xschem_ctx *xctx;
extern int cadlayers;
extern int has_x;
extern int rainbow_colors;
extern int persistent_command;
extern int autotrim_wires;
extern int disable_unique_names;
extern int change_lw; /* allow change line width*/
extern int incr_hilight;
extern int auto_hilight;
extern int big_grid_points;
extern int draw_grid;
extern double cadgrid;
extern double cadsnap;
extern int draw_window;
extern unsigned short enable_stretch;
extern int split_files;
extern char *netlist_dir;
extern int sym_txt;
extern int fullscreen;
extern int en_hilight_conn_inst;
extern int transparent_svg;
extern int color_ps;
extern int only_probes;
extern int unzoom_nodrift;
extern int spiceprefix;
extern int netlist_show;
extern double nocairo_vert_correct;
extern double nocairo_font_xscale;
extern double nocairo_font_yscale;
extern char svg_font_name[80];
extern int top_subckt;
extern char *netlist_dir;
extern int color_ps;
extern int constrained_move;
extern int netlist_type;
extern int dark_colorscheme;
extern int flat_netlist;
extern int hide_symbols; /* draw only a bounding box for component instances and @symname, @name texts */
extern int show_pin_net_names;
extern int *enable_layer;
extern int hide_symbols;
extern int sym_txt;
extern double cairo_font_scale; /* default: 1.0, allows to adjust font size */
extern char cairo_font_name[80];
extern double cairo_font_line_spacing; /* allows to change line spacing: default: 1.0 */
extern double cairo_vert_correct;
extern double nocairo_vert_correct;
extern double cairo_font_line_spacing;
extern int debug_var;
extern double color_dim; /* can not be put in Xctx unless all X11 colors are reset on window change */
/*********** End of variables backed in xschem.tcl ***********/
extern int help;
extern char *cad_icon[];
@ -778,11 +752,6 @@ extern int fill_pattern; /* fill rectangles, can not be put in Xctx, since it s
extern int text_svg;
extern int text_ps;
extern double cadhalfdotsize;
extern XEvent xev;
extern KeySym key;
extern unsigned int button;
extern unsigned int state; /* status of shift,ctrl etc.. */
extern char *xschem_version_string;
extern char initial_netlist_name[PATH_MAX];
extern char bus_char[];
extern int yyparse_error;
@ -802,11 +771,10 @@ extern Window pre_window;
extern Window parent_of_topwindow;
extern unsigned char **pixdata;
extern unsigned char pixdata_init[22][32];
extern GC *gc, *gcstipple, gctiled;
extern GC *gc, *gcstipple;
extern Display *display;
extern int screen_number;
extern int screendepth;
extern XRectangle *rectangle;
extern Pixmap cad_icon_pixmap, cad_icon_mask, *pixmap;
extern XColor xcolor_array[];
extern Visual *visual;
@ -1046,7 +1014,13 @@ extern int xschem(ClientData clientdata, Tcl_Interp *interp,
extern const char *tcleval(const char str[]);
extern const char *tclresult(void);
extern const char *tclgetvar(const char *s);
extern int tclgetboolvar(const char *s);
extern int tclgetintvar(const char *s);
extern double tclgetdoublevar(const char *s);
extern void tclsetvar(const char *s, const char *value);
extern void tclsetdoublevar(const char *s, const double value);
extern void tclsetboolvar(const char *s, const int value);
extern void tclsetintvar(const char *s, const int value);
extern const char *tcl_hook2(char **res);
extern void statusmsg(char str[],int n);
extern int place_text(int draw_text, double mx, double my);
@ -1092,7 +1066,7 @@ extern void *my_calloc(int id, size_t nmemb, size_t size);
extern void my_free(int id, void *ptr);
extern size_t my_strcat(int id, char **, const char *);
extern const char *subst_token(const char *s, const char *tok, const char *new_val);
extern void new_prop_string(int i, const char *old_prop,int fast, int disable_unique_names);
extern void new_prop_string(int i, const char *old_prop,int fast, int dis_uniq_names);
extern void hash_name(char *token, int remove);
extern void hash_all_names(int n);
extern void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2);

View File

@ -2011,6 +2011,7 @@ proc select_layers {} {
}
proc color_dim {} {
global color_dim
toplevel .dim -class dialog
wm title .dim {Dim colors}
checkbutton .dim.bg -text {Dim background} -variable color_dim
@ -2018,7 +2019,7 @@ proc color_dim {} {
-showvalue 1 -command {xschem color_dim} -orient horizontal \
-from -5 -to 5 -resolution 0.1
button .dim.ok -text OK -command {destroy .dim}
.dim.scale set [xschem get dim]
.dim.scale set $color_dim
pack .dim.scale
pack .dim.bg -side left
pack .dim.ok -side right -anchor e
@ -3603,34 +3604,22 @@ proc build_widgets { {topwin {} } } {
-command {
if { $color_ps==1 } {xschem set color_ps 1} else { xschem set color_ps 0}
}
$topwin.menubar.option.menu add checkbutton -label "Transparent SVG background" -variable transparent_svg \
-command {
if { $transparent_svg==1 } {xschem set transparent_svg 1} else { xschem set transparent_svg 0}
}
$topwin.menubar.option.menu add checkbutton -label "Transparent SVG background" -variable transparent_svg
$topwin.menubar.option.menu add checkbutton -label "Debug mode" -variable menu_debug_var \
-command {
if { $menu_debug_var==1 } {xschem debug 1} else { xschem debug 0}
}
$topwin.menubar.option.menu add checkbutton -label "Enable stretch" -variable enable_stretch \
-accelerator Y \
-command {
if { $enable_stretch==1 } {xschem set enable_stretch 1} else { xschem set enable_stretch 0}
}
-accelerator Y
$topwin.menubar.option.menu add checkbutton -label "Show netlist win" -variable netlist_show \
-accelerator {Shift+A} \
-command {
if { $netlist_show==1 } {xschem set netlist_show 1} else { xschem set netlist_show 0}
}
-accelerator {Shift+A}
$topwin.menubar.option.menu add checkbutton -label "Flat netlist" -variable flat_netlist \
-accelerator : \
-command {
if { $flat_netlist==1 } {xschem set flat_netlist 1} else { xschem set flat_netlist 0}
}
$topwin.menubar.option.menu add checkbutton -label "Split netlist" -variable split_files \
-accelerator {} \
-command {
if { $split_files==1 } {xschem set split_files 1} else { xschem set split_files 0}
}
-accelerator {}
$topwin.menubar.option.menu add checkbutton -label "hspice / ngspice netlist" -variable hspice_netlist \
-accelerator {} \
-command {
@ -3647,32 +3636,15 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.option.menu add checkbutton -label "Draw grid" -variable draw_grid \
-accelerator {%} \
-command {
if { $draw_grid == 1} { xschem set draw_grid 1; xschem redraw} else { xschem set draw_grid 0; xschem redraw}
xschem redraw
}
$topwin.menubar.option.menu add checkbutton -label "Variable grid point size" -variable big_grid_points \
-command {
if { $big_grid_points == 1} {
xschem set big_grid_points 1
xschem redraw
} else {
xschem set big_grid_points 0
xschem redraw
}
}
-command { xschem redraw }
$topwin.menubar.option.menu add checkbutton -label "Symbol text" -variable sym_txt \
-accelerator {Ctrl+B} \
-command {
if { $sym_txt == 1} { xschem set sym_txt 1; xschem redraw} else { xschem set sym_txt 0; xschem redraw}
}
-accelerator {Ctrl+B} -command { xschem set sym_txt $sym_txt; xschem redraw }
$topwin.menubar.option.menu add checkbutton -label "Toggle variable line width" -variable change_lw \
-accelerator {_} \
-command {
if { $change_lw == 1} { xschem set change_lw 1} else { xschem set change_lw 0}
}
$topwin.menubar.option.menu add checkbutton -label "Increment Hilight Color" -variable incr_hilight \
-command {
if { $incr_hilight == 1} { xschem set incr_hilight 1} else { xschem set incr_hilight 0}
}
-accelerator {_}
$topwin.menubar.option.menu add checkbutton -label "Increment Hilight Color" -variable incr_hilight
$topwin.menubar.option.menu add command -label "Set line width" \
-command {
@ -3814,7 +3786,7 @@ proc build_widgets { {topwin {} } } {
}
$topwin.menubar.view.menu add checkbutton -label "Show net names on symbol pins" -variable show_pin_net_names \
-command {
xschem set show_pin_net_names $show_pin_net_names
xschem show_pin_net_names
xschem redraw
}
$topwin.menubar.view.menu add checkbutton -label "Show Toolbar" -variable toolbar_visible \
@ -3830,7 +3802,8 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.prop.menu add command -label "View" -command "xschem view_prop" -accelerator Ctrl+Shift+Q
$topwin.menubar.prop.menu add command -background red -label "Edit file (danger!)" \
-command "xschem edit_file" -accelerator Alt+Q
$topwin.menubar.sym.menu add radiobutton -label "Show Symbols" -variable hide_symbols -value 0 \
$topwin.menubar.sym.menu add radiobutton -label "Show Symbols" \
-variable hide_symbols -value 0 \
-command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B
$topwin.menubar.sym.menu add radiobutton -label "Show instance Bounding boxes for subcircuit symbols" \
-variable hide_symbols -value 1 \
@ -3859,11 +3832,8 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.sym.menu add command -label "Create pins from highlight nets" \
-command "xschem print_hilight_net 0" -accelerator Ctrl-J
$topwin.menubar.sym.menu add checkbutton -label "Allow duplicated instance names (refdes)" \
-variable disable_unique_names -command {
xschem set disable_unique_names $disable_unique_names
}
$topwin.menubar.tools.menu add checkbutton -label "Remember last command" -variable persistent_command \
-command {xschem set persistent_command $persistent_command}
-variable disable_unique_names
$topwin.menubar.tools.menu add checkbutton -label "Remember last command" -variable persistent_command
$topwin.menubar.tools.menu add command -label "Insert symbol" -command "xschem place_symbol" -accelerator {Ins, Shift-I}
toolbar_create ToolInsertSymbol "xschem place_symbol" "Insert Symbol" $topwin
$topwin.menubar.tools.menu add command -label "Insert wire label" -command "xschem net_label 1" -accelerator {Alt-L}
@ -3896,7 +3866,6 @@ proc build_widgets { {topwin {} } } {
toolbar_create ToolBreak "xschem break_wires" "Break wires at selected\ninstance pin intersections" $topwin
$topwin.menubar.tools.menu add checkbutton -label "Auto Join/Trim Wires" -variable autotrim_wires \
-command {
xschem set autotrim_wires $autotrim_wires
if {$autotrim_wires == 1} {
xschem trim_wires
xschem redraw
@ -3927,16 +3896,9 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.hilight.menu add command -label {Un-highlight selected net/pins} \
-command "xschem unhilight" -accelerator Ctrl+K
# 20160413
$topwin.menubar.hilight.menu add checkbutton -label {Auto-highlight net/pins} -variable auto_hilight \
-command {
if { $auto_hilight == 1} {
xschem set auto_hilight 1
} else {
xschem set auto_hilight 0
}
}
$topwin.menubar.hilight.menu add checkbutton -label {Auto-highlight net/pins} -variable auto_hilight
$topwin.menubar.hilight.menu add checkbutton -label {Enable highlight connected instances} \
-variable en_hilight_conn_inst -command {xschem set en_hilight_conn_inst $en_hilight_conn_inst}
-variable en_hilight_conn_inst
$topwin.menubar.simulation.menu add command -label "Set netlist Dir" \
-command {
@ -3969,7 +3931,7 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.simulation.menu add separator
$topwin.menubar.simulation.menu add checkbutton -label "LVS netlist: Top level is a .subckt" -variable top_subckt
$topwin.menubar.simulation.menu add checkbutton -label "Use 'spiceprefix' attribute" -variable spiceprefix \
-command {xschem set spiceprefix $spiceprefix; xschem save; xschem reload}
-command {xschem save; xschem reload}
toolbar_create Netlist { xschem netlist } "Create netlist" $topwin
toolbar_create Simulate "
@ -4235,8 +4197,6 @@ set_ne enable_stretch 0
set_ne constrained_move 0
set_ne draw_grid 1
set_ne big_grid_points 0
set_ne cadsnap 10
set_ne cadgrid 20
set_ne persistent_command 0
set_ne autotrim_wires 0
set_ne disable_unique_names 0
@ -4301,7 +4261,7 @@ set_ne svg_font_name {Sans-Serif}
set has_cairo 0
set rotated_text {} ;#20171208
set_ne dark_colorscheme 1
set_ne color_dim 1
set_ne color_dim 0.0
##### set colors
if {!$rainbow_colors} {
set_ne cadlayers 22
@ -4382,22 +4342,10 @@ set_initial_dirs
set custom_token {lab}
set search_value {}
set search_exact 0
xschem set persistent_command $persistent_command
xschem set autotrim_wires $autotrim_wires
xschem set disable_unique_names $disable_unique_names
# 20171005
set custom_label_prefix {}
# 20171112 cairo stuff
xschem set cairo_font_scale $cairo_font_scale
xschem set nocairo_font_xscale $nocairo_font_xscale
xschem set nocairo_font_yscale $nocairo_font_yscale
xschem set cairo_font_line_spacing $cairo_font_line_spacing
xschem set cairo_vert_correct $cairo_vert_correct
xschem set nocairo_vert_correct $nocairo_vert_correct
# font name can not be set here as we need to wait for X-initialization
# to complete. Done in xinit.c
###
### build Tk widgets