Eskil

Diff
Login

Differences From Artifact [5dd9efed9d]:

To Artifact [381de65856]:


1279
1280
1281
1282
1283
1284
1285


1286
1287
1288
1289
1290
1291
1292

1293
1294
1295
1296

1297
1298
1299
1300
1301
1302
1303
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307







+
+







+




+







        prepareRev $top
        lappend ::eskil($top,cleanup) "rev"
    } elseif {$::eskil($top,mode) eq "conflict"} {
        prepareConflict $top
        lappend ::eskil($top,cleanup) "conflict"
    }
    # Autodetect separator before any plugin processing
    set ::eskil($top,separator) \
            [subst -nocommand -novariable $::eskil($top,separatorview)]
    if {$::eskil($top,view) eq "table" && $::eskil($top,separator) eq ""} {
        set ch1 [open $::eskil($top,leftFile)]
        gets $ch1 line1
        close $ch1
        # Any tab or comma?
        if {[regsub -all "\t" $line1 "\t" _] >= 2} {
            set ::eskil($top,separator) "\t"
            set ::eskil($top,separatorview) "\\t"
            # Make it look like it came from command line
            lappend ::eskil(argv) -sep "\t"
        } elseif {[regsub -all "," $line1 "," _] >= 2} {
            set ::eskil($top,separator) ","
            set ::eskil($top,separatorview) ","
            lappend ::eskil(argv) -sep ","
        }
    }
    if {$::eskil($top,plugin) ne "" && \
                [dict get $::eskil($top,pluginpinfo) file]} {
        preparePlugin $top
        set ::eskil($top,cleanup) "plugin $::eskil($top,cleanup)"
2875
2876
2877
2878
2879
2880
2881

2882
2883
2884
2885
2886
2887
2888
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893







+







    set ::eskil($top,mode) ""
    set ::eskil($top,view) ""
    set ::eskil($top,printFileCmd) 0
    set ::eskil($top,printFile) ""
    set ::eskil($top,mergeFile) ""
    set ::eskil($top,ancestorFile) ""
    set ::eskil($top,separator) ""
    set ::eskil($top,separatorview) ""
    set ::eskil($top,conflictFile) ""
    set ::eskil($top,limitlines) 0
    set ::eskil($top,maxwidth) 0
    set ::eskil($top,plugin) ""

    # Copy the collected options from command line
    foreach {item val} $::eskil(defaultopts) {
2969
2970
2971
2972
2973
2974
2975
2976

2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991




2992
2993
2994
2995
2996
2997
2998
2974
2975
2976
2977
2978
2979
2980

2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007







-
+















+
+
+
+







    $dMenu add command -label "Tcl DiffUtil" -command DisableDiffUtilC
    $dMenu add command -label "Evalstats" -command {evalstats}
    $dMenu add command -label "_stats" -command {parray _stats}
}

# Build the main window
# "other" is related window. Currently unused
proc makeDiffWin {{other {}}} {
proc makeDiffWin {{other {}} args} {
    global tcl_platform

    # Locate a free toplevel name
    if {[info exists ::eskil(topDiffCnt)]} {
        set t $::eskil(topDiffCnt)
    } else {
        set t 0
    }
    while {[winfo exists .diff$t]} {
        incr t
    }
    set top .diff$t
    toplevel $top
    eskilRegisterToplevel $top
    initDiffData $top

    if {"-table" in $args} {
        set ::eskil($top,view) "table"
    }

    wm title $top "Eskil:"
    wm protocol $top WM_DELETE_WINDOW [list cleanupAndExit $top]

    ttk::frame $top.f
    grid $top.f -row 0 -columnspan 5 -sticky nws
    lappend ::widgets(toolbars) $top.f
3139
3140
3141
3142
3143
3144
3145


3146
3147
3148
3149
3150
3151
3152
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163







+
+







    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 "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 \
            -command [list allowEdit $top] -state disabled
    $top.m.mt add command -label "Paste Patch" -underline 0 \
            -command [list doPastePatch $top]
    $top.m.mt add command -label "Clear Align" \
3173
3174
3175
3176
3177
3178
3179

3180
3181
3182
3183
3184
3185
3186
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198







+







            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]

    ttk::label $top.lr2 -text "Rev 2"
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
3217
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
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+











+







            -command [list findDiff $top 1] \
            -underline 0
    bind $top <Alt-n> [list findDiff $top 1]
    bind $top <Alt-p> [list findDiff $top -1]
    bind $top <Alt-c> [list revCommit $top]
    bind $top <Alt-l> [list revLog $top]

    pack $top.bfn -in $top.f -side right -padx {3 6}
    pack $top.bfp $top.bcm $top.brv $top.blg \
            $top.er2 $top.lr2 $top.er1 $top.lr1 \
            -in $top.f -side right -padx 3
    # Adjust
    pack $top.bfn $top.bfp $top.bcm -ipadx 15
    # Add a separator entry in toolbar if table mode is on
    if {$::eskil($top,view) eq "table"} {
        ttk::label $top.lsep -text "Sep"
        addBalloon $top.lsep "Separator for interpreting file as table"
        ttk::entryX $top.esep -width 2 -textvariable ::eskil($top,separatorview)
        set ::widgets($top,sep) $top.esep
        bind $top.esep <Key-Return> [list redoDiff $top]
        pack $top.esep $top.lsep \
                -in $top.f -side right -padx 3
    }

    # File and progress indicators
    catch {font delete myfont}
    font create myfont -family $::Pref(fontfamily) -size $::Pref(fontsize)

    fileLabel $top.l1 -textvariable ::eskil($top,leftLabel)
    fileLabel $top.l2 -textvariable ::eskil($top,rightLabel)

    ttk::label $top.le -textvariable ::widgets($top,eqLabel) -width 1
    addBalloon $top.le "* means external diff is running.\n= means files do\
            not differ.\n! means a large block is being processed.\nBlank\
            means files differ."

    # Main window
    if {$::eskil($top,view) eq "table"} {
        # Single frame for contents
        ttk::frame $top.ft -borderwidth 2 -relief sunken
        grid $top.l1   $top.le $top.l2  -row 1 -sticky news
        grid $top.ft   -       -        -row 2 -sticky news
        grid columnconfigure $top "0 2" -weight 1
        grid rowconfigure $top $top.ft  -weight 1
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3407
3408
3409
3410
3411
3412
3413






3414
3415
3416
3417
3418
3419
3420







-
-
-
-
-
-







        lappend val backDoor$top
        bindtags $top $val
        # Keep this binding on a separate tag, so that other key
        # bindings on the top does not steal the keys
        bind backDoor$top <Key> "backDoor $top %A"
    }

    pack $top.bfn -in $top.f -side right -padx {3 6}
    pack $top.bfp $top.bcm $top.brv $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
    }

    resetEdit $top
    return $top
}