Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Cleanup global variable usage. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
bf97ad3bfa8d83b1f7767adee292f8c4 |
User & Date: | peter.spjuth@gmail.com 2011-04-05 18:38:41.000 |
Context
2011-04-05
| ||
19:15 | Handle toplevels more consistenly. This gives a cleaner interface for embedding. check-in: beeec19be9 user: peter.spjuth@gmail.com tags: trunk | |
18:38 | Cleanup global variable usage. check-in: bf97ad3bfa user: peter.spjuth@gmail.com tags: trunk | |
2011-04-04
| ||
00:07 | Support commit in Fossil check-in: 124cbad284 user: peter.spjuth@gmail.com tags: trunk | |
Changes
Changes to src/dirdiff.tcl.
︙ | ︙ | |||
910 911 912 913 914 915 916 | $win.m add cascade -label "Help" -underline 0 -menu $win.m.help menu $win.m.help $win.m.help add command -label "Tutorial" -command makeTutorialWin \ -underline 0 $win.m.help add command -label "About" -command makeAboutWin -underline 0 | | | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 | $win.m add cascade -label "Help" -underline 0 -menu $win.m.help menu $win.m.help $win.m.help add command -label "Tutorial" -command makeTutorialWin \ -underline 0 $win.m.help add command -label "About" -command makeAboutWin -underline 0 if {$::eskil(debug)} { $win.m add cascade -label "Debug" -menu $win.m.md -underline 0 menu $win.m.md if {$::tcl_platform(platform) eq "windows"} { $win.m.md add checkbutton -label "Console" -variable consolestate \ -onvalue show -offvalue hide -command {console $consolestate} $win.m.md add separator } |
︙ | ︙ |
Changes to src/eskil.tcl.
︙ | ︙ | |||
32 33 34 35 36 37 38 | # 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 | | | | | | | | | | | | | | | | | | | | | 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 93 94 95 96 97 | # 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) 1 set ::eskil(diffver) "Version 2.5+ 2011-04-04" set ::eskil(thisScript) [file join [pwd] [info script]] namespace import tcl::mathop::+ namespace import tcl::mathop::- namespace import tcl::mathop::* namespace import tcl::mathop::/ # 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 if {[catch {package require psballoon}]} { # Add a dummy if it does not exist. proc addBalloon {args} {} } else { namespace import -force psballoon::addBalloon } set ::eskil(thisDir) [file dirname $::eskil(thisScript)] # Follow any link set tmplink $::eskil(thisScript) while {[file type $tmplink] eq "link"} { set tmplink [file readlink $tmplink] set tmplink [file normalize [file join $::eskil(thisDir) $tmplink]] set ::eskil(thisDir) [file dirname $tmplink] } # Get all other source files source $::eskil(thisDir)/clip.tcl source $::eskil(thisDir)/compare.tcl source $::eskil(thisDir)/map.tcl source $::eskil(thisDir)/merge.tcl source $::eskil(thisDir)/registry.tcl source $::eskil(thisDir)/dirdiff.tcl source $::eskil(thisDir)/help.tcl source $::eskil(thisDir)/plugin.tcl source $::eskil(thisDir)/printobj.tcl source $::eskil(thisDir)/print.tcl source $::eskil(thisDir)/rev.tcl set ::util(diffexe) diff # Diff functionality is in the DiffUtil package. package require DiffUtil # Help DiffUtil to find a diff executable, if needed catch {DiffUtil::LocateDiffExe $::eskil(thisScript)} # Figure out a place to store temporary files. locateTmp ::diff(tmpdir) if {$::tcl_platform(platform) eq "windows"} { # Locate CVS if it is in c:/bin if {[auto_execok cvs] eq "" && [file exists "c:/bin/cvs.exe"]} { |
︙ | ︙ | |||
162 163 164 165 166 167 168 | } interp alias {} toplevel {} ttk::toplevel } # Debug function to be able to reread the source even when wrapped in a kit. proc EskilRereadSource {} { | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | } interp alias {} toplevel {} ttk::toplevel } # Debug function to be able to reread the source even when wrapped in a kit. proc EskilRereadSource {} { set this $::eskil(thisScript) # FIXA: Better detection of starkit? # Maybe look at ::starkit::topdir ? #if {[info exists ::starkit::topdir]} { # puts "Topdir: $::starkit::topdir" #} |
︙ | ︙ | |||
2433 2434 2435 2436 2437 2438 2439 | # This is for scroll bindings in the toplevel. if {[winfo class [focus]] != "Text"} { $::widgets($top,wDiff1) yview scroll $n $what } } # Experiment using snit | | | 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 | # 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: |
︙ | ︙ | |||
2516 2517 2518 2519 2520 2521 2522 | } # A thing to easily get to debug mode proc backDoor {a} { append ::eskil(backdoor) $a set ::eskil(backdoor) [string range $::eskil(backdoor) end-9 end] if {$::eskil(backdoor) eq "PeterDebug"} { | | | | 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 | } # A thing to easily get to debug mode proc backDoor {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) "" } } # Build the main window proc makeDiffWin {{top {}}} { global Pref tcl_platform if {$top != "" && [winfo exists $top] && [winfo toplevel $top] eq $top} { # Reuse the old window destroy {*}[winfo children $top] } else { # Locate a free toplevel name if {[info exists ::diff(topDiffCnt)]} { |
︙ | ︙ | |||
2561 2562 2563 2564 2565 2566 2567 | menu $top.m $top configure -menu $top.m $top.m add cascade -label "File" -underline 0 -menu $top.m.mf menu $top.m.mf $top.m.mf add command -label "Redo Diff" -underline 5 \ -command [list redoDiff $top] -state disabled | | | 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 | menu $top.m $top configure -menu $top.m $top.m add cascade -label "File" -underline 0 -menu $top.m.mf menu $top.m.mf $top.m.mf add command -label "Redo Diff" -underline 5 \ -command [list redoDiff $top] -state disabled if {$::eskil(debug) == 1} { $top.m.mf entryconfigure "Redo Diff" -state normal } $top.m.mf add separator $top.m.mf add command -label "Open Both..." -underline 0 \ -command [list openBoth $top 0] $top.m.mf add command -label "Open Both (forget)..." \ -command [list openBoth $top 1] |
︙ | ︙ | |||
2834 2835 2836 2837 2838 2839 2840 | grid $top.ls -sticky "" bind $top <Key-Up> [list scrollText $top -1 u] bind $top <Key-Down> [list scrollText $top 1 u] bind $top <Key-Prior> [list scrollText $top -1 pa] bind $top <Key-Next> [list scrollText $top 1 pa] bind $top <Key-Escape> [list focus $top] | | | | 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 | grid $top.ls -sticky "" bind $top <Key-Up> [list scrollText $top -1 u] bind $top <Key-Down> [list scrollText $top 1 u] bind $top <Key-Prior> [list scrollText $top -1 pa] bind $top <Key-Next> [list scrollText $top 1 pa] bind $top <Key-Escape> [list focus $top] if {$::eskil(debug) == 0} { bind $top <Key> "backDoor %A" } 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} { $top.m add cascade -label "Debug" -menu $top.m.md -underline 0 menu $top.m.md if {$tcl_platform(platform) eq "windows"} { $top.m.md add checkbutton -label "Console" -variable consolestate \ -onvalue show -offvalue hide \ -command {console $consolestate} $top.m.md add separator |
︙ | ︙ | |||
3631 3632 3633 3634 3635 3636 3637 | tk appname Eskil } } elseif {$arg eq "-o"} { set nextArg mergeFile } elseif {$arg eq "-r"} { set nextArg revision } elseif {$arg eq "-debug"} { | | | 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 | tk appname Eskil } } elseif {$arg eq "-o"} { set nextArg mergeFile } elseif {$arg eq "-r"} { set nextArg revision } elseif {$arg eq "-debug"} { set ::eskil(debug) 1 } elseif {$arg eq "-svn"} { set preferedRev "SVN" } elseif {$arg eq "-cvs"} { set preferedRev "CVS" } elseif {$arg eq "-"} { # Allow "-" for stdin patch processing lappend files "-" |
︙ | ︙ | |||
3960 3961 3962 3963 3964 3965 3966 | grid remove \$__ } } \# " } # Global code is only run the first time to be able to reread source | | | | 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 | 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 } } |
Changes to src/help.tcl.
︙ | ︙ | |||
21 22 23 24 25 26 27 | #---------------------------------------------------------------------- # $Revision$ #---------------------------------------------------------------------- # Silly experiment... proc makeNuisance {top {str {Hi there!}}} { if {[lsearch [image names] nuisance] < 0} { | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #---------------------------------------------------------------------- # $Revision$ #---------------------------------------------------------------------- # Silly experiment... proc makeNuisance {top {str {Hi there!}}} { if {[lsearch [image names] nuisance] < 0} { set file [file join $::eskil(thisDir) .. Nuisance.gif] if {![file exists $file]} return image create photo nuisance -file $file } destroy $top.nui toplevel $top.nui wm transient $top.nui $top |
︙ | ︙ | |||
68 69 70 71 72 73 74 | pack $w.b -side bottom -pady 2 pack $w.f -side top -expand y -fill both -padx 2 -pady 2 focus $w return $w.f } proc makeAboutWin {} { | < < | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | pack $w.b -side bottom -pady 2 pack $w.f -side top -expand y -fill both -padx 2 -pady 2 focus $w return $w.f } proc makeAboutWin {} { set w [helpWin .ab "About Eskil"] set bg [ttk::style configure . -background] text $w.t -width 45 -height 11 -wrap none -relief flat \ -background $bg pack $w.t -side top -expand y -fill both $w.t insert end "A graphical frontend to diff\n\n" $w.t insert end "$::eskil(diffver)\n\n" $w.t insert end "Made by Peter Spjuth\n" $w.t insert end "E-Mail: peter.spjuth@gmail.com\n" $w.t insert end "\nURL: http://eskil.berlios.de\n" $w.t insert end "\nTcl version: [info patchlevel]\n" set du [package provide DiffUtil] if {[info procs DiffUtil::LocateDiffExe] ne ""} { |
︙ | ︙ | |||
132 133 134 135 136 137 138 | } } } proc makeHelpWin {} { global Pref | | | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | } } } proc makeHelpWin {} { global Pref set doc [file join $::eskil(thisDir) .. doc/eskil.txt] if {![file exists $doc]} return set w [helpWin .he "Eskil Help"] set t [Scroll y text $w.t -width 85 -height 35] pack $w.t -side top -expand 1 -fill both configureDocWin $t |
︙ | ︙ | |||
196 197 198 199 200 201 202 | proc makeDocWin {fileName} { set w [helpWin .doc "Eskil Help"] set t [Scroll y text $w.t -width 80 -height 25] pack $w.t -side top -expand 1 -fill both configureDocWin $t | | | | | | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | proc makeDocWin {fileName} { set w [helpWin .doc "Eskil Help"] set t [Scroll y text $w.t -width 80 -height 25] pack $w.t -side top -expand 1 -fill both configureDocWin $t if {![file exists $::eskil(thisDir)/../doc/$fileName]} { $t insert end "ERROR: Could not find doc file " $t insert end \"$fileName\" return } insertTaggedText $t $::eskil(thisDir)/../doc/$fileName #focus $t $t configure -state disabled } proc makeTutorialWin {} { global Pref set doc [file join $::eskil(thisDir) .. doc/tutorial.txt] if {![file exists $doc]} return if {[catch {cd [file join $::eskil(thisDir) .. examples]}]} { tk_messageBox -icon error -title "Eskil Error" -message \ "Could not locate examples directory." \ -type ok return } #set ::diff(tutorial) 1 |
︙ | ︙ |
Changes to src/plugin.tcl.
︙ | ︙ | |||
20 21 22 23 24 25 26 | # #---------------------------------------------------------------------- # $Revision$ #---------------------------------------------------------------------- proc PluginSearchPath {} { set dirs [list . ./plugins] | | | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # #---------------------------------------------------------------------- # $Revision$ #---------------------------------------------------------------------- proc PluginSearchPath {} { set dirs [list . ./plugins] lappend dirs [file join $::eskil(thisDir) .. ..] lappend dirs [file join $::eskil(thisDir) .. .. plugins] lappend dirs [file join $::eskil(thisDir) .. plugins] return $dirs } # Locate plugin source proc LocatePlugin {plugin} { set src "" set dirs [PluginSearchPath] |
︙ | ︙ |
Changes to src/registry.tcl.
︙ | ︙ | |||
52 53 54 55 56 57 58 | grid $l.new1 $l.new2 - -sticky "w" -padx 4 -pady 4 grid $l.delete - $l.change -sticky "w" -padx 4 -pady 4 grid $l.change -sticky "e" grid columnconfigure $l 2 -weight 1 } proc makeRegistryWin {} { | < < | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | grid $l.new1 $l.new2 - -sticky "w" -padx 4 -pady 4 grid $l.delete - $l.change -sticky "w" -padx 4 -pady 4 grid $l.change -sticky "e" grid columnconfigure $l 2 -weight 1 } proc makeRegistryWin {} { # Locate executable for this program set exe [info nameofexecutable] if {[regexp {^(.*wish)\d+\.exe$} $exe -> pre]} { set alt $pre.exe if {[file exists $alt]} { set a [tk_messageBox -icon question -title "Which Wish" -message \ "Would you prefer to use the executable\n\ |
︙ | ︙ | |||
98 99 100 101 102 103 104 | } else { if {[regexp {wish\d+\.exe} $exe]} { set exe [file join [file dirname $exe] wish.exe] if {[file exists $exe]} { set myexe [list $exe] } } | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | } else { if {[regexp {wish\d+\.exe} $exe]} { set exe [file join [file dirname $exe] wish.exe] if {[file exists $exe]} { set myexe [list $exe] } } set myexe [list $exe $::eskil(thisScript)] } set valbase {} foreach item $myexe { lappend valbase \"[file nativename $item]\" } set valbase [join $valbase] |
︙ | ︙ |