Eskil

Check-in [7a3de8b571]
Login

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

Overview
Comment:Fixed zoom to display better and to adjust to long lines. Fixed Freewrap support.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7a3de8b571697c6e6af30383371c6ede2bf3511b
User & Date: spjutp 2001-11-09 16:27:40.000
Context
2002-03-11
13:34
Added -limit option. Fixed bug where a skipped large block did not show up in map. Added 'C' to prettyprint options. check-in: d787c9f604 user: spjutp tags: trunk
2001-11-09
16:27
Fixed zoom to display better and to adjust to long lines. Fixed Freewrap support. check-in: 7a3de8b571 user: spjutp tags: trunk
2001-11-05
15:26
Release 1.9. check-in: 0f7a4d40e6 user: spjutp tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/eskil.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
#
#   diff.tcl
#
#   Purpose
#             Graphical frontend to diff
#
#   Usage
#             Do 'diff.tcl' for interactive mode
#             Do 'diff.tcl -h' for command line usage
#
#   Author    Peter Spjuth  980612
#
#   Revised   By       Date     Remark
#
#     1.0     DC-PS    980612   New Version.
#     1.1     DC-PS    980807   Parsing of change blocks added
#                               Options menu and variables changed
#                               Command line options added
#     1.2     DC-PS    980818   Improved yscroll
#                               Added map next to y-scrollbar
#     1.3     DC-PS    980921   Added Prev Diff button
#                               Added colour options, and Only diffs option
#                               Added 2nd stage line parsing
#                               Improved block parsing
#                               Added print
#     1.4     DA-PS    990210   Bug-fix in "Ignore nothing"
#                               Bug-fix in file handling
#                               Improved RCS handling.
#     1.5     DA-PS    990623   Bug-fix and improvement in block parsing
#                               Added font selection
#                               Added "diff server" functionality
#                               Split text windows in lineno/text
#                               Added "Mark last" option
#     1.6     DA-PS    000131   Added scroll-keys
#                               Bug-fixes in scroll map and printing
#     1.7     DA-PS    000427   Restricted parsing of large blocks.
#                               Fixed bug with spaces in file names.
#                               Regular screen updates during processing.
#                               Added CVS support.
#     1.8     DA-PS    001115   Highlight current diff.
#                               New -conflict flag to handle merge conflicts.
#     1.9     DA-PS    011105   Added right-click "zoom".
#                               Added -print option.
#                               Improved printing, allow print on Windows.
#                               Display patch mode.
#                               Added search and incremental search.
#                               Added context around a 'diffs only' output.
#
#-----------------------------------------------
# $Revision$
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"

set debug 0
set diffver "Version 1.9  2001-11-05"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]

if {$tcl_platform(platform) == "windows"} {
    cd $thisdir
    package require dde
}

# Support for FreeWrap. If diff.exe is wrapped, copy it so we can use it.

set diffexe diff


if {[info exists _freewrap_contents] && [file exists diff.exe]} {
    set inch [open diff.exe r]
    if {[info exists env(TEMP)]} {
        set diffexe [file join $env(TEMP) diff.exe]
    } elseif {[info exists env(TMP)]} {
        set diffexe [file join $env(TMP) diff.exe]
    } else {
        set diffexe [file join c:/ diff.exe]
    }
    set outch [open $diffexe w]


    fconfigure $inch -translation binary
    fconfigure $outch -translation binary
    puts -nonewline $outch [read $inch]
    close $inch
    close $outch
    set debug 0
}

