Eskil

Check-in [6a189c234c]
Login

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

Overview
Comment:Started on table view
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6a189c234cf7553d906f5fef2e8f8946175aa1f5
User & Date: peter 2015-04-12 21:40:50.768
Context
2015-04-15
21:46
Work on table view check-in: 6846909aaf user: peter tags: trunk
2015-04-12
21:40
Started on table view check-in: 6a189c234c user: peter tags: trunk
2015-04-09
22:03
Started working on a edit buttons shown between diffs. check-in: f983dcb004 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/eskil.syntax.
55
56
57
58
59
60
61

62
63
64
65
66
67
68
##nagelfar syntax twapi::get_window_coordinates x
##nagelfar syntax twapi::get_window_at_location x x
##nagelfar syntax twapi::set_focus x
##nagelfar syntax twapi::send_keys x
##nagelfar syntax twapi::get_window_coordinates x
##nagelfar package known twapi


##nagelfar syntax tablelist::convEventFields x x x
##nagelfar package known tablelist_tile

##nagelfar syntax MySpinBox x p*
##nagelfar option MySpinBox -textvariable -from -to -increment -width -format
##nagelfar option MySpinBox\ -textvariable n








>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
##nagelfar syntax twapi::get_window_coordinates x
##nagelfar syntax twapi::get_window_at_location x x
##nagelfar syntax twapi::set_focus x
##nagelfar syntax twapi::send_keys x
##nagelfar syntax twapi::get_window_coordinates x
##nagelfar package known twapi

##nagelfar syntax tablelist::tablelist x p*
##nagelfar syntax tablelist::convEventFields x x x
##nagelfar package known tablelist_tile

##nagelfar syntax MySpinBox x p*
##nagelfar option MySpinBox -textvariable -from -to -increment -width -format
##nagelfar option MySpinBox\ -textvariable n

Changes to src/eskil.tcl.
931
932
933
934
935
936
937





938
939

940
941
942
943
944
945
946
947
948
949
950
proc disableRedo {top} {
    $top.m.mf entryconfigure "Redo Diff" -state disabled
    $top.m.mt entryconfigure "Merge"     -state disabled
}

proc busyCursor {top} {
    global oldcursor oldcursor2





    if {![info exists oldcursor]} {
        set oldcursor [$top cget -cursor]

        set oldcursor2 [$::widgets($top,wDiff1) cget -cursor]
    }
    $top config -cursor watch
    foreach item {wLine1 wDiff1 wLine2 wDiff2} {
        if {[info exists ::widgets($top,$item)]} {
            set w $::widgets($top,$item)
            $w config -cursor watch
        }
    }
}








>
>
>
>
>


>
|


|







931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
proc disableRedo {top} {
    $top.m.mf entryconfigure "Redo Diff" -state disabled
    $top.m.mt entryconfigure "Merge"     -state disabled
}

proc busyCursor {top} {
    global oldcursor oldcursor2
    if {$::eskil($top,view) eq "table"} {
        set items wTable
    } else {
        set items {wLine1 wDiff1 wLine2 wDiff2}
    }
    if {![info exists oldcursor]} {
        set oldcursor [$top cget -cursor]
        set i1 [lindex $items 0]
        set oldcursor2 [$::widgets($top,$i1) cget -cursor]
    }
    $top config -cursor watch
    foreach item $items {
        if {[info exists ::widgets($top,$item)]} {
            set w $::widgets($top,$item)
            $w config -cursor watch
        }
    }
}

962
963
964
965
966
967
968

969
970
971
972
973
974
975
#####################################
# Special cases.  Conflict/patch
#####################################

