added menu entries to set and conmpare with schematic.

This commit is contained in:
Stefan Frederik 2022-08-25 13:59:36 +02:00
parent a2de3e9c1b
commit d279783faa
20 changed files with 179 additions and 96 deletions

View File

@ -291,7 +291,7 @@ re_comp(const char *pat)
}
static const char *bol;
const char *bol;
const char *bopat[MAXTAG];
const char *eopat[MAXTAG];
static const char *pmatch(const char *, CHAR *, int *);

View File

@ -3,6 +3,7 @@
extern const char *bopat[];
extern const char *eopat[];
extern const char *bol;
extern char *re_comp(const char *);

View File

@ -459,7 +459,7 @@ void ask_new_file(void)
dbg(1, "ask_new_file(): load file: %s\n", f);
clear_all_hilights();
xctx->currsch = 0;
unselect_all();
unselect_all(1);
remove_symbols();
load_schematic(1, f,1); /* 20180925.1 */
tclvareval("update_recent_file {", f, "}", NULL);
@ -1324,7 +1324,7 @@ int descend_schematic(int instnumber)
hilight_child_pins();
get_sch_from_sym(filename, xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym);
unselect_all();
unselect_all(1);
remove_symbols();
load_schematic(1,filename, 1);
@ -1363,7 +1363,7 @@ void go_back(int confirm) /* 20171006 add confirm */
}
}
if(save_ok==0) return;
unselect_all();
unselect_all(1);
remove_symbols();
from_embedded_sym=0;
if(strstr(xctx->sch[xctx->currsch], ".xschem_embedded_")) {
@ -2057,7 +2057,7 @@ void change_layer()
}
}
if(xctx->lastsel) delete_only_rect_line_arc_poly();
unselect_all();
unselect_all(1);
}
void new_arc(int what, double sweep)

View File

