︙ | | |
24
25
26
27
28
29
30
31
32
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
|
24
25
26
27
28
29
30
31
32
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
|
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
|
# Add a dummy if it does not exists.
proc addBalloon {args} {}
} else {
namespace import -force psballoon::addBalloon
}
set debug 1
set diffver "Version 1.9.8+ 2003-08-20"
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]
set diffver "Version 1.9.8+ 2003-08-24"
set thisScript [file join [pwd] [info script]]
set thisDir [file dirname $thisScript]
set ::diff(cvsExists) [expr {![string equal [auto_execok cvs] ""]}]
set ::diff(diffexe) diff
set ::diff(thisexe) [list [info nameofexecutable] $thisscript]
set ::util(cvsExists) [expr {![string equal [auto_execok cvs] ""]}]
set ::util(diffexe) diff
set ::util(diffWrapped) 0
# Experimenting with DiffUtil package
set ::diff(diffutil) [expr {![catch {package require DiffUtil}]}]
set ::diff(diffutil) 0
if {[info exists env(TEMP)]} {
set ::diff(tmpdir) $env(TEMP)
} elseif {[info exists env(TMP)]} {
set ::diff(tmpdir) $env(TMP)
} else {
if {$tcl_platform(platform) == "windows"} {
set ::diff(tmpdir) c:/
} else {
set ::diff(tmpdir) .
}
}
# Support for FreeWrap.
if {[info procs ::freewrap::unpack] != ""} {
set debug 0
set thisdir [pwd]
set thisscript ""
set thisDir [pwd]
set thisScript ""
set ::diff(thisexe) [list [info nameofexecutable]]
# If diff.exe is wrapped, copy it so we can use it.
set apa [::freewrap::unpack /diff.exe]
if {$apa != ""} {
set ::diff(diffexe) $apa
set ::util(diffexe) $apa
set ::util(diffWrapped) 1
}
}
if {$tcl_platform(platform) == "windows"} {
cd $thisdir
cd $thisDir
catch {package require dde}
if {!$::diff(cvsExists) && [file exists "c:/bin/cvs.exe"]} {
if {!$::util(cvsExists) && [file exists "c:/bin/cvs.exe"]} {
set env(PATH) "$env(PATH);c:\\bin"
auto_reset
set ::diff(cvsExists) [expr {![string equal [auto_execok cvs] ""]}]
set ::util(cvsExists) [expr {![string equal [auto_execok cvs] ""]}]
}
}
proc cleanupAndExit {top} {
# A security thing to make sure we can exit.
set cont 0
if {[catch {
|
︙ | | |
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
-
+
|
} errMsg]} {
tk_messageBox -icon error -title "Diff Error" -message \
"An error occured in the close process.\n$errMsg\n\
(This is a bug)\nTerminating application." -type ok
}
if {$cont} return
if {$::diff(diffexe) != "diff"} {
if {$::util(diffWrapped)} {
catch {file delete $::diff(diffexe)}
}
clearTmp
exit
}
# Format a line number
|
︙ | | |
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
|
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
|
-
+
|
}
# Run diff and parse the result.
if {$::diff(diffutil)} {
set differr [catch {eval DiffUtil::diffFiles $Pref(ignore) \
\$diff($top,leftFile) \$diff($top,rightFile)} diffres]
} else {
set differr [catch {eval exec \$::diff(diffexe) \
set differr [catch {eval exec \$::util(diffexe) \
$diff($top,dopt) $Pref(ignore) \
\$diff($top,leftFile) \$diff($top,rightFile)} diffres]
}
set apa [split $diffres "\n"]
set result {}
foreach i $apa {
if {[string match {[0-9]*} $i]} {
|
︙ | | |
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
|
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
|
-
-
+
+
+
-
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
|
proc unzoomRow {w} {
set top [winfo toplevel $w]
destroy $top.balloon
}
# Procedures for common y-scroll
proc my_yview {top args} {
foreach item {wLine1 wDiff1 wLine2 wDiff2} {
proc commonYScroll_YView {sby args} {
global yscroll
foreach w $yscroll($sby) {
set w $::diff($top,$item)
eval $w yview $args
eval [list $w yview] $args
}
}
proc my_yscroll {top args} {
eval $top.sby set $args
my_yview $top moveto [lindex $args 0]
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
}
# Reconfigure font
proc chFont {} {
global Pref
font configure myfont -size $Pref(fontsize) -family $Pref(fontfamily)
}
# Change color settings
proc applyColor {} {
global Pref
global diff Pref
foreach top $::diff(diffWindows) {
foreach top $diff(diffWindows) {
foreach item {wLine1 wDiff1 wLine2 wDiff2} {
set w $::diff($top,$item)
set w $diff($top,$item)
$w tag configure new1 -foreground $Pref(colornew1) \
-background $Pref(bgnew1)
$w tag configure change -foreground $Pref(colorchange) \
-background $Pref(bgchange)
$w tag configure new2 -foreground $Pref(colornew2) \
-background $Pref(bgnew2)
|
︙ | | |
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
|
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
|
-
+
|
-command [list openConflict $top]
$top.mf.m add command -label "Open Patch File..." \
-command [list openPatch $top]
if {$tcl_platform(platform) == "unix"} {
$top.mf.m add command -label "RCSDiff..." -underline 0 \
-command [list openRCS $top]
}
if {$::diff(cvsExists)} {
if {$::util(cvsExists)} {
$top.mf.m add command -label "CVSDiff..." -underline 1 \
-command [list openCVS $top]
}
$top.mf.m add separator
$top.mf.m add command -label "Print..." -underline 0 \
-command [list doPrint $top]
$top.mf.m add separator
|
︙ | | |
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
|
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
|
-
-
-
+
-
-
+
|
font create myfont -family $Pref(fontfamily) -size $Pref(fontsize)
fileLabel $top.l1 -textvariable diff($top,leftLabel)
fileLabel $top.l2 -textvariable diff($top,rightLabel)
frame $top.ft1 -borderwidth 2 -relief sunken
text $top.ft1.tl -height 40 -width 5 -wrap none \
-yscrollcommand [list my_yscroll $top] \
-font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
-takefocus 0
text $top.ft1.tt -height 40 -width 80 -wrap none \
-yscrollcommand [list my_yscroll $top] \
-xscrollcommand [list $top.sbx1 set] \
-font myfont -borderwidth 0 -padx 1 \
-highlightthickness 0
frame $top.ft1.f -width 2 -height 2 -bg 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
scrollbar $top.sby -orient vertical -command [list my_yview $top]
scrollbar $top.sby -orient vertical
scrollbar $top.sbx1 -orient horizontal -command [list $top.ft1.tt xview]
set ::diff($top,wLine1) $top.ft1.tl
set ::diff($top,wDiff1) $top.ft1.tt
frame $top.ft2 -borderwidth 2 -relief sunken
text $top.ft2.tl -height 60 -width 5 -wrap none \
-yscrollcommand [list my_yscroll $top] \
-font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
-takefocus 0
text $top.ft2.tt -height 60 -width 80 -wrap none \
-yscrollcommand [list my_yscroll $top] \
-xscrollcommand [list $top.sbx2 set] \
-font myfont -borderwidth 0 -padx 1 \
-highlightthickness 0
frame $top.ft2.f -width 2 -height 2 -bg 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
scrollbar $top.sbx2 -orient horizontal -command [list $top.ft2.tt xview]
set ::diff($top,wLine2) $top.ft2.tl
set ::diff($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 ::diff($top,isearchLabel)
textSearch::enableSearch $top.ft2.tt -label ::diff($top,isearchLabel)
}
|
︙ | | |
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
|
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
|
-
+
|
$top.ft2.tt configure -wrap \$wrapstate"
$top.md.m add command -label "Merge" -command [list makeMergeWin $top]
$top.md.m add command -label "Date Filter" \
-command {set ::diff(filter) {^Date}}
$top.md.m add command -label "Align" -command [list runAlign $top]
$top.md.m add separator
$top.md.m add command -label "Reread Source" \
-command {source $thisscript}
-command {source $thisScript}
$top.md.m add separator
$top.md.m add command -label "Redraw Window" \
-command [list makeDiffWin $top]
$top.md.m add separator
$top.md.m add command -label "Normal Cursor" \
-command [list normalCursor $top]
$top.md.m add separator
|
︙ | | |
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
|
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
|
-
+
-
+
|
}
#####################################
# Help and startup functions
#####################################
proc makeNuisance {{str {Hi there!}}} {
global thisdir
global thisDir
if {[lsearch [image names] nuisance] < 0} {
set file [file join $thisdir Nuisance.gif]
set file [file join $thisDir Nuisance.gif]
if {![file exists $file]} return
image create photo nuisance -file $file
}
destroy .nui
toplevel .nui
wm transient .nui .
|
︙ | | |
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
|
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
|
-
+
|
}
}
}
proc makeHelpWin {} {
global Pref
set doc [file join $::thisdir doc/diff.txt]
set doc [file join $::thisDir doc/diff.txt]
if {![file exists $doc]} return
set w [helpWin .he "Diff Help"]
text $w.t -width 82 -height 35 -wrap word -yscrollcommand "$w.sb set"\
-font "Courier 10"
scrollbar $w.sb -orient vert -command "$w.t yview"
|
︙ | | |
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
|
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
|
+
-
+
+
+
+
|
}
}
}
proc saveOptions {} {
global Pref
set rcfile "~/.diffrc"
if {[catch {set ch [open "~/.diffrc" w]} err]} {
if {[catch {set ch [open $rcfile w]} err]} {
tk_messageBox -icon error -title "File error" -message \
"Error when trying to save preferences:\n$err"
return
}
foreach i [array names Pref] {
puts $ch [list set Pref($i) $Pref($i)]
}
close $ch
tk_messageBox -icon info -title "Saved" -message \
"Prefrences saved to:\n[file nativename $rcfile]"
}
proc getOptions {} {
global Pref
set Pref(fontsize) 9
set Pref(fontfamily) Courier
|
︙ | | |