From b51ce34b1c10f0e015a19b0d0f69b49d7b9fe935 Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Wed, 16 Sep 2020 00:50:15 +0200 Subject: [PATCH] make "ctrl-[0-9]" commands work again (change layer) --- doc/xschem_man/commands.html | 1 + src/callback.c | 3 +++ src/keys.help | 1 + src/ngspice_backannotate.tcl | 15 +++++++++------ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/xschem_man/commands.html b/doc/xschem_man/commands.html index 99a486dc..144260fc 100644 --- a/doc/xschem_man/commands.html +++ b/doc/xschem_man/commands.html @@ -100,6 +100,7 @@ ctrl Enter Confirm closing dialog boxes - '#' Highlight components with duplicated name (refdes) ctrl '#' Rename components with duplicated name (refdes) - '5' View only probes +ctrl '0-9' set current layer (4 -13) - 'a' Make symbol from pin list of current schematic ctrl 'a' Select all shift 'A' Toggle show netlist diff --git a/src/callback.c b/src/callback.c index 65116bb1..ea900505 100644 --- a/src/callback.c +++ b/src/callback.c @@ -616,7 +616,10 @@ int callback(int event, int mx, int my, KeySym key, } /* /20110112 */ if(key<='9' && key >='0' && state==ControlMask) /* choose layer */ { + char n[30]; rectcolor = key - '0'+4; + my_snprintf(n, S(n), "%d", rectcolor); + Tcl_VarEval(interp, "xschem set rectcolor ", n, "; reconfigure_layers_button", NULL); dbg(1, "callback(): new color: %d\n",color_index[rectcolor]); break; } diff --git a/src/keys.help b/src/keys.help index b50362b7..a314e048 100644 --- a/src/keys.help +++ b/src/keys.help @@ -59,6 +59,7 @@ ctrl Enter Confirm closing dialog boxes - '#' Highlight components with duplicated name (refdes) ctrl '#' Rename components with duplicated name (refdes) - '5' View only probes +ctrl '0-9' set current layer (4 -13) - 'a' Make symbol from pin list of current schematic ctrl 'a' Select all shift 'A' Toggle show netlist diff --git a/src/ngspice_backannotate.tcl b/src/ngspice_backannotate.tcl index dc5227be..d5504378 100644 --- a/src/ngspice_backannotate.tcl +++ b/src/ngspice_backannotate.tcl @@ -45,11 +45,13 @@ proc read_ngspice_raw {arr fp} { } if {$variables} { set bindata [read $fp [expr 8 * $n_vars * $n_points]] - binary scan $bindata d[expr $n_vars * $n_points] data - for {set p 0} {$p < $n_points} { incr p} { - for {set v 0} {$v < $n_vars} { incr v} { - lappend var($idx($v)) [lindex $data [expr $p * $n_vars + $v]] - # puts "-->|$idx($v)|$var($idx($v))|" + if { $n_points == 1} { + binary scan $bindata d[expr $n_vars * $n_points] data + for {set p 0} {$p < $n_points} { incr p} { + for {set v 0} {$v < $n_vars} { incr v} { + lappend var($idx($v)) [lindex $data [expr $p * $n_vars + $v]] + # puts "-->|$idx($v)|$var($idx($v))|" + } } } set var(n\ vars) $n_vars @@ -122,6 +124,7 @@ proc annotate {} { } else break; } close $fp + puts {Raw file read ...} if { $op_point_read } { ### disable screen redraw and undo when looping to speed up performance ### but save state on undo stack before doing backannotations. @@ -169,4 +172,4 @@ proc annotate {} { } } -if { ![info exists no_x] } {bind .drw {annotate} } +if { ![info exists no_x] } {bind .drw {puts {Annotating...}; annotate} }