@ -111,7 +111,7 @@ static void abort_operation(void)
set_modify(0); /* aborted merge: no change, so reset modify flag set by delete() */
}
xctx->ui_state = 0;
unselect_all();
unselect_all(1);
draw();
}
@ -123,7 +123,7 @@ static void start_place_symbol(double mx, double my)
tclvareval("set INITIALINSTDIR [file dirname {",
abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), "}]", NULL);
}
unselect_all();
unselect_all(1);
xctx->mx_double_save = xctx->mousex_snap;
xctx->my_double_save = xctx->mousey_snap;
if(place_symbol(-1,NULL,xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/* to_push_undo */) ) {
@ -955,7 +955,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if( stat(xctx->sel_or_clip, &buf) && (xctx->ui_state & STARTCOPY) )
{
copy_objects(ABORT); /* also unlinks sel_or_flip file */
unselect_all();
unselect_all(1);
}
/* xschem window *receiving* selected objects */
/* no selected objects and selection file exists */
@ -1048,10 +1048,10 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(abs(mx-xctx->mx_save) > 8 ||
abs(my-xctx->my_save) > 8 ) { /* set reasonable threshold before unsel */
if(xctx->onetime) {
unselect_all(); /* 20171026 avoid multiple calls of unselect_all() */
unselect_all(1); /* 20171026 avoid multiple calls of unselect_all() */
xctx->onetime=0;
}
xctx->ui_state|=STARTSELECT; /* set it again cause unselect_all() clears it... */
xctx->ui_state|=STARTSELECT; /* set it again cause unselect_all(1) clears it... */
}
}
}
@ -1358,7 +1358,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
if(key=='p' && state == Mod1Mask) /* add symbol pin */
{
unselect_all();
unselect_all(1);
storeobject(-1, xctx->mousex_snap-2.5, xctx->mousey_snap-2.5, xctx->mousex_snap+2.5, xctx->mousey_snap+2.5,
xRECT, PINLAYER, SELECTED, "name=XXX\ndir=inout");
xctx->need_reb_sel_arr=1;
@ -1606,6 +1606,10 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
}
break;
}
if(key=='x' && state == Mod1Mask) /* compare schematics(must set first) */
{
compare_schematics("");
}
if(key=='x' && state == ControlMask) /* cut selection into clipboard */
{
if(xctx->semaphore >= 2) break;
@ -1716,7 +1720,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
"-message {Are you sure you want to reload from disk?}");
if(strcmp(tclresult(),"ok")==0) {
char filename[PATH_MAX];
unselect_all();
unselect_all(1);
remove_symbols();
my_strncpy(filename, abs_sym_path(xctx->sch[xctx->currsch], ""), S(filename));
load_schematic(1, filename, 1);
@ -2052,7 +2056,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
{
yyparse_error = 0;
if(xctx->semaphore >= 2) break;
unselect_all();
unselect_all(1);
if(set_netlist_dir(0, NULL)) {
dbg(1, "callback(): -------------\n");
if(xctx->netlist_type == CAD_SPICE_NETLIST)
@ -2075,7 +2079,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
{
yyparse_error = 0;
if(xctx->semaphore >= 2) break;
unselect_all();
unselect_all(1);
if( set_netlist_dir(0, NULL) ) {
dbg(1, "callback(): -------------\n");
if(xctx->netlist_type == CAD_SPICE_NETLIST)
@ -2586,7 +2590,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
xctx->mx_double_save=xctx->mousex_snap;
xctx->my_double_save=xctx->mousey_snap;
if( !(state & ShiftMask) && !(state & Mod1Mask) ) {
unselect_all();
unselect_all(1);
#ifndef __unix__
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gctiled, xctx->xrect[0].x, xctx->xrect[0].y,
xctx->xrect[0].width, xctx->xrect[0].height, xctx->xrect[0].x, xctx->xrect[0].y);

View File

@ -1408,7 +1408,7 @@ void edit_property(int x)
case ELEMENT:
edit_symbol_property(x);
while( x == 0 && tclgetvar("edit_symbol_prop_new_sel")[0] == '1' ) {
unselect_all();
unselect_all(1);
select_object(xctx->mousex, xctx->mousey, SELECTED, 0);
rebuild_selected_array();
if(xctx->lastsel && xctx->sel_array[0].type ==ELEMENT) {

View File

@ -29,12 +29,12 @@ void compile_font(void)
xctx->currsch = 0;
my_snprintf(name, S(name), "%s/systemlib/font.sch", tclgetvar("XSCHEM_SHAREDIR"));
unselect_all();
unselect_all(1);
remove_symbols();
load_schematic(1,name,0);
for(code=0;code<127;code++)
{
unselect_all();
unselect_all(1);
select_inside(code*FONTOFFSET-1,-FONTHEIGHT-1,
code*FONTOFFSET+FONTWIDTH+1,FONTWHITESPACE + FONTDESCENT+1, 1);
rebuild_selected_array();
@ -58,7 +58,7 @@ void compile_font(void)
dbg(2, "};\n");
}
clear_drawing();
unselect_all();
unselect_all(1);
xctx->currsch = 0;
my_strncpy(xctx->sch[xctx->currsch], "", S(xctx->sch[xctx->currsch]));
}

View File

@ -1700,7 +1700,7 @@ void unhilight_net(void)
draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
unselect_all();
unselect_all(1);
}
/* redraws the whole affected rectangle, this avoids artifacts due to antialiased text */

View File

@ -479,7 +479,7 @@ void mem_pop_undo(int redo, int set_modify_status)
}
slot = xctx->cur_undo_ptr%MAX_UNDO;
clear_drawing();
unselect_all();
unselect_all(1);
my_free(1345, &xctx->wire);
my_free(1346, &xctx->text);
my_free(1347, &xctx->inst);

View File

@ -1047,9 +1047,9 @@ void prepare_netlist_structs(int for_netlist)
}
int compare_schematics(const char *filename)
int compare_schematics(const char *f)
{
Int_hashentry *table[HASHSIZE];
Int_hashentry *table1[HASHSIZE], *table2[HASHSIZE];
Int_hashentry *found;
char *s = NULL;
int i;
@ -1057,21 +1057,29 @@ int compare_schematics(const char *filename)
char current_sch[PATH_MAX];
int ret=0; /* ret==0 means no differences found */
if(f == NULL) {
tcleval("load_file_dialog {Schematic to compare with} .sch.sym INITIALLOADDIR");
if(tclresult()[0]) my_strncpy(xctx->sch_to_compare, tclresult(), S(xctx->sch_to_compare));
else my_strncpy(xctx->sch_to_compare, "", S(xctx->sch_to_compare));
} else if(f[0] != '\0') {
my_strncpy(xctx->sch_to_compare, f, S(xctx->sch_to_compare));
}
if(!xctx->sch_to_compare[0]) {
dbg(0, "compare_schematics() schematic to compare with not set\n");
return -1;
}
memset(table1, 0, HASHSIZE * sizeof(Int_hashentry *));
memset(table2, 0, HASHSIZE * sizeof(Int_hashentry *));
my_strncpy(current_sch, abs_sym_path(xctx->current_name, ""), S(current_sch));
clear_all_hilights();
unselect_all();
remove_symbols();
xctx->no_draw = 1;
load_schematic(1, filename, 1);
memset(table, 0, HASHSIZE * sizeof(Int_hashentry *));
/* HASH SCHEMATIC 1 */
for(i = 0; i < xctx->instances; i++) {
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
my_realloc(1534, &s, l);
my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name,
xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip,
xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
int_hash_lookup(table, s, i, XINSERT_NOREPLACE);
int_hash_lookup(table1, s, i, XINSERT_NOREPLACE);
}
for(i=0;i<xctx->wires;i++)
{
@ -1080,19 +1088,61 @@ int compare_schematics(const char *filename)
my_snprintf(s, l, "N %g %g %g %g %s", xctx->wire[i].x1, xctx->wire[i].y1,
xctx->wire[i].x2, xctx->wire[i].y2,
xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
int_hash_lookup(table, s, i, XINSERT_NOREPLACE);
int_hash_lookup(table1, s, i, XINSERT_NOREPLACE);
}
clear_all_hilights();
unselect_all(1);
remove_symbols();
xctx->no_draw = 1;
load_schematic(1, xctx->sch_to_compare, 1);
/* HASH SCHEMATIC 2 , CHECK SCHEMATIC 2 WITH SCHEMATIC 1 */
for(i = 0; i < xctx->instances; i++) {
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
my_realloc(1534, &s, l);
my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name,
xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip,
xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
int_hash_lookup(table2, s, i, XINSERT_NOREPLACE);
found = int_hash_lookup(table1, s, i, XLOOKUP);
if(!found) {
dbg(1, "schematic 2 instance %d: %s mismatch or not found in schematic 1\n", i,
xctx->inst[i].instname ? xctx->inst[i].instname : "");
select_element(i,SELECTED, 1, 1);
ret = 1;
}
}
for(i=0;i<xctx->wires;i++)
{
l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
my_realloc(1535, &s, l);
my_snprintf(s, l, "N %g %g %g %g %s", xctx->wire[i].x1, xctx->wire[i].y1,
xctx->wire[i].x2, xctx->wire[i].y2,
xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
int_hash_lookup(table2, s, i, XINSERT_NOREPLACE);
found = int_hash_lookup(table1, s, i, XLOOKUP);
if(!found) {
dbg(1, "schematic 2 net %d: %s mismatch or not found in schematic 1\n", i,
xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
select_wire(i, SELECTED, 1);
ret = 1;
}
}
if(ret) {
rebuild_selected_array();
draw_selection(xctx->gc[PINLAYER], 0);
}
unselect_all(0);
load_schematic(1, current_sch, 1);
xctx->no_draw = 0;
/* CHECK SCHEMATIC 1 WITH SCHEMATIC 2*/
for(i = 0; i < xctx->instances; i++) {
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
my_realloc(1536,&s, l);
my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name,
xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip,
xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
found = int_hash_lookup(table, s, i, XLOOKUP);
found = int_hash_lookup(table2, s, i, XLOOKUP);
if(!found) {
select_element(i,SELECTED, 1, 1);
ret = 1;
@ -1105,14 +1155,16 @@ int compare_schematics(const char *filename)
my_snprintf(s, l, "N %g %g %g %g %s", xctx->wire[i].x1, xctx->wire[i].y1,
xctx->wire[i].x2, xctx->wire[i].y2,
xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
found = int_hash_lookup(table, s, i, XLOOKUP);
found = int_hash_lookup(table2, s, i, XLOOKUP);
if(!found) {
select_wire(i, SELECTED, 1);
ret = 1;
}
}
int_hash_free(table);
draw();
int_hash_free(table1);
int_hash_free(table2);
rebuild_selected_array();
draw_selection(xctx->gc[SELLAYER], 0);
my_free(1531, &s);
return ret;
}

View File

@ -352,7 +352,7 @@ void merge_file(int selection_load, const char ext[])
xctx->prep_hash_wires=0;
got_mouse = 0;
xctx->push_undo();
unselect_all();
unselect_all(1);
old=xctx->instances;
while(!endfile)
{

View File

@ -1830,7 +1830,7 @@ int save_schematic(const char *schname) /* 20171020 added return value */
tcleval("alert_ {file opening for write failed!} {}");
return 0;
}
unselect_all();
unselect_all(1);
write_xschem_file(fd);
fclose(fd);
/* update time stamp */
@ -2127,7 +2127,7 @@ void pop_undo(int redo, int set_modify_status)
xctx->cur_undo_ptr--; /* will be restored after building file name */
}
clear_drawing();
unselect_all();
unselect_all(1);
#if HAS_POPEN==1
my_snprintf(diff_name, S(diff_name), "gzip -d -c %s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO);
@ -3282,13 +3282,13 @@ void descend_symbol(void)
}
save_embedded_symbol(xctx->inst[xctx->sel_array[0].n].ptr+xctx->sym, fd);
fclose(fd);
unselect_all();
unselect_all(1);
remove_symbols(); /* must follow save (if) embedded */
/* load_symbol(name_embedded); */
load_schematic(1, name_embedded, 1);
} else {
/* load_symbol(abs_sym_path(name, "")); */
unselect_all();
unselect_all(1);
remove_symbols(); /* must follow save (if) embedded */
load_schematic(1, abs_sym_path(name, ""), 1);
}

View File

@ -289,7 +289,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(!strcmp(argv[1],"add_symbol_pin"))
{
cmd_found = 1;
unselect_all();
unselect_all(1);
storeobject(-1, xctx->mousex_snap-2.5, xctx->mousey_snap-2.5, xctx->mousex_snap+2.5, xctx->mousey_snap+2.5,
xRECT, PINLAYER, SELECTED, "name=XXX\ndir=inout");
xctx->need_reb_sel_arr=1;
@ -302,7 +302,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(!strcmp(argv[1],"add_graph"))
{
cmd_found = 1;
unselect_all();
unselect_all(1);
xctx->graph_lastsel = xctx->rects[GRIDLAYER];
storeobject(-1, xctx->mousex_snap-400, xctx->mousey_snap-200, xctx->mousex_snap+400, xctx->mousey_snap+200,
xRECT, GRIDLAYER, SELECTED,
@ -336,7 +336,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
{
char str[PATH_MAX+100];
cmd_found = 1;
unselect_all();
unselect_all(1);
tcleval("tk_getOpenFile -filetypes { {{Png} {.png}} {{All files} *} }");
if(tclresult()[0]) {
my_snprintf(str, S(str), "flags=image,unscaled\nalpha=0.8\nimage=%s\n", tclresult());
@ -487,7 +487,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
int i;
xctx->currsch = 0;
unselect_all();
unselect_all(1);
remove_symbols();
clear_drawing();
if(argc>=3 && !strcmp(argv[2],"SYMBOL")) {
@ -552,6 +552,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(argc > 2) {
ret = compare_schematics(argv[2]);
}
else {
ret = compare_schematics(NULL);
}
Tcl_SetResult(interp, my_itoa(ret), TCL_VOLATILE);
}
@ -1623,7 +1626,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
if(!skip) {
clear_all_hilights();
unselect_all();
unselect_all(1);
if(!undo_reset) xctx->push_undo();
xctx->currsch = 0;
remove_symbols();
@ -1735,7 +1738,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(!strcmp(argv[1],"net_label"))
{
cmd_found = 1;
unselect_all();
unselect_all(1);
if(argc>=3) place_net_label(atoi(argv[2]));
}
@ -1867,7 +1870,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
tclvareval("set INITIALINSTDIR [file dirname {",
abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), "}]", NULL);
}
unselect_all();
unselect_all(1);
xctx->mx_double_save = xctx->mousex_snap;
xctx->my_double_save = xctx->mousey_snap;
if(argc == 4) {
@ -1894,7 +1897,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xctx->semaphore++;
xctx->last_command = 0;
unselect_all();
unselect_all(1);
xctx->mx_double_save = xctx->mousex_snap;
xctx->my_double_save = xctx->mousey_snap;
if(place_text(0, xctx->mousex_snap, xctx->mousey_snap)) { /* 1 = draw text 24122002 */
@ -2195,7 +2198,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"reload"))
{
cmd_found = 1;
unselect_all();
unselect_all(1);
remove_symbols();
load_schematic(1, xctx->sch[xctx->currsch], 1);
if(argc >= 3 && !strcmp(argv[2], "zoom_full") ) {
@ -2883,7 +2886,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"unselect_all"))
{
cmd_found = 1;
unselect_all();
if(argc > 2) unselect_all(atoi(argv[2]));
else unselect_all(1);
Tcl_ResetResult(interp);
}
}

View File

@ -579,14 +579,14 @@ void bbox(int what,double x1,double y1, double x2, double y2)
}
}
void unselect_all(void)
void unselect_all(int dr)
{
int i,c;
char str[PATH_MAX];
#if HAS_CAIRO==1
int customfont;
#endif
dbg(1, "unselect_all(): start\n");
dbg(1, "unselect_all(1): start\n");
xctx->ui_state = 0;
xctx->lastsel = 0;
@ -596,12 +596,14 @@ void unselect_all(void)
{
xctx->wire[i].sel = 0;
{
if(xctx->wire[i].bus)
drawtempline(xctx->gctiled, THICK, xctx->wire[i].x1, xctx->wire[i].y1,
if(dr) {
if(xctx->wire[i].bus)
drawtempline(xctx->gctiled, THICK, xctx->wire[i].x1, xctx->wire[i].y1,
xctx->wire[i].x2, xctx->wire[i].y2);
else
drawtempline(xctx->gctiled, ADD, xctx->wire[i].x1, xctx->wire[i].y1,
xctx->wire[i].x2, xctx->wire[i].y2);
else
drawtempline(xctx->gctiled, ADD, xctx->wire[i].x1, xctx->wire[i].y1,
xctx->wire[i].x2, xctx->wire[i].y2);
}
}
}
}
@ -610,7 +612,7 @@ void unselect_all(void)
if(xctx->inst[i].sel == SELECTED)
{
xctx->inst[i].sel = 0;
for(c=0;c<cadlayers;c++)
if(dr) for(c=0;c<cadlayers;c++)
draw_temp_symbol(ADD, xctx->gctiled, i, c,0,0,0.0,0.0);
}
}
@ -619,16 +621,18 @@ void unselect_all(void)
if(xctx->text[i].sel == SELECTED)
{
xctx->text[i].sel = 0;
#if HAS_CAIRO==1
customfont = set_text_custom_font(& xctx->text[i]); /* needed for bbox calculation */
#endif
draw_temp_string(xctx->gctiled,ADD, xctx->text[i].txt_ptr,
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
xctx->text[i].x0, xctx->text[i].y0,
xctx->text[i].xscale, xctx->text[i].yscale);
#if HAS_CAIRO==1
if(customfont) cairo_restore(xctx->cairo_ctx);
#endif
if(dr) {
#if HAS_CAIRO==1
customfont = set_text_custom_font(& xctx->text[i]); /* needed for bbox calculation */
#endif
draw_temp_string(xctx->gctiled,ADD, xctx->text[i].txt_ptr,
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
xctx->text[i].x0, xctx->text[i].y0,
xctx->text[i].xscale, xctx->text[i].yscale);
#if HAS_CAIRO==1
if(customfont) cairo_restore(xctx->cairo_ctx);
#endif
}
}
}
for(c=0;c<cadlayers;c++)
@ -638,7 +642,7 @@ void unselect_all(void)
if(xctx->arc[c][i].sel)
{
xctx->arc[c][i].sel = 0;
drawtemparc(xctx->gctiled, ADD, xctx->arc[c][i].x, xctx->arc[c][i].y,
if(dr) drawtemparc(xctx->gctiled, ADD, xctx->arc[c][i].x, xctx->arc[c][i].y,
xctx->arc[c][i].r, xctx->arc[c][i].a, xctx->arc[c][i].b);
}
}
@ -647,7 +651,7 @@ void unselect_all(void)
if(xctx->rect[c][i].sel)
{
xctx->rect[c][i].sel = 0;
drawtemprect(xctx->gctiled, ADD, xctx->rect[c][i].x1, xctx->rect[c][i].y1,
if(dr) drawtemprect(xctx->gctiled, ADD, xctx->rect[c][i].x1, xctx->rect[c][i].y1,
xctx->rect[c][i].x2, xctx->rect[c][i].y2);
}
}
@ -656,12 +660,14 @@ void unselect_all(void)
if(xctx->line[c][i].sel)
{
xctx->line[c][i].sel = 0;
if(xctx->line[c][i].bus)
drawtempline(xctx->gctiled, THICK, xctx->line[c][i].x1, xctx->line[c][i].y1,
if(dr) {
if(xctx->line[c][i].bus)
drawtempline(xctx->gctiled, THICK, xctx->line[c][i].x1, xctx->line[c][i].y1,
xctx->line[c][i].x2, xctx->line[c][i].y2);
else
drawtempline(xctx->gctiled, ADD, xctx->line[c][i].x1, xctx->line[c][i].y1,
xctx->line[c][i].x2, xctx->line[c][i].y2);
else
drawtempline(xctx->gctiled, ADD, xctx->line[c][i].x1, xctx->line[c][i].y1,
xctx->line[c][i].x2, xctx->line[c][i].y2);
}
}
}
for(i=0;i<xctx->polygons[c];i++)
@ -671,18 +677,20 @@ void unselect_all(void)
int k;
for(k=0;k<xctx->poly[c][i].points; k++) xctx->poly[c][i].selected_point[k] = 0;
xctx->poly[c][i].sel = 0;
drawtemppolygon(xctx->gctiled, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points);
if(dr) drawtemppolygon(xctx->gctiled, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points);
}
}
}
drawtemparc(xctx->gctiled, END, 0.0, 0.0, 0.0, 0.0, 0.0);
drawtemprect(xctx->gctiled, END, 0.0, 0.0, 0.0, 0.0);
drawtempline(xctx->gctiled,END, 0.0, 0.0, 0.0, 0.0);
if(dr) {
drawtemparc(xctx->gctiled, END, 0.0, 0.0, 0.0, 0.0, 0.0);
drawtemprect(xctx->gctiled, END, 0.0, 0.0, 0.0, 0.0);
drawtempline(xctx->gctiled,END, 0.0, 0.0, 0.0, 0.0);
}
xctx->ui_state &= ~SELECTION;
/*\statusmsg("",2); */
my_snprintf(str, S(str), "%s/%s", user_conf_dir, ".selection.sch"); /* 20161115 PWD->HOME */
xunlink(str);
dbg(1, "unselect_all(): done\n");
dbg(1, "unselect_all(1): done\n");
}
void select_wire(int i,unsigned short select_mode, int fast)

View File

@ -39,7 +39,7 @@ void hier_psprint(void) /* netlister driver */
zoom_full(0, 0, 1, 0.97);
ps_draw(2); /* page */
dbg(1,"--> %s\n", skip_dir( xctx->sch[xctx->currsch]) );
unselect_all();
unselect_all(1);
remove_symbols(); /* ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
@ -75,7 +75,7 @@ void hier_psprint(void) /* netlister driver */
my_free(1229, &subckt_name);
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
xctx->currsch--;
unselect_all();
unselect_all(1);
xctx->pop_undo(0, 0);
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name));
ps_draw(4); /* trailer */
@ -348,7 +348,7 @@ void global_spice_netlist(int global) /* netlister driver */
if(global)
{
int saved_hilight_nets = xctx->hilight_nets;
unselect_all();
unselect_all(1);
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
@ -388,7 +388,7 @@ void global_spice_netlist(int global) /* netlister driver */
/*clear_drawing(); */
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
xctx->currsch--;
unselect_all();
unselect_all(1);
xctx->pop_undo(0, 0);
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name));
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */

