Eskil

Check-in [1e6d8dba4f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use a callback from tablelist to colorize table diff
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1e6d8dba4fbbe55e7d63a52ccb0199c6778fd1b0
User & Date: peter 2015-06-02 23:56:10.910
Context
2015-06-03
21:45
Use color callback from patched tablelist check-in: 87b8685b79 user: peter tags: trunk
2015-06-02
23:56
Use a callback from tablelist to colorize table diff check-in: 1e6d8dba4f user: peter tags: trunk
2015-04-19
18:50
Added disassembly view in debug win check-in: 0cd889765c user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/eskil.tcl.
383
384
385
386
387
388
389
390

391
392
393

394
395
396
397

398
399
400
401
402
403
404
        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"]
                } else {
                    lappend ::eskil($top,tablechanges) \

                            [list $id,$col "" $w "0 0 1 1"]
                }
            }
            incr col

        }
        return
    }
    $::widgets($top,wDiff$n) insert end "$text\n" $tag
    if {$linetag ne ""} {
        append tag " $linetag"
    }







|
>
|

|
>
|

<
|
>







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
                    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 {
                    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
            }
        }
        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
        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
        $::widgets($top,wTable) cellconfigure $cell -text $w1$w2


        #puts "Cell $cell"
        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"
    }
}

# Insert one line in each text widget.
# Mark them as changed, and optionally parse them.
proc insertMatchingLines {top line1 line2} {
    global doingLine1 doingLine2








|
|
|
>
|
|
>
|
|
>
|
>
>
|
<
>
>
|
<
<
<
|
|
|
|
|
<







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
}

# 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


    #puts "COLOR UPDATE W $win K $key R $row C $col TB1 $tabIdx1 TB2 $tabIdx2"
    #puts "   [string length $xxx] '$xxx'"
    #puts "   CHANGEME"



    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

        # Lap 2, collect cell changes
        set col -1
        foreach w1 $words1 w2 $words2 r $rs {
            incr col
            # Equal? Skip
            if {[llength $r] <= 2} continue


            lappend ::eskil($top,tablechanges) [list $id,$col $w1 $w2 $r]
        }

        incr doingLine1
        incr doingLine2
        return
    }








>
>
|







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
            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
        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.







<
<







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
            }
        }


    }

    close $ch1
    close $ch2

    # We can turn off editing in the text windows after everything
    # is displayed.