︙ | | |
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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
|
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
+
+
|
"&Debug" {
"Reread &Source" -acc F1 -cmd _rs
}
}
}
# Main call for psmenu. Optional arguments are for internal use.
proc psmenu::psmenu {top def {Toplevel ""} {Level ""}} {
proc psmenu::psmenu {top args} {
set def [lindex $args end]
set args [lrange $args 0 end-1]
set opts(-top) ""
set opts(-level) ""
set opts(-level) ""
set opts(-recursive) 0
array set opts $args
# Is given arg a toplevel or menu?
if {$top eq "."} {
set m .m
} else {
if {[winfo class $top] ne "Menu"} {
set m $top.m
}
if {$Toplevel ne ""} {
set m $top.m
} else {
# A menu was given, assume -top
set m $top
set top $opts(-top)
}
}
if {$opts(-recursive)} {
# Locate a free window name for the menu, for internal call
while {[winfo exists $m]} {
if {[regexp {^(.*?)(\d+)$} $m -> prefix index]} {
incr index
} else {
set prefix $m
set index 0
}
set m $prefix$index
}
}
# It might exists for a second user call
# It might exist for a second user call
if { ! [winfo exists $m]} {
# Create
menu $m -tearoff 0
}
if {$Level eq ""} {
if {$opts(-level) eq ""} {
# Store initial level to handle scope when recursing cascades
set Level [uplevel 1 info level]
set opts(-level) [uplevel 1 info level]
}
if {$Toplevel eq ""} {
set Toplevel $top
if {$opts(-top) eq ""} {
set opts(-top) $top
$top configure -menu $m
}
# Comments in definition block
set def [regsub -all -line {^\s*#.*$} $def ""]
set state ""
|
︙ | | |
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
-
+
-
+
|
# Conditionals
if {$label eq "if"} {
# TBD support elseif
set ifExpr [lindex $entry 1]
set body [lindex $entry 2]
set elseBody [lindex $entry 4]
set cond [uplevel \#$Level [list expr $ifExpr]]
set cond [uplevel \#$opts(-level) [list expr $ifExpr]]
#puts "if expression '$ifExpr' = $cond"
if {$cond} {
# Prepend
set def [list {*}$body {*}$def]
} elseif {$elseBody ne ""} {
set def [list {*}$elseBody {*}$def]
}
continue
}
# Recognise Cascade by even args "Name ?opts? Def"
# An item will be "Name ?opts?", i.e odd
if {[llength $entry] % 2 == 0} {
# Cascade
set options [lrange $entry 1 end-1]
set body [lindex $entry end]
# Recurse cascade defintion
set cascade [psmenu $m $body $Toplevel $Level]
set cascade [psmenu $m {*}[array get opts] -recursive 1 $body]
# Since -menu is last, processing below can assume that.
lappend options -menu $cascade
} else {
set options [lrange $entry 1 end]
}
#puts "Label '$label'"
#puts "Options '$options'"
|
︙ | | |
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
-
+
|
set doBind ""
set command ""
set value ""
set variable ""
set cfgvar ""
set default 0
foreach {opt val} $options {
set val [uplevel \#$Level [list subst $val]]
set val [uplevel \#$opts(-level) [list subst $val]]
switch -- $opt {
-ul - -underline {
lappend newOptions -underline $val
}
-var - -variable {
if {$type eq "cascade"} {
set variable $val
|
︙ | | |
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
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
|
256
257
258
259
260
261
262
263
264
265
266
267
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
|
-
+
-
+
-
+
-
+
|
}
-onvalue {
lappend newOptions -onvalue $val
}
-menu {
lappend newOptions -menu $val
if {$variable ne ""} {
uplevel \#$Level [list set $variable $val]
uplevel \#$opts(-level) [list set $variable $val]
}
}
-def {
set default $val
}
default {
# Just let through
lappend newOptions $opt $val
}
}
}
if {$variable ne ""} {
upvar \#$Level $variable __vv
upvar \#$opts(-level) $variable __vv
if {![info exists __vv]} {
set __vv $default
}
}
# TK helper to handle & in label
::tk::AmpMenuArgs $m add $type {*}$newOptions
if {$cfgvar ne ""} {
set ix [$m index end]
set tmp [list $m entryconfigure $ix]
uplevel \#$Level [list set $cfgvar $tmp]
uplevel \#$opts(-level) [list set $cfgvar $tmp]
}
if {$doBind ne ""} {
if {[regexp {^(.*)-(.*)$} $doBind -> pre post]} {
if {$pre eq "Ctrl"} {
set pre "Control"
}
set doBind $pre-Key-$post
} else {
set doBind Key-$doBind
}
#puts "Binding '$doBind' '$command'"
bind $Toplevel <$doBind> $command
bind $opts(-top) <$doBind> $command
}
}
return $m
}
# Extract one entry from definiton
|
︙ | | |
︙ | | |
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
-
-
-
-
-
-
-
-
-
-
-
-
-
|
global doingLine1 doingLine2
if {$::eskil($top,view) eq "table"} {
insertMatchingLinesTable $top $line1 $line2
return
}
# FIXA: fully implement filter
if {$::eskil(filter) != ""} {
if {[regexp $::eskil(filter) $line1]} {
insertLine $top 1 $doingLine1 $line1
insertLine $top 2 $doingLine2 $line2
incr doingLine1
incr doingLine2
set ::eskil(filterflag) 1
return
}
set ::eskil(filterflag) 0
}
if {$::Pref(parse) != 0} {
set opts $::Pref(ignore)
if {$::Pref(nocase)} {lappend opts -nocase}
if {$::Pref(lineparsewords)} {lappend opts -words}
if {$::eskil($top,separator) ne ""} {
set res [diffWithSeparator $::eskil($top,separator) $line1 $line2 \
$opts]
|
︙ | | |
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
|
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
|
-
-
-
-
-
+
+
-
-
-
+
+
-
-
+
+
|
# If block parsing is turned off, only do line parsing for
# blocks of equal size.
for {set t 0} {$t < $n1} {incr t} {
gets $ch1 textline1
gets $ch2 textline2
insertMatchingLines $top $textline1 $textline2
}
if {$::eskil(filter) != "" && $::eskil(filterflag)} {
addMapLines $top $n1
} else {
addChange $top $n1 change $line1 $n1 $line2 $n2
nextHighlight $top
addChange $top $n1 change $line1 $n1 $line2 $n2
nextHighlight $top
}
} else {
# Collect blocks
set block1 {}
for {set t 0} {$t < $n1} {incr t} {
gets $ch1 apa
lappend block1 $apa
}
set block2 {}
for {set t 0} {$t < $n2} {incr t} {
gets $ch2 apa
lappend block2 $apa
}
insertMatchingBlocks $top $block1 $block2 $line1 $line2 1
}
# Empty return value
return
}
proc enableRedo {top} {
$top.m.mf entryconfigure "Redo Diff" -state normal
$top.m.mt entryconfigure "Merge" -state normal
{*}$::widgets($top,configureRedoDiffCmd) -state normal
{*}$::widgets($top,configureMergeCmd) -state normal
}
proc disableRedo {top} {
$top.m.mf entryconfigure "Redo Diff" -state disabled
$top.m.mt entryconfigure "Merge" -state disabled
{*}$::widgets($top,configureRedoDiffCmd) -state disabled
{*}$::widgets($top,configureMergeCmd) -state disabled
}
proc busyCursor {top} {
global oldcursor oldcursor2
if {$::eskil($top,view) eq "table"} {
set items wTable
} else {
|
︙ | | |
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
|
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
|
-
+
|
}
}
# Clear Editing state
proc resetEdit {top} {
set ::eskil($top,leftEdit) 0
set ::eskil($top,rightEdit) 0
$top.m.mt entryconfigure "Edit Mode" -state normal
{*}$::widgets($top,configureEditModeCmd) -state normal
if {$::eskil($top,view) eq "table"} {
return
}
resetEditW $::widgets($top,wDiff1)
resetEditW $::widgets($top,wDiff2)
}
|
︙ | | |
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
|
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
|
-
+
-
+
|
$W configure -undo 1
set ::eskil($W,allowChange) line
}
# Turn on editing on sides where it has not been disallowed
proc allowEdit {top} {
$top.m.mt entryconfigure "Edit Mode" -state disable
{*}$::widgets($top,configureEditModeCmd) -state disable
if {$::eskil($top,leftEdit) == 0} {
set ::eskil($top,leftEdit) 1
turnOnEdit $::widgets($top,wDiff1)
}
if {$::eskil($top,rightEdit) == 0} {
set ::eskil($top,rightEdit) 1
turnOnEdit $::widgets($top,wDiff2)
}
}
# Turn off editing on sides that do not correspond to a file
proc disallowEdit {top {side 0}} {
if {$side == 0 || $side == 1} {
set ::eskil($top,leftEdit) -1
}
if {$side == 0 || $side == 2} {
set ::eskil($top,rightEdit) -1
}
if {$::eskil($top,leftEdit) == -1 && $::eskil($top,rightEdit) == -1} {
$top.m.mt entryconfigure "Edit Mode" -state disabled
{*}$::widgets($top,configureEditModeCmd) -state disabled
}
}
# Ask if editing is allowed on a side
proc mayEdit {top side} {
if {$side == 1} {
return [expr {$::eskil($top,leftEdit) == 1}]
|
︙ | | |
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
|
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
|
-
+
-
+
|
}
################
# Align function
################
proc enableAlign {top} {
eval $::widgets($top,enableAlignCmd)
{*}$::widgets($top,configureAlignCmd) -state normal
}
proc disableAlign {top} {
eval $::widgets($top,disableAlignCmd)
{*}$::widgets($top,configureAlignCmd) -state disabled
}
# Remove one or all alignment pairs
proc clearAlign {top {leftline {}}} {
if {$leftline == ""} {
set ::eskil($top,aligns) {}
} else {
|
︙ | | |
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
|
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
|
+
-
-
-
+
+
+
-
-
-
-
+
+
+
-
-
-
+
+
-
-
+
-
-
-
-
-
+
+
+
+
+
+
|
proc DisableDiffUtilC {} {
uplevel \#0 [list source $::eskil(thisDir)/../lib/diffutil/tcl/diffutil.tcl]
}
# Add a debug menu to a toplevel window
proc AddDebugMenu {top} {
set dMenu [debugMenu $top.m]
$dMenu add checkbutton -label "Wrap" -variable wrapstate \
-onvalue char -offvalue none -command \
"$top.ft1.tt configure -wrap \$wrapstate ;\
$top.ft2.tt configure -wrap \$wrapstate"
$dMenu add command -label "Date Filter" \
"$::widgets($top,wDiff1) configure -wrap \$wrapstate ;\
$::widgets($top,wDiff2) configure -wrap \$wrapstate"
-command {set ::eskil(filter) {^Date}}
$dMenu add separator
$dMenu add command -label "Reread Source" -underline 0 \
-command {EskilRereadSource}
psmenu::psmenu $dMenu -top $top {
---
"&Reread Source" -cmd EskilRereadSource
$dMenu add separator
$dMenu add command -label "Normal Cursor" \
-command [list normalCursor $top]
---
"Normal Cursor" -cmd "normalCursor $top"
$dMenu add command -label "Fill X" \
-command [list fillWindowX $top]
"Fill X" -cmd "fillWindowX $top"
$dMenu add separator
# Runtime disable of C version of DiffUtil
$dMenu add command -label "Tcl DiffUtil" -command DisableDiffUtilC
$dMenu add command -label "Evalstats" -command {evalstats}
$dMenu add command -label "_stats" -command {parray _stats}
---
# Runtime disable of C version of DiffUtil
"Tcl DiffUtil" -cmd DisableDiffUtilC
"Evalstats" -cmd {evalstats}
"_stats" -cmd {parray _stats}
}
}
# Build the main window
# "other" is related window. Currently unused
proc makeDiffWin {{other {}} args} {
global tcl_platform
|
︙ | | |
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
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
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
|
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
|
-
+
-
-
-
+
-
-
+
+
-
-
+
-
-
-
-
-
+
+
+
-
-
+
-
-
+
-
-
-
+
+
-
-
+
-
-
+
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
-
-
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
-
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
ttk::frame $top.f
grid $top.f -row 0 -columnspan 5 -sticky nws
lappend ::widgets(toolbars) $top.f
if { ! $::Pref(toolbar)} {
grid remove $top.f
}
menu $top.m
set redoState [expr {$::eskil(debug) == 1 ? "normal" : "disabled"}]
$top configure -menu $top.m
$top.m add cascade -label "File" -underline 0 -menu $top.m.mf
menu $top.m.mf
psmenu::psmenu $top {
$top.m.mf add command -label "Redo Diff" -underline 5 \
-command [list redoDiff $top] -state disabled
"&File" {
"Redo &Diff" -cmd "redoDiff $top" -state $redoState \
if {$::eskil(debug) == 1} {
$top.m.mf entryconfigure "Redo Diff" -state normal
-cfgvar ::widgets($top,configureRedoDiffCmd)
}
$top.m.mf add separator
$top.m.mf add command -label "Open Both..." -underline 0 \
-command [list openBoth $top 0]
$top.m.mf add command -label "Open Both (forget)..." \
---
"&Open Both..." -cmd "openBoth $top 0"
"Open Both (forget)..." -cmd "openBoth $top 1"
-command [list openBoth $top 1]
$top.m.mf add command -label "Open Left File..." \
"Open Left File..." -cmd "openLeft $top"
-command [list openLeft $top]
$top.m.mf add command -label "Open Right File..." \
"Open Right File..." -cmd "openRight $top"
-command [list openRight $top]
$top.m.mf add separator
$top.m.mf add command -label "Open Ancestor File..." \
---
"Open Ancestor File..." -cmd "openAncestor $top"
-command [list openAncestor $top]
$top.m.mf add command -label "Open Conflict File..." \
"Open Conflict File..." -cmd "openConflict $top"
-command [list openConflict $top]
$top.m.mf add command -label "Open Patch File..." \
"Open Patch File..." -cmd "openPatch $top"
-command [list openPatch $top]
$top.m.mf add command -label "Revision Diff..." -underline 0 \
"&Revision Diff..." -cmd "openRev $top"
-command [list openRev $top]
$top.m.mf add separator
$top.m.mf add command -label "Print Pdf..." -underline 0 \
-command [list doPrint $top]
---
"&Print Pdf..." -cmd "doPrint $top"
---
"&Close" -cmd "list cleanupAndExit $top"
---
"&Quit" -cmd "cleanupAndExit all"
}
"&Options" {
"&Font" {
"&Select..." -command makeFontWin
$top.m.mf add separator
$top.m.mf add command -label "Close" -underline 0 \
-command [list cleanupAndExit $top]
$top.m.mf add separator
$top.m.mf add command -label "Quit" -underline 0 \
-command {cleanupAndExit all}
_Radio -var ::Pref(fontsize) -command chFont {
6 7 8 9 10
}
$top.m add cascade -label "Options" -underline 0 -menu $top.m.mo
menu $top.m.mo
$top.m.mo add cascade -label "Font" -underline 0 -menu $top.m.mo.f
$top.m.mo add cascade -label "Ignore" -underline 0 -menu $top.m.mo.i
$top.m.mo add command -label "Preprocess..." -underline 0 \
-command [list EditPrefPreprocess $top]
}
"&Ignore" {
"No spaces" -var ::Pref(ignore) -value " "
"Space changes (-b)" -var ::Pref(ignore) -value "-b"
"All spaces (-w)" -var ::Pref(ignore) -value "-w"
---
"Case (-i)" -var ::Pref(nocase)
"Empty" -var ::Pref(noempty)
"Digits" -var ::Pref(nodigit)
}
"&Preprocess..." -cmd "EditPrefPreprocess $top"
$top.m.mo add command -label "Plugins..." -underline 1 \
-command [list editPrefPlugins $top]
$top.m.mo add cascade -label "Parse" -underline 1 -menu $top.m.mo.p
"P&lugins..." -cmd "editPrefPlugins $top"
"P&arse" {
$top.m.mo add command -label "Colours..." -underline 0 -command makePrefWin
$top.m.mo add cascade -label "Context" -underline 1 -menu $top.m.mo.c
$top.m.mo add cascade -label "Pivot" -underline 2 -menu $top.m.mo.piv
$top.m.mo add separator
$top.m.mo add checkbutton -label "Toolbar" -variable ::Pref(toolbar)
"Nothing" -var ::Pref(parse) -value 0
"Lines" -var ::Pref(parse) -value 1
"Blocks (small)" -var ::Pref(parse) -value 2
"Blocks" -var ::Pref(parse) -value 3
$top.m.mo add separator
$top.m.mo add command -label "Save default" \
-command [list saveOptions $top]
---
"Characters" -var ::Pref(lineparsewords) -value "0"
"Words" -var ::Pref(lineparsewords) -value "1"
---
"Fine chunks" -var ::Pref(finegrainchunks)
---
"Mark last" -var ::Pref(marklast)
}
menu $top.m.mo.f
$top.m.mo.f add command -label "Select..." -command makeFontWin \
"&Colours..." -cmd makePrefWin
-underline 0
$top.m.mo.f add radiobutton -label 6 -variable ::Pref(fontsize) -value 6 \
-command chFont
"C&ontext" {
$top.m.mo.f add radiobutton -label 7 -variable ::Pref(fontsize) -value 7 \
-command chFont
$top.m.mo.f add radiobutton -label 8 -variable ::Pref(fontsize) -value 8 \
-command chFont
$top.m.mo.f add radiobutton -label 9 -variable ::Pref(fontsize) -value 9 \
-command chFont
$top.m.mo.f add radiobutton -label 10 -variable ::Pref(fontsize) -value 10 \
-command chFont
"Show all lines" -var ::Pref(context) -value -1
"Show only diffs" -var ::Pref(context) -value 0
---
"Context 2 lines" -var ::Pref(context) -value 2
"Context 5 lines" -var ::Pref(context) -value 5
"Context 10 lines" -var ::Pref(context) -value 10
"Context 20 lines" -var ::Pref(context) -value 20
}
menu $top.m.mo.i
$top.m.mo.i add radiobutton -label "No spaces" \
-variable ::Pref(ignore) -value " "
"Pi&vot" {
"1" -var ::Pref(pivot) -value 1
$top.m.mo.i add radiobutton -label "Space changes (-b)" \
-variable ::Pref(ignore) -value "-b"
"10" -var ::Pref(pivot) -value 10
$top.m.mo.i add radiobutton -label "All spaces (-w)" \
-variable ::Pref(ignore) -value "-w"
$top.m.mo.i add separator
"100" -var ::Pref(pivot) -value 100
"1000" -var ::Pref(pivot) -value 1000
$top.m.mo.i add checkbutton -label "Case (-i)" \
-variable ::Pref(nocase)
$top.m.mo.i add checkbutton -label "Empty" \
-variable ::Pref(noempty)
$top.m.mo.i add checkbutton -label "Digits" \
-variable ::Pref(nodigit)
menu $top.m.mo.p
$top.m.mo.p add radiobutton -label "Nothing" -variable ::Pref(parse) -value 0
"Max" -var ::Pref(pivot) -value 2000000000
}
---
"Toolbar" -var ::Pref(toolbar)
---
"Save default" -cmd "saveOptions $top"
}
"&Search" -var searchMenu {
# Added below
$top.m.mo.p add radiobutton -label "Lines" -variable ::Pref(parse) -value 1
$top.m.mo.p add radiobutton -label "Blocks (small)" -variable ::Pref(parse) \
-value 2
}
"&Tools" {
$top.m.mo.p add radiobutton -label "Blocks" -variable ::Pref(parse) -value 3
$top.m.mo.p add separator
"&New Diff Window" -cmd "makeDiffWin $top"
$top.m.mo.p add radiobutton -label "Characters" \
-variable ::Pref(lineparsewords) -value "0"
$top.m.mo.p add radiobutton -label "Words" \
-variable ::Pref(lineparsewords) -value "1"
$top.m.mo.p add separator
$top.m.mo.p add checkbutton -label "Fine chunks" -variable ::Pref(finegrainchunks)
$top.m.mo.p add separator
$top.m.mo.p add checkbutton -label "Mark last" -variable ::Pref(marklast)
"&Directory Diff" -cmd makeDirDiffWin
"&Clip Diff" -cmd makeClipDiffWin
"&Fourway Diff" -cmd makeFourWayWin
"&Table Diff" -cmd "makeDiffWin $top -table"
"&Merge" -cmd "makeMergeWin $top" -state disabled \
-cfgvar ::widgets($top,configureMergeCmd)
"&Edit Mode" -cmd "allowEdit $top" -acc Ctrl-E -state disabled \
-cfgvar ::widgets($top,configureEditModeCmd)
"&Paste Patch" -cmd "doPastePatch $top"
"Clear Align" -cmd "clearAlign $top" -state disabled \
-cfgvar ::widgets($top,configureAlignCmd)
"Highlight tabs" -cmd "highlightTabs $top"
if {$::tcl_platform(platform) eq "windows"} {
if { ! [catch {package require registry}]} {
---
"Setup &Registry" -cmd makeRegistryWin
}
menu $top.m.mo.c
$top.m.mo.c add radiobutton -label "Show all lines" \
-variable ::Pref(context) -value -1
$top.m.mo.c add radiobutton -label "Show only diffs" \
-variable ::Pref(context) -value 0
$top.m.mo.c add separator
$top.m.mo.c add radiobutton -label "Context 2 lines" \
-variable ::Pref(context) -value 2
$top.m.mo.c add radiobutton -label "Context 5 lines" \
-variable ::Pref(context) -value 5
$top.m.mo.c add radiobutton -label "Context 10 lines" \
-variable ::Pref(context) -value 10
$top.m.mo.c add radiobutton -label "Context 20 lines" \
-variable ::Pref(context) -value 20
menu $top.m.mo.piv
$top.m.mo.piv add radiobutton -label "1" \
-variable ::Pref(pivot) -value 1
$top.m.mo.piv add radiobutton -label "10" \
-variable ::Pref(pivot) -value 10
}
}
"&Help" {
"&General" -cmd makeHelpWin
"&Tutorial" -cmd makeTutorialWin
"&Revision Control" -cmd "makeDocWin revision.txt"
"&Edit Mode" -cmd "makeDocWin editmode.txt"
"&Plugins" -cmd "makeDocWin plugins.txt"
---
"&About" -cmd makeAboutWin
$top.m.mo.piv add radiobutton -label "100" \
-variable ::Pref(pivot) -value 100
$top.m.mo.piv add radiobutton -label "1000" \
-variable ::Pref(pivot) -value 1000
$top.m.mo.piv add radiobutton -label "Max" \
-variable ::Pref(pivot) -value 2000000000
}
$top.m add cascade -label "Search" -underline 0 -menu $top.m.ms
menu $top.m.ms
}
if {[info procs textSearch::searchMenu] != ""} {
textSearch::searchMenu $top.m.ms
textSearch::searchMenu $searchMenu
} else {
$top.m.ms add command -label "Text search not available" \
$searchMenu add command -label "Text search not available" -state disabled
-state disabled
}
$top.m add cascade -label "Tools" -underline 0 -menu $top.m.mt
menu $top.m.mt
$top.m.mt add command -label "New Diff Window" -underline 0 \
-command [list makeDiffWin $top]
$top.m.mt add command -label "Directory Diff" -underline 0 \
-command makeDirDiffWin
$top.m.mt add command -label "Clip Diff" -underline 0 \
-command makeClipDiffWin
$top.m.mt add command -label "Fourway Diff" -underline 0 \
-command makeFourWayWin
$top.m.mt add command -label "Table Diff" -underline 0 \
-command [list makeDiffWin $top -table]
$top.m.mt add command -label "Merge" -underline 0 \
-command [list makeMergeWin $top] -state disabled
$top.m.mt add command -label "Edit Mode" -underline 0 -accelerator Ctrl-E \
-command [list allowEdit $top] -state disabled
bind $top <Control-Key-E> [list allowEdit $top]
$top.m.mt add command -label "Paste Patch" -underline 0 \
-command [list doPastePatch $top]
$top.m.mt add command -label "Clear Align" \
-command [list clearAlign $top] -state disabled
$top.m.mt add command -label "Highlight tabs" \
-command [list highlightTabs $top]
set ::widgets($top,enableAlignCmd) [list \
$top.m.mt entryconfigure "Clear Align" -state normal]
set ::widgets($top,disableAlignCmd) [list \
$top.m.mt entryconfigure "Clear Align" -state disabled]
if {$::tcl_platform(platform) eq "windows"} {
if { ! [catch {package require registry}]} {
$top.m.mt add separator
$top.m.mt add command -label "Setup Registry" -underline 6 \
-command makeRegistryWin
}
}
$top.m add cascade -label "Help" -underline 0 -menu $top.m.help
menu $top.m.help
$top.m.help add command -label "General" -command makeHelpWin -underline 0
$top.m.help add command -label "Tutorial" -command makeTutorialWin \
-underline 0
foreach label {{Revision Control} {Edit Mode} {Plugins}} \
file {revision.txt editmode.txt plugins.txt} {
$top.m.help add command -label $label \
-command [list makeDocWin $file] -underline 0
}
$top.m.help add separator
$top.m.help add command -label "About" -command makeAboutWin -underline 0
# Toolbar
ttk::label $top.lr1 -text "Rev 1"
addBalloon $top.lr1 "Revision number for version diff."
ttk::entryX $top.er1 -width 12 -textvariable ::eskil($top,doptrev1)
set ::widgets($top,rev1) $top.er1
bind $top.er1 <Key-Return> [list redoDiff $top]
|
︙ | | |