proc cleanupAndExit {} {
    if {$::diffexe != "diff"} {
        file delete $::diffexe
    }
    cleartmp













|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







|
|





<
|
<
|
<
|
>
|
>
>
|
|
|
|
|
|
|
|
|
|
>
>
|
<
<
|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
82


83
84
85
86
87
88
89
90
91
92
#!/bin/sh
#
#   diff.tcl
#
#   Purpose
#             Graphical frontend to diff
#
#   Usage
#             Do 'diff.tcl' for interactive mode
#             Do 'diff.tcl -h' for command line usage
#
#   Author    Peter Spjuth  980612
#
#   Revised   Date     Remark
#             
#     1.0     980612   New Version.
#     1.1     980807   Parsing of change blocks added
#                      Options menu and variables changed
#                      Command line options added
#     1.2     980818   Improved yscroll
#                      Added map next to y-scrollbar
#     1.3     980921   Added Prev Diff button
#                      Added colour options, and Only diffs option
#                      Added 2nd stage line parsing
#                      Improved block parsing
#                      Added print
#     1.4     990210   Bug-fix in "Ignore nothing"
#                      Bug-fix in file handling
#                      Improved RCS handling.
#     1.5     990623   Bug-fix and improvement in block parsing
#                      Added font selection
#                      Added "diff server" functionality
#                      Split text windows in lineno/text
#                      Added "Mark last" option
#     1.6     000131   Added scroll-keys
#                      Bug-fixes in scroll map and printing
#     1.7     000427   Restricted parsing of large blocks.
#                      Fixed bug with spaces in file names.
#                      Regular screen updates during processing.
#                      Added CVS support.
#     1.8     001115   Highlight current diff.
#                      New -conflict flag to handle merge conflicts.
#     1.9     011105   Added right-click "zoom".
#                      Added -print option.
#                      Improved printing, allow print on Windows.
#                      Display patch mode.
#                      Added search and incremental search.
#                      Added context around a 'diffs only' output.
#
#-----------------------------------------------
# $Revision$
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"

set debug 1
set diffver "Version 1.9.1  2001-11-09"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]


set diffexe diff



# Support for FreeWrap.
if {[info exists ::freewrap::contents]} {
    set debug 0
    set thisdir [pwd]
    set thisscript ""
    # If diff.exe is wrapped, copy it so we can use it.
    if {[info exists ::freewrap::pkgInfo(diff.exe)]} {
        if {[info exists env(TEMP)]} {
            set diffexe [file join $env(TEMP) diff.exe]
        } elseif {[info exists env(TMP)]} {
            set diffexe [file join $env(TMP) diff.exe]
        } else {
            set diffexe [file join c:/ diff.exe]
        }
        ::freewrap::pkgfilecopy diff.exe $diffexe force
    }
}



if {$tcl_platform(platform) == "windows"} {
    cd $thisdir
    catch {package require dde}
}

proc cleanupAndExit {} {
    if {$::diffexe != "diff"} {
        file delete $::diffexe
    }
    cleartmp
2300
2301
2302
2303
2304
2305
2306
2307

2308
2309

2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326

2327

2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349

2350
2351


2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
        return
    }

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

    label .pr.l1 -justify left -text "The print function is just on an\

            experimental level. It will write a postcript file\
            \"tcldiff.ps\" in your home directory."

    label .pr.l2 -justify left -text "Below you can adjust the what gray scale\
            level is 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 300
    .pr.l2 configure -wraplength 300

    scale .pr.s1 -orient horizontal -resolution 0.1 -showvalue 1 -from 0.0 \
            -to 1.0 -variable grayLevel1
    scale .pr.s2 -orient horizontal -resolution 0.1 -showvalue 1 -from 0.0 \
            -to 1.0 -variable grayLevel2
    frame .pr.f
    radiobutton .pr.r1 -text "No Syntax" -variable prettyPrint -value ""
    radiobutton .pr.r2 -text "VHDL" -variable prettyPrint -value "vhdl"
    radiobutton .pr.r3 -text "Tcl" -variable prettyPrint -value "tcl"

    button .pr.b1 -text Print -command {destroy .pr; update; printDiffs}

    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.b1 .pr.b2 -sticky w
    grid .pr.b2 -sticky e
    pack .pr.r1 .pr.r2 .pr.r3 -in .pr.f -side left -fill x -expand 1

}

#####################################
# GUI stuff
#####################################

