Eskil

Check-in [d83662d1cc]
Login

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

Overview
Comment:Removed support for Postscript output.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d83662d1ccd99d2ef6f9ecd6d0c5d80f10c8e825
User & Date: peter.spjuth@gmail.com 2010-04-27 21:31:50.000
Context
2010-04-27
22:10
Added command line options to control PDF options. check-in: a0e927608f user: peter.spjuth@gmail.com tags: trunk
21:31
Removed support for Postscript output. check-in: d83662d1cc user: peter.spjuth@gmail.com tags: trunk
21:06
Moved packages pstools and psballoon into GIT repository. check-in: 51939a3dd4 user: peter.spjuth@gmail.com tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Changes.
1



2
3
4
5
6
7
8
9
10
2010-04-27



Handle an empty .eskilrc. [Bug 17113]
Moved packages pstools and psballoon into GIT repository.

2010-02-13
 Do git add after conflict merge of a git file.
 Select colors for PDF print.

2009-11-02
 Detect and display annotation in patches. E.g. when using -p with diff.

>
>
>
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
2010-04-27
 Removed support for Postscript output.

2010-04-27
 Handle an empty .eskilrc. [Bug 17113]
 Moved packages pstools and psballoon into GIT repository.

2010-02-13
 Do git add after conflict merge of a git file.
 Select colors for PDF print.

2009-11-02
 Detect and display annotation in patches. E.g. when using -p with diff.
Changes to doc/cmdline.txt.
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  -conflict   : Treat file as a merge conflict file and enter merge
                mode.
  -o <file>   : Specify merge result output file.

  -browse     : Automatically bring up file dialog after starting.
  -server     : Set up Eskil to be controllable from the outside.

  -print <file> : Generate postscript and exit.

  -plugin <name> : Preprocess files using plugin.

  -limit <lines> : Do not process more than <lines> lines.}

To list all options matching a prefix, run 'eskil --query prefix'.
In tcsh use this line to get option completion:







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  -conflict   : Treat file as a merge conflict file and enter merge
                mode.
  -o <file>   : Specify merge result output file.

  -browse     : Automatically bring up file dialog after starting.
  -server     : Set up Eskil to be controllable from the outside.

  -print <file> : Generate PDF and exit.

  -plugin <name> : Preprocess files using plugin.

  -limit <lines> : Do not process more than <lines> lines.}

To list all options matching a prefix, run 'eskil --query prefix'.
In tcsh use this line to get option completion:
Changes to doc/eskil.txt.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<b><ul>Commands</ul></b>

<b>File Menu</b>
  Redo Diff       \t: Run diff again on the same files.
  Open Both       \t: Select two files, run diff.
  Open Left File  \t: Select a file for left window, run diff
  Open Right File \t: Select a file for right window, run diff
  Open Conflict File\t: Select a file containing conflicts such as from
                    \t  a CVS merge.
  Open Patch File \t: Display a patch file created by diff -c or diff -u.
  Revision Diff   \t: Select one revision controlled file.
  Print           \t: Experimental print function.
                  \t  It currently creates a postscript file ~/eskil.ps
  Close           \t: Close this window.
  Quit            \t: Guess

<b>Options Menu</b>
  Font   \t: Select font and fontsize for the two main text windows
  Ignore \t: Diff options for ignoring e.g. whitespace
  Parse  \t: Additional parsing made by Eskil to improve the display.











|
<







1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
<b><ul>Commands</ul></b>

<b>File Menu</b>
  Redo Diff       \t: Run diff again on the same files.
  Open Both       \t: Select two files, run diff.
  Open Left File  \t: Select a file for left window, run diff
  Open Right File \t: Select a file for right window, run diff
  Open Conflict File\t: Select a file containing conflicts such as from
                    \t  a CVS merge.
  Open Patch File \t: Display a patch file created by diff -c or diff -u.
  Revision Diff   \t: Select one revision controlled file.
  Print PDF       \t: Print diff to PDF file.

  Close           \t: Close this window.
  Quit            \t: Guess

<b>Options Menu</b>
  Font   \t: Select font and fontsize for the two main text windows
  Ignore \t: Diff options for ignoring e.g. whitespace
  Parse  \t: Additional parsing made by Eskil to improve the display.
