initial support for auto_hilight_graph_nodes

This commit is contained in:
stefan schippers 2024-03-25 11:39:57 +01:00
parent 77a5cecef8
commit aa6182c65f
8 changed files with 60 additions and 23 deletions

View File

@ -3632,6 +3632,9 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
if(strpbrk(express, " \n\t")) {
expression = 1;
}
if(!expression && tclgetboolvar("auto_hilight_graph_nodes")) {
hilight_graph_node(express, wc);
}
}
/* quickly find index number of ntok_copy variable to be plotted */
if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1 ) {

View File

@ -257,6 +257,33 @@ static int there_are_hilights()
return 0;
}
int hilight_graph_node(const char *node, int col)
{
const char *path;
char *n = NULL;
char *nptr, *ptr;
Hilight_hashentry *entry;
if(strchr(node, '.')) return 0;
path = xctx->sch_path[xctx->currsch];
my_strdup2(_ALLOC_ID_, &n, node);
nptr = n;
if(strstr(n, "i(")) {nptr[1] = ' '; nptr += 1;}
else if(strstr(n, "I(")) {nptr[1] = ' '; nptr += 1;}
if((ptr = strchr(n, ')'))) *ptr = '\0';
dbg(1, "hilight_graph_node(): %s: %d\n", n, col);
entry = hier_hilight_hash_lookup(nptr, -col, path, XLOOKUP);
if(!entry || entry->value != -col ) {
hier_hilight_hash_lookup(nptr, -col, path, XINSERT);
dbg(1, "hilight_graph_node(): propagate_hilights(), col=%d\n", col);
propagate_hilights(1, 0, XINSERT_NOREPLACE);
}
my_free(_ALLOC_ID_, &n);
return 1;
}
/* by default:
* xctx->active_layer[0] = 7
* xctx->active_layer[1] = 8

View File

@ -5414,9 +5414,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
del_object_table();
Tcl_ResetResult(interp);
}
else if(argc > 4 && atoi(argv[2]) == 2) {
else if(argc > 5 && atoi(argv[2]) == 2) {
prepare_netlist_structs(0);
hier_hilight_hash_lookup(argv[4], 0, argv[3], XINSERT);
hier_hilight_hash_lookup(argv[4], atoi(argv[5]), argv[3], XINSERT);
propagate_hilights(1, 0, XINSERT_NOREPLACE);
Tcl_ResetResult(interp);
}

View File

@ -1344,6 +1344,7 @@ extern int text_bbox(const char * str,double xscale, double yscale,
double x1,double y1, double *rx1, double *ry1,
double *rx2, double *ry2, int *cairo_lines, double *longest_line);
extern void create_memory_cairo_ctx(int what);
extern int hilight_graph_node(const char *node, int col);
extern int get_color(int value);
extern void incr_hilight_color(void);
extern void get_inst_pin_coord(int i, int j, double *x, double *y);

View File

@ -6869,7 +6869,7 @@ proc no_open_dialogs {} {
set tctx::global_list {
PDK_ROOT PDK SKYWATER_MODELS SKYWATER_STDCELLS
INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR XSCHEM_LIBRARY_PATH
add_all_windows_drives auto_hilight autofocus_mainwindow
add_all_windows_drives auto_hilight auto_hilight_graph_nodes autofocus_mainwindow
autotrim_wires bespice_listen_port big_grid_points bus_replacement_char cadgrid cadlayers
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
@ -7867,6 +7867,8 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.simulation.menu add cascade -label "Graphs" -menu $topwin.menubar.simulation.menu.graph
menu $topwin.menubar.simulation.menu.graph -tearoff 0
$topwin.menubar.simulation.menu.graph add checkbutton -label {Auto highlight plotted nets} \
-selectcolor $selectcolor -variable auto_hilight_graph_nodes
$topwin.menubar.simulation.menu.graph add command -label {Add waveform graph} -command {xschem add_graph}
$topwin.menubar.simulation.menu.graph add command -label {Add waveform reload launcher} -command {
xschem place_symbol [rel_sym_path [find_file_first launcher.sym]] "name=h5\ndescr=\"load waves\"
@ -8358,6 +8360,7 @@ if {$OS == "Windows"} {
set_ne launcher_default_program {xdg-open}
}
set_ne auto_hilight 0
set_ne auto_hilight_graph_nodes 0
set_ne use_tclreadline 1
set_ne en_hilight_conn_inst 0
## xpm to png conversion

View File

@ -234,6 +234,9 @@
#### enable drawing the grid. Default: enabled (1)
# set draw_grid 1
#### auto highlight nodes shown in graphs: default: not enabled (0)
# set auto_hilight_graph_nodes 0
#### enable stretch mode: when dragging a selection rectangle that cuts wires these are stretched
#### to follow the selected objects when moved. Default: not enabled (0).
#### This can be normally done by dragging with the Control key pressed.

View File

@ -55,12 +55,12 @@ divy = 12
x1=0.0246194
x2=0.0249318
divx=10
node="outp
outm
vpp
vnn
x1.vboost
x0.vboost"
node="OUTP
OUTM
VPP
VNN
x1.VBOOST
x0.VBOOST"
color="4 15 6 12 7 4"
unitx=m
hilight_wave=-1

View File

@ -91,15 +91,15 @@ subdivy=1
x1=5e-10
x2=0.001
divx=8
node="panel
led" unitx=m
node="PANEL
LED" unitx=m
color="7 4"
jpeg_quality=30
linewidth_mult=2.0
hilight_wave=-1}
B 2 1260 -390 1680 -220 {flags=graph
y1 = 3.35
y2 = 10.05
y1 = -0.0012
y2 = 6.8
divy = 4
subdivy=1
x1=5e-10
@ -107,9 +107,9 @@ x2=0.001
divx=8
unitx=m
color="7 4 6"
node="i(vpanel)
i(vled)
\\"R.Avg. I(vpanel); i(vpanel) 20u ravg()\\""
node="i(Vpanel)
i(Vled)
\\"R.Avg. I(VPANEL); i(VPANEL) 20u ravg()\\""
jpeg_quality=30
linewidth_mult=2.0}
B 2 1260 -750 1680 -560 {flags=graph
@ -123,10 +123,10 @@ divx=9
unitx=m subdivx=4
color="7 4 6 10"
node="\\"Panel power; i(vpanel) v(panel) *\\"
\\"Led power; i(vled) v(led) *\\"
\\"Avg.Pan. Pwr; i(vpanel) v(panel) * 20u ravg()\\"
\\"SUN \\\\%; sun 100 *\\""
node="\\"Panel power; i(Vpanel) v(PANEL) *\\"
\\"Led power; i(Vled) v(LED) *\\"
\\"Avg.Pan. Pwr; i(Vpanel) v(PANEL) * 20u ravg()\\"
\\"SUN \\\\%; SUN 100 *\\""
hilight_wave=-1
jpeg_quality=30
linewidth_mult=2.0}
@ -141,8 +141,8 @@ divx=9
unitx=u subdivx=4
color="14 7"
node="triang
level"
node="TRIANG
LEVEL"
hilight_wave=-1
digital=0
ypos1=0.00261891
@ -167,7 +167,7 @@ digital=0
ypos1=0.00261891
ypos2=0.51596
color=8
node="\\"CTRL1 Duty cycle; ctrl1 20u ravg()\\""
node="\\"CTRL1 Duty cycle; CTRL1 20u ravg()\\""
jpeg_quality=30
linewidth_mult=2.0}
B 18 65 -960 320 -775 {}