44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#-----------------------------------------------
# $Revision$
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"
set debug 1
set diffver "Version 1.8.5 2001-10-25"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]
if {$tcl_platform(platform) == "windows"} {
cd $thisdir
|
|
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#-----------------------------------------------
# $Revision$
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"
set debug 1
set diffver "Version 1.8.6 2001-10-26"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]
if {$tcl_platform(platform) == "windows"} {
cd $thisdir
|
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
|
bind .c <Configure> {drawMap %h}
bind . <Key-Up> {scroll -1 u}
bind . <Key-Down> {scroll 1 u}
bind . <Key-Prior> {scroll -1 p}
bind . <Key-Next> {scroll 1 p}
bind . <Key-Escape> {focus .}
if {$debug == 1} {
menubutton .md -text Debug -menu .md.m -relief ridge
menu .md.m
if {$tcl_platform(platform) == "windows"} {
.md.m add checkbutton -label Console -variable consolestate \
-onvalue show -offvalue hide \
|
>
>
>
>
>
>
>
>
>
>
>
|
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
|
bind .c <Configure> {drawMap %h}
bind . <Key-Up> {scroll -1 u}
bind . <Key-Down> {scroll 1 u}
bind . <Key-Prior> {scroll -1 p}
bind . <Key-Next> {scroll 1 p}
bind . <Key-Escape> {focus .}
bind . <Control-Key-f> {Search}
bind . <Key-F3> {SearchNext}
bind . <Control-Key-F3> {SearchPrev}
menubutton .mg -text Search -underline 0 -menu .mg.m
menu .mg.m
.mg.m add command -label "Find" -accelerator "Ctrl+f" -command Search
.mg.m add command -label "Find Next" -accelerator "F3" \
-command SearchNext
.mg.m add command -label "Find Prev" -accelerator "Ctrl+F3" \
-command SearchPrev
if {$debug == 1} {
menubutton .md -text Debug -menu .md.m -relief ridge
menu .md.m
if {$tcl_platform(platform) == "windows"} {
.md.m add checkbutton -label Console -variable consolestate \
-onvalue show -offvalue hide \
|
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
|
.md.m add separator
.md.m add command -label "Normal Cursor" -command {normalCursor}
.md.m add separator
.md.m add command -label "Evalstats" -command {evalstats}
.md.m add command -label "_stats" -command {parray _stats}
.md.m add command -label "Nuisance" -command {makeNuisance \
"It looks like you are trying out the debug menu."}
pack .mf .mo .mh .md -in .f -side left
} else {
pack .mf .mo .mh -in .f -side left
}
pack .bfn .bfp .eo .lo -in .f -side right
}
# Set new preferences.
proc applyPref {} {
global Pref TmpPref
|
|
|
|
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
|
.md.m add separator
.md.m add command -label "Normal Cursor" -command {normalCursor}
.md.m add separator
.md.m add command -label "Evalstats" -command {evalstats}
.md.m add command -label "_stats" -command {parray _stats}
.md.m add command -label "Nuisance" -command {makeNuisance \
"It looks like you are trying out the debug menu."}
pack .mf .mo .mh .mg .md -in .f -side left
} else {
pack .mf .mo .mh .mg -in .f -side left
}
pack .bfn .bfp .eo .lo -in .f -side right
}
# Set new preferences.
proc applyPref {} {
global Pref TmpPref
|
3272
3273
3274
3275
3276
3277
3278
|
if {![winfo exists .f]} {
getOptions
makeDiffWin
update idletasks
parseCommandLine
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
|
if {![winfo exists .f]} {
getOptions
makeDiffWin
update idletasks
parseCommandLine
}
## FIXA, ga igenom Ulfs kod
proc Dialog_Create {top title args} {
global dialog
if {[winfo exists $top]} {
switch -- [wm state $top] {
normal {
# Raise a buried window
raise $top
}
withdrawn -
iconified {
# Open and restore geometry
wm deiconify $top
catch {wm geometry $top $dialog(geo,$top)}
}
}
return 0
} else {
eval {toplevel $top} $args
wm title $top $title
return 1
}
}
proc Dialog_Wait {top varName {focus {}}} {
upvar $varName var
# Poke the variable if the user nukes the window
bind $top <Destroy> [list set $varName $var]
# Grab focus for the dialog
if {[string length $focus] == 0} {
set focus $top
}
set old [focus -displayof $top]
focus $focus
catch {tkwait visibility $top}
catch {grab $top}
# Wait for the dialog to complete
tkwait variable $varName
catch {grab release $top}
focus $old
}
proc Dialog_Dismiss {top} {
global dialog
# Save current size and position
catch {
# window may have been deleted
set dialog(geo,$top) [wm geometry $top]
wm withdraw $top
}
}
proc Find_Dialog { string } {
global prompt CaseSensitive
set f .prompt
if {[Dialog_Create $f "Find" -borderwidth 10]} {
message $f.msg -text $string -aspect 1000
entry $f.entry -textvariable prompt(result)
checkbutton $f.case -text "Match Case" -variable ::diff(searchcase)
pack $f.case -side right
set b [frame $f.buttons]
pack $f.msg $f.entry $f.buttons -side top -fill x
pack $f.entry -pady 5
button $b.ok -text OK -command {set prompt(ok) 1}
button $b.cancel -text Cancel \
-command {set prompt(ok) 0}
pack $b.ok -side left
pack $b.cancel -side right
bind $f.entry <Return> {set prompt(ok) 1 ; break}
bind $f.entry <Key-Escape> {set prompt(ok) 0 ; break}
}
set prompt(ok) 0
Dialog_Wait $f prompt(ok) $f.entry
Dialog_Dismiss $f
if {$prompt(ok)} {
return $prompt(result)
} else {
return {}
}
}
proc Search {} {
if {![info exists diff(searchcase)]} {
set ::diff(searchcase) 0
set ::diff(searchindex) 1.0
set ::diff(searchstring) ""
}
set ::diff(searchstring) [Find_Dialog "Please enter string to find"]
if {$::diff(searchcase)} {
set searchpos [.ft1.tt search -count cnt $::diff(searchstring) @0,0]
} else {
set searchpos [.ft1.tt search -count cnt -nocase \
$::diff(searchstring) @0,0]
}
if {$searchpos == ""} {
tk_messageBox -message "Search string not found!" -type ok -title Diff
return
}
.ft1.tt see $searchpos
.ft1.tt tag remove sel 1.0 end
.ft1.tt tag add sel $searchpos "$searchpos + $cnt chars"
set ::diff(searchindex) $searchpos
}
proc SearchNext {} {
if {$::diff(searchcase)} {
set searchpos [.ft1.tt search -count cnt $::diff(searchstring) \
"$::diff(searchindex) + 1 chars"]
} else {
set searchpos [.ft1.tt search -count cnt -nocase $::diff(searchstring) \
"$::diff(searchindex) + 1 chars"]
}
if {$searchpos == "" || $searchpos == $::diff(searchindex)} {
tk_messageBox -message "String not found!" -type ok -title Diff
return
}
.ft1.tt see $searchpos
.ft1.tt tag remove sel 1.0 end
.ft1.tt tag add sel $searchpos "$searchpos + $cnt chars"
set ::diff(searchindex) $searchpos
}
proc SearchPrev {} {
if {$::diff(searchcase)} {
set searchpos [.ft1.tt search -count cnt -backwards \
$::diff(searchstring) "$::diff(searchindex) - 1 chars"]
} else {
set searchpos [.ft1.tt search -count cnt -nocase -backwards \
$::diff(searchstring) "$::diff(searchindex) - 1 chars"]
}
if {$searchpos == "" || $searchpos == $::diff(searchindex)} {
tk_messageBox -message "String not found!" -type ok -title Diff
return
}
.ft1.tt see $searchpos
.ft1.tt tag remove sel 1.0 end
.ft1.tt tag add sel $searchpos "$searchpos + $cnt chars"
set ::diff(searchindex) $searchpos
}
|