View File

@ -181,7 +181,7 @@ void global_tedax_netlist(int global) /* netlister driver */
if(global) /* was if(global) ... 20180901 no hierarchical tEDAx netlist for now */
{
int saved_hilight_nets = xctx->hilight_nets;
unselect_all();
unselect_all(1);
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
@ -206,7 +206,7 @@ void global_tedax_netlist(int global) /* netlister driver */
/*clear_drawing(); */
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
xctx->currsch--;
unselect_all();
unselect_all(1);
xctx->pop_undo(0, 0);
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name));
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */

View File

@ -141,7 +141,7 @@ void global_verilog_netlist(int global) /* netlister driver */
dbg(1, "global_verilog_netlist(): printing top level entity\n");
fprintf(fd,"module %s (\n", skip_dir( xctx->sch[xctx->currsch]) );
/* flush data structures (remove unused symbols) */
unselect_all();
unselect_all(1);
remove_symbols(); /* removed 25122002, readded 04112003 */
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
@ -333,7 +333,7 @@ void global_verilog_netlist(int global) /* netlister driver */
if(global)
{
int saved_hilight_nets = xctx->hilight_nets;
unselect_all();
unselect_all(1);
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
@ -371,7 +371,7 @@ void global_verilog_netlist(int global) /* netlister driver */
my_free(1073, &subckt_name);
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
xctx->currsch--;
unselect_all();
unselect_all(1);
xctx->pop_undo(0, 0);
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name));
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */

