50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
set msg [regsub -all "\n" $msg " "]
# Remove multiple whitespace
set msg [regsub -all {\s+} $msg " "]
set msg [string trim $msg]
# Any explicitly requested newlines?
set msg [regsub -all {\\n\s*} $msg "\n"]
# Any remaining substs like tabs?
set msg [subst -nocommand -novariable $msg]
# Further line breaks by length?
set lines {}
foreach line [split $msg \n] {
while {[string length $line] > 80} {
# There should be no path through this loop that does not
# shorten $line
set ix [string last " " $line 80]
|
|
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
set msg [regsub -all "\n" $msg " "]
# Remove multiple whitespace
set msg [regsub -all {\s+} $msg " "]
set msg [string trim $msg]
# Any explicitly requested newlines?
set msg [regsub -all {\\n\s*} $msg "\n"]
# Any remaining substs like tabs?
set msg [subst -nocommands -novariables $msg]
# Further line breaks by length?
set lines {}
foreach line [split $msg \n] {
while {[string length $line] > 80} {
# There should be no path through this loop that does not
# shorten $line
set ix [string last " " $line 80]
|
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
} else {
if {[string index $msg 0] eq "\["} {
set msg [subst -novariables -nobackslashes $msg]
}
set bWidth [Measure $font $msg]
}
if {!$create} return
# Preferred position of the balloon
set rootX [expr {[winfo rootx $W] + $itemX}]
set rootY [expr {[winfo rooty $W] + $itemY + $wHeight + 2}]
set useframe $balloon(frame,$W)
|
|
|
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
} else {
if {[string index $msg 0] eq "\["} {
set msg [subst -novariables -nobackslashes $msg]
}
set bWidth [Measure $font $msg]
}
if { ! $create} return
# Preferred position of the balloon
set rootX [expr {[winfo rootx $W] + $itemX}]
set rootY [expr {[winfo rooty $W] + $itemY + $wHeight + 2}]
set useframe $balloon(frame,$W)
|