Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Require 8.5. Use argument expansion instead of eval. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
eaa675fac3720c6ef032f13f4da53f56 |
User & Date: | peter 2009-02-12 18:31:27.000 |
Context
2009-02-12
| ||
19:11 | More 8.5 features used: lassign instead of foreach. lrepeat+lreverse Math commands for some expressions. check-in: ace521ad0a user: peter tags: trunk | |
18:31 | Require 8.5. Use argument expansion instead of eval. check-in: eaa675fac3 user: peter tags: trunk | |
15:26 | Allow stepping down in directory diff check-in: 2bd38e69fc user: peter tags: trunk | |
Changes
Changes to src/compare.tcl.
︙ | ︙ | |||
28 29 30 31 32 33 34 | # Compare two lines and rate how much they resemble each other. # This has never worked well. Some day I'll sit down, think this through, # and come up with a better algorithm. proc CompareLines {line1 line2} { set opts $::Pref(ignore) if {$::Pref(nocase)} {lappend opts -nocase} | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # Compare two lines and rate how much they resemble each other. # This has never worked well. Some day I'll sit down, think this through, # and come up with a better algorithm. proc CompareLines {line1 line2} { set opts $::Pref(ignore) if {$::Pref(nocase)} {lappend opts -nocase} set res [DiffUtil::diffStrings {*}$opts $line1 $line2] # Collect identical pieces and different pieces set sames {} set diffs1 {} set diffs2 {} foreach {same1 same2 diff1 diff2} $res { lappend sames $same1 |
︙ | ︙ |
Changes to src/dirdiff.tcl.
︙ | ︙ | |||
375 376 377 378 379 380 381 | set todoNow $todo set todo {} foreach node $todoNow { set status [$tree set $node status] if {$status eq "equal"} { $tree delete $node } else { | | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | set todoNow $todo set todo {} foreach node $todoNow { set status [$tree set $node status] if {$status eq "equal"} { $tree delete $node } else { lappend todo {*}[$tree children $node] } } } } # Open or close all directories in the tree view method OpenAll {{state 1}} { set todo [$tree children {}] while {[llength $todo] > 0} { set todoNow $todo set todo {} foreach node $todoNow { set children [$tree children $node] if {[llength $children] > 0} { $tree item $node -open $state lappend todo {*}$children } } } } # Copy a file from one directory to the other method CopyFile {node from} { |
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | grid $check.rb2 -sticky w -padx 3 -pady 3 grid $check.rb3 -sticky w -padx 3 -pady 3 grid columnconfigure $check {0 1 2} -uniform a -weight 1 set opts [ttk::labelframe $top.opts -text "Options" -padding 3] ttk::checkbutton $opts.cb1 -variable TmpPref(dir,ignorekey) \ -text "Ignore \$Keyword:\$" | | | 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 | grid $check.rb2 -sticky w -padx 3 -pady 3 grid $check.rb3 -sticky w -padx 3 -pady 3 grid columnconfigure $check {0 1 2} -uniform a -weight 1 set opts [ttk::labelframe $top.opts -text "Options" -padding 3] ttk::checkbutton $opts.cb1 -variable TmpPref(dir,ignorekey) \ -text "Ignore \$Keyword:\$" pack {*}[winfo children $opts] -side top -anchor w set filter [ttk::labelframe $top.filter -text "Filter" -padding 3] ttk::label $filter.l1 -text "Include Files" -anchor w ttk::entryX $filter.e1 -width 20 -textvariable TmpPref(dir,incfiles) ttk::label $filter.l2 -text "Exclude Files" -anchor w ttk::entryX $filter.e2 -width 20 -textvariable TmpPref(dir,exfiles) ttk::label $filter.l3 -text "Include Dirs" -anchor w |
︙ | ︙ |
Changes to src/eskil.tcl.
︙ | ︙ | |||
26 27 28 29 30 31 32 | # #---------------------------------------------------------------------- # $Revision$ #---------------------------------------------------------------------- # the next line restarts using tclsh \ exec tclsh "$0" "$@" | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # #---------------------------------------------------------------------- # $Revision$ #---------------------------------------------------------------------- # the next line restarts using tclsh \ exec tclsh "$0" "$@" package require Tcl 8.5 # 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 |
︙ | ︙ | |||
116 117 118 119 120 121 122 | # Reportedly, the ttk scrollbar looks bad on Aqua if {[tk windowingsystem] ne "aqua"} { interp alias {} scrollbar {} ttk::scrollbar } # Provide a ttk-friendly toplevel, fixing background and menubar if {[info commands ttk::toplevel] eq ""} { proc ttk::toplevel {w args} { | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | # Reportedly, the ttk scrollbar looks bad on Aqua if {[tk windowingsystem] ne "aqua"} { interp alias {} scrollbar {} ttk::scrollbar } # Provide a ttk-friendly toplevel, fixing background and menubar if {[info commands ttk::toplevel] eq ""} { proc ttk::toplevel {w args} { tk::toplevel $w {*}$args place [ttk::frame $w.tilebg] -x 0 -y 0 -relwidth 1 -relheight 1 # Menubar looks out of place on linux. This adjusts the background # Which is enough to make it reasonable. set bg [ttk::style configure . -background] option add *Menubutton.background $bg option add *Menu.background $bg return $w |
︙ | ︙ | |||
149 150 151 152 153 154 155 | } # Circumvent a bug in ttk::entry that "xview end" does not work. method xview {args} { if {[llength $args] == 1} { set ix [lindex $args 0] $hull xview [$hull index $ix] } else { | | | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | } # Circumvent a bug in ttk::entry that "xview end" does not work. method xview {args} { if {[llength $args] == 1} { set ix [lindex $args 0] $hull xview [$hull index $ix] } else { $hull xview {*}$args } } } interp alias {} toplevel {} ttk::toplevel } |
︙ | ︙ | |||
304 305 306 307 308 309 310 | set ::diff(filterflag) 0 } if {$Pref(parse) != 0} { set opts $Pref(ignore) if {$Pref(nocase)} {lappend opts -nocase} if {$Pref(lineparsewords)} {lappend opts -words} | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | set ::diff(filterflag) 0 } if {$Pref(parse) != 0} { set opts $Pref(ignore) if {$Pref(nocase)} {lappend opts -nocase} if {$Pref(lineparsewords)} {lappend opts -words} set res [DiffUtil::diffStrings {*}$opts $line1 $line2] set dotag 0 set n [expr {[llength $res] / 2}] $::widgets($top,wLine1) insert end [myFormL $doingLine1] \ "hl$::HighLightCount change" $::widgets($top,wLine2) insert end [myFormL $doingLine2] \ "hl$::HighLightCount change" set new1 "new1" |
︙ | ︙ | |||
1202 1203 1204 1205 1206 1207 1208 | } if {[info exists ::diff($top,rightFileDiff)]} { set dFile2 $::diff($top,rightFileDiff) } else { set dFile2 $::diff($top,rightFile) } | | | | 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | } if {[info exists ::diff($top,rightFileDiff)]} { set dFile2 $::diff($top,rightFileDiff) } else { set dFile2 $::diff($top,rightFile) } set differr [catch {DiffUtil::diffFiles {*}$opts \ $dFile1 $dFile2} diffres] # In conflict mode we can use the diff information collected when # parsing the conflict file. This makes sure the blocks in the conflict # file become change-blocks during merge. if {$::diff($top,mode) eq "conflict" && $::diff($top,modetype) eq "Pure"} { set diffres $::diff($top,conflictDiff) } |
︙ | ︙ | |||
1814 1815 1816 1817 1818 1819 1820 | proc myOpenFile {args} { # When in tutorial mode, make sure the Tcl file dialog is used # to be able to access the files in a starkit. if {[info exists ::diff(tutorial)] && $::diff(tutorial)} { # Only do this if tk_getOpenFile is not a proc. if {[info procs tk_getOpenFile] eq ""} { # If there is any problem, call the real one | | | | 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | proc myOpenFile {args} { # When in tutorial mode, make sure the Tcl file dialog is used # to be able to access the files in a starkit. if {[info exists ::diff(tutorial)] && $::diff(tutorial)} { # Only do this if tk_getOpenFile is not a proc. if {[info procs tk_getOpenFile] eq ""} { # If there is any problem, call the real one if {![catch {set res [::tk::dialog::file:: open {*}$args]}]} { return $res } } } return [tk_getOpenFile {*}$args] } proc doOpenLeft {top {forget 0}} { if {!$forget && [info exists ::diff($top,leftDir)]} { set initDir $::diff($top,leftDir) } elseif {[info exists ::diff($top,rightDir)]} { set initDir $::diff($top,rightDir) |
︙ | ︙ | |||
1951 1952 1953 1954 1955 1956 1957 | } default { return -code error "Bad scrolldirection \"$dir\"" } } ttk::frame $w | | | 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 | } default { return -code error "Bad scrolldirection \"$dir\"" } } ttk::frame $w $class $w.s {*}$args # Move border properties to frame set bw [$w.s cget -borderwidth] set relief [$w.s cget -relief] $w configure -relief $relief -borderwidth $bw $w.s configure -borderwidth 0 |
︙ | ︙ | |||
2095 2096 2097 2098 2099 2100 2101 | set wl $::widgets($top,wLine$n) if {$hl eq ""} { set range [$wd tag ranges sel] } else { set range [$wl tag ranges hl$::diff($top,separate$n)] } | | | 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 | set wl $::widgets($top,wLine$n) if {$hl eq ""} { set range [$wd tag ranges sel] } else { set range [$wl tag ranges hl$::diff($top,separate$n)] } set text [$wd get {*}$range] set ::diff($top,separatetext$n) $text # Get the lines involved in the display set from [lindex $range 0] set to [lindex $range 1] foreach {froml fromi} [split $from "."] break foreach {tol toi} [split $to "."] break |
︙ | ︙ | |||
2370 2371 2372 2373 2374 2375 2376 | } # 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 | | | 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 | } # 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 $w configure -takefocus 0 -state readonly ;#-readonlybackground $bg set i [lsearch $args -textvariable] if {$i >= 0} { set var [lindex $args [expr {$i + 1}]] uplevel \#0 "trace variable $var w \ |
︙ | ︙ | |||
2453 2454 2455 2456 2457 2458 2459 | # Build the main window proc makeDiffWin {{top {}}} { global Pref tcl_platform debug if {$top != "" && [winfo exists $top] && [winfo toplevel $top] eq $top} { # Reuse the old window | | | 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 | # Build the main window proc makeDiffWin {{top {}}} { global Pref tcl_platform debug 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)]} { set t $::diff(topDiffCnt) } else { set t 0 } |
︙ | ︙ | |||
2674 2675 2676 2677 2678 2679 2680 | text $top.ft1.tl -height $Pref(lines) -width 5 -wrap none \ -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \ -takefocus 0 text $top.ft1.tt -height $Pref(lines) -width $Pref(linewidth) -wrap none \ -xscrollcommand [list $top.sbx1 set] \ -font myfont -borderwidth 0 -padx 1 \ -highlightthickness 0 | | | | 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 | text $top.ft1.tl -height $Pref(lines) -width 5 -wrap none \ -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \ -takefocus 0 text $top.ft1.tt -height $Pref(lines) -width $Pref(linewidth) -wrap none \ -xscrollcommand [list $top.sbx1 set] \ -font myfont -borderwidth 0 -padx 1 \ -highlightthickness 0 $top.ft1.tt configure -tabstyle wordprocessor tk::frame $top.ft1.f -width 2 -height 2 -background lightgray pack $top.ft1.tl -side left -fill y pack $top.ft1.f -side left -fill y pack $top.ft1.tt -side right -fill both -expand 1 scrollbar $top.sby -orient vertical scrollbar $top.sbx1 -orient horizontal -command [list $top.ft1.tt xview] set ::widgets($top,wLine1) $top.ft1.tl set ::widgets($top,wDiff1) $top.ft1.tt ttk::frame $top.ft2 -borderwidth 2 -relief sunken text $top.ft2.tl -height $Pref(lines) -width 5 -wrap none \ -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \ -takefocus 0 text $top.ft2.tt -height $Pref(lines) -width $Pref(linewidth) -wrap none \ -xscrollcommand [list $top.sbx2 set] \ -font myfont -borderwidth 0 -padx 1 \ -highlightthickness 0 $top.ft2.tt configure -tabstyle wordprocessor tk::frame $top.ft2.f -width 2 -height 2 -background lightgray pack $top.ft2.tl -side left -fill y pack $top.ft2.f -side left -fill y pack $top.ft2.tt -side right -fill both -expand 1 scrollbar $top.sbx2 -orient horizontal -command [list $top.ft2.tt xview] set ::widgets($top,wLine2) $top.ft2.tl set ::widgets($top,wDiff2) $top.ft2.tt |
︙ | ︙ |
Changes to src/help.tcl.
︙ | ︙ | |||
162 163 164 165 166 167 168 | insertTaggedText $t $doc $t configure -state disabled } proc createDocFonts {} { if {[catch {font create docFont -family Helvetica -size -16}]} return | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | insertTaggedText $t $doc $t configure -state disabled } proc createDocFonts {} { if {[catch {font create docFont -family Helvetica -size -16}]} return font create docFontB {*}[font configure docFont] -weight bold set h [font metrics docFont -linespace] set t [expr {-$h + 4}] font create docFontP -family Courier -size $t for {} {$t > -20} {incr t -1} { font configure docFontP -size $t if {[font metrics docFontP -linespace] >= $h} break |
︙ | ︙ |
Changes to src/merge.tcl.
︙ | ︙ | |||
212 213 214 215 216 217 218 | if {[file exists $::diff($top,rightFile)] && \ $::diff($top,rightFile) eq $::diff($top,rightLabel)} { lappend buttons Right append text "\nRight: $::diff($top,rightFile)" } lappend buttons Browse Cancel if {[llength $buttons] > 2} { | | | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | if {[file exists $::diff($top,rightFile)] && \ $::diff($top,rightFile) eq $::diff($top,rightLabel)} { lappend buttons Right append text "\nRight: $::diff($top,rightFile)" } lappend buttons Browse Cancel if {[llength $buttons] > 2} { set apa [tk_dialog .savemerge "Save merge file" \ $text \ questhead -1 {*}$buttons] if {$apa < 0} return set apa [lindex $buttons $apa] if {$apa eq "Left"} { set ::diff($top,mergeFile) $::diff($top,leftFile) } elseif {$apa eq "Right"} { set ::diff($top,mergeFile) $::diff($top,rightFile) } elseif {$apa eq "Cancel"} { |
︙ | ︙ | |||
265 266 267 268 269 270 271 | # Create a window to display merge result. proc makeMergeWin {top} { set w $top.merge if {![winfo exists $w]} { toplevel $w } else { | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | # Create a window to display merge result. proc makeMergeWin {top} { set w $top.merge if {![winfo exists $w]} { toplevel $w } else { destroy {*}[winfo children $w] } wm title $w "Merge result" ttk::frame $w.f ttk::radiobutton $w.f.rb1 -text "LR" -value 12 \ |
︙ | ︙ |
Changes to src/print.tcl.
︙ | ︙ | |||
325 326 327 328 329 330 331 | lappend enscriptCmd "--header=$lfile|Page \$% of \$=|$rfile" if {$::diff(prettyPrint) != ""} { lappend enscriptCmd -E$::diff(prettyPrint) } lappend enscriptCmd -p $tmpFile2 $tmpFile | | | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | lappend enscriptCmd "--header=$lfile|Page \$% of \$=|$rfile" if {$::diff(prettyPrint) != ""} { lappend enscriptCmd -E$::diff(prettyPrint) } lappend enscriptCmd -p $tmpFile2 $tmpFile if {[catch {exec {*}$enscriptCmd} result]} { if {[string index $result 0] != "\["} { tk_messageBox -message "Enscript error: $result\ncmd: $enscriptCmd" return } } } |
︙ | ︙ |