Eskil

Diff
Login

Differences From Artifact [50beecb4af]:

To Artifact [2cd43523c1]:


47
48
49
50
51
52
53

54
55
56
57
58
59
60
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61







+








# Do initalisations for needed packages and globals.
# This is not run until needed to speed up command line error reporting.
proc Init {} {
    package require Tk 8.4
    catch {package require textSearch}
    package require wcb
    package require snit

    if {[catch {package require psballoon}]} {
        # Add a dummy if it does not exist.
        proc addBalloon {args} {}
    } else {
        namespace import -force psballoon::addBalloon
    }
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2507
2508
2509
2510
2511
2512
2513








2514
2515
2516
2517
2518
2519
2520







-
-
-
-
-
-
-
-







    # Do not scroll if focus is in a text window.
    # This is for scroll bindings in the toplevel.
    if {[winfo class [focus]] != "Text"} {
        $::widgets($top,wDiff1) yview scroll $n $what
    }
}

# Experiment using snit
lappend ::auto_path [file dirname [file dirname $::eskil(thisScript)]]/lib
#puts $::auto_path
if {[catch {package require snit}]} {
    namespace eval snit {
        proc widgetadaptor {args} {}
    }
}
# Emulate a label that:
# 1 : Displays the right part of the text if there isn't enough room
# 2 : Justfify text to the left if there is enough room.
# 3 : Does not try to allocate space according to its contents
proc fileLabel {w args} {
    ttk::entryX $w -style TLabel
    $w configure {*}$args
3658
3659
3660
3661
3662
3663
3664
3665

3666
3667

3668
3669

3670
3671
3672
3673
3674
3675
3676
3651
3652
3653
3654
3655
3656
3657

3658
3659

3660
3661

3662
3663
3664
3665
3666
3667
3668
3669







-
+

-
+

-
+







        } elseif {$arg eq "-nokeyword"} {
            set Pref(dir,ignorekey) 1
        } elseif {$arg eq "-prefix"} {
            set nextArg prefix
        } elseif {$arg eq "-preprocess"} {
            set nextArg preprocess
        } elseif {$arg eq "-plugin"} {
            set nextArg plugin
            set nextArg "plugin"
        } elseif {$arg eq "-plugininfo"} {
            set nextArg plugininfo
            set nextArg "plugininfo"
        } elseif {$arg eq "-plugindump"} {
            set nextArg plugindump
            set nextArg "plugindump"
        } elseif {$arg eq "-pluginlist"} {
            set pluginlist 1
        } elseif {$arg eq "-context"} {
            set nextArg context
        } elseif {$arg eq "-noparse"} {
            set Pref(parse) 0
        } elseif {$arg eq "-line"} {
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068












4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4046
4047
4048
4049
4050
4051
4052









4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064

4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077







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













    }
    unset Pref(onlydiffs)

    # Set up reactions to some Pref settings
    if {![info exists ::widgets(toolbars)]} {
        set ::widgets(toolbars) {}
    }
    # FIXA: Move to procs, handle destroyed windows.
    trace add variable ::Pref(toolbar) write "
        foreach __ \$::widgets(toolbars) {
            if {\$::Pref(toolbar)} {
                grid configure \$__
            } else {
                grid remove \$__
            }
        }
    trace add variable ::Pref(toolbar) write TraceToolbar
}

proc TraceToolbar {args} {
    # FIXA: Handle destroyed windows ?
    foreach __ $::widgets(toolbars) {
        if {$::Pref(toolbar)} {
            grid configure $__
        } else {
            grid remove $__
        }
    }
    \# "
}

# Global code is only run the first time to be able to reread source
if {![info exists ::eskil(gurkmeja)]} {
    set ::eskil(gurkmeja) 1

    package require pstools
    namespace import -force pstools::*
    getOptions
    if {![info exists ::eskil_testsuite]} {
        parseCommandLine
    }
}