cairo_font_scale can be changed runtime to rescale text fonts, hier_hilight_hash_lookup(() function to hilight an arbitrary hierarchic net; improved xschem list_hilights command

This commit is contained in:
Stefan Schippers 2024-03-24 19:34:30 +01:00
parent 642ee525ac
commit 85d7e565a3
7 changed files with 56 additions and 16 deletions

View File

@ -944,8 +944,12 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
20230211_010031 {/home/.../ngspice/pv_ngspice.sch}
20221011_175308 {/home/.../ngspice/diode_ngspice.sch}
20221014_091945 {/home/.../ngspice/comp_ngspice.sch}</pre>
<li><kbd> list_hilights [sep]</kbd></li><pre>
Sorted list of highlight nets, separated by character 'sep' (default: space) </pre>
<li><kbd> list_hilights [sep | all | all_nets | all_inst]</kbd></li><pre>
Sorted list of non port or non top level current level highlight nets,
separated by character 'sep' (default: space)
if `all_inst` is given list all instance hilights
if `all_nets` is given list all net hilights
if `all` is given list all hash content </pre>
<li><kbd> list_nets</kbd></li><pre>
List all nets with type (in / out / inout / net) </pre>
<li><kbd> list_tokens str with_quotes</kbd></li><pre>

View File

@ -4405,6 +4405,7 @@ void draw(void)
if(!xctx || xctx->no_draw) return;
cs = tclgetdoublevar("cadsnap");
cairo_font_scale = tclgetdoublevar("cairo_font_scale");
xctx->cadhalfdotsize = CADHALFDOTSIZE * (cs < 20. ? cs : 20.) / 10.;
xctx->crosshair_layer = tclgetintvar("crosshair_layer");
if(xctx->crosshair_layer < 0 ) xctx->crosshair_layer = 2;

View File

@ -194,6 +194,18 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha
return ptr2;
}
Hilight_hashentry *hier_hilight_hash_lookup(const char *token, int value, char *path, int what)
{
Hilight_hashentry *entry;
char *oldpath = xctx->sch_path[xctx->currsch];
xctx->sch_path_hash[xctx->currsch] = 0;
xctx->sch_path[xctx->currsch] = path;
entry = bus_hilight_hash_lookup(token, value, what);
xctx->sch_path[xctx->currsch] = oldpath;
xctx->sch_path_hash[xctx->currsch] = 0;
return entry;
}
/* what:
* 1: list only nets
* 2: list only intances
@ -2259,7 +2271,7 @@ void print_hilight_net(int show)
my_free(_ALLOC_ID_, &filetmp2);
}
void list_hilights(void)
void list_hilights(int all)
{
int i, first = 1;
Hilight_hashentry *entry;
@ -2268,6 +2280,17 @@ void list_hilights(void)
Tcl_ResetResult(interp);
prepare_netlist_structs(1); /* use full prepare_netlist_structs(1) to recognize pin direction */
/* when creating pins from hilight nets 20171221 */
if(all) {
for(i=0;i<HASHSIZE; ++i) {
entry=xctx->hilight_table[i];
for( entry=xctx->hilight_table[i]; entry; entry = entry->next) {
if(all == 1 && entry->token[0] == ' ') continue;
if(all == 2 && entry->token[0] != ' ') continue;
Tcl_AppendResult(interp, entry->path, " ",
entry->token, " ", my_itoa(entry->value), "\n", NULL);
}
}
} else
for(i=0;i<HASHSIZE; ++i) {
entry=xctx->hilight_table[i];
while(entry) {
@ -2278,7 +2301,7 @@ void list_hilights(void)
entry->token[0] == '#' ? entry->token + 1 : entry->token, NULL);
first = 0;
}
entry = entry ->next ;
entry = entry ->next;
}
}
}

View File

