Eskil

Diff
Login

Differences From Artifact [b74b502860]:

To Artifact [73603a7dab]:


33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47







-
+







# 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 ::eskil(debug) 0
set ::eskil(diffver) "Version 2.6.2+ 2012-06-22"
set ::eskil(diffver) "Version 2.6.2+ 2012-06-26"
set ::eskil(thisScript) [file join [pwd] [info script]]

namespace import tcl::mathop::+
namespace import tcl::mathop::-
namespace import tcl::mathop::*
namespace import tcl::mathop::/

240
241
242
243
244
245
246
247

248
249
250
251
252
253
254
240
241
242
243
244
245
246

247
248
249
250
251
252
253
254







-
+







            }
        }
    }
    # Configure  our new style.
    ttk::style configure My.Toolbutton {*}[ttk::style configure Toolbutton] \
        -padding {1 1}
    ttk::style map My.Toolbutton {*}[ttk::style map Toolbutton] \
        -relief {disabled flat selected sunken pressed sunken active raised}     
        -relief {disabled flat selected sunken pressed sunken active raised}
    # Re-do if the user changes theme.
    if {[lsearch -exact [bind . <<ThemeChanged>>] EskilThemeInit] == -1} {
        bind . <<ThemeChanged>> +EskilThemeInit
    }
}

# This function is called when a toplevel is closed.
561
562
563
564
565
566
567
568

569
570
571
572
573
574
575
561
562
563
564
565
566
567

568
569
570
571
572
573
574
575