Changes to src/eskil.tcl.
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
    cleanupFiles $top
    if {$::diff($top,mode) eq "conflict"} {
        if {$::widgets($top,eqLabel) != "="} {
            makeMergeWin $top
        }
    }
    if {$::diff($top,printFile) ne ""} {
        if {$::diff($top,printMode) eq "PS"} {
            after idle "doPrint $top 1 ; cleanupAndExit all"
        } else {
            after idle "doPrint2 $top 1 ; cleanupAndExit all"
        }
    }
}

# This is the entrypoint to do a diff via DDE or Send
proc remoteDiff {file1 file2} {
    newDiff $file1 $file2
}







<
|
<
<
<







1376
1377
1378
1379
1380
1381
1382

1383



1384
1385
1386
1387
1388
1389
1390
    cleanupFiles $top
    if {$::diff($top,mode) eq "conflict"} {
        if {$::widgets($top,eqLabel) != "="} {
            makeMergeWin $top
        }
    }
    if {$::diff($top,printFile) ne ""} {

        after idle "doPrint $top 1 ; cleanupAndExit all"



    }
}

# This is the entrypoint to do a diff via DDE or Send
proc remoteDiff {file1 file2} {
    newDiff $file1 $file2
}
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431

# 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
    set ::diff($top,plugin) ""
}

# Create a new diff window and diff two files







<







2413
2414
2415
2416
2417
2418
2419

2420
2421
2422
2423
2424
2425
2426

# 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,mergeFile) ""
    set ::diff($top,conflictFile) ""
    set ::diff($top,limitlines) 0
    set ::diff($top,plugin) ""
}

# Create a new diff window and diff two files
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
    $top.m.mf add command -label "Open Conflict File..." \
            -command [list openConflict $top]
    $top.m.mf add command -label "Open Patch File..." \
            -command [list openPatch $top]
    $top.m.mf add command -label "Revision Diff..." -underline 0 \
            -command [list openRev $top]
    $top.m.mf add separator
    $top.m.mf add command -label "Print Ps..." \
            -command [list doPrint $top]
    $top.m.mf add command -label "Print Pdf..." -underline 0 \
            -command [list doPrint2 $top]
    $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}








|

<
<







2530
2531
2532
2533
2534
2535
2536
2537
2538


2539
2540
2541
2542
2543
2544
2545
    $top.m.mf add command -label "Open Conflict File..." \
            -command [list openConflict $top]
    $top.m.mf add command -label "Open Patch File..." \
            -command [list openPatch $top]
    $top.m.mf add command -label "Revision Diff..." -underline 0 \
            -command [list openRev $top]
    $top.m.mf add separator
    $top.m.mf add command -label "Print Pdf..." -underline 0 \
            -command [list doPrint $top]


    $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}

3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
  -conflict   : Treat file as a merge conflict file and enter merge
                mode.
  -o <file>   : Specify merge result output file.

  -browse     : Automatically bring up file dialog after starting.
  -server     : Set up Eskil to be controllable from the outside.

  -printps <file>  : Generate postscript and exit.
  -printpdf <file> : Generate pdf and exit.

  -plugin <plugin>     : Use plugin
  -plugininfo <info>   : Pass info to plugin (plugin specific)
  -plugindump <plugin> : Dump plugin source to stdout

  -limit <lines> : Do not process more than <lines> lines.








<
|







3311
3312
3313
3314
3315
3316
3317

3318
3319
3320
3321
3322
3323
3324
3325
  -conflict   : Treat file as a merge conflict file and enter merge
                mode.
  -o <file>   : Specify merge result output file.

  -browse     : Automatically bring up file dialog after starting.
  -server     : Set up Eskil to be controllable from the outside.


  -print <file> : Generate pdf and exit.

  -plugin <plugin>     : Use plugin
  -plugininfo <info>   : Pass info to plugin (plugin specific)
  -plugindump <plugin> : Dump plugin source to stdout

  -limit <lines> : Do not process more than <lines> lines.

