︙ | | | ︙ | |
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# 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 debug 0
set diffver "Version 2.3 2007-12-05"
set ::thisScript [file join [pwd] [info script]]
# 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
if {[catch {package require psballoon}]} {
# Add a dummy if it does not exist.
proc addBalloon {args} {}
} else {
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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 debug 0
set diffver "Version 2.3+ 2008-01-13"
set ::thisScript [file join [pwd] [info script]]
# 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}
if {[catch {package require Ttk}]} {
if {[catch {package require tile}]} {
puts "Themed Tk not found"
exit
}
}
if {[tk windowingsystem] ne "aqua"} {
#namespace import -force ttk::scrollbar
interp alias {} scrollbar {} ttk::scrollbar
}
if {[info commands ttk::toplevel] eq ""} {
proc ttk::toplevel {w args} {
eval [linsert $args 0 tk::toplevel $w]
place [ttk::frame $w.tilebg] -x 0 -y 0 -relwidth 1 -relheight 1
return $w
}
}
#interp alias {} frame {} ttk::frame
#interp alias {} toplevel {} ttk::toplevel
#interp alias {} labelframe {} ttk::labelframe
#interp alias {} label {} ttk::label
#interp alias {} entry {} ttk::entry ;# need to support xview end
#interp alias {} radiobutton {} ttk::radiobutton
#interp alias {} menubutton {} ttk::menubutton
#interp alias {} checkbutton {} ttk::checkbutton
#interp alias {} button {} ttk::button
package require wcb
if {[catch {package require psballoon}]} {
# Add a dummy if it does not exist.
proc addBalloon {args} {}
} else {
|
︙ | | | ︙ | |
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
|
-background $Pref(bgchange)
$w tag configure new2 -foreground $Pref(colornew2) \
-background $Pref(bgnew2)
}
continue
}
$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(wLeft) tag configure invalid -background #a9a9a9
$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)
$dirdiff(wRight) tag configure invalid -background #a9a9a9
}
}
# Scroll text windows
proc scrollText {top n what} {
# Do not scroll if focus is in a text window.
# This is for scroll bindings in the toplevel.
if {[winfo class [focus]] != "Text"} {
$::widgets($top,wDiff1) yview scroll $n $what
}
}
# Experiment using snit
if {[catch {package require snit}]} {
namespace eval snit {
proc widgetadaptor {args} {}
}
}
# Emulate a label that:
# 1 : Displays the right part of the text if there isn't enough room
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
|
-background $Pref(bgchange)
$w tag configure new2 -foreground $Pref(colornew2) \
-background $Pref(bgnew2)
}
continue
}
# $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(wLeft) tag configure invalid -background #a9a9a9
# $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)
# $dirdiff(wRight) tag configure invalid -background #a9a9a9
}
}
# Scroll text windows
proc scrollText {top n what} {
# Do not scroll if focus is in a text window.
# This is for scroll bindings in the toplevel.
if {[winfo class [focus]] != "Text"} {
$::widgets($top,wDiff1) yview scroll $n $what
}
}
# Experiment using snit
lappend ::auto_path [file dirname [file dirname $::thisScript]]/lib
#puts $::auto_path
if {[catch {package require snit}]} {
namespace eval snit {
proc widgetadaptor {args} {}
}
}
# Emulate a label that:
# 1 : Displays the right part of the text if there isn't enough room
|
︙ | | | ︙ | |
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
|
}
# Emulate a label that:
# 1 : Displays the right part of the text if there isn't enough room
# 2 : Justfify text to the left if there is enough room.
# 3 : Does not try to allocate space according to its contents
proc fileLabel {w args} {
eval label $w $args
set fg [$w cget -foreground]
set bg [$w cget -background]
set font [$w cget -font]
destroy $w
entry $w -relief flat -bd 0 -highlightthickness 0 \
-foreground $fg -background $bg -font $font
|
|
|
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
|
}
# Emulate a label that:
# 1 : Displays the right part of the text if there isn't enough room
# 2 : Justfify text to the left if there is enough room.
# 3 : Does not try to allocate space according to its contents
proc fileLabel {w args} {
eval tk::label $w $args
set fg [$w cget -foreground]
set bg [$w cget -background]
set font [$w cget -font]
destroy $w
entry $w -relief flat -bd 0 -highlightthickness 0 \
-foreground $fg -background $bg -font $font
|
︙ | | | ︙ | |
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
|
# Fill in default data for a diff window
proc initDiffData {top} {
set ::diff($top,leftOK) 0
set ::diff($top,rightOK) 0
set ::diff($top,mode) ""
set ::diff($top,printFile) ""
set ::diff($top,printMode) "PS"
set ::diff($top,mergeFile) ""
set ::diff($top,conflictFile) ""
set ::diff($top,limitlines) 0
}
# Create a new diff window and diff two files
proc newDiff {file1 file2 {range {}}} {
|
|
|
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
|
# Fill in default data for a diff window
proc initDiffData {top} {
set ::diff($top,leftOK) 0
set ::diff($top,rightOK) 0
set ::diff($top,mode) ""
set ::diff($top,printFile) ""
set ::diff($top,printMode) "PDF"
set ::diff($top,mergeFile) ""
set ::diff($top,conflictFile) ""
set ::diff($top,limitlines) 0
}
# Create a new diff window and diff two files
proc newDiff {file1 file2 {range {}}} {
|
︙ | | | ︙ | |
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
|
}
grid $top.l1 $top.le - $top.l2 -row 1 -sticky news
grid $top.ft1 $map $top.sby $top.ft2 -row 2 -sticky news
grid $top.sbx1 $top.ls - $top.sbx2 -row 3 -sticky news
grid columnconfigure $top {0 3} -weight 1
grid rowconfigure $top 2 -weight 1
grid $map -pady [expr {[$top.sby cget -width] + 2}]
grid $top.ls -sticky ""
bind $top <Key-Up> [list scrollText $top -1 u]
bind $top <Key-Down> [list scrollText $top 1 u]
bind $top <Key-Prior> [list scrollText $top -1 p]
bind $top <Key-Next> [list scrollText $top 1 p]
bind $top <Key-Escape> [list focus $top]
if {$debug == 0} {
bind $top <Key> "backDoor %A"
}
pack $top.bfn -in $top.f -side right -padx {3 6}
pack $top.bfp $top.bcm $top.er2 $top.lr2 $top.er1 $top.lr1 \
|
|
|
|
|
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
|
}
grid $top.l1 $top.le - $top.l2 -row 1 -sticky news
grid $top.ft1 $map $top.sby $top.ft2 -row 2 -sticky news
grid $top.sbx1 $top.ls - $top.sbx2 -row 3 -sticky news
grid columnconfigure $top {0 3} -weight 1
grid rowconfigure $top 2 -weight 1
grid $map -pady [expr {[winfo reqwidth $top.sby] - 2}]
grid $top.ls -sticky ""
bind $top <Key-Up> [list scrollText $top -1 u]
bind $top <Key-Down> [list scrollText $top 1 u]
bind $top <Key-Prior> [list scrollText $top -1 pa]
bind $top <Key-Next> [list scrollText $top 1 pa]
bind $top <Key-Escape> [list focus $top]
if {$debug == 0} {
bind $top <Key> "backDoor %A"
}
pack $top.bfn -in $top.f -side right -padx {3 6}
pack $top.bfp $top.bcm $top.er2 $top.lr2 $top.er1 $top.lr1 \
|
︙ | | | ︙ | |
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
|
} elseif {$len >= 2} {
set fullname1 [lindex $files 0]
set fullname2 [lindex $files 1]
if {[FileIsDirectory $fullname1 1] && [FileIsDirectory $fullname2 1]} {
set dirdiff(leftDir) $fullname1
set dirdiff(rightDir) $fullname2
makeDirDiffWin
after idle doDirCompare
return
}
}
# Ok, we have a normal diff
makeDiffWin
update
|
<
|
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
|
} elseif {$len >= 2} {
set fullname1 [lindex $files 0]
set fullname2 [lindex $files 1]
if {[FileIsDirectory $fullname1 1] && [FileIsDirectory $fullname2 1]} {
set dirdiff(leftDir) $fullname1
set dirdiff(rightDir) $fullname2
makeDirDiffWin
return
}
}
# Ok, we have a normal diff
makeDiffWin
update
|
︙ | | | ︙ | |
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
|
}
\# "
}
# Global code is only run the first time to be able to reread source
if {![info exists gurkmeja]} {
set gurkmeja 1
package require pstools
namespace import -force pstools::*
getOptions
if {![info exists ::eskil_testsuite]} {
parseCommandLine
}
}
|
>
|
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
|
}
\# "
}
# Global code is only run the first time to be able to reread source
if {![info exists gurkmeja]} {
set gurkmeja 1
package require pstools
namespace import -force pstools::*
getOptions
if {![info exists ::eskil_testsuite]} {
parseCommandLine
}
}
|