@ -825,7 +825,7 @@ int raw_read_from_attr(Raw **rawptr, const char *type, double sweep1, double swe
res = raw_read(tmp_filename, rawptr, type, sweep1, sweep2);
unlink(tmp_filename);
} else {
dbg(0, "read_rawfile_from_attr(): failed to open file %s for reading\n", tmp_filename);
dbg(0, "raw_read_from_attr(): failed to open file %s for reading\n", tmp_filename);
}
}
}

View File

@ -2545,19 +2545,25 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_free(_ALLOC_ID_, &res);
}
/* list_hilights [sep]
* Sorted list of highlight nets, separated by character 'sep' (default: space) */
/* list_hilights [sep | all | all_nets | all_inst]
* Sorted list of non port or non top level current level highlight nets,
* separated by character 'sep' (default: space)
* if `all_inst` is given list all instance hilights
* if `all_nets` is given list all net hilights
* if `all` is given list all hash content */
else if(!strcmp(argv[1], "list_hilights"))
{
const char *sep;
const char *sep = "{ }";
int i, all = 0;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 2) {
sep = argv[2];
} else {
sep = "{ }";
for(i = 2; i < argc; i++) {
if(!strcmp(argv[i], "all")) all = 3;
else if(!strcmp(argv[i], "all_inst")) all = 2;
else if(!strcmp(argv[i], "all_nets")) all = 1;
else sep = argv[i];
}
list_hilights();
tclvareval("join [lsort -decreasing -dictionary {", tclresult(), "}] ", sep, NULL);
list_hilights(all);
if(!all) tclvareval("join [lsort -decreasing -dictionary {", tclresult(), "}] ", sep, NULL);
}
/* list_nets
@ -5409,6 +5415,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
else if(argc > 2 && atoi(argv[2]) == 2) {
prepare_netlist_structs(0);
hier_hilight_hash_lookup("LDCP_REF", 0, ".x17.xctrl.", XINSERT);
hier_hilight_hash_lookup(" x4", 1, ".x17.xctrl.", XINSERT);
propagate_hilights(1, 0, XINSERT_NOREPLACE);
Tcl_ResetResult(interp);
}
else if(argc > 2 && atoi(argv[2]) == 3) {

View File

@ -1303,6 +1303,8 @@ extern void save_ascii_string(const char *ptr, FILE *fd, int newline);
extern Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int what) ;
/* wrapper function to hash highlighted instances, avoid clash with net names */
extern Hilight_hashentry *inst_hilight_hash_lookup(int i, int value, int what);
/* wrapper to bus_hilight_hash_lookup that provides a signal path instead of using xctx->sch_path */
extern Hilight_hashentry *hier_hilight_hash_lookup(const char *token, int value, char *path, int what);
extern Hilight_hashentry *hilight_lookup(const char *token, int value, int what);
extern int search(const char *tok, const char *val, int sub, int sel, int match_case);
extern int process_options(int argc, char **argv);
@ -1709,7 +1711,7 @@ extern char *str_replace(const char *str, const char *rep, const char *with, int
extern char *escape_chars(const char *source, const char *charset);
extern int set_different_token(char **s,const char *new, const char *old);
extern void print_hilight_net(int show);
extern void list_hilights(void);
extern void list_hilights(int all);
extern void change_layer();
extern void launcher();
extern void windowid(const char *winpath);

View File

@ -6871,7 +6871,7 @@ set tctx::global_list {
INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR XSCHEM_LIBRARY_PATH
add_all_windows_drives auto_hilight autofocus_mainwindow
autotrim_wires bespice_listen_port big_grid_points bus_replacement_char cadgrid cadlayers
cadsnap cairo_font_name change_lw color_ps tctx::colors compare_sch constr_mv
cadsnap cairo_font_name cairo_font_scale change_lw color_ps tctx::colors compare_sch constr_mv
copy_cell crosshair_layer custom_label_prefix custom_token dark_colors dark_colorscheme
dark_gui_colorscheme delay_flag dim_bg dim_value disable_unique_names
do_all_inst draw_crosshair