proc zoomRow {w X Y x y} {
    global Pref
    # Find out row
    set index [$w index @$x,$y]
    set row [lindex [split $index "."] 0]


    set data1 [.ft1.tt dump -tag -text $row.0 $row.end]
    set data2 [.ft2.tt dump -tag -text $row.0 $row.end]


    set font [.ft1.tt cget -font]
    set wx $X
    set wy [expr {$Y + 4}]

    destroy .balloon
    toplevel .balloon -bg black
    wm iconify .balloon
    wm overrideredirect .balloon 1
    
    set wid 0
    foreach x {1 2} {
        text .balloon.t$x -relief flat -font $font -bg #ffffaa -fg black \
                -padx 2 -pady 0 -height 1 -wrap word
        .balloon.t$x tag configure new1 -foreground $Pref(colornew1) \







|
>
|
|
>
|



|
|










|
>
|
>






|











|



>


>
>






|







2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
        return
    }

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

    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 \"tcldiff.ps\" in your home directory."
    label .pr.l2 -justify left -anchor w \
            -text "Below you can adjust the what gray scale\
            level is 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 320
    .pr.l2 configure -wraplength 320

    scale .pr.s1 -orient horizontal -resolution 0.1 -showvalue 1 -from 0.0 \
            -to 1.0 -variable grayLevel1
    scale .pr.s2 -orient horizontal -resolution 0.1 -showvalue 1 -from 0.0 \
            -to 1.0 -variable grayLevel2
    frame .pr.f
    radiobutton .pr.r1 -text "No Syntax" -variable prettyPrint -value ""
    radiobutton .pr.r2 -text "VHDL" -variable prettyPrint -value "vhdl"
    radiobutton .pr.r3 -text "Tcl" -variable prettyPrint -value "tcl"

    button .pr.b1 -text Print -width 7 \
            -command {destroy .pr; update; printDiffs}
    button .pr.b2 -text Cancel -width 7 \
            -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.b1 .pr.b2 -sticky w -padx 5 -pady 5
    grid .pr.b2 -sticky e
    pack .pr.r1 .pr.r2 .pr.r3 -in .pr.f -side left -fill x -expand 1

}

#####################################
# GUI stuff
#####################################

proc zoomRow {w X Y x y} {
    global Pref
    # Get the row that was clicked
    set index [$w index @$x,$y]
    set row [lindex [split $index "."] 0]

    # Extract the data
    set data1 [.ft1.tt dump -tag -text $row.0 $row.end]
    set data2 [.ft2.tt dump -tag -text $row.0 $row.end]
    if {[llength $data1] == 0 && [llength $data2] == 0} return

    set font [.ft1.tt cget -font]
    set wx $X
    set wy [expr {$Y + 4}]

    destroy .balloon
    toplevel .balloon -bg black
    wm withdraw .balloon
    wm overrideredirect .balloon 1
    
    set wid 0
    foreach x {1 2} {
        text .balloon.t$x -relief flat -font $font -bg #ffffaa -fg black \
                -padx 2 -pady 0 -height 1 -wrap word
        .balloon.t$x tag configure new1 -foreground $Pref(colornew1) \
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413


2414
2415
2416

2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
                .balloon.t$x insert end $value $tags
            }
        }
        set text [.balloon.t$x get 1.0 1.end]
        regsub -all "\t" $text "        " text
        .balloon.t$x configure -width [string length $text]
    }

    wm geometry .balloon +${wx}+${wy}
    update
    wm withdraw .balloon

    # Is the balloon within the diff window?
    set wid [winfo width .balloon]
    if {$wid + $wx > [winfo rootx .] + [winfo width .]} {
        # No.
        # Center on diff window
        set wx [expr {([winfo width .] - $wid) / 2 + [winfo rootx .]}]
        if {$wx < 0} {set wx 0}
        # Is the balloon not within the screen?
        if {$wx + $wid > [winfo screenwidth .]} {
            # Center in screen
            set wx [expr {([winfo screenwidth .] - $wid) / 2}]
            if {$wx < 0} {set wx 0}
        }
    }
            
    # Does the balloon fit within the screen?
    if {$wid > [winfo screenwidth .]} {


        # Add a row and fill screen width
        .balloon.t1 configure -height 2
        .balloon.t2 configure -height 2

        update idletasks
        wm geometry .balloon \
                [winfo screenwidth .]x[winfo reqheight .balloon]
        set wx 0
        set apa {
            set h [.balloon.t1 cget -height]
            incr h
            .balloon.t1 configure -height $h
            .balloon.t2 configure -height $h
            update idletasks
            wm geometry .balloon \
                    [winfo screenwidth .]x[winfo reqheight .balloon]
        }
        bind .balloon <Button-1> $apa
        bind . <Button-1> $apa
    }
    wm deiconify .balloon
    wm geometry .balloon +$wx+$wy
}

