383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
|
-
-
+
+
+
-
-
+
+
+
-
-
+
+
|
set words [split $text $RE]
set id [$::widgets($top,wTable) insert end $words]
if {$tag ne "equal"} {
set col 0
foreach w $words {
if {$n == 1} {
# TBD TABLE, r is faked here for now
lappend ::eskil($top,tablechanges) \
[list $id,$col $w "" "0 0 1 1"]
dict set ::eskil($top,tablechanges) $id,$col w1 $w
dict set ::eskil($top,tablechanges) $id,$col w2 ""
dict set ::eskil($top,tablechanges) $id,$col r "0 0 1 1"
} else {
lappend ::eskil($top,tablechanges) \
[list $id,$col "" $w "0 0 1 1"]
dict set ::eskil($top,tablechanges) $id,$col w1 ""
dict set ::eskil($top,tablechanges) $id,$col w2 $w
dict set ::eskil($top,tablechanges) $id,$col r "0 0 1 1"
}
}
incr col
incr col
}
}
return
}
$::widgets($top,wDiff$n) insert end "$text\n" $tag
if {$linetag ne ""} {
append tag " $linetag"
}
|
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
|
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
|
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
|
set s1 [expr {$ns1 + 1}]
set s2 [expr {$ns2 + 1}]
}
#puts "RES '$res'"
return $res
}
# Colour changes within table cells
proc postprocessTable {top} {
#puts "POST!"
# Make sure table is populated
update idletasks
foreach cdata $::eskil($top,tablechanges) {
lassign $cdata cell w1 w2 r
# TBD TABLE, simple display for now
# Re-set the cell text to make sure it is in the body text widget
# TABLE: Make this callback generic in tablelist package
proc testTblColorCallback {win w key row col tabIdx1 tabIdx2 inStripe selected} {
set cellX $key,$col
set top [winfo toplevel $win]
if {![dict exists $::eskil($top,tablechanges) $cellX]} {
return
}
set cinfo [dict get $::eskil($top,tablechanges) $cellX]
set w1 [dict get $cinfo w1]
set w2 [dict get $cinfo w2]
#set xxx [$w get $tabIdx1 $tabIdx2]
#if {$xxx eq ""} return
$::widgets($top,wTable) cellconfigure $cell -text $w1$w2
#puts "Cell $cell"
#puts "COLOR UPDATE W $win K $key R $row C $col TB1 $tabIdx1 TB2 $tabIdx2"
#puts " [string length $xxx] '$xxx'"
#puts " CHANGEME"
lassign [$::widgets($top,wTable) cellbodyindex $cell] \
cIdx1 cIdx2
set body [$::widgets($top,wTable) bodypath]
set l1 [string length $w1]
set l2 [expr {$l1 + 1}]
set l3 [expr {$l1 + [string length $w2]}]
$body tag add new1 "$cIdx1" "$cIdx1 + $l1 char"
$body tag add new2 "$cIdx1 + $l1 char" "$cIdx1 + $l3 char"
set l1 [string length $w1]
set l2 [expr {$l1 + 1}]
set l3 [expr {$l1 + [string length $w2]}]
$w tag add new1 "$tabIdx1" "$tabIdx1 + $l1 char"
$w tag add new2 "$tabIdx1 + $l1 char" "$tabIdx1 + $l3 char"
}
}
# Insert one line in each text widget.
# Mark them as changed, and optionally parse them.
proc insertMatchingLines {top line1 line2} {
global doingLine1 doingLine2
|
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
|
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
|
+
+
-
+
|
# Lap 2, collect cell changes
set col -1
foreach w1 $words1 w2 $words2 r $rs {
incr col
# Equal? Skip
if {[llength $r] <= 2} continue
dict set ::eskil($top,tablechanges) $id,$col w1 $w1
dict set ::eskil($top,tablechanges) $id,$col w2 $w2
lappend ::eskil($top,tablechanges) [list $id,$col $w1 $w2 $r]
dict set ::eskil($top,tablechanges) $id,$col r $r
}
incr doingLine1
incr doingLine2
return
}
|
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
|
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
|
-
-
|
foreach item {wLine1 wDiff1 wLine2 wDiff2} {
set w $::widgets($top,$item)
set d [expr {int($max) - int([$w index end])}]
for {set t 0} {$t < $d} {incr t} {
$w insert end \n padding
}
}
} else {
postprocessTable $top
}
close $ch1
close $ch2
# We can turn off editing in the text windows after everything
# is displayed.
|