3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
        makeDiffWin
        return
    }

    set allOpts {
        -w --help -help -b -noignore -i -nocase -nodigit -nokeyword -prefix
        -noparse -line -smallblock -block -char -word -limit -nodiff -dir
        -clip -patch -browse -conflict -print -printps -printpdf
        -server -o -r -context -cvs -svn -review
        -foreach -preprocess -close -nonewline -plugin -plugininfo
        -plugindump
    }

    # If the first option is "--query", use it to ask about options.
    if {$::eskil(argc) == 2 && [lindex $::eskil(argv) 0] == "--query"} {







|







3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
        makeDiffWin
        return
    }

    set allOpts {
        -w --help -help -b -noignore -i -nocase -nodigit -nokeyword -prefix
        -noparse -line -smallblock -block -char -word -limit -nodiff -dir
        -clip -patch -browse -conflict -print
        -server -o -r -context -cvs -svn -review
        -foreach -preprocess -close -nonewline -plugin -plugininfo
        -plugindump
    }

    # If the first option is "--query", use it to ask about options.
    if {$::eskil(argc) == 2 && [lindex $::eskil(argv) 0] == "--query"} {
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
            set ::eskil(ignorenewline) 1
        } elseif {$arg eq "-nonewline+"} {
            set ::eskil(ignorenewline) 2
        } elseif {$arg eq "-close"} {
            set ::eskil(autoclose) 1
        } elseif {$arg eq "-conflict"} {
            set opts(mode) "conflict"
        } elseif {$arg eq "-print" || $arg eq "-printps"} {
            set nextArg printFile
        } elseif {$arg eq "-printpdf"} {
            set nextArg printFile
            set opts(printMode) "PDF"
        } elseif {$arg eq "-server"} {
            if {$::tcl_platform(platform) eq "windows"} {
                catch {
                    package require dde
                    dde servername Eskil
                }
            } else {







|

<
<
<







3498
3499
3500
3501
3502
3503
3504
3505
3506



3507
3508
3509
3510
3511
3512
3513
            set ::eskil(ignorenewline) 1
        } elseif {$arg eq "-nonewline+"} {
            set ::eskil(ignorenewline) 2
        } elseif {$arg eq "-close"} {
            set ::eskil(autoclose) 1
        } elseif {$arg eq "-conflict"} {
            set opts(mode) "conflict"
        } elseif {$arg eq "-print" || $arg eq "-printpdf"} {
            set nextArg printFile



        } elseif {$arg eq "-server"} {
            if {$::tcl_platform(platform) eq "windows"} {
                catch {
                    package require dde
                    dde servername Eskil
                }
            } else {
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
    set Pref(lines) 60
    set Pref(editor) ""
    set Pref(regsub) {}
    set Pref(toolbar) 0
    set Pref(wideMap) 0 ;# Not settable in GUI yet

    # Print options
    set Pref(grayLevel1) 0.6
    set Pref(grayLevel2) 0.8
    set Pref(wideLines) 0
    set Pref(printHeaderSize) 10
    set Pref(printCharsPerLine) 80
    set Pref(printPaper) a4
    set Pref(printColorChange) "1.0 0.7 0.7"
    set Pref(printColorNew1)   "0.7 1.0 0.7"
    set Pref(printColorNew2)   "0.8 0.8 1.0"








<
<
<







3786
3787
3788
3789
3790
3791
3792



3793
3794
3795
3796
3797
3798
3799
    set Pref(lines) 60
    set Pref(editor) ""
    set Pref(regsub) {}
    set Pref(toolbar) 0
    set Pref(wideMap) 0 ;# Not settable in GUI yet

    # Print options



    set Pref(printHeaderSize) 10
    set Pref(printCharsPerLine) 80
    set Pref(printPaper) a4
    set Pref(printColorChange) "1.0 0.7 0.7"
    set Pref(printColorNew1)   "0.7 1.0 0.7"
    set Pref(printColorNew2)   "0.8 0.8 1.0"

Changes to src/print.tcl.
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
        if {$i == -1} break
        set n [expr {(- $i - $index - 1) % 8 + 1}]
        set text [string replace $text $i $i [format %*s $n ""]]
    }
    return $text
}

# Format a line of text/tag pairs to enscript code
proc FormatLine {line} {
    set result ""
    foreach {text tag} $line {
        if {$tag eq ""} {
            append result $text
        } else {
            if {$tag eq "change"} {
                set gray $::Pref(grayLevel1)
            } elseif {[string match "new*" $tag]} {
                set gray $::Pref(grayLevel2)
            } else {
                # Should not happen
                set gray 1.0
                puts stderr "Bad tag in FormatLine: '$tag'"
            }
            append result "\0bggray\{$gray\}$text\0bggray\{1.0\}"
        }
    }
    return $result
}

# Find the lastnumber in a text widget
proc FindLastNumber {w} {
    set index [$w search -backwards -regexp {\d} end]
    set line [$w get "$index linestart" "$index lineend"]
    #puts "X '$line' '$index'"
    regexp {\d+} $line number
    return $number
}

# Main print function
proc PrintDiffs {top {quiet 0} {pdfprint 0}} {
    busyCursor $top
    update idletasks

    set tmpFile [file nativename ~/eskil.enscript]
    if {$::diff($top,printFile) != ""} {
        set tmpFile2 [file nativename $::diff($top,printFile)]
    } else {
        set tmpFile2 [file nativename ~/eskil.ps]
    }

    set lines1 {}
    set lines2 {}
    if {$pdfprint && [info exists ::Pref(printCharsPerLine)]} {
        set wraplength $::Pref(printCharsPerLine)
    } elseif {$::Pref(wideLines)} {
        set wraplength 100
        set linesPerPage 74
    } else {
        set wraplength 85
        set linesPerPage 66
    }

    set tdump1 [$::widgets($top,wDiff1) dump -tag -text 1.0 end]
    set tdump2 [$::widgets($top,wDiff2) dump -tag -text 1.0 end]

    # Figure out how many chars are needed for line numbers
    set len1 [string length [FindLastNumber $::widgets($top,wLine1)]]







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










|



<
<
<
<
<
<
<


|

<
<
<


<







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
        if {$i == -1} break
        set n [expr {(- $i - $index - 1) % 8 + 1}]
        set text [string replace $text $i $i [format %*s $n ""]]
    }
    return $text
}