proc unzoomRow {} {
    destroy .balloon
    bind . <Button-1> ""
}

# Procedures for common y-scroll
proc my_yview args {
    foreach w {.ft1.tl .ft1.tt .ft2.tl .ft2.tt} {
        eval $w yview $args
    }







|
|
|
<


|















>
>
|
|
|
>




<
<
<
<
<
<
<
<
|
|
<
<

<




<







2392
2393
2394
2395
2396
2397
2398
2399
2400
2401

2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429








2430
2431


2432

2433
2434
2435
2436

2437
2438
2439
2440
2441
2442
2443
                .balloon.t$x insert end $value $tags
            }
        }
        set text [.balloon.t$x get 1.0 1.end]
        regsub -all "\t" $text "        " text
        .balloon.t$x configure -width [string length $text]
    }
    
    # Let geometry requests propagate
    update idletasks


    # Is the balloon within the diff window?
    set wid [winfo reqwidth .balloon]
    if {$wid + $wx > [winfo rootx .] + [winfo width .]} {
        # No.
        # Center on diff window
        set wx [expr {([winfo width .] - $wid) / 2 + [winfo rootx .]}]
        if {$wx < 0} {set wx 0}
        # Is the balloon not within the screen?
        if {$wx + $wid > [winfo screenwidth .]} {
            # Center in screen
            set wx [expr {([winfo screenwidth .] - $wid) / 2}]
            if {$wx < 0} {set wx 0}
        }
    }
            
    # Does the balloon fit within the screen?
    if {$wid > [winfo screenwidth .]} {
        # How many rows does it take?
        set rows [expr {ceil(double($wid) / [winfo screenwidth .])}]
        # Add rows and fill screen width
        .balloon.t1 configure -height $rows
        .balloon.t2 configure -height $rows
        # Let geometry requests propagate
        update idletasks
        wm geometry .balloon \
                [winfo screenwidth .]x[winfo reqheight .balloon]
        set wx 0








    }
    wm geometry .balloon +$wx+$wy


    wm deiconify .balloon

}

proc unzoomRow {} {
    destroy .balloon

}

# Procedures for common y-scroll
proc my_yview args {
    foreach w {.ft1.tl .ft1.tt .ft2.tl .ft2.tt} {
        eval $w yview $args
    }
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
  Open Left File    : Select a file for left window, run diff
  Open Right File   : Select a file for right window, run diff
  Open Conflict File: Select a file containing conflicts such as from
                      a CVS merge.
  Open Patch File   : Display a patch file created by diff -c or diff -u.
  RCSDiff           : (UNIX only) Select one file and diff like rcsdiff.
  CVSDiff           : (UNIX only) Select one file and diff like cvs diff.
  Print             : (UNIX only) Experimental print function.
                      It currently creates a postscript file ~/tcldiff.ps
  Quit              : Guess

Options Menu
  Font     : Select font and fontsize for the two main text windows
  Ignore   : Diff options for handling whitespace
  Parse    : Additional parsing made by diff.tcl to improve the display.







|







2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
  Open Left File    : Select a file for left window, run diff
  Open Right File   : Select a file for right window, run diff
  Open Conflict File: Select a file containing conflicts such as from
                      a CVS merge.
  Open Patch File   : Display a patch file created by diff -c or diff -u.
  RCSDiff           : (UNIX only) Select one file and diff like rcsdiff.
  CVSDiff           : (UNIX only) Select one file and diff like cvs diff.
  Print             : Experimental print function.
                      It currently creates a postscript file ~/tcldiff.ps
  Quit              : Guess

Options Menu
  Font     : Select font and fontsize for the two main text windows
  Ignore   : Diff options for handling whitespace
  Parse    : Additional parsing made by diff.tcl to improve the display.