-
+







    }

    # A large block may take time.  Give a small warning.
    if {$large} {
        set ::widgets($top,eqLabel) "!"
        update idletasks
    }
    

    # Detect if only newlines has changed within the block, e.g.
    # when rearranging newlines.
    if {$::eskil(ignorenewline)} {
        set res [ParseBlocksAcrossNewline $top $block1 $block2]
        if {$res != 0} {
            # FIXA: move this to ParseBlocksAcrossNewline ?
            if {$res > 0 && $details} {
633
634
635
636
637
638
639
640
641
642



643
644
645
646
647
648
649
633
634
635
636
637
638
639



640
641
642
643
644
645
646
647
648
649







-
-
-
+
+
+







                addChange $top 1 change [expr {$line1 + $t1}] 1 \
                        [expr {$line2 + $t2}] 1
                nextHighlight $top
            }
            incr t1
            incr t2
        } elseif {$c eq "C"} {
	    # This is two lines that the block matching considered
	    # too different to use line parsing on them.
	    # Marked the whole line as deleted/inserted
            # This is two lines that the block matching considered
            # too different to use line parsing on them.
            # Marked the whole line as deleted/inserted
            set textline1 [lindex $block1 $t1]
            set textline2 [lindex $block2 $t2]
            $::widgets($top,wLine1) insert end [myFormL $doingLine1] \
                    "hl$::HighLightCount change"
            $::widgets($top,wDiff1) insert end "$textline1\n" new1
            $::widgets($top,wLine2) insert end [myFormL $doingLine2] \
                    "hl$::HighLightCount change"
708
709
710
711
712
713
714
715

716
717
718
719
720
721
722
708
709
710
711
712
713
714

715
716
717
718
719
720
721
722







-
+







    if {$n1 == 0 && $n2 == 0} {
        # All blocks have been processed. Continue until end of file.
        # If "show all" is not on, just display a couple of context lines.
        set limit -1
        if {$Pref(context) >= 0} {
            set limit $Pref(context)
        }
	# Consider any total limit on displayed lines.
        # Consider any total limit on displayed lines.
        if {$::eskil($top,limitlines)} {
            set limit [expr {$::eskil($top,limitlines) - $::eskil($top,mapMax)}]
            if {$limit < 0} {
                set limit 0
            }
        }
        if {$limit >= 0} {disallowEdit $top}
2132
2133
2134
2135
2136
2137
2138
2139

2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156

2157
2158
2159
2160
2161
2162
2163
2132
2133
2134
2135
2136
2137
2138

2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155

2156
2157
2158
2159
2160
2161
2162
2163







-
+
















-
+








proc openPatch {top} {
    global Pref
    if {[doOpenLeft $top]} {
        set ::eskil($top,mode) "patch"
        set Pref(ignore) " "
        set Pref(nocase) 0
        set Pref(noempty) 0 
        set Pref(noempty) 0
        set ::eskil($top,patchFile) $::eskil($top,leftFile)
        set ::eskil($top,patchData) ""
        doDiff $top
    }
}

# Get data from clipboard and display as a patch.
proc doPastePatch {top} {
    if {[catch {::tk::GetSelection $top CLIPBOARD} sel]} {
        tk_messageBox -icon error -title "Eskil Error" -parent $top \
                -message "Could not retreive clipboard" -type ok
        return
    }
    set ::eskil($top,mode) "patch"
    set ::Pref(ignore) " "
    set ::Pref(nocase) 0
    set ::Pref(noempty) 0 
    set ::Pref(noempty) 0
    set ::eskil($top,patchFile) ""
    set ::eskil($top,patchData) $sel
    doDiff $top
}

proc openRev {top} {
    if {[doOpenRight $top]} {
2433
2434
2435
2436
2437
2438
2439
2440

2441
2442
2443
2444
2445
2446
2447
2433
2434
2435
2436
2437
2438
2439

2440
2441
2442
2443
2444
2445
2446
2447







-
+







            set ::eskil($top,alignDrag,state) "drag"
        }
    }
    if {$::eskil($top,alignDrag,state) eq "drag"} {
        set w $::eskil($top,alignDrag,W)
        # Move drag label with cursor
        wm geometry $w +[expr {$X + 1}]+[expr {$Y + 1}]
        

        set n $::eskil($top,alignDrag,from)
        set other [expr {$n == 1 ? 2 : 1}]
        set w2 $::widgets($top,wLine$other)
        # Are we over the other line window?
        if {[winfo containing $X $Y] eq $w2} {
            set x [expr {$X - [winfo rootx $w2]}]
            set y [expr {$Y - [winfo rooty $w2]}]
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786



2787
2788
2789
2790
2791
2792
2793
2777
2778
2779
2780
2781
2782
2783



2784
2785
2786
2787
2788
2789
2790
2791
2792
2793







-
-
-
+
+
+







    ttk::entryX $w -style TLabel
    $w configure {*}$args

    $w configure -takefocus 0 -state readonly ;#-readonlybackground $bg

    set i [lsearch $args -textvariable]
    if {$i >= 0} {
	set var [lindex $args [+ $i 1]]
	uplevel \#0 "trace variable $var w \
		{after idle {$w xview end} ;#}"
        set var [lindex $args [+ $i 1]]
        uplevel \#0 "trace variable $var w \
                {after idle {$w xview end} ;#}"
    }
}

# Fill in default data for a diff window
proc initDiffData {top} {
    set ::eskil($top,leftOK) 0
    set ::eskil($top,rightOK) 0
2845
2846
2847
2848
2849
2850
2851
2852

2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866


2867
2868
2869

2870
2871
2872

2873
2874
2875

2876
2877
2878

2879
2880
2881
2882
2883
2884
2885
2845
2846
2847
2848
2849
2850
2851

2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864


2865
2866
2867
2868

2869
2870
2871

2872
2873
2874

2875
2876
2877

2878
2879
2880
2881
2882
2883
2884
2885







-
+












-
-
+
+


-
+


-
+


-
+


-
+







proc backDoor {top a} {
    append ::eskil(backdoor) $a
    set ::eskil(backdoor) [string range $::eskil(backdoor) end-9 end]
    if {$::eskil(backdoor) eq "PeterDebug"} {
        set ::eskil(debug) 1
        catch {console show}
        set ::eskil(backdoor) ""
	AddDebugMenu $top
        AddDebugMenu $top
    }
}

# Runtime disable of C version of DiffUtil
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 ;\
        -onvalue char -offvalue none -command \
        "$top.ft1.tt configure -wrap \$wrapstate ;\
                $top.ft2.tt configure -wrap \$wrapstate"
    $dMenu add command -label "Date Filter" \
	-command {set ::eskil(filter) {^Date}}
        -command {set ::eskil(filter) {^Date}}
    $dMenu add separator
    $dMenu add command -label "Reread Source" -underline 0 \
	-command {EskilRereadSource}
        -command {EskilRereadSource}
        $dMenu add separator
    $dMenu add command -label "Redraw Window" \
	-command [list makeDiffWin $top]
        -command [list makeDiffWin $top]
    $dMenu add separator
    $dMenu add command -label "Normal Cursor" \
	-command [list normalCursor $top]
        -command [list normalCursor $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}
    $dMenu add command -label "Nuisance" -command [list makeNuisance \
        $top "It looks like you are trying out the debug menu."]
3213
3214
3215
3216
3217
3218
3219
3220

3221
3222
3223
3224
3225
3226
3227
3213
3214
3215
3216
3217
3218
3219

3220
3221
3222
3223
3224
3225
3226
3227







-
+







    pack $top.bfn -in $top.f -side right -padx {3 6}
    pack $top.bfp $top.bcm $top.blg \
            $top.er2 $top.lr2 $top.er1 $top.lr1 \
            -in $top.f -side right -padx 3
    pack $top.bfn $top.bfp $top.bcm -ipadx 15

    if {$::eskil(debug) == 1} {
	AddDebugMenu $top
        AddDebugMenu $top
    }

    initDiffData $top
    return $top
}

proc ValidateNewColors {} {
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701






3702
3703

3704
3705
3706


3707
3708
3709
3710
3711
3712
3713

3714
3715
3716

3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
















3734
3735
3736


3737
3738
3739
3740
3741
3742
3743






3744
3745
3746
3747
3748
3749
3750






3751
3752
3753
3754
3755
3756
3757






3758
3759
3760
3761
3762
3763
3764






3765
3766

3767
3768
3769
3770
3771
3772
3773






3774
3775
3776
3777



3778
3779
3780


3781
3782
3783
3784
3785
3786
3787






3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798










3799
3800
3801


3802
3803

3804
3805
3806
3807
3808




3809
3810
3811
3812
3813
3814





3815
3816
3817
3818
3819
3820
3821
3822







3823
3824

3825
3826
3827
3828
3829
3830
3831
3689
3690
3691
3692
3693
3694
3695






3696
3697
3698
3699
3700
3701
3702

3703
3704


3705
3706
3707
3708
3709
3710
3711
3712

3713
3714
3715

3716
3717
















3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734


3735
3736
3737






3738
3739
3740
3741
3742
3743
3744






3745
3746
3747
3748
3749
3750
3751






3752
3753
3754
3755
3756
3757
3758






3759
3760
3761
3762
3763
3764
3765

3766
3767






3768
3769
3770
3771
3772
3773
3774



3775
3776
3777
3778


3779
3780
3781






3782
3783
3784
3785
3786
3787
3788










3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799


3800
3801
3802

3803
3804




3805
3806
3807
3808
3809





3810
3811
3812
3813
3814
3815







3816
3817
3818
3819
3820
3821
3822
3823

3824
3825
3826
3827
3828
3829
3830
3831







-
-
-
-
-
-
+
+
+
+
+
+

-
+

-
-
+
+






-
+


-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
+

-
-
-
-
-
-
+
+
+
+
+
+

-
-
-
+
+
+

-
-
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+

-
-
+
+

-
+

-
-
-
-
+
+
+
+

-
-
-
-
-
+
+
+
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
+







    EditPrefRegsubUpdate $top
}

proc defaultGuiOptions {} {
    option add *Menu.tearOff 0
    option add *Button.padX 5
    if {[tk windowingsystem] eq "x11"} {
	option add *Button.padY 1
	option add *Listbox.selectBorderWidth 0
	option add *Entry.selectBorderWidth 0
	option add *Text.selectBorderWidth 0
	option add *highlightThickness 0
	option add *Scrollbar.borderWidth 1
        option add *Button.padY 1
        option add *Listbox.selectBorderWidth 0
        option add *Entry.selectBorderWidth 0
        option add *Text.selectBorderWidth 0
        option add *highlightThickness 0
        option add *Scrollbar.borderWidth 1

	option add *Menu.activeBorderWidth 1
        option add *Menu.activeBorderWidth 1
        option add *Menu.borderWidth 1
	option add *Menubutton.highlightThickness 0
 
        option add *Menubutton.highlightThickness 0

        option add *Listbox.exportSelection 0
        option add *Listbox.borderWidth 1
        #option add *Listbox.highlightThickness 1
        option add *Font "Helvetica -12"
        option add *Scrollbar.highlightThickness 0
        option add *Scrollbar.takeFocus 0
	option add *Panedwindow.showHandle 0
        option add *Panedwindow.showHandle 0
    }

    # other Win2K like color changes 
    # other Win2K like color changes
    if {[tk windowingsystem]=="x11"} {
	set SystemButtonFace #D4D0C8
	set SystemButtonText #000000
	set SystemHighlight #0A226A
	set SystemHighlightText #ffffff
	set SystemWindow #ffffff
	set SystemWindowText #000000
	set SystemWindowFrame #000000
	set NORMAL_BG $SystemButtonFace
	set NORMAL_FG $SystemButtonText
	set SELECT_BG $SystemHighlight
	set SELECT_FG $SystemHighlightText
	set MENU_BG $NORMAL_BG
	set MENU_FG $NORMAL_FG
	set HIGHLIGHT $SystemWindowFrame
	set TEXT_FG $SystemWindowText
	set TROUGH $NORMAL_BG
        set SystemButtonFace #D4D0C8
        set SystemButtonText #000000
        set SystemHighlight #0A226A
        set SystemHighlightText #ffffff
        set SystemWindow #ffffff
        set SystemWindowText #000000
        set SystemWindowFrame #000000
        set NORMAL_BG $SystemButtonFace
        set NORMAL_FG $SystemButtonText
        set SELECT_BG $SystemHighlight
        set SELECT_FG $SystemHighlightText
        set MENU_BG $NORMAL_BG
        set MENU_FG $NORMAL_FG
        set HIGHLIGHT $SystemWindowFrame
        set TEXT_FG $SystemWindowText
        set TROUGH $NORMAL_BG

	# need to set this explicitly, since its already been created
	. configure -bg $NORMAL_BG
        # need to set this explicitly, since its already been created
        . configure -bg $NORMAL_BG

	option add *Button.activeBackground $NORMAL_BG
	option add *Button.activeForeground $NORMAL_FG
	option add *Button.background $NORMAL_BG
	option add *Button.foreground $NORMAL_FG
	option add *Button.highlightBackground $NORMAL_BG
	option add *Button.highlightForeground $NORMAL_FG
        option add *Button.activeBackground $NORMAL_BG
        option add *Button.activeForeground $NORMAL_FG
        option add *Button.background $NORMAL_BG
        option add *Button.foreground $NORMAL_FG
        option add *Button.highlightBackground $NORMAL_BG
        option add *Button.highlightForeground $NORMAL_FG

	option add *Label.activeBackground $NORMAL_BG
	option add *Label.activeForeground $NORMAL_FG
	option add *Label.background $NORMAL_BG
	option add *Label.foreground $NORMAL_FG
	option add *Label.highlightBackground $NORMAL_BG
	option add *Label.highlightForeground $NORMAL_FG
        option add *Label.activeBackground $NORMAL_BG
        option add *Label.activeForeground $NORMAL_FG
        option add *Label.background $NORMAL_BG
        option add *Label.foreground $NORMAL_FG
        option add *Label.highlightBackground $NORMAL_BG
        option add *Label.highlightForeground $NORMAL_FG

	option add *Checkbutton.background $NORMAL_BG
	option add *Checkbutton.foreground $NORMAL_FG
	option add *Checkbutton.highlightBackground $NORMAL_BG
	option add *Checkbutton.highlightForeground $NORMAL_FG
	option add *Checkbutton.activeForeground $NORMAL_FG
	option add *Checkbutton.activeBackground $NORMAL_BG
        option add *Checkbutton.background $NORMAL_BG
        option add *Checkbutton.foreground $NORMAL_FG
        option add *Checkbutton.highlightBackground $NORMAL_BG
        option add *Checkbutton.highlightForeground $NORMAL_FG
        option add *Checkbutton.activeForeground $NORMAL_FG
        option add *Checkbutton.activeBackground $NORMAL_BG

	option add *Radiobutton.background $NORMAL_BG
	option add *Radiobutton.foreground $NORMAL_FG
	option add *Radiobutton.highlightBackground $NORMAL_BG
	option add *Radiobutton.highlightForeground $NORMAL_FG
	option add *Radiobutton.activeForeground $NORMAL_FG
	option add *Radiobutton.activeBackground $NORMAL_BG
        option add *Radiobutton.background $NORMAL_BG
        option add *Radiobutton.foreground $NORMAL_FG
        option add *Radiobutton.highlightBackground $NORMAL_BG
        option add *Radiobutton.highlightForeground $NORMAL_FG
        option add *Radiobutton.activeForeground $NORMAL_FG
        option add *Radiobutton.activeBackground $NORMAL_BG

	option add *Canvas.background $NORMAL_BG
        option add *Canvas.background $NORMAL_BG

	option add *Entry.background $SystemWindow
	option add *Entry.foreground $SystemWindowText
	option add *Entry.highlightBackground $NORMAL_BG
	option add *Entry.insertBackground $SystemWindowText
	option add *Entry.selectBackground $SELECT_BG
	option add *Entry.selectForeground $SELECT_FG
        option add *Entry.background $SystemWindow
        option add *Entry.foreground $SystemWindowText
        option add *Entry.highlightBackground $NORMAL_BG
        option add *Entry.insertBackground $SystemWindowText
        option add *Entry.selectBackground $SELECT_BG
        option add *Entry.selectForeground $SELECT_FG

	option add *Frame.background $NORMAL_BG
	option add *Frame.highlightBackground $NORMAL_BG
	option add *Frame.highlightForeground $SystemWindowFrame
        option add *Frame.background $NORMAL_BG
        option add *Frame.highlightBackground $NORMAL_BG
        option add *Frame.highlightForeground $SystemWindowFrame

	option add *Labelframe.foreground $NORMAL_FG
	option add *Labelframe.background $NORMAL_BG
        option add *Labelframe.foreground $NORMAL_FG
        option add *Labelframe.background $NORMAL_BG

	option add *Listbox.background $SystemWindow
	option add *Listbox.foreground $NORMAL_FG
	option add *Listbox.selectForeground $SELECT_FG
	option add *Listbox.selectBackground $SELECT_BG
	option add *Listbox.highlightBackground $NORMAL_BG
	option add *Listbox.highlightForeground $HIGHLIGHT
        option add *Listbox.background $SystemWindow
        option add *Listbox.foreground $NORMAL_FG
        option add *Listbox.selectForeground $SELECT_FG
        option add *Listbox.selectBackground $SELECT_BG
        option add *Listbox.highlightBackground $NORMAL_BG
        option add *Listbox.highlightForeground $HIGHLIGHT

	option add *Menu.activeBackground $SELECT_BG
	option add *Menu.activeForeground $SELECT_FG
	option add *Menu.background $MENU_BG
	option add *Menu.foreground $MENU_FG
	option add *Menu.selectForeground $MENU_FG
	
	option add *Menubutton.activeBackground $NORMAL_BG
	option add *Menubutton.activeForeground $NORMAL_FG
	option add *Menubutton.background $NORMAL_BG
	option add *Menubutton.foreground $NORMAL_FG
        option add *Menu.activeBackground $SELECT_BG
        option add *Menu.activeForeground $SELECT_FG
        option add *Menu.background $MENU_BG
        option add *Menu.foreground $MENU_FG
        option add *Menu.selectForeground $MENU_FG

        option add *Menubutton.activeBackground $NORMAL_BG
        option add *Menubutton.activeForeground $NORMAL_FG
        option add *Menubutton.background $NORMAL_BG
        option add *Menubutton.foreground $NORMAL_FG

	option add *Message.background $NORMAL_BG
	option add *Messsage.foreground $NORMAL_FG
        option add *Message.background $NORMAL_BG
        option add *Message.foreground $NORMAL_FG

	option add *Panedwindow.background $NORMAL_BG
        option add *Panedwindow.background $NORMAL_BG

	option add *Scale.activeBackground $NORMAL_BG
	option add *Scale.background $NORMAL_BG
	option add *Scale.foreground $NORMAL_FG
	option add *Scale.troughColor $TROUGH
        option add *Scale.activeBackground $NORMAL_BG
        option add *Scale.background $NORMAL_BG
        option add *Scale.foreground $NORMAL_FG
        option add *Scale.troughColor $TROUGH

	option add *Scrollbar.activeBackground $NORMAL_BG
	option add *Scrollbar.background $NORMAL_BG
	option add *Scrollbar.highlightBackground $NORMAL_BG
	option add *Scrollbar.highlightForeground $HIGHLIGHT
	option add *Scale.troughColor $TROUGH
        option add *Scrollbar.activeBackground $NORMAL_BG
        option add *Scrollbar.background $NORMAL_BG
        option add *Scrollbar.highlightBackground $NORMAL_BG
        option add *Scrollbar.highlightForeground $HIGHLIGHT
        option add *Scale.troughColor $TROUGH

	option add *Text.background $SystemWindow
	option add *Text.foreground $SystemWindowText
	option add *Text.highlightBackground $NORMAL_BG
	option add *Text.highlightForeground $HIGHLIGHT
	option add *Text.insertForeground $TEXT_FG
	option add *Text.selectBackground $SELECT_BG
	option add *Text.selectForeground $SELECT_FG
        option add *Text.background $SystemWindow
        option add *Text.foreground $SystemWindowText
        option add *Text.highlightBackground $NORMAL_BG
        option add *Text.highlightForeground $HIGHLIGHT
        option add *Text.insertForeground $TEXT_FG
        option add *Text.selectBackground $SELECT_BG
        option add *Text.selectForeground $SELECT_FG

	option add *Toplevel.background $NORMAL_BG
        option add *Toplevel.background $NORMAL_BG
    }

    if {$::tcl_platform(platform) eq "windows"} {
        option add *Panedwindow.sashRelief flat
        option add *Panedwindow.sashWidth 4
        option add *Panedwindow.sashPad 0
        #option add *Menubutton.activeBackground SystemHighlight