Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Handle toplevels more consistenly. This gives a cleaner interface for embedding. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
beeec19be93d9b92f63a0a1bc9a2c15c |
User & Date: | peter.spjuth@gmail.com 2011-04-05 19:15:48.000 |
Context
2011-04-05
| ||
19:38 | Added -pluginlist option. check-in: 3353e42217 user: peter.spjuth@gmail.com tags: trunk | |
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 | |
Changes
Changes to src/clip.tcl.
︙ | ︙ | |||
129 130 131 132 133 134 135 | } proc makeClipDiffWin {} { set top .clipdiff if {[winfo exists $top] && [winfo toplevel $top] eq $top} { raise $top focus -force $top | | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | } proc makeClipDiffWin {} { set top .clipdiff if {[winfo exists $top] && [winfo toplevel $top] eq $top} { raise $top focus -force $top return $top } destroy $top toplevel $top eskilRegisterToplevel $top wm title $top "Clip Diff" wm protocol $top WM_DELETE_WINDOW "cleanupAndExit $top" set t1 [Scroll both \ text $top.t1 -width 60 -height 35 -font myfont] set t2 [Scroll both \ text $top.t2 -width 60 -height 35 -font myfont] |
︙ | ︙ | |||
192 193 194 195 196 197 198 199 | } grid $top.f - -sticky we grid $top.t1 $top.t2 -sticky news grid $top.t2 -padx {2 0} grid rowconfigure $top 1 -weight 1 grid columnconfigure $top {0 1} -weight 1 } | > | 192 193 194 195 196 197 198 199 200 | } grid $top.f - -sticky we grid $top.t1 $top.t2 -sticky news grid $top.t2 -padx {2 0} grid rowconfigure $top 1 -weight 1 grid columnconfigure $top {0 1} -weight 1 return $top } |
Changes to src/dirdiff.tcl.
︙ | ︙ | |||
848 849 850 851 852 853 854 | snit::widget DirDiff { hulltype toplevel widgetclass Toplevel component tree variable statusVar constructor {args} { | | | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | snit::widget DirDiff { hulltype toplevel widgetclass Toplevel component tree variable statusVar constructor {args} { eskilRegisterToplevel $win wm title $win "Eskil Dir" wm protocol $win WM_DELETE_WINDOW [list cleanupAndExit $win] install tree using DirCompareTree $win.dc \ -leftdirvariable ::dirdiff(leftDir) \ -rightdirvariable ::dirdiff(rightDir) \ -statusvar [myvar statusVar] |
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 1134 | set ::dirdiff(leftDir) "" } if {![info exists ::dirdiff(rightDir)]} { set ::dirdiff(rightDir) "" } destroy .dirdiff DirDiff .dirdiff } | > | 1127 1128 1129 1130 1131 1132 1133 1134 1135 | set ::dirdiff(leftDir) "" } if {![info exists ::dirdiff(rightDir)]} { set ::dirdiff(rightDir) "" } destroy .dirdiff DirDiff .dirdiff return .dirdiff } |
Changes to src/eskil.tcl.
︙ | ︙ | |||
190 191 192 193 194 195 196 197 198 199 200 201 202 203 | puts "Resourcing $this" uplevel \#0 [list source $this] } # This function is called when a toplevel is closed. # If it is the last remaining toplevel, the application quits. # If top = "all" it means quit. proc cleanupAndExit {top} { # A security thing to make sure we can exit. set cont 0 if {[catch { if {$top != "all"} { set i [lsearch $::diff(diffWindows) $top] if {$i >= 0} { | > | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | puts "Resourcing $this" uplevel \#0 [list source $this] } # This function is called when a toplevel is closed. # If it is the last remaining toplevel, the application quits. # If top = "all" it means quit. # If eskil is embedded, this should be used to close an eskil toplevel. proc cleanupAndExit {top} { # A security thing to make sure we can exit. set cont 0 if {[catch { if {$top != "all"} { set i [lsearch $::diff(diffWindows) $top] if {$i >= 0} { |
︙ | ︙ | |||
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | (This is a bug)\nTerminating application." -type ok } if {$cont} return clearTmp exit } # Format a line number proc myFormL {lineNo} { if {![string is integer -strict $lineNo]} {return "$lineNo\n"} return [format "%3d: \n" $lineNo] } # Get a name for a temporary file | > > > > > > > | > > > > | | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | (This is a bug)\nTerminating application." -type ok } if {$cont} return clearTmp exit } # If embedding, tell eskil about any other toplevel, then # cleanupAndExit can be used to get rid of it. proc eskilRegisterToplevel {top} { lappend ::diff(diffWindows) $top } # Format a line number proc myFormL {lineNo} { if {![string is integer -strict $lineNo]} {return "$lineNo\n"} return [format "%3d: \n" $lineNo] } # Get a name for a temporary file # A tail can be given to make the file more recognisable. proc tmpFile {{tail {}}} { if {[info exists ::tmpcnt]} { incr ::tmpcnt } else { set ::tmpcnt 0 } set name "tmpd[pid]a$::tmpcnt" if {$tail ne ""} { append name " [file tail $tail]" } set name [file join $::diff(tmpdir) $name] lappend ::tmpfiles $name return $name } # Delete temporary files proc clearTmp {args} { if {![info exists ::tmpfiles]} { |
︙ | ︙ | |||
2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 | proc applyColor {} { global dirdiff Pref foreach top $::diff(diffWindows) { if {$top eq ".clipdiff"} continue if {$top != ".dirdiff"} { foreach item {wLine1 wDiff1 wLine2 wDiff2} { set w $::widgets($top,$item) $w tag configure equal -foreground $Pref(colorequal) \ -background $Pref(bgequal) $w tag configure new1 -foreground $Pref(colornew1) \ -background $Pref(bgnew1) $w tag configure change -foreground $Pref(colorchange) \ | > | 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 | proc applyColor {} { global dirdiff Pref foreach top $::diff(diffWindows) { if {$top eq ".clipdiff"} continue if {$top != ".dirdiff"} { foreach item {wLine1 wDiff1 wLine2 wDiff2} { if {![info exists ::widgets($top,$item)]} continue set w $::widgets($top,$item) $w tag configure equal -foreground $Pref(colorequal) \ -background $Pref(bgequal) $w tag configure new1 -foreground $Pref(colornew1) \ -background $Pref(bgnew1) $w tag configure change -foreground $Pref(colorchange) \ |
︙ | ︙ | |||
2541 2542 2543 2544 2545 2546 2547 | set t 0 } while {[winfo exists .diff$t]} { incr t } set top .diff$t toplevel $top | | | 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 | set t 0 } while {[winfo exists .diff$t]} { incr t } set top .diff$t toplevel $top eskilRegisterToplevel $top } wm title $top "Eskil:" wm protocol $top WM_DELETE_WINDOW [list cleanupAndExit $top] ttk::frame $top.f grid $top.f -row 0 -columnspan 4 -sticky nws |
︙ | ︙ | |||
3401 3402 3403 3404 3405 3406 3407 | } if {$fail} { puts "Argument $opt must be a list of RBG values from 0.0 to 1.0" exit } } | | > > > > | < | 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 | } if {$fail} { puts "Argument $opt must be a list of RBG values from 0.0 to 1.0" exit } } # Go through all command line arguments and start the appropriate # diff window. # Returns the created toplevel. # This can be used as an entry point if embedding eskil. # In that case fill in ::eskil(argv) and ::eskil(argc) before calling. proc parseCommandLine {} { global dirdiff Pref set ::eskil(autoclose) 0 set ::eskil(ignorenewline) 0 if {$::eskil(argc) == 0} { Init return [makeDiffWin] } set allOpts { -w --help -help -b -noignore -i -nocase -nodigit -nokeyword -prefix -noparse -line -smallblock -block -char -word -limit -nodiff -dir -clip -patch -browse -conflict -print -printHeaderSize -printCharsPerLine -printPaper |
︙ | ︙ | |||
3668 3669 3670 3671 3672 3673 3674 | exit } set opts(plugin) $pinterp } # Do we start in clip diff mode? if {$doclip} { | | < | < | < | < | < | | < | 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 | exit } set opts(plugin) $pinterp } # Do we start in clip diff mode? if {$doclip} { return [makeClipDiffWin] } # Figure out if we start in a diff or dirdiff window. set len [llength $files] if {$len == 0 && $dodir} { set dirdiff(leftDir) [pwd] set dirdiff(rightDir) [pwd] return [makeDirDiffWin] } if {$len == 1} { set fullname [lindex $files 0] if {[FileIsDirectory $fullname 1]} { set dirdiff(leftDir) $fullname set dirdiff(rightDir) $dirdiff(leftDir) return [makeDirDiffWin] } } elseif {$len >= 2} { set fullname1 [lindex $files 0] set fullname2 [lindex $files 1] if {[FileIsDirectory $fullname1 1] && [FileIsDirectory $fullname2 1]} { set dirdiff(leftDir) $fullname1 set dirdiff(rightDir) $fullname2 return [makeDirDiffWin] } } # Ok, we have a normal diff set top [makeDiffWin] update # Copy the previously collected options foreach {item val} [array get opts] { set ::diff($top,$item) $val } # It is preferable to see the end if the rev string is too long $::widgets($top,rev1) xview end $::widgets($top,rev2) xview end if {$doreview} { set rev [detectRevSystem "" $preferedRev] set ::diff($top,modetype) $rev set ::diff($top,mode) "patch" set ::diff($top,patchFile) "" set ::diff($top,reviewFiles) $files set ::Pref(toolbar) 1 after idle [list doDiff $top] return $top } if {$len == 1 || $foreach} { set ReturnAfterLoop 0 set first 1 foreach file $files { if {$first} { set first 0 } else { # Create new window for other files set top [makeDiffWin] update # Copy the previously collected options foreach {item val} [array get opts] { set ::diff($top,$item) $val } # It is preferable to see the end if the rev string is too long $::widgets($top,rev1) xview end $::widgets($top,rev2) xview end |
︙ | ︙ | |||
3784 3785 3786 3787 3788 3789 3790 | } else { after idle [list doDiff $top] } set ReturnAfterLoop 1 continue } } | | | 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 | } else { after idle [list doDiff $top] } set ReturnAfterLoop 1 continue } } if {$ReturnAfterLoop} {return $top} } elseif {$len >= 2} { set fullname [file join [pwd] [lindex $files 0]] set fulldir [file dirname $fullname] set ::diff($top,leftDir) $fulldir set ::diff($top,leftFile) $fullname set ::diff($top,leftLabel) $fullname set ::diff($top,leftOK) 1 |
︙ | ︙ | |||
3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 | set fullname $::diff($top,leftFile) set ::diff($top,leftOK) 0 startRevMode $top "CVS" $fullname after idle [list doDiff $top] } } } } # Save options to file ~/.eskilrc proc saveOptions {top} { global Pref # Check if the window size has changed | > | 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 | set fullname $::diff($top,leftFile) set ::diff($top,leftOK) 0 startRevMode $top "CVS" $fullname after idle [list doDiff $top] } } } return $top } # Save options to file ~/.eskilrc proc saveOptions {top} { global Pref # Check if the window size has changed |
︙ | ︙ |