proc startConflictDiff {top file} {
    set ::eskil($top,mode) "conflict"
    set ::eskil($top,modetype) ""

    set ::eskil($top,conflictFile) $file
    set ::eskil($top,rightDir) [file dirname $file]
    set ::eskil($top,rightOK) 1
    set ::eskil($top,rightLabel) $file
    set ::eskil($top,leftLabel) $file
    set ::eskil($top,leftOK) 0








>







968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
#####################################
# Special cases.  Conflict/patch
#####################################

proc startConflictDiff {top file} {
    set ::eskil($top,mode) "conflict"
    set ::eskil($top,modetype) ""
    set ::eskil($top,view) ""
    set ::eskil($top,conflictFile) $file
    set ::eskil($top,rightDir) [file dirname $file]
    set ::eskil($top,rightOK) 1
    set ::eskil($top,rightLabel) $file
    set ::eskil($top,leftLabel) $file
    set ::eskil($top,leftOK) 0

1430
1431
1432
1433
1434
1435
1436






1437
1438
1439
1440

1441
1442
1443
1444
1445
1446
1447
        enableRedo $top
    }

    busyCursor $top
    resetEdit $top

    # Clear up everything before starting processing






    foreach item {wLine1 wDiff1 wLine2 wDiff2 wTb} {
        set w $::widgets($top,$item)
        $w configure -state normal
        $w delete 1.0 end

    }
    clearMap $top
    set ::HighLightCount 0
    highLightChange $top -1
    # Display a star during diff execution, to know when the internal
    # processing starts, and when the label is "valid".
    set ::widgets($top,eqLabel) "*"







>
>
>
>
>
>
|
|
|
|
>







1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
        enableRedo $top
    }

    busyCursor $top
    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
    } else {
        foreach item {wLine1 wDiff1 wLine2 wDiff2 wTb} {
            set w $::widgets($top,$item)
            $w configure -state normal
            $w delete 1.0 end
        }
    }
    clearMap $top
    set ::HighLightCount 0
    highLightChange $top -1
    # Display a star during diff execution, to know when the internal
    # processing starts, and when the label is "valid".
    set ::widgets($top,eqLabel) "*"
1456
1457
1458
1459
1460
1461
1462

