-
Notifications
You must be signed in to change notification settings - Fork 0
/
cvc_select.tcl
67 lines (58 loc) · 1.71 KB
/
cvc_select.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
proc load_selection {} {
global gClipboardSource
if { ! [info exists gClipboardSource] } {
set gClipboardSource clipboard
}
set myClipboard [open "|xclip -o -selection $gClipboardSource" r]
if { "$myClipboard" eq "" } {
set mySelelction ""
} else {
gets $myClipboard mySelection
}
Gui:Print $mySelection
set visu [Gui:GetMainVisualizer]
set db [Gui:GetDataBase $visu]
set topoid [Gui:GetCurrentModule $visu]
if { $topoid == "" } {
$db foreach top topoid {
break
}
}
set topcell [$db oid root $topoid]
set path [$db oid path $topoid]
set oidList {}
regsub {\([^\)]*\)[ ]*$} $mySelection "" mySelection
regsub -all {\([^\)]*\)/} $mySelection " " mySelection
regsub -all {==} $mySelection "--" mySelection
regsub {^/} $mySelection "" mySelection
#regsub -all {/} $mySelection "-" mySelection
#regsub -all {\[} $mySelection "<" mySelection
#regsub -all {\]} $mySelection ">" mySelection
#Gui:Print $mySelection
lappend oidList "inst $topcell $path $mySelection"
Gui:AppendCone $visu $oidList
set col 12
#set db [Gui:GetDataBase $visu]
foreach oid $oidList {
$db flathilight $oid set $col
}
Gui:HighlightChanged
set oidList {}
regsub { [^ ]*$} $mySelection "" mySelection
#Gui:Print $mySelection
lappend oidList "inst $topcell $path $mySelection"
Gui:AppendCone $visu $oidList
Gui:ActivateTab $visu Search&Cone
}
proc toggle_selection {} {
global gClipboardSource
if { [info exists gClipboardSource] && "$gClipboardSource" eq "clipboard" } {
set gClipboardSource primary
Gui:Print "Clipboard selection set to X"
} else {
set gClipboardSource clipboard
Gui:Print "Clipboard selection set to Windows"
}
}
bind . <Control-k> {load_selection}
bind . <Control-K> {toggle_selection}