Eskil

Check-in [4e328111e5]
Login

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

Overview
Comment:Moved remaining globals into dirdiff and util. Some polish to make the code more compatible with diff.tcl, preparing to integrate the two programs.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4e328111e55a32bbfca1844eaf67e4b4eea66e77
User & Date: peter 2003-08-24 19:38:54.000
Context
2003-08-26
19:55
Prepared for inclusion in diff. check-in: aa36760ca1 user: peter tags: trunk
2003-08-24
19:38
Moved remaining globals into dirdiff and util. Some polish to make the code more compatible with diff.tcl, preparing to integrate the two programs. check-in: 4e328111e5 user: peter tags: trunk
19:34
A few small adjustments to prepare for integrating dirdiff. check-in: 5cc07cb4c3 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to dirdiff.tcl.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package require Tk 8.3

set debug 1
set thisScript [file join [pwd] [info script]]
set thisDir [file dirname $thisScript]

# Support for FreeWrap 5.5
if {[info proc ::freewrap::unpack] != ""} {
    set debug 0
    set thisDir [file dirname [info nameofexecutable]]
    set thisScript ""
    # Assume a wrapped diff too
    set tclDiffExe [list [file join $::thisDir diffw.exe]]
} else {
    if {[file type $thisScript] == "link"} {







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package require Tk 8.3

set debug 1
set thisScript [file join [pwd] [info script]]
set thisDir [file dirname $thisScript]

# Support for FreeWrap 5.5
if {[info procs ::freewrap::unpack] != ""} {
    set debug 0
    set thisDir [file dirname [info nameofexecutable]]
    set thisScript ""
    # Assume a wrapped diff too
    set tclDiffExe [list [file join $::thisDir diffw.exe]]
} else {
    if {[file type $thisScript] == "link"} {
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


if {$::tcl_platform(platform) == "windows"} {
    package require dde
}

if {$::tcl_platform(platform) == "unix"} {
    set editor emacs
    set diffExe diff
} else {
    set editor wordpad
    foreach dir [lsort -decreasing -dictionary [glob c:/apps/emacs*]] {
        set em [file join $dir bin runemacs.exe]
        if {[file exists $em]} {
            set editor $em
            break
        }
    }
    set diffExe [file join $::thisDir diff.exe]
}

# Compare file names
proc fstrcmp {s1 s2} {
    # On Unix filenames are case sensitive
    if {$::tcl_platform(platform) == "unix"} {
	return [string compare $s1 $s2]
    }
    string compare -nocase $s1 $s2
}


proc flsort {l} {
    if {$::tcl_platform(platform) == "unix"} {
	return [lsort $l]
    }
    # Case insensitive on windows
    lsort -dictionary $l
}


proc compareFiles {file1 file2} {
    global Pref
    file stat $file1 stat1
    file stat $file2 stat2

    if {[file isdirectory $file1] != [file isdirectory $file2]} {
	return 0







|
|

|



|



|



|







>
|







>







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


if {$::tcl_platform(platform) == "windows"} {
    package require dde
}

if {$::tcl_platform(platform) == "unix"} {
    set util(editor) emacs
    set util(diffexe) diff
} else {
    set util(editor) wordpad
    foreach dir [lsort -decreasing -dictionary [glob c:/apps/emacs*]] {
        set em [file join $dir bin runemacs.exe]
        if {[file exists $em]} {
            set util(editor) $em
            break
        }
    }
    set util(diffexe) [file join $::thisDir diff.exe]
}

# Compare file names
proc FStrCmp {s1 s2} {
    # On Unix filenames are case sensitive
    if {$::tcl_platform(platform) == "unix"} {
	return [string compare $s1 $s2]
    }
    string compare -nocase $s1 $s2
}

# Sort file names
proc Fsort {l} {
    if {$::tcl_platform(platform) == "unix"} {
	return [lsort $l]
    }
    # Case insensitive on windows
    lsort -dictionary $l
}

# Compare two files
proc compareFiles {file1 file2} {
    global Pref
    file stat $file1 stat1
    file stat $file2 stat2

    if {[file isdirectory $file1] != [file isdirectory $file2]} {
	return 0
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
            if {([eof $ch1] + [eof $ch2]) < 2} {
                set eq 0
            }
            close $ch1
            close $ch2
        }
        2 { # Simple external diff
            set eq [expr {![catch {exec $::diffExe $file1 $file2}]}]
        }
        3 { # Ignore space
            set eq [expr {![catch {exec $::diffExe -w $file1 $file2}]}]
        }
        4 { # Ignore case
            set eq [expr {![catch {exec $::diffExe -i $file1 $file2}]}]
        }
        5 { # Ignore RCS
            set eq [expr {![catch {exec $::diffExe {--ignore-matching-lines=RCS: @(#) $Id} $file1 $file2} differr]}]
        }
    }
    return $eq
}

# infoFiles: 1= noLeft 2 = noRight 4=left is dir  8= right is dir 16=diff
proc listFiles {df1 df2 diff level} {
    global dirdiff leftFiles rightFiles infoFiles

    if {$::Pref(nodir)} {
        if {$df1 != "" && [file isdirectory $df1] && \
                $df2 != "" && [file isdirectory $df2] } {
            return
        }
    }

    lappend leftFiles $df1
    lappend rightFiles $df2
    set info 16
    if {$df1 == ""} {
        incr info 1
    }
    if {$df2 == ""} {
        incr info 2
    }







|


|


|


|







|

|






|
|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
            if {([eof $ch1] + [eof $ch2]) < 2} {
                set eq 0
            }
            close $ch1
            close $ch2
        }
        2 { # Simple external diff
            set eq [expr {![catch {exec $::util(diffexe) $file1 $file2}]}]
        }
        3 { # Ignore space
            set eq [expr {![catch {exec $::util(diffexe) -w $file1 $file2}]}]
        }
        4 { # Ignore case
            set eq [expr {![catch {exec $::util(diffexe) -i $file1 $file2}]}]
        }
        5 { # Ignore RCS
            set eq [expr {![catch {exec $::util(diffexe) {--ignore-matching-lines=RCS: @(#) $Id} $file1 $file2} differr]}]
        }
    }
    return $eq
}

# infoFiles: 1= noLeft 2 = noRight 4=left is dir  8= right is dir 16=diff
proc listFiles {df1 df2 diff level} {
    global dirdiff Pref

    if {$Pref(nodir)} {
        if {$df1 != "" && [file isdirectory $df1] && \
                $df2 != "" && [file isdirectory $df2] } {
            return
        }
    }

    lappend dirdiff(leftFiles) $df1
    lappend dirdiff(rightFiles) $df2
    set info 16
    if {$df1 == ""} {
        incr info 1
    }
    if {$df2 == ""} {
        incr info 2
    }
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
	$dirdiff(wLeft) insert end \n
    } else {
	$dirdiff(wLeft) insert end [format "%-30s %8d %16s\n" \
                $f1 [file size $df1] \
		[clock format [file mtime $df1] -format "%Y-%m-%d %H:%M"]] \
		$tag1
    }
    lappend infoFiles $info
}

proc compareDirs {dir1 dir2 {level 0}} {
    global Pref
    set olddir [pwd]
    cd $dir1
    set files1 [flsort [glob -nocomplain * {.[a-zA-Z]*}]]
    cd $dir2
    set files2 [flsort [glob -nocomplain * {.[a-zA-Z]*}]]
    cd $olddir

    set len1 [llength $files1]
    set len2 [llength $files2]

    set p1 0
    set p2 0
    while 1 {
	if {$p1 < $len1 && $p2 < $len2} {
	    set f1 [lindex $files1 $p1]
	    set df1 [file join $dir1 $f1]
	    set f2 [lindex $files2 $p2]
	    set df2 [file join $dir2 $f2]
            set apa [fstrcmp $f1 $f2]
            if {$apa == 0} {
                set apa [expr {- [file isdirectory $df1] \
                               + [file isdirectory $df2]}]
            }
	    switch -- $apa {
		0 {
		    set diff [expr {![compareFiles $df1 $df2]}]
		    if {$diff || !$Pref(diffonly)} { 
			listFiles $df1 $df2 $diff $level
		    }
		    if {[file isdirectory $df1] && [file isdirectory $df2] && \
			    $Pref(recursive) && [file tail $df1] != "CVS"} {
			compareDirs $df1 $df2 [expr {$level + 1}]
		    }
		    incr p1







|






|

|













|







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	$dirdiff(wLeft) insert end \n
    } else {
	$dirdiff(wLeft) insert end [format "%-30s %8d %16s\n" \
                $f1 [file size $df1] \
		[clock format [file mtime $df1] -format "%Y-%m-%d %H:%M"]] \
		$tag1
    }
    lappend dirdiff(infoFiles) $info
}

proc compareDirs {dir1 dir2 {level 0}} {
    global Pref
    set olddir [pwd]
    cd $dir1
    set files1 [Fsort [glob -nocomplain * {.[a-zA-Z]*}]]
    cd $dir2
    set files2 [Fsort [glob -nocomplain * {.[a-zA-Z]*}]]
    cd $olddir

    set len1 [llength $files1]
    set len2 [llength $files2]

    set p1 0
    set p2 0
    while 1 {
	if {$p1 < $len1 && $p2 < $len2} {
	    set f1 [lindex $files1 $p1]
	    set df1 [file join $dir1 $f1]
	    set f2 [lindex $files2 $p2]
	    set df2 [file join $dir2 $f2]
            set apa [FStrCmp $f1 $f2]
            if {$apa == 0} {
                set apa [expr {- [file isdirectory $df1] \
                               + [file isdirectory $df2]}]
            }
	    switch -- $apa {
		0 {
		    set diff [expr {![compareFiles $df1 $df2]}]
		    if {$diff || !$Pref(dir,onlydiffs)} { 
			listFiles $df1 $df2 $diff $level
		    }
		    if {[file isdirectory $df1] && [file isdirectory $df2] && \
			    $Pref(recursive) && [file tail $df1] != "CVS"} {
			compareDirs $df1 $df2 [expr {$level + 1}]
		    }
		    incr p1
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
	} else {
	    break
	}
    }
}

proc doCompare {} {
    global dirdiff leftFiles rightFiles infoFiles
    if {![file isdirectory $dirdiff(leftDir)]} return
    if {![file isdirectory $dirdiff(rightDir)]} return
    set leftFiles {}
    set rightFiles {}
    set infoFiles {}
    $dirdiff(wLeft) delete 1.0 end
    $dirdiff(wRight) delete 1.0 end
    compareDirs $dirdiff(leftDir) $dirdiff(rightDir)
}

proc browseDir {dirVar} {
    global Pref
    upvar #0 $dirVar dir

    set newdir $dir
    while {$newdir != "." && ![file isdirectory $newdir]} {
        set newdir [file dirname $newdir]
    }
    set newdir [tk_chooseDirectory -initialdir $newdir -title "Select Directory"]
    if {$newdir != ""} {
        set dir $newdir
    }
    if {$Pref(autocompare)} doCompare
}

proc selectFile {w x y} {
    global dirdiff leftFiles rightFiles infoFiles Pref

    set row [expr {int([$w index @$x,$y]) - 1}]
    set lf [lindex $leftFiles $row]
    set rf [lindex $rightFiles $row]
    set i [lindex $infoFiles $row]
    if {($i & 12) == 12} { # Both are dirs
        set dirdiff(leftDir) $lf
        set dirdiff(rightDir) $rf
        if {$Pref(autocompare)} doCompare
    } elseif {$i & 4} { # Left is dir
        set dirdiff(leftDir) $lf
        if {$Pref(autocompare)} doCompare
    } elseif {$i & 8} { # Right is dir
        set dirdiff(rightDir) $rf
        if {$Pref(autocompare)} doCompare
    } elseif {($i & 3) == 0} { # Both exists
        remoteDiff $lf $rf
    }
}

proc rightClick {w x y X Y} {
    global dirdiff leftFiles rightFiles infoFiles Pref

    set row [expr {int([$w index @$x,$y]) - 1}]
    set lf [lindex $leftFiles $row]
    set rf [lindex $rightFiles $row]
    set i [lindex $infoFiles $row]

    set m .dirdiff.m
    destroy $m
    menu $m -tearoff 0
    if {($i & 12) == 12} { # Both are dirs
        $m add command -label "Compare Directories" -command "
            [list set dirdiff(leftDir) $lf]







|


|
|
|







|













|


|
|
|
















|


|
|
|







270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
	} else {
	    break
	}
    }
}

proc doCompare {} {
    global dirdiff
    if {![file isdirectory $dirdiff(leftDir)]} return
    if {![file isdirectory $dirdiff(rightDir)]} return
    set dirdiff(leftFiles) {}
    set dirdiff(rightFiles) {}
    set dirdiff(infoFiles) {}
    $dirdiff(wLeft) delete 1.0 end
    $dirdiff(wRight) delete 1.0 end
    compareDirs $dirdiff(leftDir) $dirdiff(rightDir)
}

proc browseDir {dirVar} {
    global Pref
    upvar "#0" $dirVar dir

    set newdir $dir
    while {$newdir != "." && ![file isdirectory $newdir]} {
        set newdir [file dirname $newdir]
    }
    set newdir [tk_chooseDirectory -initialdir $newdir -title "Select Directory"]
    if {$newdir != ""} {
        set dir $newdir
    }
    if {$Pref(autocompare)} doCompare
}

proc selectFile {w x y} {
    global dirdiff Pref

    set row [expr {int([$w index @$x,$y]) - 1}]
    set lf [lindex $dirdiff(leftFiles) $row]
    set rf [lindex $dirdiff(rightFiles) $row]
    set i [lindex $dirdiff(infoFiles) $row]
    if {($i & 12) == 12} { # Both are dirs
        set dirdiff(leftDir) $lf
        set dirdiff(rightDir) $rf
        if {$Pref(autocompare)} doCompare
    } elseif {$i & 4} { # Left is dir
        set dirdiff(leftDir) $lf
        if {$Pref(autocompare)} doCompare
    } elseif {$i & 8} { # Right is dir
        set dirdiff(rightDir) $rf
        if {$Pref(autocompare)} doCompare
    } elseif {($i & 3) == 0} { # Both exists
        remoteDiff $lf $rf
    }
}

proc rightClick {w x y X Y} {
    global dirdiff Pref

    set row [expr {int([$w index @$x,$y]) - 1}]
    set lf [lindex $dirdiff(leftFiles) $row]
    set rf [lindex $dirdiff(rightFiles) $row]
    set i [lindex $dirdiff(infoFiles) $row]

    set m .dirdiff.m
    destroy $m
    menu $m -tearoff 0
    if {($i & 12) == 12} { # Both are dirs
        $m add command -label "Compare Directories" -command "
            [list set dirdiff(leftDir) $lf]
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
                -command [list editFile $row right]
    }

    tk_popup $m $X $Y
}

proc copyFile {row to} {
    global dirdiff leftFiles rightFiles infoFiles Pref

    if {$to == "left"} {
        set src [lindex $rightFiles $row]
        set n [expr {[string length $dirdiff(rightDir)] + 1}]
        set dst [file join $dirdiff(leftDir) [string range $src $n end]]
    } elseif {$to == "right"} {
        set src [lindex $leftFiles $row]
        set n [expr {[string length $dirdiff(leftDir)] + 1}]
        set dst [file join $dirdiff(rightDir) [string range $src $n end]]
    } else {
        error "Bad to argument to copyFile: $to"
    }

    if {[file exists $dst]} {
        if {[tk_messageBox -icon question -title "Overwrite file?" -message \
                "Copy\n$src\noverwriting\n$dst ?" -type yesno] == "yes"} {
            file copy -force $src $dst
        }
    } else {
        if {[tk_messageBox -icon question -title "Copy file?" -message \
                "Copy\n$src\nto\n$dst ?" -type yesno] == "yes"} {
            file copy $src $dst
        }
    }
}

proc editFile {row from} {
    global dirdiff leftFiles rightFiles infoFiles Pref

    if {$from == "left"} {
        set src [file join $dirdiff(leftDir) [lindex $leftFiles $row]]
    } elseif {$from == "right"} {
        set src [file join $dirdiff(rightDir) [lindex $rightFiles $row]]
    } else {
        error "Bad from argument to editFile: $from"
    }

    exec $::editor $src &
}

proc remoteDiff {file1 file2} {
    set cmd [list remoteDiff $file1 $file2]

    if {$::tcl_platform(platform) == "unix"} {
        # send -async Diff $cmd







|


|



|




















|


|

|




|







366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
                -command [list editFile $row right]
    }

    tk_popup $m $X $Y
}

proc copyFile {row to} {
    global dirdiff Pref

    if {$to == "left"} {
        set src [lindex $dirdiff(rightFiles) $row]
        set n [expr {[string length $dirdiff(rightDir)] + 1}]
        set dst [file join $dirdiff(leftDir) [string range $src $n end]]
    } elseif {$to == "right"} {
        set src [lindex $dirdiff(leftFiles) $row]
        set n [expr {[string length $dirdiff(leftDir)] + 1}]
        set dst [file join $dirdiff(rightDir) [string range $src $n end]]
    } else {
        error "Bad to argument to copyFile: $to"
    }

    if {[file exists $dst]} {
        if {[tk_messageBox -icon question -title "Overwrite file?" -message \
                "Copy\n$src\noverwriting\n$dst ?" -type yesno] == "yes"} {
            file copy -force $src $dst
        }
    } else {
        if {[tk_messageBox -icon question -title "Copy file?" -message \
                "Copy\n$src\nto\n$dst ?" -type yesno] == "yes"} {
            file copy $src $dst
        }
    }
}

proc editFile {row from} {
    global dirdiff Pref

    if {$from == "left"} {
        set src [file join $dirdiff(leftDir) [lindex $dirdiff(leftFiles) $row]]
    } elseif {$from == "right"} {
        set src [file join $dirdiff(rightDir) [lindex $dirdiff(rightFiles) $row]]
    } else {
        error "Bad from argument to editFile: $from"
    }

    exec $::util(editor) $src &
}

proc remoteDiff {file1 file2} {
    set cmd [list remoteDiff $file1 $file2]

    if {$::tcl_platform(platform) == "unix"} {
        # send -async Diff $cmd
439
440
441
442
443
444
445

446
447

448


449



450
451

452
453
454

455



456
457
458
459
460
461
462
463
464
465
466
467

468

469
470

471

472
473
474
475
476
477
478
        2 {
            set dirdiff(rightDir) [file dirname $dirdiff(rightDir)]
            if {$Pref(autocompare)} doCompare
        }
    }            
}


proc my_yview {args} {
    global dirdiff

    eval $dirdiff(wLeft) yview $args


    eval $dirdiff(wRight) yview $args



}


proc my_yscroll {args} {
    global dirdiff
    eval $dirdiff(wY) set $args

    my_yview moveto [lindex $args 0]



}

proc chFont {} {
    global Pref

    font configure myfont -size $Pref(fontsize) -family $Pref(fontfamily)
}

proc applyColor {} {
    global dirdiff Pref

    $dirdiff(wLeft) tag configure new1 -foreground $Pref(colornew1) -background $Pref(bgnew1)

    $dirdiff(wLeft) tag configure change -foreground $Pref(colorchange) -background $Pref(bgchange)

    $dirdiff(wLeft) tag configure changed -foreground $Pref(colorchange)
    $dirdiff(wRight) tag configure new2 -foreground $Pref(colornew2) -background $Pref(bgnew2)

    $dirdiff(wRight) tag configure change -foreground $Pref(colorchange) -background $Pref(bgchange)

    $dirdiff(wRight) tag configure changed -foreground $Pref(colorchange)
}

proc makeDirDiffWin {} {
    global Pref dirdiff

    set top .dirdiff







>
|
|
>
|
>
>
|
>
>
>


>
|
|
|
>
|
>
>
>











|
>
|
>

|
>
|
>







441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
        2 {
            set dirdiff(rightDir) [file dirname $dirdiff(rightDir)]
            if {$Pref(autocompare)} doCompare
        }
    }            
}

# Procedures for common y-scroll
proc commonYScroll_YView {sby args} {
    global yscroll
    foreach w $yscroll($sby) {
        eval [list $w yview] $args
    }
}

proc commonYScroll_YScroll {sby args} {
    eval [list $sby set] $args
    commonYScroll_YView $sby moveto [lindex $args 0]
}

# Set up a common yscrollbar for a few scrollable widgets
proc commonYScroll {sby args} {
    global yscroll

    $sby configure -command [list commonYScroll_YView $sby]
    foreach w $args {
        $w configure -yscrollcommand [list commonYScroll_YScroll $sby]
    }
    set yscroll($sby) $args
}

proc chFont {} {
    global Pref

    font configure myfont -size $Pref(fontsize) -family $Pref(fontfamily)
}

proc applyColor {} {
    global dirdiff Pref

    $dirdiff(wLeft) tag configure new1 -foreground $Pref(colornew1) \
            -background $Pref(bgnew1)
    $dirdiff(wLeft) tag configure change -foreground $Pref(colorchange) \
            -background $Pref(bgchange)
    $dirdiff(wLeft) tag configure changed -foreground $Pref(colorchange)
    $dirdiff(wRight) tag configure new2 -foreground $Pref(colornew2) \
            -background $Pref(bgnew2)
    $dirdiff(wRight) tag configure change -foreground $Pref(colorchange) \
            -background $Pref(bgchange)
    $dirdiff(wRight) tag configure changed -foreground $Pref(colorchange)
}

proc makeDirDiffWin {} {
    global Pref dirdiff

    set top .dirdiff
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
    menu $top.mf.m
    $top.mf.m add command -label "Quit" -underline 0 -command exit

    menubutton $top.mo -menu $top.mo.m -text "Preferences" -underline 0
    menu $top.mo.m
    $top.mo.m add checkbutton -variable Pref(recursive) -label "Recursive"
    $top.mo.m add cascade -label "Check" -menu $top.mo.mc
    $top.mo.m add checkbutton -variable Pref(diffonly) -label "Diffs Only"
    $top.mo.m add checkbutton -variable Pref(nodir)    -label "No Directory"
    $top.mo.m add checkbutton -variable Pref(autocompare) -label "Auto Compare"

    menu $top.mo.mc
    $top.mo.mc add radiobutton -variable Pref(comparelevel) -value 0 \
            -label "Do not check contents"
    $top.mo.mc add radiobutton -variable Pref(comparelevel) -value 1 \







|







511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
    menu $top.mf.m
    $top.mf.m add command -label "Quit" -underline 0 -command exit

    menubutton $top.mo -menu $top.mo.m -text "Preferences" -underline 0
    menu $top.mo.m
    $top.mo.m add checkbutton -variable Pref(recursive) -label "Recursive"
    $top.mo.m add cascade -label "Check" -menu $top.mo.mc
    $top.mo.m add checkbutton -variable Pref(dir,onlydiffs) -label "Diffs Only"
    $top.mo.m add checkbutton -variable Pref(nodir)    -label "No Directory"
    $top.mo.m add checkbutton -variable Pref(autocompare) -label "Auto Compare"

    menu $top.mo.mc
    $top.mo.mc add radiobutton -variable Pref(comparelevel) -value 0 \
            -label "Do not check contents"
    $top.mo.mc add radiobutton -variable Pref(comparelevel) -value 1 \
550
551
552
553
554
555
556
557
558
559
560
561
562
563

564
565
566
567
568
569
570
    bind $top.e2 <Return> doCompare

    pack $top.bb1 $top.bu1 -in $top.fe1 -side right
    pack $top.e1 -in $top.fe1 -side left -fill x -expand 1
    pack $top.bb2 $top.bu2 -in $top.fe2 -side right
    pack $top.e2 -in $top.fe2 -side left -fill x -expand 1

    text $top.t1 -height 40 -width 60 -wrap none -yscrollcommand my_yscroll \
	    -xscrollcommand "$top.sbx1 set" -font myfont
    scrollbar $top.sby -orient vertical -command "my_yview"
    scrollbar $top.sbx1 -orient horizontal -command "$top.t1 xview"
    text $top.t2 -height 40 -width 60 -wrap none -yscrollcommand my_yscroll \
	    -xscrollcommand "$top.sbx2 set" -font myfont
    scrollbar $top.sbx2 -orient horizontal -command "$top.t2 xview"

    canvas $top.c -width 4

    bind $top.t1 <Double-Button-1> "after idle selectFile $top.t1 %x %y"
    bind $top.t2 <Double-Button-1> "after idle selectFile $top.t2 %x %y"
    bind $top.t1 <Button-3> "rightClick $top.t1 %x %y %X %Y"
    bind $top.t2 <Button-3> "rightClick $top.t2 %x %y %X %Y"








|
|
|

|
|

>







568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
    bind $top.e2 <Return> doCompare

    pack $top.bb1 $top.bu1 -in $top.fe1 -side right
    pack $top.e1 -in $top.fe1 -side left -fill x -expand 1
    pack $top.bb2 $top.bu2 -in $top.fe2 -side right
    pack $top.e2 -in $top.fe2 -side left -fill x -expand 1

    text $top.t1 -height 40 -width 60 -wrap none -font myfont \
	    -xscrollcommand "$top.sbx1 set"
    scrollbar $top.sby -orient vertical
    scrollbar $top.sbx1 -orient horizontal -command "$top.t1 xview"
    text $top.t2 -height 40 -width 60 -wrap none -font myfont \
	    -xscrollcommand "$top.sbx2 set"
    scrollbar $top.sbx2 -orient horizontal -command "$top.t2 xview"
    commonYScroll $top.sby $top.t1 $top.t2
    canvas $top.c -width 4

    bind $top.t1 <Double-Button-1> "after idle selectFile $top.t1 %x %y"
    bind $top.t2 <Double-Button-1> "after idle selectFile $top.t2 %x %y"
    bind $top.t1 <Button-3> "rightClick $top.t1 %x %y %X %Y"
    bind $top.t2 <Button-3> "rightClick $top.t2 %x %y %X %Y"

592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
    set Pref(colornew1) darkgreen
    set Pref(colornew2) blue
    set Pref(bgchange) gray
    set Pref(bgnew1) gray
    set Pref(bgnew2) gray
    set Pref(comparelevel) 1
    set Pref(recursive) 0
    set Pref(diffonly) 0
    set Pref(nodir) 0
    set Pref(autocompare) 1

    if {[file exists "~/.dirdiffrc"]} {
        source "~/.dirdiffrc"
    }
}







|







611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
    set Pref(colornew1) darkgreen
    set Pref(colornew2) blue
    set Pref(bgchange) gray
    set Pref(bgnew1) gray
    set Pref(bgnew2) gray
    set Pref(comparelevel) 1
    set Pref(recursive) 0
    set Pref(dir,onlydiffs) 0
    set Pref(nodir) 0
    set Pref(autocompare) 1

    if {[file exists "~/.dirdiffrc"]} {
        source "~/.dirdiffrc"
    }
}