# Find the lastnumber in a text widget
proc FindLastNumber {w} {
    set index [$w search -backwards -regexp {\d} end]
    set line [$w get "$index linestart" "$index lineend"]
    #puts "X '$line' '$index'"
    regexp {\d+} $line number
    return $number
}

# Main print function
proc PrintDiffs {top {quiet 0}} {
    busyCursor $top
    update idletasks








    set lines1 {}
    set lines2 {}
    if {[info exists ::Pref(printCharsPerLine)]} {
        set wraplength $::Pref(printCharsPerLine)



    } else {
        set wraplength 85

    }

    set tdump1 [$::widgets($top,wDiff1) dump -tag -text 1.0 end]
    set tdump2 [$::widgets($top,wDiff2) dump -tag -text 1.0 end]

    # Figure out how many chars are needed for line numbers
    set len1 [string length [FindLastNumber $::widgets($top,wLine1)]]
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
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
        } elseif {$w2 > $w1} {
            for {set t $w1} {$t < $w2} {incr t} {
                lappend wraplines1 {}
            }
        }
    }

    if {$pdfprint} {
        PdfPrint $top $wraplength $maxlen $wraplines1 $wraplines2
    } else {
        # Write all lines to a file, taking one page at a time from each
        # side.

        set ch [open $tmpFile "w"]
        fconfigure $ch -encoding binary

        set len1 [llength $wraplines1]
        set len2 [llength $wraplines2]

        set i1 0
        set i2 0

        while {$i1 < $len1 && $i2 < $len2} {
            for {set i 0} {$i < $linesPerPage && $i1 < $len1} {incr i ; incr i1} {
                puts $ch [FormatLine [lindex $wraplines1 $i1]]
            }
            if {$i < $linesPerPage} {puts -nonewline $ch "\f"}
            for {set i 0} {$i < $linesPerPage && $i2 < $len2} {incr i ; incr i2} {
                puts $ch [FormatLine [lindex $wraplines2 $i2]]
            }
            if {$i < $linesPerPage} {puts -nonewline $ch "\f"}
        }

        close $ch

        # Run enscript to generate postscript

        if {$::tcl_platform(platform) eq "windows" &&\
                    ![info exists ::env(ENSCRIPT_LIBRARY)]} {
            set ::env(ENSCRIPT_LIBRARY) [pwd]
        }
        if {[auto_execok enscript.bin] ne ""} {
            set enscriptCmd [list enscript.bin]
        } else {
            set enscriptCmd [list enscript]
        }

        lappend enscriptCmd -2jcre -L $linesPerPage -M A4

        if {$::Pref(wideLines)} {
            lappend enscriptCmd  -f Courier6
        }
        if {![regexp {^(.*)( \(.*?\))$} $::diff($top,leftLabel) -> lfile lrest]} {
            set lfile $::diff($top,leftLabel)
            set lrest ""
        }
        set lfile [file tail $lfile]$lrest
        if {![regexp {^(.*)( \(.*?\))$} $::diff($top,rightLabel) -> rfile rrest]} {
            set rfile $::diff($top,rightLabel)
            set rrest ""
        }
        set rfile [file tail $rfile]$rrest

        lappend enscriptCmd "--header=$lfile|Page \$% of \$=|$rfile"
        if {$::diff(prettyPrint) != ""} {
            lappend enscriptCmd -E$::diff(prettyPrint)
        }
        lappend enscriptCmd -p $tmpFile2 $tmpFile

        if {[catch {exec {*}$enscriptCmd} result]} {
            if {[string index $result 0] != "\["} {
                tk_messageBox -message "Enscript error: $result\ncmd: $enscriptCmd"
                return
            }
        }
    }

    # Finished

    normalCursor $top
    if {!$pdfprint && !$quiet} {
        destroy .dp
        toplevel .dp
        wm title .dp "Eskil Print"
        ttk::button .dp.b -text "Close" -command {destroy .dp}
        ttk::label .dp.l -anchor w -justify left \
                -text "The following files have\
                been created:\n\n$tmpFile\nInput file to enscript.\
                \n\n$tmpFile2\nCreated with\
                '[lrange $enscriptCmd 0 end-3] \\\n             \
                [lrange $enscriptCmd end-2 end]'" \
                -font "Courier 8"
        pack .dp.b -side bottom
        pack .dp.l -side "top"
    }
}

