allow to block change color of selected waves using text selection in signal list
This commit is contained in:
parent
b691021f66
commit
8c431a51f8
|
|
@ -2208,6 +2208,26 @@ proc graph_get_signal_list {siglist pattern } {
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc touches {sel tag} {
|
||||||
|
set res 0
|
||||||
|
scan $sel {%d.%d %d.%d} sel_linestart sel_charstart sel_lineend sel_charend
|
||||||
|
scan $tag {%d.%d %d.%d} tag_linestart tag_charstart tag_lineend tag_charend
|
||||||
|
set selstart [expr {$sel_linestart * 1000000 + $sel_charstart}]
|
||||||
|
set selend [expr {$sel_lineend * 1000000 + $sel_charend}]
|
||||||
|
set tagstart [expr {$tag_linestart * 1000000 + $tag_charstart}]
|
||||||
|
set tagend [expr {$tag_lineend * 1000000 + $tag_charend}]
|
||||||
|
# puts "selstart: $selstart"
|
||||||
|
# puts "selend: $selend"
|
||||||
|
# puts "tagstart: $tagstart"
|
||||||
|
# puts "tagend: $tagend"
|
||||||
|
if { ($tagstart >= $selstart && $tagstart <= $selend) ||
|
||||||
|
($tagend >= $selstart && $tagend <= $selend) } {
|
||||||
|
set res 1
|
||||||
|
}
|
||||||
|
# puts "touch: returning $res"
|
||||||
|
return $res
|
||||||
|
}
|
||||||
|
|
||||||
# change color of selected wave in text widget and redraw graph
|
# change color of selected wave in text widget and redraw graph
|
||||||
# OR
|
# OR
|
||||||
# change color attribute of wave given as parameter, redraw graph
|
# change color attribute of wave given as parameter, redraw graph
|
||||||
|
|
@ -2217,7 +2237,26 @@ proc graph_change_wave_color {{wave {}}} {
|
||||||
if { [xschem get schname] ne $graph_schname } return
|
if { [xschem get schname] ne $graph_schname } return
|
||||||
# get tag the cursor is on:
|
# get tag the cursor is on:
|
||||||
if { $wave eq {}} {
|
if { $wave eq {}} {
|
||||||
|
set sel_range [.graphdialog.center.right.text1 tag ranges sel]
|
||||||
|
if {$sel_range ne {}} {
|
||||||
|
# puts "sel_range --> $sel_range"
|
||||||
|
foreach tag [.graphdialog.center.right.text1 tag names] {
|
||||||
|
if {$tag eq {sel}} {continue}
|
||||||
|
set tag_range [.graphdialog.center.right.text1 tag ranges $tag]
|
||||||
|
# puts "$tag --> $tag_range"
|
||||||
|
|
||||||
|
if { [touches $sel_range $tag_range]} {
|
||||||
|
set index [string range $tag 1 end]
|
||||||
|
set col [xschem getprop rect 2 $graph_selected color]
|
||||||
|
set col [lreplace $col $index $index $graph_sel_color]
|
||||||
|
xschem setprop rect 2 $graph_selected color $col fast
|
||||||
|
}
|
||||||
|
}
|
||||||
|
graph_update_nodelist
|
||||||
|
xschem draw_graph $graph_selected
|
||||||
|
} else {
|
||||||
set tag [.graphdialog.center.right.text1 tag names insert]
|
set tag [.graphdialog.center.right.text1 tag names insert]
|
||||||
|
if { $tag eq {}} {set tag [.graphdialog.center.right.text1 tag names {insert - 1 char}]}
|
||||||
if { [regexp {^t} $tag]} {
|
if { [regexp {^t} $tag]} {
|
||||||
set index [string range $tag 1 end]
|
set index [string range $tag 1 end]
|
||||||
set col [xschem getprop rect 2 $graph_selected color]
|
set col [xschem getprop rect 2 $graph_selected color]
|
||||||
|
|
@ -2226,6 +2265,7 @@ proc graph_change_wave_color {{wave {}}} {
|
||||||
graph_update_nodelist
|
graph_update_nodelist
|
||||||
xschem draw_graph $graph_selected
|
xschem draw_graph $graph_selected
|
||||||
}
|
}
|
||||||
|
}
|
||||||
# wave to change provided as parameter
|
# wave to change provided as parameter
|
||||||
} else {
|
} else {
|
||||||
set col [xschem getprop rect 2 $graph_selected color]
|
set col [xschem getprop rect 2 $graph_selected color]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue