Fossil SCM
Merge UI menu buttons working on Darwin.
Commit
76b39a2c9f5f60d21ad8fc426643297660b01c2e9bce0839aa03f8f474367825
Parent
e9d1d7166924802…
1 file changed
+88
-77
+88
-77
| --- src/merge.tcl | ||
| +++ src/merge.tcl | ||
| @@ -349,94 +349,105 @@ | ||
| 349 | 349 | frame .bb |
| 350 | 350 | if {[info exists filelist]} { |
| 351 | 351 | label .bb.filetag -text "File:" |
| 352 | 352 | set current_file [lindex $filelist 1] |
| 353 | 353 | trace add variable current_file write readMerge |
| 354 | - ::ttk::menubutton .bb.files -text $current_file | |
| 355 | - if {[tk windowingsystem] eq "win32"} { | |
| 356 | - ::ttk::style theme use winnative | |
| 357 | - .bb.files configure -padding {20 1 10 2} | |
| 358 | - } | |
| 359 | - toplevel .wfiles | |
| 360 | - wm withdraw .wfiles | |
| 361 | - update idletasks | |
| 362 | - wm transient .wfiles . | |
| 363 | - wm overrideredirect .wfiles 1 | |
| 364 | - set ht [expr {[llength $filelist]/2}] | |
| 365 | - if {$ht>$CFG(LB_HEIGHT)} {set ht $CFG(LB_HEIGHT)} | |
| 366 | - listbox .wfiles.lb -width 0 -height $ht -activestyle none \ | |
| 367 | - -yscroll {.wfiles.sb set} | |
| 368 | - set mx 1 | |
| 369 | - foreach {op fn} $filelist { | |
| 370 | - set n [string length $fn] | |
| 371 | - if {$n>$mx} {set mx $n} | |
| 372 | - .wfiles.lb insert end [format "%-9s %s" $op $fn] | |
| 373 | - } | |
| 374 | - .bb.files config -width $mx | |
| 375 | - ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} | |
| 376 | - grid .wfiles.lb .wfiles.sb -sticky ns | |
| 377 | - bind .bb.files <1> { | |
| 378 | - set x [winfo rootx %W] | |
| 379 | - set y [expr {[winfo rooty %W]+[winfo height %W]}] | |
| 380 | - wm geometry .wfiles +$x+$y | |
| 381 | - wm deiconify .wfiles | |
| 382 | - focus .wfiles.lb | |
| 383 | - } | |
| 384 | - bind .wfiles <FocusOut> {wm withdraw .wfiles} | |
| 385 | - bind .wfiles <Escape> {focus .} | |
| 386 | - foreach evt {1 Return} { | |
| 387 | - bind .wfiles.lb <$evt> { | |
| 388 | - set ii [%W curselection] | |
| 389 | - set ::current_file [lindex $::filelist [expr {$ii*2+1}]] | |
| 390 | - .bb.files config -text $::current_file | |
| 391 | - focus . | |
| 392 | - break | |
| 393 | - } | |
| 394 | - } | |
| 395 | - bind .wfiles.lb <Motion> { | |
| 396 | - %W selection clear 0 end | |
| 397 | - %W selection set @%x,%y | |
| 354 | + | |
| 355 | + if {$tcl_platform(os)=="Darwin"} { | |
| 356 | + set fnlist {} | |
| 357 | + foreach {op fn} $filelist {lappend fnlist $fn} | |
| 358 | + tk_optionMenu .bb.files current_file {*}$fnlist | |
| 359 | + } else { | |
| 360 | + ::ttk::menubutton .bb.files -text $current_file | |
| 361 | + if {[tk windowingsystem] eq "win32"} { | |
| 362 | + ::ttk::style theme use winnative | |
| 363 | + .bb.files configure -padding {20 1 10 2} | |
| 364 | + } | |
| 365 | + toplevel .wfiles | |
| 366 | + wm withdraw .wfiles | |
| 367 | + update idletasks | |
| 368 | + wm transient .wfiles . | |
| 369 | + wm overrideredirect .wfiles 1 | |
| 370 | + set ht [expr {[llength $filelist]/2}] | |
| 371 | + if {$ht>$CFG(LB_HEIGHT)} {set ht $CFG(LB_HEIGHT)} | |
| 372 | + listbox .wfiles.lb -width 0 -height $ht -activestyle none \ | |
| 373 | + -yscroll {.wfiles.sb set} | |
| 374 | + set mx 1 | |
| 375 | + foreach {op fn} $filelist { | |
| 376 | + set n [string length $fn] | |
| 377 | + if {$n>$mx} {set mx $n} | |
| 378 | + .wfiles.lb insert end [format "%-9s %s" $op $fn] | |
| 379 | + } | |
| 380 | + .bb.files config -width $mx | |
| 381 | + ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} | |
| 382 | + grid .wfiles.lb .wfiles.sb -sticky ns | |
| 383 | + bind .bb.files <1> { | |
| 384 | + set x [winfo rootx %W] | |
| 385 | + set y [expr {[winfo rooty %W]+[winfo height %W]}] | |
| 386 | + wm geometry .wfiles +$x+$y | |
| 387 | + wm deiconify .wfiles | |
| 388 | + focus .wfiles.lb | |
| 389 | + } | |
| 390 | + bind .wfiles <FocusOut> {wm withdraw .wfiles} | |
| 391 | + bind .wfiles <Escape> {focus .} | |
| 392 | + foreach evt {1 Return} { | |
| 393 | + bind .wfiles.lb <$evt> { | |
| 394 | + set ii [%W curselection] | |
| 395 | + set ::current_file [lindex $::filelist [expr {$ii*2+1}]] | |
| 396 | + .bb.files config -text $::current_file | |
| 397 | + focus . | |
| 398 | + break | |
| 399 | + } | |
| 400 | + } | |
| 401 | + bind .wfiles.lb <Motion> { | |
| 402 | + %W selection clear 0 end | |
| 403 | + %W selection set @%x,%y | |
| 404 | + } | |
| 398 | 405 | } |
| 399 | 406 | } |
| 400 | 407 | |
| 401 | 408 | label .bb.ctxtag -text "Context:" |
| 402 | 409 | set context_choices {3 6 12 25 50 100 All} |
| 403 | 410 | if {$ncontext<0} {set ncontext All} |
| 404 | 411 | trace add variable ncontext write readMerge |
| 405 | -::ttk::menubutton .bb.ctx -text $ncontext | |
| 406 | -if {[tk windowingsystem] eq "win32"} { | |
| 407 | - ::ttk::style theme use winnative | |
| 408 | - .bb.ctx configure -padding {20 1 10 2} | |
| 409 | -} | |
| 410 | -toplevel .wctx | |
| 411 | -wm withdraw .wctx | |
| 412 | -update idletasks | |
| 413 | -wm transient .wctx . | |
| 414 | -wm overrideredirect .wctx 1 | |
| 415 | -listbox .wctx.lb -width 0 -height 7 -activestyle none | |
| 416 | -.wctx.lb insert end {*}$context_choices | |
| 417 | -pack .wctx.lb | |
| 418 | -bind .bb.ctx <1> { | |
| 419 | - set x [winfo rootx %W] | |
| 420 | - set y [expr {[winfo rooty %W]+[winfo height %W]}] | |
| 421 | - wm geometry .wctx +$x+$y | |
| 422 | - wm deiconify .wctx | |
| 423 | - focus .wctx.lb | |
| 424 | -} | |
| 425 | -bind .wctx <FocusOut> {wm withdraw .wctx} | |
| 426 | -bind .wctx <Escape> {focus .} | |
| 427 | -foreach evt {1 Return} { | |
| 428 | - bind .wctx.lb <$evt> { | |
| 429 | - set ::ncontext [lindex $::context_choices [%W curselection]] | |
| 430 | - .bb.ctx config -text $::ncontext | |
| 431 | - focus . | |
| 432 | - break | |
| 433 | - } | |
| 434 | -} | |
| 435 | -bind .wctx.lb <Motion> { | |
| 436 | - %W selection clear 0 end | |
| 437 | - %W selection set @%x,%y | |
| 412 | +if {$tcl_platform(os)=="Darwin"} { | |
| 413 | + tk_optionMenu .bb.ctx ncontext {*}$context_choices | |
| 414 | +} else { | |
| 415 | + ::ttk::menubutton .bb.ctx -text $ncontext | |
| 416 | + if {[tk windowingsystem] eq "win32"} { | |
| 417 | + ::ttk::style theme use winnative | |
| 418 | + .bb.ctx configure -padding {20 1 10 2} | |
| 419 | + } | |
| 420 | + toplevel .wctx | |
| 421 | + wm withdraw .wctx | |
| 422 | + update idletasks | |
| 423 | + wm transient .wctx . | |
| 424 | + wm overrideredirect .wctx 1 | |
| 425 | + listbox .wctx.lb -width 0 -height 7 -activestyle none | |
| 426 | + .wctx.lb insert end {*}$context_choices | |
| 427 | + pack .wctx.lb | |
| 428 | + bind .bb.ctx <1> { | |
| 429 | + set x [winfo rootx %W] | |
| 430 | + set y [expr {[winfo rooty %W]+[winfo height %W]}] | |
| 431 | + wm geometry .wctx +$x+$y | |
| 432 | + wm deiconify .wctx | |
| 433 | + focus .wctx.lb | |
| 434 | + } | |
| 435 | + bind .wctx <FocusOut> {wm withdraw .wctx} | |
| 436 | + bind .wctx <Escape> {focus .} | |
| 437 | + foreach evt {1 Return} { | |
| 438 | + bind .wctx.lb <$evt> { | |
| 439 | + set ::ncontext [lindex $::context_choices [%W curselection]] | |
| 440 | + .bb.ctx config -text $::ncontext | |
| 441 | + focus . | |
| 442 | + break | |
| 443 | + } | |
| 444 | + } | |
| 445 | + bind .wctx.lb <Motion> { | |
| 446 | + %W selection clear 0 end | |
| 447 | + %W selection set @%x,%y | |
| 448 | + } | |
| 438 | 449 | } |
| 439 | 450 | |
| 440 | 451 | foreach {side syncCol} {A .txtB B .txtA C .txtC D .txtD} { |
| 441 | 452 | set ln .ln$side |
| 442 | 453 | text $ln |
| 443 | 454 |
| --- src/merge.tcl | |
| +++ src/merge.tcl | |
| @@ -349,94 +349,105 @@ | |
| 349 | frame .bb |
| 350 | if {[info exists filelist]} { |
| 351 | label .bb.filetag -text "File:" |
| 352 | set current_file [lindex $filelist 1] |
| 353 | trace add variable current_file write readMerge |
| 354 | ::ttk::menubutton .bb.files -text $current_file |
| 355 | if {[tk windowingsystem] eq "win32"} { |
| 356 | ::ttk::style theme use winnative |
| 357 | .bb.files configure -padding {20 1 10 2} |
| 358 | } |
| 359 | toplevel .wfiles |
| 360 | wm withdraw .wfiles |
| 361 | update idletasks |
| 362 | wm transient .wfiles . |
| 363 | wm overrideredirect .wfiles 1 |
| 364 | set ht [expr {[llength $filelist]/2}] |
| 365 | if {$ht>$CFG(LB_HEIGHT)} {set ht $CFG(LB_HEIGHT)} |
| 366 | listbox .wfiles.lb -width 0 -height $ht -activestyle none \ |
| 367 | -yscroll {.wfiles.sb set} |
| 368 | set mx 1 |
| 369 | foreach {op fn} $filelist { |
| 370 | set n [string length $fn] |
| 371 | if {$n>$mx} {set mx $n} |
| 372 | .wfiles.lb insert end [format "%-9s %s" $op $fn] |
| 373 | } |
| 374 | .bb.files config -width $mx |
| 375 | ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} |
| 376 | grid .wfiles.lb .wfiles.sb -sticky ns |
| 377 | bind .bb.files <1> { |
| 378 | set x [winfo rootx %W] |
| 379 | set y [expr {[winfo rooty %W]+[winfo height %W]}] |
| 380 | wm geometry .wfiles +$x+$y |
| 381 | wm deiconify .wfiles |
| 382 | focus .wfiles.lb |
| 383 | } |
| 384 | bind .wfiles <FocusOut> {wm withdraw .wfiles} |
| 385 | bind .wfiles <Escape> {focus .} |
| 386 | foreach evt {1 Return} { |
| 387 | bind .wfiles.lb <$evt> { |
| 388 | set ii [%W curselection] |
| 389 | set ::current_file [lindex $::filelist [expr {$ii*2+1}]] |
| 390 | .bb.files config -text $::current_file |
| 391 | focus . |
| 392 | break |
| 393 | } |
| 394 | } |
| 395 | bind .wfiles.lb <Motion> { |
| 396 | %W selection clear 0 end |
| 397 | %W selection set @%x,%y |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | label .bb.ctxtag -text "Context:" |
| 402 | set context_choices {3 6 12 25 50 100 All} |
| 403 | if {$ncontext<0} {set ncontext All} |
| 404 | trace add variable ncontext write readMerge |
| 405 | ::ttk::menubutton .bb.ctx -text $ncontext |
| 406 | if {[tk windowingsystem] eq "win32"} { |
| 407 | ::ttk::style theme use winnative |
| 408 | .bb.ctx configure -padding {20 1 10 2} |
| 409 | } |
| 410 | toplevel .wctx |
| 411 | wm withdraw .wctx |
| 412 | update idletasks |
| 413 | wm transient .wctx . |
| 414 | wm overrideredirect .wctx 1 |
| 415 | listbox .wctx.lb -width 0 -height 7 -activestyle none |
| 416 | .wctx.lb insert end {*}$context_choices |
| 417 | pack .wctx.lb |
| 418 | bind .bb.ctx <1> { |
| 419 | set x [winfo rootx %W] |
| 420 | set y [expr {[winfo rooty %W]+[winfo height %W]}] |
| 421 | wm geometry .wctx +$x+$y |
| 422 | wm deiconify .wctx |
| 423 | focus .wctx.lb |
| 424 | } |
| 425 | bind .wctx <FocusOut> {wm withdraw .wctx} |
| 426 | bind .wctx <Escape> {focus .} |
| 427 | foreach evt {1 Return} { |
| 428 | bind .wctx.lb <$evt> { |
| 429 | set ::ncontext [lindex $::context_choices [%W curselection]] |
| 430 | .bb.ctx config -text $::ncontext |
| 431 | focus . |
| 432 | break |
| 433 | } |
| 434 | } |
| 435 | bind .wctx.lb <Motion> { |
| 436 | %W selection clear 0 end |
| 437 | %W selection set @%x,%y |
| 438 | } |
| 439 | |
| 440 | foreach {side syncCol} {A .txtB B .txtA C .txtC D .txtD} { |
| 441 | set ln .ln$side |
| 442 | text $ln |
| 443 |
| --- src/merge.tcl | |
| +++ src/merge.tcl | |
| @@ -349,94 +349,105 @@ | |
| 349 | frame .bb |
| 350 | if {[info exists filelist]} { |
| 351 | label .bb.filetag -text "File:" |
| 352 | set current_file [lindex $filelist 1] |
| 353 | trace add variable current_file write readMerge |
| 354 | |
| 355 | if {$tcl_platform(os)=="Darwin"} { |
| 356 | set fnlist {} |
| 357 | foreach {op fn} $filelist {lappend fnlist $fn} |
| 358 | tk_optionMenu .bb.files current_file {*}$fnlist |
| 359 | } else { |
| 360 | ::ttk::menubutton .bb.files -text $current_file |
| 361 | if {[tk windowingsystem] eq "win32"} { |
| 362 | ::ttk::style theme use winnative |
| 363 | .bb.files configure -padding {20 1 10 2} |
| 364 | } |
| 365 | toplevel .wfiles |
| 366 | wm withdraw .wfiles |
| 367 | update idletasks |
| 368 | wm transient .wfiles . |
| 369 | wm overrideredirect .wfiles 1 |
| 370 | set ht [expr {[llength $filelist]/2}] |
| 371 | if {$ht>$CFG(LB_HEIGHT)} {set ht $CFG(LB_HEIGHT)} |
| 372 | listbox .wfiles.lb -width 0 -height $ht -activestyle none \ |
| 373 | -yscroll {.wfiles.sb set} |
| 374 | set mx 1 |
| 375 | foreach {op fn} $filelist { |
| 376 | set n [string length $fn] |
| 377 | if {$n>$mx} {set mx $n} |
| 378 | .wfiles.lb insert end [format "%-9s %s" $op $fn] |
| 379 | } |
| 380 | .bb.files config -width $mx |
| 381 | ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} |
| 382 | grid .wfiles.lb .wfiles.sb -sticky ns |
| 383 | bind .bb.files <1> { |
| 384 | set x [winfo rootx %W] |
| 385 | set y [expr {[winfo rooty %W]+[winfo height %W]}] |
| 386 | wm geometry .wfiles +$x+$y |
| 387 | wm deiconify .wfiles |
| 388 | focus .wfiles.lb |
| 389 | } |
| 390 | bind .wfiles <FocusOut> {wm withdraw .wfiles} |
| 391 | bind .wfiles <Escape> {focus .} |
| 392 | foreach evt {1 Return} { |
| 393 | bind .wfiles.lb <$evt> { |
| 394 | set ii [%W curselection] |
| 395 | set ::current_file [lindex $::filelist [expr {$ii*2+1}]] |
| 396 | .bb.files config -text $::current_file |
| 397 | focus . |
| 398 | break |
| 399 | } |
| 400 | } |
| 401 | bind .wfiles.lb <Motion> { |
| 402 | %W selection clear 0 end |
| 403 | %W selection set @%x,%y |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | label .bb.ctxtag -text "Context:" |
| 409 | set context_choices {3 6 12 25 50 100 All} |
| 410 | if {$ncontext<0} {set ncontext All} |
| 411 | trace add variable ncontext write readMerge |
| 412 | if {$tcl_platform(os)=="Darwin"} { |
| 413 | tk_optionMenu .bb.ctx ncontext {*}$context_choices |
| 414 | } else { |
| 415 | ::ttk::menubutton .bb.ctx -text $ncontext |
| 416 | if {[tk windowingsystem] eq "win32"} { |
| 417 | ::ttk::style theme use winnative |
| 418 | .bb.ctx configure -padding {20 1 10 2} |
| 419 | } |
| 420 | toplevel .wctx |
| 421 | wm withdraw .wctx |
| 422 | update idletasks |
| 423 | wm transient .wctx . |
| 424 | wm overrideredirect .wctx 1 |
| 425 | listbox .wctx.lb -width 0 -height 7 -activestyle none |
| 426 | .wctx.lb insert end {*}$context_choices |
| 427 | pack .wctx.lb |
| 428 | bind .bb.ctx <1> { |
| 429 | set x [winfo rootx %W] |
| 430 | set y [expr {[winfo rooty %W]+[winfo height %W]}] |
| 431 | wm geometry .wctx +$x+$y |
| 432 | wm deiconify .wctx |
| 433 | focus .wctx.lb |
| 434 | } |
| 435 | bind .wctx <FocusOut> {wm withdraw .wctx} |
| 436 | bind .wctx <Escape> {focus .} |
| 437 | foreach evt {1 Return} { |
| 438 | bind .wctx.lb <$evt> { |
| 439 | set ::ncontext [lindex $::context_choices [%W curselection]] |
| 440 | .bb.ctx config -text $::ncontext |
| 441 | focus . |
| 442 | break |
| 443 | } |
| 444 | } |
| 445 | bind .wctx.lb <Motion> { |
| 446 | %W selection clear 0 end |
| 447 | %W selection set @%x,%y |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | foreach {side syncCol} {A .txtB B .txtA C .txtC D .txtD} { |
| 452 | set ln .ln$side |
| 453 | text $ln |
| 454 |