Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Rebuilt main menus to psmenu. Changed psmenu to use options. Removed experiemental filter from debug. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6bf27462d443c4890767f1a762fa9c76 |
User & Date: | peter 2024-09-08 20:52:55.019 |
Context
2024-09-08
| ||
20:56 | Bumped revision on psmenu to 1.1 check-in: a605281ea5 user: peter tags: trunk | |
20:52 | Rebuilt main menus to psmenu. Changed psmenu to use options. Removed experiemental filter from debug. check-in: 6bf27462d4 user: peter tags: trunk | |
14:10 | PsMenu can store entry reconfig info. Subst on any value. check-in: bafe8468f1 user: peter tags: trunk | |
Changes
Changes to eskil.vfs/lib/psmenu-1.0.tm.
︙ | ︙ | |||
78 79 80 81 82 83 84 | "&Debug" { "Reread &Source" -acc F1 -cmd _rs } } } # Main call for psmenu. Optional arguments are for internal use. | | > > > > > > > > > > > | > > > > | > | > | | | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | "&Debug" { "Reread &Source" -acc F1 -cmd _rs } } } # Main call for psmenu. Optional arguments are for internal use. proc psmenu::psmenu {top args} { set def [lindex $args end] set args [lrange $args 0 end-1] set opts(-top) "" set opts(-level) "" set opts(-level) "" set opts(-recursive) 0 array set opts $args # Is given arg a toplevel or menu? if {$top eq "."} { set m .m } else { if {[winfo class $top] ne "Menu"} { set m $top.m } else { # A menu was given, assume -top set m $top set top $opts(-top) } } if {$opts(-recursive)} { # Locate a free window name for the menu, for internal call while {[winfo exists $m]} { if {[regexp {^(.*?)(\d+)$} $m -> prefix index]} { incr index } else { set prefix $m set index 0 } set m $prefix$index } } # It might exist for a second user call if { ! [winfo exists $m]} { # Create menu $m -tearoff 0 } if {$opts(-level) eq ""} { # Store initial level to handle scope when recursing cascades set opts(-level) [uplevel 1 info level] } if {$opts(-top) eq ""} { set opts(-top) $top $top configure -menu $m } # Comments in definition block set def [regsub -all -line {^\s*#.*$} $def ""] set state "" |
︙ | ︙ | |||
147 148 149 150 151 152 153 | # Conditionals if {$label eq "if"} { # TBD support elseif set ifExpr [lindex $entry 1] set body [lindex $entry 2] set elseBody [lindex $entry 4] | | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | # Conditionals if {$label eq "if"} { # TBD support elseif set ifExpr [lindex $entry 1] set body [lindex $entry 2] set elseBody [lindex $entry 4] set cond [uplevel \#$opts(-level) [list expr $ifExpr]] #puts "if expression '$ifExpr' = $cond" if {$cond} { # Prepend set def [list {*}$body {*}$def] } elseif {$elseBody ne ""} { set def [list {*}$elseBody {*}$def] } continue } # Recognise Cascade by even args "Name ?opts? Def" # An item will be "Name ?opts?", i.e odd if {[llength $entry] % 2 == 0} { # Cascade set options [lrange $entry 1 end-1] set body [lindex $entry end] # Recurse cascade defintion set cascade [psmenu $m {*}[array get opts] -recursive 1 $body] # Since -menu is last, processing below can assume that. lappend options -menu $cascade } else { set options [lrange $entry 1 end] } #puts "Label '$label'" #puts "Options '$options'" |
︙ | ︙ | |||
198 199 200 201 202 203 204 | set doBind "" set command "" set value "" set variable "" set cfgvar "" set default 0 foreach {opt val} $options { | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | set doBind "" set command "" set value "" set variable "" set cfgvar "" set default 0 foreach {opt val} $options { set val [uplevel \#$opts(-level) [list subst $val]] switch -- $opt { -ul - -underline { lappend newOptions -underline $val } -var - -variable { if {$type eq "cascade"} { set variable $val |
︙ | ︙ | |||
239 240 241 242 243 244 245 | } -onvalue { lappend newOptions -onvalue $val } -menu { lappend newOptions -menu $val if {$variable ne ""} { | | | | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | } -onvalue { lappend newOptions -onvalue $val } -menu { lappend newOptions -menu $val if {$variable ne ""} { uplevel \#$opts(-level) [list set $variable $val] } } -def { set default $val } default { # Just let through lappend newOptions $opt $val } } } if {$variable ne ""} { upvar \#$opts(-level) $variable __vv if {![info exists __vv]} { set __vv $default } } # TK helper to handle & in label ::tk::AmpMenuArgs $m add $type {*}$newOptions if {$cfgvar ne ""} { set ix [$m index end] set tmp [list $m entryconfigure $ix] uplevel \#$opts(-level) [list set $cfgvar $tmp] } if {$doBind ne ""} { if {[regexp {^(.*)-(.*)$} $doBind -> pre post]} { if {$pre eq "Ctrl"} { set pre "Control" } set doBind $pre-Key-$post } else { set doBind Key-$doBind } #puts "Binding '$doBind' '$command'" bind $opts(-top) <$doBind> $command } } return $m } # Extract one entry from definiton |
︙ | ︙ |
Changes to src/dirdiff.tcl.
︙ | ︙ | |||
1278 1279 1280 1281 1282 1283 1284 | } ttk::frame $win.fe1 ttk::frame $win.fe2 # Need to do this manually with snit $hull configure -menu $win.m | | | 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 | } ttk::frame $win.fe1 ttk::frame $win.fe2 # Need to do this manually with snit $hull configure -menu $win.m psmenu::psmenu $win -top $win { "&File" { "C&ompare" -cmd "[mymethod DoDirCompare]" -acc "Alt-c" --- "&Close" -cmd "cleanupAndExit $win" --- "&Quit" -cmd "cleanupAndExit all" } |
︙ | ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | --- } "&Reread Source" -cmd {EskilRereadSource} --- "Redraw Window" -cmd {makeDirDiffWin} } } | < > | 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | --- } "&Reread Source" -cmd {EskilRereadSource} --- "Redraw Window" -cmd {makeDirDiffWin} } } } ttk::button $win.bu -image $::img(upup) -command [mymethod UpDir] \ -underline 0 addBalloon $win.bu "Up in both." bind $win <Alt-u> "$win.bu invoke" #catch {font delete myfont} |
︙ | ︙ |
Changes to src/eskil.tcl.
︙ | ︙ | |||
317 318 319 320 321 322 323 | global doingLine1 doingLine2 if {$::eskil($top,view) eq "table"} { insertMatchingLinesTable $top $line1 $line2 return } | < < < < < < < < < < < < < | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | global doingLine1 doingLine2 if {$::eskil($top,view) eq "table"} { insertMatchingLinesTable $top $line1 $line2 return } if {$::Pref(parse) != 0} { set opts $::Pref(ignore) if {$::Pref(nocase)} {lappend opts -nocase} if {$::Pref(lineparsewords)} {lappend opts -words} if {$::eskil($top,separator) ne ""} { set res [diffWithSeparator $::eskil($top,separator) $line1 $line2 \ $opts] |
︙ | ︙ | |||
789 790 791 792 793 794 795 | # If block parsing is turned off, only do line parsing for # blocks of equal size. for {set t 0} {$t < $n1} {incr t} { gets $ch1 textline1 gets $ch2 textline2 insertMatchingLines $top $textline1 $textline2 } | < < < | | < | | | | | 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 | # If block parsing is turned off, only do line parsing for # blocks of equal size. for {set t 0} {$t < $n1} {incr t} { gets $ch1 textline1 gets $ch2 textline2 insertMatchingLines $top $textline1 $textline2 } addChange $top $n1 change $line1 $n1 $line2 $n2 nextHighlight $top } else { # Collect blocks set block1 {} for {set t 0} {$t < $n1} {incr t} { gets $ch1 apa lappend block1 $apa } set block2 {} for {set t 0} {$t < $n2} {incr t} { gets $ch2 apa lappend block2 $apa } insertMatchingBlocks $top $block1 $block2 $line1 $line2 1 } # Empty return value return } proc enableRedo {top} { {*}$::widgets($top,configureRedoDiffCmd) -state normal {*}$::widgets($top,configureMergeCmd) -state normal } proc disableRedo {top} { {*}$::widgets($top,configureRedoDiffCmd) -state disabled {*}$::widgets($top,configureMergeCmd) -state disabled } proc busyCursor {top} { global oldcursor oldcursor2 if {$::eskil($top,view) eq "table"} { set items wTable } else { |
︙ | ︙ | |||
1821 1822 1823 1824 1825 1826 1827 | } } # Clear Editing state proc resetEdit {top} { set ::eskil($top,leftEdit) 0 set ::eskil($top,rightEdit) 0 | | | 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 | } } # Clear Editing state proc resetEdit {top} { set ::eskil($top,leftEdit) 0 set ::eskil($top,rightEdit) 0 {*}$::widgets($top,configureEditModeCmd) -state normal if {$::eskil($top,view) eq "table"} { return } resetEditW $::widgets($top,wDiff1) resetEditW $::widgets($top,wDiff2) } |
︙ | ︙ | |||
1910 1911 1912 1913 1914 1915 1916 | $W configure -undo 1 set ::eskil($W,allowChange) line } # Turn on editing on sides where it has not been disallowed proc allowEdit {top} { | | | | 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 | $W configure -undo 1 set ::eskil($W,allowChange) line } # Turn on editing on sides where it has not been disallowed proc allowEdit {top} { {*}$::widgets($top,configureEditModeCmd) -state disable if {$::eskil($top,leftEdit) == 0} { set ::eskil($top,leftEdit) 1 turnOnEdit $::widgets($top,wDiff1) } if {$::eskil($top,rightEdit) == 0} { set ::eskil($top,rightEdit) 1 turnOnEdit $::widgets($top,wDiff2) } } # Turn off editing on sides that do not correspond to a file proc disallowEdit {top {side 0}} { if {$side == 0 || $side == 1} { set ::eskil($top,leftEdit) -1 } if {$side == 0 || $side == 2} { set ::eskil($top,rightEdit) -1 } if {$::eskil($top,leftEdit) == -1 && $::eskil($top,rightEdit) == -1} { {*}$::widgets($top,configureEditModeCmd) -state disabled } } # Ask if editing is allowed on a side proc mayEdit {top side} { if {$side == 1} { return [expr {$::eskil($top,leftEdit) == 1}] |
︙ | ︙ | |||
2572 2573 2574 2575 2576 2577 2578 | } ################ # Align function ################ proc enableAlign {top} { | | | | 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 | } ################ # Align function ################ proc enableAlign {top} { {*}$::widgets($top,configureAlignCmd) -state normal } proc disableAlign {top} { {*}$::widgets($top,configureAlignCmd) -state disabled } # Remove one or all alignment pairs proc clearAlign {top {leftline {}}} { if {$leftline == ""} { set ::eskil($top,aligns) {} } else { |
︙ | ︙ | |||
3218 3219 3220 3221 3222 3223 3224 3225 3226 | 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 \ -onvalue char -offvalue none -command \ | > | | | < | | | < < > | < | < > | | | | > | 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 | 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 \ -onvalue char -offvalue none -command \ "$::widgets($top,wDiff1) configure -wrap \$wrapstate ;\ $::widgets($top,wDiff2) configure -wrap \$wrapstate" psmenu::psmenu $dMenu -top $top { --- "&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} } } # Build the main window # "other" is related window. Currently unused proc makeDiffWin {{other {}} args} { global tcl_platform |
︙ | ︙ | |||
3272 3273 3274 3275 3276 3277 3278 | ttk::frame $top.f grid $top.f -row 0 -columnspan 5 -sticky nws lappend ::widgets(toolbars) $top.f if { ! $::Pref(toolbar)} { grid remove $top.f } | | < < | < > | < | < < < > | | < | < | < < > | < | < | < | < < > | > > > > > > > | < < < < < | > | < < < > | > > > > > | > > | < | | < | | | | < > | | > > > > | < | < < | < < < < | > | | | > > | < < > | < | < | | < | > | | | | | | | < < > | < | < < < < | > > | | | > > > > > > > > > > | < < < < < < < < < < < < < < | > > > > | | | | | < < < < < < | < < > | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 | ttk::frame $top.f grid $top.f -row 0 -columnspan 5 -sticky nws lappend ::widgets(toolbars) $top.f if { ! $::Pref(toolbar)} { grid remove $top.f } set redoState [expr {$::eskil(debug) == 1 ? "normal" : "disabled"}] psmenu::psmenu $top { "&File" { "Redo &Diff" -cmd "redoDiff $top" -state $redoState \ -cfgvar ::widgets($top,configureRedoDiffCmd) --- "&Open Both..." -cmd "openBoth $top 0" "Open Both (forget)..." -cmd "openBoth $top 1" "Open Left File..." -cmd "openLeft $top" "Open Right File..." -cmd "openRight $top" --- "Open Ancestor File..." -cmd "openAncestor $top" "Open Conflict File..." -cmd "openConflict $top" "Open Patch File..." -cmd "openPatch $top" "&Revision Diff..." -cmd "openRev $top" --- "&Print Pdf..." -cmd "doPrint $top" --- "&Close" -cmd "list cleanupAndExit $top" --- "&Quit" -cmd "cleanupAndExit all" } "&Options" { "&Font" { "&Select..." -command makeFontWin _Radio -var ::Pref(fontsize) -command chFont { 6 7 8 9 10 } } "&Ignore" { "No spaces" -var ::Pref(ignore) -value " " "Space changes (-b)" -var ::Pref(ignore) -value "-b" "All spaces (-w)" -var ::Pref(ignore) -value "-w" --- "Case (-i)" -var ::Pref(nocase) "Empty" -var ::Pref(noempty) "Digits" -var ::Pref(nodigit) } "&Preprocess..." -cmd "EditPrefPreprocess $top" "P&lugins..." -cmd "editPrefPlugins $top" "P&arse" { "Nothing" -var ::Pref(parse) -value 0 "Lines" -var ::Pref(parse) -value 1 "Blocks (small)" -var ::Pref(parse) -value 2 "Blocks" -var ::Pref(parse) -value 3 --- "Characters" -var ::Pref(lineparsewords) -value "0" "Words" -var ::Pref(lineparsewords) -value "1" --- "Fine chunks" -var ::Pref(finegrainchunks) --- "Mark last" -var ::Pref(marklast) } "&Colours..." -cmd makePrefWin "C&ontext" { "Show all lines" -var ::Pref(context) -value -1 "Show only diffs" -var ::Pref(context) -value 0 --- "Context 2 lines" -var ::Pref(context) -value 2 "Context 5 lines" -var ::Pref(context) -value 5 "Context 10 lines" -var ::Pref(context) -value 10 "Context 20 lines" -var ::Pref(context) -value 20 } "Pi&vot" { "1" -var ::Pref(pivot) -value 1 "10" -var ::Pref(pivot) -value 10 "100" -var ::Pref(pivot) -value 100 "1000" -var ::Pref(pivot) -value 1000 "Max" -var ::Pref(pivot) -value 2000000000 } --- "Toolbar" -var ::Pref(toolbar) --- "Save default" -cmd "saveOptions $top" } "&Search" -var searchMenu { # Added below } "&Tools" { "&New Diff Window" -cmd "makeDiffWin $top" "&Directory Diff" -cmd makeDirDiffWin "&Clip Diff" -cmd makeClipDiffWin "&Fourway Diff" -cmd makeFourWayWin "&Table Diff" -cmd "makeDiffWin $top -table" "&Merge" -cmd "makeMergeWin $top" -state disabled \ -cfgvar ::widgets($top,configureMergeCmd) "&Edit Mode" -cmd "allowEdit $top" -acc Ctrl-E -state disabled \ -cfgvar ::widgets($top,configureEditModeCmd) "&Paste Patch" -cmd "doPastePatch $top" "Clear Align" -cmd "clearAlign $top" -state disabled \ -cfgvar ::widgets($top,configureAlignCmd) "Highlight tabs" -cmd "highlightTabs $top" if {$::tcl_platform(platform) eq "windows"} { if { ! [catch {package require registry}]} { --- "Setup &Registry" -cmd makeRegistryWin } } } "&Help" { "&General" -cmd makeHelpWin "&Tutorial" -cmd makeTutorialWin "&Revision Control" -cmd "makeDocWin revision.txt" "&Edit Mode" -cmd "makeDocWin editmode.txt" "&Plugins" -cmd "makeDocWin plugins.txt" --- "&About" -cmd makeAboutWin } } if {[info procs textSearch::searchMenu] != ""} { textSearch::searchMenu $searchMenu } else { $searchMenu add command -label "Text search not available" -state disabled } # Toolbar ttk::label $top.lr1 -text "Rev 1" addBalloon $top.lr1 "Revision number for version diff." ttk::entryX $top.er1 -width 12 -textvariable ::eskil($top,doptrev1) set ::widgets($top,rev1) $top.er1 bind $top.er1 <Key-Return> [list redoDiff $top] |
︙ | ︙ |
Changes to src/merge.tcl.
︙ | ︙ | |||
381 382 383 384 385 386 387 | psmenu::psmenu $w { "&File" { "&Save" -cmd "saveMerge $top" ---- "&Close" -cmd "closeMerge $top" } "&Select" { | | | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | psmenu::psmenu $w { "&File" { "&Save" -cmd "saveMerge $top" ---- "&Close" -cmd "closeMerge $top" } "&Select" { _Radio -var ::eskil($top,curMergeSel) -cmd "selectMerge $top" { "Left+Right" -value 12 "&Left" -value 1 "&Right" -value 2 "Right+Left" -value 21 } --- "All Left" -cmd "selectMergeAll $top 1" |
︙ | ︙ |