proc PdfPrint {top cpl cpln wraplines1 wraplines2} {

    if {$::diff($top,printFile) != ""} {
        set pdfFile $::diff($top,printFile)
    } else {







<
|
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







226
227
228
229
230
231
232

233



234
































































235
236
237















238
239
240
241
242
243
244
        } elseif {$w2 > $w1} {
            for {set t $w1} {$t < $w2} {incr t} {
                lappend wraplines1 {}
            }
        }
    }


    PdfPrint $top $wraplength $maxlen $wraplines1 $wraplines2




































































    # Finished

    normalCursor $top















}

proc PdfPrint {top cpl cpln wraplines1 wraplines2} {

    if {$::diff($top,printFile) != ""} {
        set pdfFile $::diff($top,printFile)
    } else {
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
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
            $pdf drawTextLine [lindex $wraplines2 $i2]
            $pdf newLine
        }
    }
    $pdf endPrint
}

# Create a print dialog.
proc doPrint {top {quiet 0}} {
    if {![info exists ::diff(prettyPrint)]} {
        set ::diff(prettyPrint) ""
    }
    if {$quiet} {
        PrintDiffs $top 1
        return
    }

    destroy .pr
    toplevel .pr
    wm title .pr "Print diffs"

    ttk::label .pr.l1 -justify left -anchor w \
            -text "The print function is just on an\
            experimental level. It will use 'enscript' to write a postcript\
            file \"eskil.ps\" in your home directory."
    ttk::label .pr.l2 -justify left -anchor w \
            -text "Below you can adjust the gray scale\
            levels that are used on the background to mark changes.\
            The first value is used for changed text. The second for\
            new/deleted text."
    .pr.l1 configure -wraplength 400
    .pr.l2 configure -wraplength 400

    ttk::scale .pr.s1 -orient horizontal -from 0.0 \
            -to 1.0 -variable Pref(grayLevel1)
    ttk::scale .pr.s2 -orient horizontal -from 0.0 \
            -to 1.0 -variable Pref(grayLevel2)
    ttk::frame .pr.f
    ttk::radiobutton .pr.r1 -text "No Syntax" -variable diff(prettyPrint) \
            -value ""
    ttk::radiobutton .pr.r2 -text "VHDL" -variable diff(prettyPrint) \
            -value "vhdl"
    ttk::radiobutton .pr.r3 -text "Tcl"  -variable diff(prettyPrint) \
            -value "tcl"
    ttk::radiobutton .pr.r4 -text "C"    -variable diff(prettyPrint) \
            -value "c"

    ttk::frame .pr.fs
    ttk::radiobutton .pr.fs.r1 -text "80 char" -variable Pref(wideLines) \
            -value 0
    ttk::radiobutton .pr.fs.r2 -text "95 char" -variable Pref(wideLines) \
            -value 1
    pack .pr.fs.r1 .pr.fs.r2 -side left -padx 10

    ttk::button .pr.b1 -text "Print to File" \
            -command "destroy .pr; update; PrintDiffs $top"
    ttk::button .pr.b2 -text "Cancel" -command {destroy .pr}

    grid .pr.l1 - - -sticky we
    grid .pr.l2 - - -sticky we
    grid .pr.s1 - - -sticky we
    grid .pr.s2 - - -sticky we
    grid .pr.f  - - -sticky we
    grid .pr.fs - - -sticky we
    grid .pr.b1 x .pr.b2 -sticky we -padx 5 -pady 5 -ipadx 5
    grid columnconfigure .pr {0 2} -uniform a
    grid columnconfigure .pr 1 -weight 1
    pack .pr.r1 .pr.r2 .pr.r3 .pr.r4 -in .pr.f -side left -fill x -expand 1

}

