Eskil

Diff
Login

Differences From Artifact [1a6b3b33ef]:

To Artifact [fa53143080]:


3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
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
3181
3182
3183
3184
3185
3186
3187












3188
3189
3190
3191
3192





3193
3194
3195
3196
3197
3198
3199



3200
3201
3202
3203

3204


3205
3206
3207
3208

3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222







-
-
-
-
-
-
-
-
-
-
-
-





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

-
+
-
-




-




+
+
+







    }
    wm deiconify $top
    raise $top
    update
    doDiff $top
}

# A thing to easily get to debug mode
proc backDoor {top aVal} {
    append ::eskil(backdoor) $aVal
    set ::eskil(backdoor) [string range $::eskil(backdoor) end-9 end]
    if {$::eskil(backdoor) eq "EskilDebug"} {
        set ::eskil(debug) 1
        catch {console show}
        set ::eskil(backdoor) ""
        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 \
# Organise a keyword to create backdoor menu
proc SetupBackDoor {top now} {
    set menu {
        "&Reread Source" -cmd EskilRereadSource
        ---
    }

        -onvalue char -offvalue none -command \
        "$::widgets($top,wDiff1) configure -wrap \$wrapstate ;\
                $::widgets($top,wDiff2) configure -wrap \$wrapstate"
    set cmd "$::widgets($top,wDiff1) configure -wrap \\\$wrapstate ;\
                $::widgets($top,wDiff2) configure -wrap \\\$wrapstate"
    set menu2 [list "Wrap" -cmd $cmd -var wrapstate -onvalue char -offvalue none]
    
    psmenu::psmenu $dMenu -top $top {
    append menu2 {
        ---
        "&Reread Source" -cmd EskilRereadSource
        ---
        "Normal Cursor"  -cmd "normalCursor $top"
        "Fill X"         -cmd "fillWindowX $top"
        ---
        # Runtime disable of C version of DiffUtil
        "Tcl DiffUtil" -cmd DisableDiffUtilC
        "Evalstats"    -cmd {evalstats}
        "_stats"       -cmd {parray _stats}
    }
    backDoor $top -keyword "EskilDebug" -escape 1 \
            -callback [list set ::eskil(debug) 1] \
            -menu $menu -postmenu $menu2 -now $now
}

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

3589
3590
3591
3592
3593
3594
3595

3596

3597
3598

3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3579
3580
3581
3582
3583
3584
3585
3586

3587
3588

3589











3590
3591
3592
3593
3594
3595
3596







+
-
+

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







        bind $top <Key-l>     [list scrollText $top xview scroll  5 u]
        bind $top <Key-Home>  [list scrollText $top yview moveto 0]
        bind $top <Key-g>     [list scrollText $top yview moveto 0]
        bind $top <Key-End>   [list scrollText $top yview moveto 1]
    }

    # Go out to toplevel with escape, whereever you are
    # Thus is handled by backdoor now
    bind $top <Key-Escape> [list focus $top]
    #bind $top <Key-Escape> [list focus $top]

    if {$::eskil(debug) == 0} {
    SetupBackDoor $top $::eskil(debug)
        set val [bindtags $top]
        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"
    }

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

    resetEdit $top
    return $top
}

proc ValidateNewColors {} {
    foreach item {colorchange bgchange colornew1 bgnew1