Eskil

Check-in [87b8685b79]
Login

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

Overview
Comment:Use color callback from patched tablelist
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 87b8685b79018f69824058eb5e41cca70b51328d
User & Date: peter 2015-06-03 21:45:54.179
Context
2015-06-03
22:03
Made a patched version of tablelist for table diff. Patch stored in src dir. check-in: 1d4acbe241 user: peter tags: trunk
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
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/eskil.tcl.
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Stop Tk from meddling with the command line by copying it first.
set ::eskil(argv) $::argv
set ::eskil(argc) $::argc
set ::argv {}
set ::argc 0

set ::eskil(debug) 0
set ::eskil(diffver) "Version 2.7+ 2015-04-19"
set ::eskil(thisScript) [file join [pwd] [info script]]

namespace import tcl::mathop::+
namespace import tcl::mathop::-
namespace import tcl::mathop::*
namespace import tcl::mathop::/

# Do initalisations for needed packages and globals.
# This is not run until needed to speed up command line error reporting.
proc Init {} {
    package require Tk 8.4
    catch {package require textSearch}
    package require wcb
    package require snit
    package require tablelist_tile

    # Patch tablelist to add cellbodyindex subcommand
    lappend ::tablelist::cmdOpts cellbodyindex
    proc tablelist::cellbodyindexSubCmd {win argList} {
        if {[llength $argList] != 1} {
            mwutil::wrongNumArgs "$win cellbodyindex cellIndex"
        }

        synchronize $win
        updateKeyToRowMap $win
        displayItems $win
        foreach {row col} [cellIndex $win [lindex $argList 0] 1] {}
        findTabs $win [expr {$row + 1}] $col $col tabIdx1 tabIdx2
        upvar ::tablelist::ns${win}::data data
        # Get indices for cell contents
        set cIdx1 [$data(body) index "$tabIdx1 + 1 char"]
        set cIdx2 [$data(body) index "$tabIdx2 - 1 char"]
        return [list $cIdx1 $cIdx2]
    }

    if {[catch {package require psballoon}]} {
        # Add a dummy if it does not exist.
        proc addBalloon {args} {}
    } else {
        namespace import -force psballoon::addBalloon
    }








|
















<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







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
# Stop Tk from meddling with the command line by copying it first.
set ::eskil(argv) $::argv
set ::eskil(argc) $::argc
set ::argv {}
set ::argc 0

set ::eskil(debug) 0
set ::eskil(diffver) "Version 2.7+ 2015-06-02"
set ::eskil(thisScript) [file join [pwd] [info script]]

namespace import tcl::mathop::+
namespace import tcl::mathop::-
namespace import tcl::mathop::*
namespace import tcl::mathop::/

# Do initalisations for needed packages and globals.
# This is not run until needed to speed up command line error reporting.
proc Init {} {
    package require Tk 8.4
    catch {package require textSearch}
    package require wcb
    package require snit
    package require tablelist_tile




















    if {[catch {package require psballoon}]} {
        # Add a dummy if it does not exist.
        proc addBalloon {args} {}
    } else {
        namespace import -force psballoon::addBalloon
    }

486
487
488
489
490
491
492
493

494
495
496
497
498
499
500
501
        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]







|
>
|







467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
        set s1 [expr {$ns1 + 1}]
        set s2 [expr {$ns2 + 1}]
    }
    #puts "RES   '$res'"
    return $res
}

# This is called from the table view whenever a cell is drawn.
# Add color as needed.
proc tblModeColorCallback {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]
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
    resetEdit $top

    # Clear up everything before starting processing
    if {$::eskil($top,view) eq "table"} {
        set w $::widgets($top,wTable)
        # TBD TABLE
        $w configure -state normal
        #$w delete 1.0 end
        set ::eskil($top,tablechanges) {}
    } else {
        foreach item {wLine1 wDiff1 wLine2 wDiff2 wTb} {
            set w $::widgets($top,$item)
            $w configure -state normal
            $w delete 1.0 end
        }







|







1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
    resetEdit $top

    # Clear up everything before starting processing
    if {$::eskil($top,view) eq "table"} {
        set w $::widgets($top,wTable)
        # TBD TABLE
        $w configure -state normal
        $w delete 0 end
        set ::eskil($top,tablechanges) {}
    } else {
        foreach item {wLine1 wDiff1 wLine2 wDiff2 wTb} {
            set w $::widgets($top,$item)
            $w configure -state normal
            $w delete 1.0 end
        }
3426
3427
3428
3429
3430
3431
3432
3433

3434
3435
3436
3437
3438
3439
3440
        grid $top.l1   $top.le $top.l2  -row 1 -sticky news
        grid $top.ft   -       -        -row 2 -sticky news
        grid columnconfigure $top "0 2" -weight 1
        grid rowconfigure $top $top.ft  -weight 1
        # TBD TABLE
        tablelist::tablelist $top.ft.tab -height 20 -width 80 \
                -movablecolumns no -setgrid no -showseparators no \
                -fullseparators yes -selectmode none

        ttk::scrollbar $top.ft.vsb -orient vertical \
                -command "$top.ft.tab yview"
        ttk::scrollbar $top.ft.hsb -orient horizontal \
                -command "$top.ft.tab xview"
        $top.ft.tab configure -yscrollcommand "$top.ft.vsb set" \
                -xscrollcommand "$top.ft.hsb set"
        set body [$top.ft.tab bodypath]







|
>







3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
        grid $top.l1   $top.le $top.l2  -row 1 -sticky news
        grid $top.ft   -       -        -row 2 -sticky news
        grid columnconfigure $top "0 2" -weight 1
        grid rowconfigure $top $top.ft  -weight 1
        # TBD TABLE
        tablelist::tablelist $top.ft.tab -height 20 -width 80 \
                -movablecolumns no -setgrid no -showseparators no \
                -fullseparators yes -selectmode none \
                -colorizecommand tblModeColorCallback
        ttk::scrollbar $top.ft.vsb -orient vertical \
                -command "$top.ft.tab yview"
        ttk::scrollbar $top.ft.hsb -orient horizontal \
                -command "$top.ft.tab xview"
        $top.ft.tab configure -yscrollcommand "$top.ft.vsb set" \
                -xscrollcommand "$top.ft.hsb set"
        set body [$top.ft.tab bodypath]