1463
1464
1465
1466
1467
1468
1469
        #drawEditButtons $top
        foreach item {wLine1 wLine2} {
            set w $::widgets($top,$item)
            $w configure -state disabled
        }
        update idletasks
        wm title $top "Eskil: [file tail $::eskil($top,patchFile)]"

        $::widgets($top,wLine2) see 1.0
        if {$::eskil($top,printFile) ne ""} {
            after idle "doPrint $top 1 ; cleanupAndExit all"
        }
        normalCursor $top
        return
    } else {







>







1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
        #drawEditButtons $top
        foreach item {wLine1 wLine2} {
            set w $::widgets($top,$item)
            $w configure -state disabled
        }
        update idletasks
        wm title $top "Eskil: [file tail $::eskil($top,patchFile)]"
        # TBD TABLE
        $::widgets($top,wLine2) see 1.0
        if {$::eskil($top,printFile) ne ""} {
            after idle "doPrint $top 1 ; cleanupAndExit all"
        }
        normalCursor $top
        return
    } else {
1512
1513
1514
1515
1516
1517
1518



1519

1520
1521
1522
1523
1524
1525
1526
    # parsing the conflict file. This makes sure the blocks in the conflict
    # file become change-blocks during merge.
    if {$::eskil($top,mode) eq "conflict" && $::eskil($top,modetype) eq "Pure"} {
        set diffres $::eskil($top,conflictDiff)
    }

    if {$differr != 0} {



        $::widgets($top,wDiff1) insert end $diffres

        normalCursor $top
        return
    }
    if {[llength $diffres] == 0} {
        set ::widgets($top,eqLabel) "="
        # Automatically close if equal
        if {$::eskil(autoclose)} {







>
>
>
|
>







1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
    # parsing the conflict file. This makes sure the blocks in the conflict
    # file become change-blocks during merge.
    if {$::eskil($top,mode) eq "conflict" && $::eskil($top,modetype) eq "Pure"} {
        set diffres $::eskil($top,conflictDiff)
    }

    if {$differr != 0} {
        if {$::eskil($top,view) eq "table"} {
            # TBD TABLE
        } else {
            $::widgets($top,wDiff1) insert end $diffres
        }
        normalCursor $top
        return
    }
    if {[llength $diffres] == 0} {
        set ::widgets($top,eqLabel) "="
        # Automatically close if equal
        if {$::eskil(autoclose)} {
1539
1540
1541
1542
1543
1544
1545





























1546
1547
1548
1549
1550
1551
1552

    set firstview 1

    set ch1 [open $::eskil($top,leftFile)]
    set ch2 [open $::eskil($top,rightFile)]
    set doingLine1 1
    set doingLine2 1






























    # If there is a range, skip lines up to the range
    if {[llength $range] != 0} {
        disallowEdit $top
        lassign $range start1 end1 start2 end2
        while {$doingLine1 < $start1 && [gets $ch1 line] >= 0} {
            incr doingLine1







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600

    set firstview 1

    set ch1 [open $::eskil($top,leftFile)]
    set ch2 [open $::eskil($top,rightFile)]
    set doingLine1 1
    set doingLine2 1

    if {$::eskil($top,view) eq "table"} {
        # Look for table header line
        set i [lindex $diffres 0]
        lassign $i line1 n1 line2 n2
        if {$line1 == 1 || $line2 == 1} {
            # Hide header line of widget TBD TABLE
            #$::widgets($top,wTable) configure 
            # Set up columns??
        } else {
            # First lines are equal, treat them as header
            # Consume table header line
            gets $ch1 line1
            incr doingLine1
            gets $ch2 line
            incr doingLine2
            set headings [split $line1 $::eskil($top,separator)]
            set col {}
            foreach heading $headings {
                lappend col 0 $heading
            }
            $::widgets($top,wTable) configure -columns $col
        }
    }

    # TBD TABLE, stop for now
    if {$::eskil($top,view) eq "table"} {
        return
    }

    # If there is a range, skip lines up to the range
    if {[llength $range] != 0} {
        disallowEdit $top
        lassign $range start1 end1 start2 end2
        while {$doingLine1 < $start1 && [gets $ch1 line] >= 0} {
            incr doingLine1
1739
1740
1741
1742
1743
1744
1745



1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763



1764
1765
1766
1767
1768
1769
1770

# Clear Editing state
proc resetEdit {top} {
    set ::eskil($top,leftEdit) 0
    set ::eskil($top,rightEdit) 0
    $top.m.mt entryconfigure "Edit Mode" -state normal




    resetEditW $::widgets($top,wDiff1)
    resetEditW $::widgets($top,wDiff2)
}

# Clear Editing state for a Text widget
proc resetEditW {w} {
    $w tag configure padding -background {}
    $w edit reset
    $w configure -undo 0

    set ::eskil($w,allowChange) all

    wcb::callback $w before insert {}
    wcb::callback $w before delete {}
}

# Do not allow any editing
proc noEdit {top} {



    noEditW $::widgets($top,wDiff1)
    noEditW $::widgets($top,wDiff2)
}

# Do not allow any editing in a Text widget
proc noEditW {w} {
    set ::eskil($w,allowChange) none







>
>
>


















>
>
>







1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824

# Clear Editing state
proc resetEdit {top} {
    set ::eskil($top,leftEdit) 0
    set ::eskil($top,rightEdit) 0
    $top.m.mt entryconfigure "Edit Mode" -state normal

    if {$::eskil($top,view) eq "table"} {
        return
    }
    resetEditW $::widgets($top,wDiff1)
    resetEditW $::widgets($top,wDiff2)
}

# Clear Editing state for a Text widget
proc resetEditW {w} {
    $w tag configure padding -background {}
    $w edit reset
    $w configure -undo 0

    set ::eskil($w,allowChange) all

    wcb::callback $w before insert {}
    wcb::callback $w before delete {}
}

# Do not allow any editing
proc noEdit {top} {
    if {$::eskil($top,view) eq "table"} {
        return
    }
    noEditW $::widgets($top,wDiff1)
    noEditW $::widgets($top,wDiff2)
}

# Do not allow any editing in a Text widget
proc noEditW {w} {
    set ::eskil($w,allowChange) none
2855
2856
2857
2858
2859
2860
2861

2862
2863
2864
2865
2866
2867
2868
}

# Fill in default data for a diff window
proc initDiffData {top} {
    set ::eskil($top,leftOK) 0
    set ::eskil($top,rightOK) 0
    set ::eskil($top,mode) ""

    set ::eskil($top,printFile) ""
    set ::eskil($top,mergeFile) ""
    set ::eskil($top,ancestorFile) ""
    set ::eskil($top,separator) ""
    set ::eskil($top,conflictFile) ""
    set ::eskil($top,limitlines) 0
    set ::eskil($top,plugin) ""







>







2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
}

# Fill in default data for a diff window
proc initDiffData {top} {
    set ::eskil($top,leftOK) 0
    set ::eskil($top,rightOK) 0
    set ::eskil($top,mode) ""
    set ::eskil($top,view) ""
    set ::eskil($top,printFile) ""
    set ::eskil($top,mergeFile) ""
    set ::eskil($top,ancestorFile) ""
    set ::eskil($top,separator) ""
    set ::eskil($top,conflictFile) ""
    set ::eskil($top,limitlines) 0
    set ::eskil($top,plugin) ""
2883
2884
2885
2886
2887
2888
2889

2890
2891
2892
2893
2894
2895
2896
    set ::eskil($top,leftLabel) $file1
    set ::eskil($top,leftOK) 1
    set ::eskil($top,rightDir) [file dirname $file2]
    set ::eskil($top,rightFile) $file2
    set ::eskil($top,rightLabel) $file2
    set ::eskil($top,rightOK) 1
    set ::eskil($top,mode) ""

    set ::eskil($top,range) $range
    wm deiconify $top
    raise $top
    update
    doDiff $top
    return $top
}







>







2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
    set ::eskil($top,leftLabel) $file1
    set ::eskil($top,leftOK) 1
    set ::eskil($top,rightDir) [file dirname $file2]
    set ::eskil($top,rightFile) $file2
    set ::eskil($top,rightLabel) $file2
    set ::eskil($top,rightOK) 1
    set ::eskil($top,mode) ""
    set ::eskil($top,view) ""
    set ::eskil($top,range) $range
    wm deiconify $top
    raise $top
    update
    doDiff $top
    return $top
}
2966
2967
2968
2969
2970
2971
2972

2973
2974
2975
2976
2977
2978
2979
    }
    while {[winfo exists .diff$t]} {
        incr t
    }
    set top .diff$t
    toplevel $top
    eskilRegisterToplevel $top


    wm title $top "Eskil:"
    wm protocol $top WM_DELETE_WINDOW [list cleanupAndExit $top]

    ttk::frame $top.f
    grid $top.f -row 0 -columnspan 5 -sticky nws
    lappend ::widgets(toolbars) $top.f







>







3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
    }
    while {[winfo exists .diff$t]} {
        incr t
    }
    set top .diff$t
    toplevel $top
    eskilRegisterToplevel $top
    initDiffData $top

    wm title $top "Eskil:"
    wm protocol $top WM_DELETE_WINDOW [list cleanupAndExit $top]

    ttk::frame $top.f
    grid $top.f -row 0 -columnspan 5 -sticky nws
    lappend ::widgets(toolbars) $top.f
3192
3193
3194
3195
3196
3197
3198



























3199
3200
3201
3202
3203

3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222

3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311

3312
3313
3314
3315
3316
3317
3318

    catch {font delete myfont}
    font create myfont -family $::Pref(fontfamily) -size $::Pref(fontsize)

    fileLabel $top.l1 -textvariable ::eskil($top,leftLabel)
    fileLabel $top.l2 -textvariable ::eskil($top,rightLabel)




























    ttk::frame $top.ft1 -borderwidth 2 -relief sunken
    text $top.ft1.tl -height $::Pref(lines) -width 5 -wrap none \
            -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
            -takefocus 0
    text $top.ft1.tt -height $::Pref(lines) -width $::Pref(linewidth) -wrap none \

            -xscrollcommand [list $top.sbx1 set] \
            -font myfont -borderwidth 0 -padx 1 \
            -highlightthickness 0
    $top.ft1.tt configure -tabstyle wordprocessor
    tk::frame $top.ft1.f -width 2 -height 2 -background lightgray
    pack $top.ft1.tl -side left -fill y
    pack $top.ft1.f -side left -fill y
    pack $top.ft1.tt -side right -fill both -expand 1
    ttk::scrollbar $top.sby -orient vertical
    ttk::scrollbar $top.sbx1 -orient horizontal \
            -command [list $top.ft1.tt xview]
    set ::widgets($top,wLine1) $top.ft1.tl
    set ::widgets($top,wDiff1) $top.ft1.tt

    ttk::frame $top.ft2 -borderwidth 2 -relief sunken
    text $top.ft2.tl -height $::Pref(lines) -width 5 -wrap none \
            -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
            -takefocus 0
    text $top.ft2.tt -height $::Pref(lines) -width $::Pref(linewidth) -wrap none \

            -xscrollcommand [list $top.sbx2 set] \
            -font myfont -borderwidth 0 -padx 1 \
            -highlightthickness 0
    $top.ft2.tt configure -tabstyle wordprocessor
    tk::frame $top.ft2.f -width 2 -height 2 -background lightgray
    pack $top.ft2.tl -side left -fill y
    pack $top.ft2.f -side left -fill y
    pack $top.ft2.tt -side right -fill both -expand 1
    ttk::scrollbar $top.sbx2 -orient horizontal \
            -command [list $top.ft2.tt xview]
    set ::widgets($top,wLine2) $top.ft2.tl
    set ::widgets($top,wDiff2) $top.ft2.tt
    #commonYScroll $top.sby $top.ft1.tl $top.ft1.tt $top.ft2.tl $top.ft2.tt

    # Set up a tag for incremental search bindings
    if {[info procs textSearch::enableSearch] != ""} {
        textSearch::enableSearch $top.ft1.tt -label ::widgets($top,isearchLabel)
        textSearch::enableSearch $top.ft2.tt -label ::widgets($top,isearchLabel)
    }

    # Set up file dropping in text windows if TkDnd is available
    if {![catch {package require tkdnd}]} {
        dnd bindtarget $top.ft1.tt text/uri-list <Drop> "fileDrop $top left %D"
        dnd bindtarget $top.ft2.tt text/uri-list <Drop> "fileDrop $top right %D"
    }

    ttk::label $top.le -textvariable ::widgets($top,eqLabel) -width 1
    addBalloon $top.le "* means external diff is running.\n= means files do\
            not differ.\n! means a large block is being processed.\nBlank\
            means files differ."
    # FIXA: verify that this label is ok after Tile migration
    ttk::label $top.ls -width 1 \
            -textvariable ::widgets($top,isearchLabel)
    addBalloon $top.ls "Incremental search indicator"
    set bg [ttk::style configure . -background]
    set map [createMap $top $bg]

    # Edit buttons widget
    set ::widgets($top,wTb) $top.tb
    text $top.tb -width 4 -wrap none -background $bg \
            -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
            -takefocus 0
    commonYScroll $top.sby $top.ft1.tl $top.ft1.tt $top.ft2.tl $top.ft2.tt \
            $top.tb

    applyColor
    foreach w [list $top.ft1.tt $top.ft2.tt] {
        # The last change in a row is underlined
        $w tag configure last -underline 1
        # Each file in a patch view starts with a block of this type
        $w tag configure patch -background gray
        # Make sure selection is visible
        $w tag raise sel
        bind $w <ButtonPress-3> "zoomRow %W %X %Y %x %y"
        bind $w <ButtonRelease-3> "unzoomRow %W"
    }
    foreach w [list $top.ft1.tl $top.ft2.tl] {
        $w tag configure align -underline 1
        bind $w <ButtonPress-3> "rowPopup %W %X %Y %x %y"
    }
    SetupAlignDrag $top $top.ft1.tl $top.ft2.tl

    grid $top.l1   $top.le -    -        $top.l2   -row 1 -sticky news
    grid $top.ft1  $top.tb $map $top.sby $top.ft2  -row 2 -sticky news
    grid $top.sbx1 $top.ls -    -        $top.sbx2 -row 3 -sticky news
    grid columnconfigure $top "$top.ft1 $top.ft2" -weight 1
    grid rowconfigure $top $top.ft1 -weight 1
    grid $top.tb -pady 2
    grid $map -pady [expr {[winfo reqwidth $top.sby] - 2}]
    grid $top.ls -sticky ""

    grid remove $top.tb ;# Hide until done

    # Allow scrolling from keys at toplevel
    bind $top <Key-Up>    [list scrollText $top yview scroll -1 u]
    bind $top <Key-k>     [list scrollText $top yview scroll -1 u]
    bind $top <Key-Down>  [list scrollText $top yview scroll  1 u]
    bind $top <Key-j>     [list scrollText $top yview scroll  1 u]
    bind $top <Key-Prior> [list scrollText $top yview scroll -1 pa]
    bind $top <Key-b>     [list scrollText $top yview scroll -1 pa]
    bind $top <Key-Next>  [list scrollText $top yview scroll  1 pa]
    bind $top <Key-space> [list scrollText $top yview scroll  1 pa]
    bind $top <Key-Left>  [list scrollText $top xview scroll -5 u]
    bind $top <Key-h>     [list scrollText $top xview scroll -5 u]
    bind $top <Key-Right> [list scrollText $top xview scroll  5 u]
    bind $top <Key-l>     [list scrollText $top xview scroll  5 u]
    bind $top <Key-Home>  [list scrollText $top yview moveto 0]
    bind $top <Key-g>     [list scrollText $top yview moveto 0]
    bind $top <Key-End>   [list scrollText $top yview moveto 1]


    # Go out to toplevel with escape, whereever you are
    bind $top <Key-Escape> [list focus $top]

    if {$::eskil(debug) == 0} {
        set val [bindtags $top]
        lappend val backDoor$top







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|

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

|
|
|
|
|

|
|
|
|
|

|
|


|
|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|

|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320

3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404

    catch {font delete myfont}
    font create myfont -family $::Pref(fontfamily) -size $::Pref(fontsize)

    fileLabel $top.l1 -textvariable ::eskil($top,leftLabel)
    fileLabel $top.l2 -textvariable ::eskil($top,rightLabel)

    if {$::eskil($top,view) eq "table"} {
        # Single frame for contents
        ttk::frame $top.ft -borderwidth 2 -relief sunken
        grid $top.l1   $top.l2  -row 1 -sticky news
        grid $top.ft   -        -row 2 -sticky news
        grid columnconfigure $top "$top.ft" -weight 1
        grid rowconfigure $top $top.ft      -weight 1
        # TBD TABLE
        tablelist::tablelist $top.ft.tab -height 20 \
                -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 bg [ttk::style configure . -background]
        set map [createMap $top $bg]
        
        grid $top.ft.tab $top.ft.vsb $map -sticky news
        grid $top.ft.hsb x           x    -sticky news
        grid columnconfigure $top.ft 0 -weight 1
        grid rowconfigure    $top.ft 0 -weight 1
        set ::widgets($top,wTable) $top.ft.tab
    } else {
        ttk::frame $top.ft1 -borderwidth 2 -relief sunken
        text $top.ft1.tl -height $::Pref(lines) -width 5 -wrap none \
                -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
                -takefocus 0
        text $top.ft1.tt -height $::Pref(lines) -width $::Pref(linewidth) \
                -wrap none \
                -xscrollcommand [list $top.sbx1 set] \
                -font myfont -borderwidth 0 -padx 1 \
                -highlightthickness 0
        $top.ft1.tt configure -tabstyle wordprocessor
        tk::frame $top.ft1.f -width 2 -height 2 -background lightgray
        pack $top.ft1.tl -side left -fill y
        pack $top.ft1.f -side left -fill y
        pack $top.ft1.tt -side right -fill both -expand 1
        ttk::scrollbar $top.sby -orient vertical
        ttk::scrollbar $top.sbx1 -orient horizontal \
                -command [list $top.ft1.tt xview]
        set ::widgets($top,wLine1) $top.ft1.tl
        set ::widgets($top,wDiff1) $top.ft1.tt

        ttk::frame $top.ft2 -borderwidth 2 -relief sunken
        text $top.ft2.tl -height $::Pref(lines) -width 5 -wrap none \
                -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
                -takefocus 0
        text $top.ft2.tt -height $::Pref(lines) -width $::Pref(linewidth) \
                -wrap none \
                -xscrollcommand [list $top.sbx2 set] \
                -font myfont -borderwidth 0 -padx 1 \
                -highlightthickness 0
        $top.ft2.tt configure -tabstyle wordprocessor
        tk::frame $top.ft2.f -width 2 -height 2 -background lightgray
        pack $top.ft2.tl -side left -fill y
        pack $top.ft2.f -side left -fill y
        pack $top.ft2.tt -side right -fill both -expand 1
        ttk::scrollbar $top.sbx2 -orient horizontal \
                -command [list $top.ft2.tt xview]
        set ::widgets($top,wLine2) $top.ft2.tl
        set ::widgets($top,wDiff2) $top.ft2.tt


        # Set up a tag for incremental search bindings
        if {[info procs textSearch::enableSearch] != ""} {
            textSearch::enableSearch $top.ft1.tt -label ::widgets($top,isearchLabel)
            textSearch::enableSearch $top.ft2.tt -label ::widgets($top,isearchLabel)
        }

        # Set up file dropping in text windows if TkDnd is available
        if {![catch {package require tkdnd}]} {
            dnd bindtarget $top.ft1.tt text/uri-list <Drop> "fileDrop $top left %D"
            dnd bindtarget $top.ft2.tt text/uri-list <Drop> "fileDrop $top right %D"
        }

        ttk::label $top.le -textvariable ::widgets($top,eqLabel) -width 1
        addBalloon $top.le "* means external diff is running.\n= means files do\
            not differ.\n! means a large block is being processed.\nBlank\
            means files differ."
        # FIXA: verify that this label is ok after Tile migration
        ttk::label $top.ls -width 1 \
                -textvariable ::widgets($top,isearchLabel)
        addBalloon $top.ls "Incremental search indicator"
        set bg [ttk::style configure . -background]
        set map [createMap $top $bg]

        # Edit buttons widget
        set ::widgets($top,wTb) $top.tb
        text $top.tb -width 4 -wrap none -background $bg \
                -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
                -takefocus 0
        commonYScroll $top.sby $top.ft1.tl $top.ft1.tt $top.ft2.tl $top.ft2.tt \
                ;#$top.tb

        applyColor
        foreach w [list $top.ft1.tt $top.ft2.tt] {
            # The last change in a row is underlined
            $w tag configure last -underline 1
            # Each file in a patch view starts with a block of this type
            $w tag configure patch -background gray
            # Make sure selection is visible
            $w tag raise sel
            bind $w <ButtonPress-3> "zoomRow %W %X %Y %x %y"
            bind $w <ButtonRelease-3> "unzoomRow %W"
        }
        foreach w [list $top.ft1.tl $top.ft2.tl] {
            $w tag configure align -underline 1
            bind $w <ButtonPress-3> "rowPopup %W %X %Y %x %y"
        }
        SetupAlignDrag $top $top.ft1.tl $top.ft2.tl

        grid $top.l1   $top.le -    -        $top.l2   -row 1 -sticky news
        grid $top.ft1  $top.tb $map $top.sby $top.ft2  -row 2 -sticky news
        grid $top.sbx1 $top.ls -    -        $top.sbx2 -row 3 -sticky news
        grid columnconfigure $top "$top.ft1 $top.ft2" -weight 1
        grid rowconfigure $top $top.ft1 -weight 1
        grid $top.tb -pady 2
        grid $map -pady [expr {[winfo reqwidth $top.sby] - 2}]
        grid $top.ls -sticky ""

        grid remove $top.tb ;# Hide until done

        # Allow scrolling from keys at toplevel
        bind $top <Key-Up>    [list scrollText $top yview scroll -1 u]
        bind $top <Key-k>     [list scrollText $top yview scroll -1 u]
        bind $top <Key-Down>  [list scrollText $top yview scroll  1 u]
        bind $top <Key-j>     [list scrollText $top yview scroll  1 u]
        bind $top <Key-Prior> [list scrollText $top yview scroll -1 pa]
        bind $top <Key-b>     [list scrollText $top yview scroll -1 pa]
        bind $top <Key-Next>  [list scrollText $top yview scroll  1 pa]
        bind $top <Key-space> [list scrollText $top yview scroll  1 pa]
        bind $top <Key-Left>  [list scrollText $top xview scroll -5 u]
        bind $top <Key-h>     [list scrollText $top xview scroll -5 u]
        bind $top <Key-Right> [list scrollText $top xview scroll  5 u]
        bind $top <Key-l>     [list scrollText $top xview scroll  5 u]
        bind $top <Key-Home>  [list scrollText $top yview moveto 0]
        bind $top <Key-g>     [list scrollText $top yview moveto 0]
        bind $top <Key-End>   [list scrollText $top yview moveto 1]
    }

    # Go out to toplevel with escape, whereever you are
    bind $top <Key-Escape> [list focus $top]

    if {$::eskil(debug) == 0} {
        set val [bindtags $top]
        lappend val backDoor$top
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
            -in $top.f -side right -padx 3
    pack $top.bfn $top.bfp $top.bcm -ipadx 15

    if {$::eskil(debug) == 1} {
        AddDebugMenu $top
    }

    initDiffData $top
    resetEdit $top
    return $top
}

proc ValidateNewColors {} {
    foreach item {colorchange bgchange colornew1 bgnew1
        colornew2 bgnew2 colorequal bgequal} {







<







3414
3415
3416
3417
3418
3419
3420

3421
3422
3423
3424
3425
3426
3427
            -in $top.f -side right -padx 3
    pack $top.bfn $top.bfp $top.bcm -ipadx 15

    if {$::eskil(debug) == 1} {
        AddDebugMenu $top
    }


    resetEdit $top
    return $top
}

proc ValidateNewColors {} {
    foreach item {colorchange bgchange colornew1 bgnew1
        colornew2 bgnew2 colorequal bgequal} {
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
        -clip -patch -browse -conflict -print -noempty -pivot
        -printHeaderSize -printCharsPerLine -printPaper
        -printColorChange -printColorOld -printColorNew
        -printFont -sep
        -server -o -a -fine -r -context -cvs -svn -review
        -foreach -preprocess -preprocessleft -preprocessright
        -close -nonewline -plugin -plugininfo -pluginallow
        -plugindump -pluginlist -nocdiff
    }

    # If the first option is "--query", use it to ask about options.
    if {$::eskil(argc) == 2 && [lindex $::eskil(argv) 0] == "--query"} {
        set arg [lindex $::eskil(argv) 1]
        if {[lsearch -exact $allOpts $arg] < 0} {
            set match [lsearch -glob -all -inline $allOpts $arg*]







|







4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
        -clip -patch -browse -conflict -print -noempty -pivot
        -printHeaderSize -printCharsPerLine -printPaper
        -printColorChange -printColorOld -printColorNew
        -printFont -sep
        -server -o -a -fine -r -context -cvs -svn -review
        -foreach -preprocess -preprocessleft -preprocessright
        -close -nonewline -plugin -plugininfo -pluginallow
        -plugindump -pluginlist -nocdiff -table
    }

    # If the first option is "--query", use it to ask about options.
    if {$::eskil(argc) == 2 && [lindex $::eskil(argv) 0] == "--query"} {
        set arg [lindex $::eskil(argv) 1]
        if {[lsearch -exact $allOpts $arg] < 0} {
            set match [lsearch -glob -all -inline $allOpts $arg*]
4137
4138
4139
4140
4141
4142
4143


4144
4145
4146
4147
4148
4149
4150
            set noautodiff 1
        } elseif {$arg eq "-nocdiff"} {
            set nocdiff 1
        } elseif {$arg eq "-dir"} {
            set dodir 1
        } elseif {$arg eq "-clip"} {
            set doclip 1


        } elseif {$arg eq "-patch"} {
            set dopatch 1
        } elseif {$arg eq "-review"} {
            set doreview 1
        } elseif {$arg eq "-browse"} {
            set autobrowse 1
        } elseif {$arg eq "-foreach"} {







>
>







4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
            set noautodiff 1
        } elseif {$arg eq "-nocdiff"} {
            set nocdiff 1
        } elseif {$arg eq "-dir"} {
            set dodir 1
        } elseif {$arg eq "-clip"} {
            set doclip 1
        } elseif {$arg eq "-table"} {
            set opts(view) "table"
        } elseif {$arg eq "-patch"} {
            set dopatch 1
        } elseif {$arg eq "-review"} {
            set doreview 1
        } elseif {$arg eq "-browse"} {
            set autobrowse 1
        } elseif {$arg eq "-foreach"} {
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
        set fullname2 [lindex $files 1]
        if {[FileIsDirectory $fullname1 1] && [FileIsDirectory $fullname2 1]} {
            set dirdiff(leftDir) $fullname1
            set dirdiff(rightDir) $fullname2
            return [makeDirDiffWin]
        }
    }

    # Ok, we have a normal diff
    set top [makeDiffWin]
    update

    # It is preferable to see the end if the rev string is too long
    $::widgets($top,rev1) xview end
    $::widgets($top,rev2) xview end







|







4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
        set fullname2 [lindex $files 1]
        if {[FileIsDirectory $fullname1 1] && [FileIsDirectory $fullname2 1]} {
            set dirdiff(leftDir) $fullname1
            set dirdiff(rightDir) $fullname2
            return [makeDirDiffWin]
        }
    }
    
    # Ok, we have a normal diff
    set top [makeDiffWin]
    update

    # It is preferable to see the end if the rev string is too long
    $::widgets($top,rev1) xview end
    $::widgets($top,rev2) xview end
4367
4368
4369
4370
4371
4372
4373

4374
4375
4376
4377
4378
4379
4380
            openBoth $top 0
        } elseif {!$::eskil($top,leftOK)} {
            openLeft $top
        } elseif {!$::eskil($top,rightOK)} {
            openRight $top
        }
        # If we cancel the second file and detect CVS, ask about it.

        if {$::eskil($top,leftOK) && !$::eskil($top,rightOK) && \
                [llength [glob -nocomplain [file join $fulldir CVS]]]} {

            if {[tk_messageBox -title Diff -icon question \
                    -message "Do CVS diff?" -type yesno] eq "yes"} {
                set fullname $::eskil($top,leftFile)
                set ::eskil($top,leftOK) 0







>







4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
            openBoth $top 0
        } elseif {!$::eskil($top,leftOK)} {
            openLeft $top
        } elseif {!$::eskil($top,rightOK)} {
            openRight $top
        }
        # If we cancel the second file and detect CVS, ask about it.
        # TBD: Extend this to all VCS:s?
        if {$::eskil($top,leftOK) && !$::eskil($top,rightOK) && \
                [llength [glob -nocomplain [file join $fulldir CVS]]]} {

            if {[tk_messageBox -title Diff -icon question \
                    -message "Do CVS diff?" -type yesno] eq "yes"} {
                set fullname $::eskil($top,leftFile)
                set ::eskil($top,leftOK) 0