View File

@ -200,7 +200,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
/* 20071015 end */
/* flush data structures (remove unused symbols) */
unselect_all();
unselect_all(1);
remove_symbols(); /* removed 25122002, readded 04112003.. this removes unused symbols */
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
@ -428,7 +428,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
if(global)
{
int saved_hilight_nets = xctx->hilight_nets;
unselect_all();
unselect_all(1);
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0);
@ -467,7 +467,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
my_free(1087, &subckt_name);
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
xctx->currsch--;
unselect_all();
unselect_all(1);
xctx->pop_undo(0, 0);
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name));
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */

View File

@ -476,6 +476,9 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->prep_hash_wires = 0;
xctx->modified = 0;
xctx->semaphore = 0;
xctx->current_name[0] = '\0';
xctx->sel_or_clip[0] = '\0';
xctx->sch_to_compare[0] = '\0';
xctx->tok_size = 0;
xctx->netlist_name[0] = '\0';
xctx->flat_netlist = 0;
@ -534,6 +537,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->hilight_nets = 0;
xctx->hilight_color = 0;
for(i=0;i<CADMAXHIER;i++) {
xctx->sch[i][0] = '\0';
xctx->sch_path[i]=NULL;
xctx->sch_path_hash[i]=0;
xctx->hier_attr[i].prop_ptr = NULL;
@ -632,8 +636,8 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
static void delete_schematic_data(void)
{
dbg(1, "delete_schematic_data()\n");
unselect_all();
/* clear static data in get_tok_value() must be done after unselect_all()
unselect_all(1);
/* clear static data in get_tok_value() must be done after unselect_all(1)
* as this functions re-uses get_tok_value() */
get_tok_value(NULL, NULL, 0); /* clear static data in function */
/* delete inst and wire node fields, delete inst_pin spatial hash, and node hash table */

View File

@ -848,6 +848,8 @@ typedef struct {
int nl_points, nl_maxpoints;
/* select_rect */
double nl_xr, nl_yr, nl_xr2, nl_yr2;
/* compare_schematics */
char sch_to_compare[PATH_MAX];
/* pan */
double xpan,ypan,xpan2,ypan2;
double p_xx1,p_xx2,p_yy1,p_yy2;
@ -1112,7 +1114,7 @@ extern int text_bbox_nocairo(const char * str,double xscale, double yscale,
extern unsigned short select_object(double mx,double my, unsigned short sel_mode,
int override_lock); /* return type 20160503 */
extern void unselect_all(void);
extern void unselect_all(int dr);
extern void select_inside(double x1,double y1, double x2, double y2, int sel);
extern int Tcl_AppInit(Tcl_Interp *interp);
extern int callback(const char *winpath, int event, int mx, int my, KeySym key,

View File

@ -5236,6 +5236,14 @@ proc build_widgets { {topwin {} } } {
-command { xschem connected_nets}
$topwin.menubar.tools.menu add command -label "Select conn. wires, stop at junctions" \
-accelerator {Ctrl-Righ Butt.} -command { xschem connected_nets 1 }
$topwin.menubar.hilight.menu add command \
-label {Set schematic to compare and compare with} \
-command "xschem compare_schematics"
$topwin.menubar.hilight.menu add command \
-label {Compare schematics} \
-command "xschem compare_schematics {}" \
-accelerator {Alt-X}
$topwin.menubar.hilight.menu add command \
-label {Highlight net-pin name mismatches on selected instances} \
-command "xschem net_pin_mismatch" \