# Count the length of a line during a text dump
proc AccumulateMax {key value index} {
    set index [lindex [split $index "."] 1]
    set len [expr {[string length $value] + $index - 1}]
    if {$len > $::diff(currentCharsPerLine)} {
        set ::diff(currentCharsPerLine) $len
    }







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







285
286
287
288
289
290
291
































































292
293
294
295
296
297
298
            $pdf drawTextLine [lindex $wraplines2 $i2]
            $pdf newLine
        }
    }
    $pdf endPrint
}

































































# Count the length of a line during a text dump
proc AccumulateMax {key value index} {
    set index [lindex [split $index "."] 1]
    set len [expr {[string length $value] + $index - 1}]
    if {$len > $::diff(currentCharsPerLine)} {
        set ::diff(currentCharsPerLine) $len
    }
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
    if {$apa ne ""} {
        set ::diff($top,printFile) $apa
        $entry xview end
    }
}

# Create a print dialog for PDF.
proc doPrint2 {top {quiet 0}} {
    if {$quiet} {
        PrintDiffs $top 1 1
        return
    }

    destroy .pr
    toplevel .pr -padx 3 -pady 3
    wm title .pr "Print diffs to PDF"








|

|







315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
    if {$apa ne ""} {
        set ::diff($top,printFile) $apa
        $entry xview end
    }
}

# Create a print dialog for PDF.
proc doPrint {top {quiet 0}} {
    if {$quiet} {
        PrintDiffs $top 1
        return
    }

    destroy .pr
    toplevel .pr -padx 3 -pady 3
    wm title .pr "Print diffs to PDF"

591
592
593
594
595
596
597
598
599
600
601
602
603
604
605

    if {$::diff($top,printFile) eq ""} {
        set ::diff($top,printFile) "~/eskil.pdf"
    }

    ttk::frame .pr.fb
    ttk::button .pr.b1 -text "Print to File" \
            -command "destroy .pr; update; PrintDiffs $top 0 1"
    ttk::button .pr.b2 -text "Cancel" -command {destroy .pr}
    pack .pr.b1 -in .pr.fb -side left  -padx 3 -pady 3 -ipadx 5
    pack .pr.b2 -in .pr.fb -side right -padx 3 -pady 3 -ipadx 5

    grid .pr.hsl .pr.hss         -sticky we -padx 3 -pady 3
    grid .pr.psl .pr.psc         -sticky we -padx 3 -pady 3
    grid .pr.cll .pr.cle .pr.clf -sticky we -padx 3 -pady 3







|







411
412
413
414
415
416
417
418
419
420
421
422
423
424
425

    if {$::diff($top,printFile) eq ""} {
        set ::diff($top,printFile) "~/eskil.pdf"
    }

    ttk::frame .pr.fb
    ttk::button .pr.b1 -text "Print to File" \
            -command "destroy .pr; update; PrintDiffs $top"
    ttk::button .pr.b2 -text "Cancel" -command {destroy .pr}
    pack .pr.b1 -in .pr.fb -side left  -padx 3 -pady 3 -ipadx 5
    pack .pr.b2 -in .pr.fb -side right -padx 3 -pady 3 -ipadx 5

    grid .pr.hsl .pr.hss         -sticky we -padx 3 -pady 3
    grid .pr.psl .pr.psc         -sticky we -padx 3 -pady 3
    grid .pr.cll .pr.cle .pr.clf -sticky we -padx 3 -pady 3