From 7afbd6a51d91da0acb24e078249a430f3574db4c Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sun, 18 Sep 2022 12:25:09 +0200 Subject: [PATCH] various small fixes for cursor b backannotation, updated xschemtest netlist hashes --- src/callback.c | 19 ++++++++++++++++++- tests/xschemtest.tcl | 6 +++--- xschem_library/examples/LCC_instances.sch | 7 ++++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/callback.c b/src/callback.c index 305439e6..ec2cf875 100644 --- a/src/callback.c +++ b/src/callback.c @@ -208,6 +208,19 @@ static void backannotate_at_cursor_b_pos(xRect *r) if(ss != s) break; } } + if(p >= ofs + xctx->graph_npoints[dataset]) { + double sweep0, sweep1; + p--; + sweep0 = xctx->graph_values[sweepvar][ofs]; + sweep1 = xctx->graph_values[sweepvar][p]; + if(fabs(sweep0 - xctx->graph_cursor2_x) < fabs(sweep1 - xctx->graph_cursor2_x)) { + p = ofs; + } + } + + + + dbg(1, "ofs=%d, npoints=%d, close to cursor=%g, p=%d\n", ofs, xctx->graph_npoints[dataset], sweep, p); for(i = 0; i < xctx->graph_nvars; i++) { @@ -300,6 +313,11 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int /* set cursor position from master graph x-axis */ else if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 32 )) { xctx->graph_cursor2_x = G_X(xctx->mousex); + if(tclgetboolvar("live_cursor2_backannotate")) { + backannotate_at_cursor_b_pos(r); + redraw_all_at_end = 1; + } + else need_redraw = 1; } if(xctx->ui_state & GRAPHPAN) break; /* After GRAPHPAN only need to check Motion events for cursors */ if(xctx->mousey_snap < W_Y(gr->gy2)) { @@ -506,7 +524,6 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int /* move cursor2 */ else if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 32 )) { if(tclgetboolvar("live_cursor2_backannotate")) { - backannotate_at_cursor_b_pos(r); redraw_all_at_end = 1; } else need_redraw = 1; diff --git a/tests/xschemtest.tcl b/tests/xschemtest.tcl index 09145a13..ef3c0140 100644 --- a/tests/xschemtest.tcl +++ b/tests/xschemtest.tcl @@ -190,10 +190,10 @@ proc test_xschem_simulation {{f simulate_ff.sch}} { proc netlist_test {} { global netlist_dir foreach {f t h} { - rom8k.sch spice 2107101451 + rom8k.sch spice 2248266091 greycnt.sch verilog 3378316826 - autozero_comp.sch spice 3864091521 - loading.sch vhdl 2601437773 + autozero_comp.sch spice 2275498269 + loading.sch vhdl 584526899 mos_power_ampli.sch spice 1004049459 hierarchical_tedax.sch tedax 998070173 LCC_instances.sch spice 3904804413 diff --git a/xschem_library/examples/LCC_instances.sch b/xschem_library/examples/LCC_instances.sch index 3d7af2cf..e4a38867 100644 --- a/xschem_library/examples/LCC_instances.sch +++ b/xschem_library/examples/LCC_instances.sch @@ -1,4 +1,5 @@ -v {xschem version=3.1.0 file_version=1.2 } +v {xschem version=3.1.0 file_version=1.2 +} G {} K {} V {} @@ -178,3 +179,7 @@ tclcommand=" xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw " } +C {ngspice_probe.sym} 520 -490 0 0 {name=r3} +C {ngspice_probe.sym} 200 -490 0 1 {name=r3} +C {ngspice_probe.sym} 360 -190 0 0 {name=r3} +C {ngspice_probe.sym} 240 -190 0 1 {name=r3}