Git fork

Merge branch 'ml/abandon-old-version' (early part)

* 'ml/abandon-old-version' (early part):
gitk: allow horizontal commit-graph scrolling
gitk: update aqua scrolling for TclTk 8.6 / TIP171
gitk: update x11 scrolling for TclTk 8.6 / TIP 171
gitk: update win32 scrolling for Tk 8.6 / TIP 171
gitk: mousewheel scrolling functions for Tk 8.6
gitk: wheel scrolling multiplier preference
gitk: separate x11 / win32 / aqua Mouse bindings
gitk: remove non-ttk support code
gitk: replace ${NS} with ttk
gitk: always use themed Tk (ttk)
gitk: use $config_variables as list for save/restore
gitk: remove implementations for Tcl/Tk < 8.6
gitk: Make TclTk 8.6 the minimum, allow 8.7
gitk: remove code targeting git <= 1.7.2
gitk: require git >= 2.20

+400 -601
+400 -601
gitk
··· 7 7 # and distributed under the terms of the GNU General Public Licence, 8 8 # either version 2, or (at your option) any later version. 9 9 10 - package require Tk 10 + if {[catch {package require Tcl 8.6-8.8} err]} { 11 + catch {wm withdraw .} 12 + tk_messageBox \ 13 + -icon error \ 14 + -type ok \ 15 + -title "gitk: fatal error" \ 16 + -message $err 17 + exit 1 18 + } 19 + 20 + set MIN_GIT_VERSION 2.20 21 + regexp {^git version ([\d.]*\d)} [exec git version] _ git_version 22 + if {[package vcompare $git_version $MIN_GIT_VERSION] < 0} { 23 + set message "The git executable found is too old. 24 + The minimum required version is $MIN_GIT_VERSION.0. 25 + The version of git found is $git_version." 26 + 27 + catch {wm withdraw .} 28 + tk_messageBox \ 29 + -icon error \ 30 + -type ok \ 31 + -title "gitk: fatal error" \ 32 + -message $message 33 + exit 1 34 + } 11 35 12 36 ###################################################################### 13 37 ## ··· 345 369 proc parseviewargs {n arglist} { 346 370 global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env 347 371 global vinlinediff 348 - global worddiff git_version 372 + global worddiff 349 373 350 374 set vdatemode($n) 0 351 375 set vmergeonly($n) 0 ··· 396 420 "--color-words*" - "--word-diff=color" { 397 421 # These trigger a word diff in the console interface, 398 422 # so help the user by enabling our own support 399 - if {[package vcompare $git_version "1.7.2"] >= 0} { 400 - set worddiff [mc "Color words"] 401 - } 423 + set worddiff [mc "Color words"] 402 424 } 403 425 "--word-diff*" { 404 - if {[package vcompare $git_version "1.7.2"] >= 0} { 405 - set worddiff [mc "Markup words"] 406 - } 426 + set worddiff [mc "Markup words"] 407 427 } 408 428 "--stat=*" - "--numstat" - "--shortstat" - "--summary" - 409 429 "--check" - "--exit-code" - "--quiet" - "--topo-order" - ··· 552 572 global viewactive viewinstances vmergeonly 553 573 global mainheadid viewmainheadid viewmainheadid_orig 554 574 global vcanopt vflags vrevs vorigargs 555 - global show_notes 556 575 557 576 set startmsecs [clock clicks -milliseconds] 558 577 set commitidx($view) 0 ··· 602 621 } 603 622 604 623 if {[catch { 605 - set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw $show_notes \ 624 + set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw --show-notes \ 606 625 --parents --boundary $args --stdin] \ 607 626 [list "<<[join [concat $revs "--" $files] "\n"]"]] 608 627 } err]} { ··· 698 717 global mainheadid viewmainheadid viewmainheadid_orig pending_select 699 718 global hasworktree 700 719 global varcid vposids vnegids vflags vrevs 701 - global show_notes 702 720 global hashlength 703 721 704 722 set hasworktree [hasworktree] ··· 756 774 set args $vorigargs($view) 757 775 } 758 776 if {[catch { 759 - set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw $show_notes \ 777 + set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw --show-notes \ 760 778 --parents --boundary $args --stdin] \ 761 779 [list "<<[join [concat $revs "--" $vfilelimit($view)] "\n"]"]] 762 780 } err]} { ··· 2086 2104 } 2087 2105 2088 2106 proc ttk_toplevel {w args} { 2089 - global use_ttk 2090 2107 eval [linsert $args 0 ::toplevel $w] 2091 - if {$use_ttk} { 2092 - place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1 2093 - } 2108 + place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1 2094 2109 return $w 2095 2110 } 2096 2111 2097 2112 proc make_transient {window origin} { 2098 - global have_tk85 2099 - 2100 - # In MacOS Tk 8.4 transient appears to work by setting 2101 - # overrideredirect, which is utterly useless, since the 2102 - # windows get no border, and are not even kept above 2103 - # the parent. 2104 - if {!$have_tk85 && [tk windowingsystem] eq {aqua}} return 2105 - 2106 2113 wm transient $window $origin 2107 2114 2108 2115 # Windows fails to place transient windows normally, so ··· 2113 2120 } 2114 2121 2115 2122 proc show_error {w top msg} { 2116 - global NS 2117 - if {![info exists NS]} {set NS ""} 2118 2123 if {[wm state $top] eq "withdrawn"} { wm deiconify $top } 2119 2124 message $w.m -text $msg -justify center -aspect 400 2120 2125 pack $w.m -side top -fill x -padx 20 -pady 20 2121 - ${NS}::button $w.ok -default active -text [mc OK] -command "destroy $top" 2126 + ttk::button $w.ok -default active -text [mc OK] -command "destroy $top" 2122 2127 pack $w.ok -side bottom -fill x 2123 2128 bind $top <Visibility> "grab $top; focus $top" 2124 2129 bind $top <Key-Return> "destroy $top" ··· 2140 2145 } 2141 2146 2142 2147 proc confirm_popup {msg {owner .}} { 2143 - global confirm_ok NS 2148 + global confirm_ok 2144 2149 set confirm_ok 0 2145 2150 set w .confirm 2146 2151 ttk_toplevel $w 2147 2152 make_transient $w $owner 2148 2153 message $w.m -text $msg -justify center -aspect 400 2149 2154 pack $w.m -side top -fill x -padx 20 -pady 20 2150 - ${NS}::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" 2155 + ttk::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" 2151 2156 pack $w.ok -side left -fill x 2152 - ${NS}::button $w.cancel -text [mc Cancel] -command "destroy $w" 2157 + ttk::button $w.cancel -text [mc Cancel] -command "destroy $w" 2153 2158 pack $w.cancel -side right -fill x 2154 2159 bind $w <Visibility> "grab $w; focus $w" 2155 2160 bind $w <Key-Return> "set confirm_ok 1; destroy $w" ··· 2165 2170 } 2166 2171 2167 2172 proc setoptions {} { 2168 - global use_ttk 2169 - 2170 2173 if {[tk windowingsystem] ne "win32"} { 2171 2174 option add *Panedwindow.showHandle 1 startupFile 2172 2175 option add *Panedwindow.sashRelief raised startupFile ··· 2259 2262 $w selection clear 2260 2263 } 2261 2264 proc makedroplist {w varname args} { 2262 - global use_ttk 2263 - if {$use_ttk} { 2264 - set width 0 2265 - foreach label $args { 2266 - set cx [string length $label] 2267 - if {$cx > $width} {set width $cx} 2268 - } 2269 - set gm [ttk::combobox $w -width $width -state readonly\ 2270 - -textvariable $varname -values $args \ 2271 - -exportselection false] 2272 - bind $gm <<ComboboxSelected>> [list $gm selection clear] 2273 - } else { 2274 - set gm [eval [linsert $args 0 tk_optionMenu $w $varname]] 2265 + set width 0 2266 + foreach label $args { 2267 + set cx [string length $label] 2268 + if {$cx > $width} {set width $cx} 2275 2269 } 2270 + set gm [ttk::combobox $w -width $width -state readonly\ 2271 + -textvariable $varname -values $args \ 2272 + -exportselection false] 2273 + bind $gm <<ComboboxSelected>> [list $gm selection clear] 2276 2274 return $gm 2277 2275 } 2278 2276 2277 + proc scrollval {D {koff 0}} { 2278 + global kscroll scroll_D0 2279 + return [expr int(-($D / $scroll_D0) * max(1, $kscroll-$koff))] 2280 + } 2281 + 2282 + proc bind_mousewheel {} { 2283 + global canv cflist ctext 2284 + bindall <MouseWheel> {allcanvs yview scroll [scrollval %D] units} 2285 + bindall <Shift-MouseWheel> break 2286 + bind $ctext <MouseWheel> {$ctext yview scroll [scrollval %D 2] units} 2287 + bind $ctext <Shift-MouseWheel> {$ctext xview scroll [scrollval %D 2] units} 2288 + bind $cflist <MouseWheel> {$cflist yview scroll [scrollval %D 2] units} 2289 + bind $cflist <Shift-MouseWheel> break 2290 + bind $canv <Shift-MouseWheel> {$canv xview scroll [scrollval %D] units} 2291 + } 2292 + 2293 + proc bind_mousewheel_buttons {} { 2294 + global canv cflist ctext 2295 + bindall <ButtonRelease-4> {allcanvs yview scroll [scrollval 1] units} 2296 + bindall <ButtonRelease-5> {allcanvs yview scroll [scrollval -1] units} 2297 + bindall <Shift-ButtonRelease-4> break 2298 + bindall <Shift-ButtonRelease-5> break 2299 + bind $ctext <ButtonRelease-4> {$ctext yview scroll [scrollval 1 2] units} 2300 + bind $ctext <ButtonRelease-5> {$ctext yview scroll [scrollval -1 2] units} 2301 + bind $ctext <Shift-ButtonRelease-4> {$ctext xview scroll [scrollval 1 2] units} 2302 + bind $ctext <Shift-ButtonRelease-5> {$ctext xview scroll [scrollval -1 2] units} 2303 + bind $cflist <ButtonRelease-4> {$cflist yview scroll [scrollval 1 2] units} 2304 + bind $cflist <ButtonRelease-5> {$cflist yview scroll [scrollval -1 2] units} 2305 + bind $cflist <Shift-ButtonRelease-4> break 2306 + bind $cflist <Shift-ButtonRelease-5> break 2307 + bind $canv <Shift-ButtonRelease-4> {$canv xview scroll [scrollval 1] units} 2308 + bind $canv <Shift-ButtonRelease-5> {$canv xview scroll [scrollval -1] units} 2309 + } 2310 + 2279 2311 proc makewindow {} { 2280 2312 global canv canv2 canv3 linespc charspc ctext cflist cscroll 2281 2313 global tabstop ··· 2294 2326 global headctxmenu progresscanv progressitem progresscoords statusw 2295 2327 global fprogitem fprogcoord lastprogupdate progupdatepending 2296 2328 global rprogitem rprogcoord rownumsel numcommits 2297 - global have_tk85 have_tk86 use_ttk NS 2298 - global git_version 2299 2329 global worddiff 2300 - global hashlength 2330 + global hashlength scroll_D0 2301 2331 2302 2332 # The "mc" arguments here are purely so that xgettext 2303 2333 # sees the following string as needing to be translated ··· 2349 2379 makemenu .bar $bar 2350 2380 . configure -menu .bar 2351 2381 2352 - if {$use_ttk} { 2353 - # cover the non-themed toplevel with a themed frame. 2354 - place [ttk::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1 2355 - } 2382 + # cover the non-themed toplevel with a themed frame. 2383 + place [ttk::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1 2356 2384 2357 2385 # the gui has upper and lower half, parts of a paned window. 2358 - ${NS}::panedwindow .ctop -orient vertical 2386 + ttk::panedwindow .ctop -orient vertical 2359 2387 2360 2388 # possibly use assumed geometry 2361 2389 if {![info exists geometry(pwsash0)]} { ··· 2368 2396 } 2369 2397 2370 2398 # the upper half will have a paned window, a scroll bar to the right, and some stuff below 2371 - ${NS}::frame .tf -height $geometry(topheight) -width $geometry(topwidth) 2372 - ${NS}::frame .tf.histframe 2373 - ${NS}::panedwindow .tf.histframe.pwclist -orient horizontal 2374 - if {!$use_ttk} { 2375 - .tf.histframe.pwclist configure -sashpad 0 -handlesize 4 2376 - } 2399 + ttk::frame .tf -height $geometry(topheight) -width $geometry(topwidth) 2400 + ttk::frame .tf.histframe 2401 + ttk::panedwindow .tf.histframe.pwclist -orient horizontal 2377 2402 2378 2403 # create three canvases 2379 2404 set cscroll .tf.histframe.csb ··· 2381 2406 canvas $canv \ 2382 2407 -selectbackground $selectbgcolor \ 2383 2408 -background $bgcolor -bd 0 \ 2409 + -xscrollincr $linespc \ 2384 2410 -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll" 2385 2411 .tf.histframe.pwclist add $canv 2386 2412 set canv2 .tf.histframe.pwclist.canv2 ··· 2393 2419 -selectbackground $selectbgcolor \ 2394 2420 -background $bgcolor -bd 0 -yscrollincr $linespc 2395 2421 .tf.histframe.pwclist add $canv3 2396 - if {$use_ttk} { 2397 - bind .tf.histframe.pwclist <Map> { 2398 - bind %W <Map> {} 2399 - .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0] 2400 - .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0] 2401 - } 2402 - } else { 2403 - eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0) 2404 - eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1) 2422 + bind .tf.histframe.pwclist <Map> { 2423 + bind %W <Map> {} 2424 + .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0] 2425 + .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0] 2405 2426 } 2406 2427 2407 2428 # a scroll bar to rule them 2408 - ${NS}::scrollbar $cscroll -command {allcanvs yview} 2409 - if {!$use_ttk} {$cscroll configure -highlightthickness 0} 2429 + ttk::scrollbar $cscroll -command {allcanvs yview} 2410 2430 pack $cscroll -side right -fill y 2411 2431 bind .tf.histframe.pwclist <Configure> {resizeclistpanes %W %w} 2412 2432 lappend bglist $canv $canv2 $canv3 2413 2433 pack .tf.histframe.pwclist -fill both -expand 1 -side left 2414 2434 2415 2435 # we have two button bars at bottom of top frame. Bar 1 2416 - ${NS}::frame .tf.bar 2417 - ${NS}::frame .tf.lbar -height 15 2436 + ttk::frame .tf.bar 2437 + ttk::frame .tf.lbar -height 15 2418 2438 2419 2439 set sha1entry .tf.bar.sha1 2420 2440 set entries $sha1entry ··· 2423 2443 -command gotocommit -width 8 2424 2444 $sha1but conf -disabledforeground [$sha1but cget -foreground] 2425 2445 pack .tf.bar.sha1label -side left 2426 - ${NS}::entry $sha1entry -width $hashlength -font textfont -textvariable sha1string 2446 + ttk::entry $sha1entry -width $hashlength -font textfont -textvariable sha1string 2427 2447 trace add variable sha1string write sha1change 2428 2448 pack $sha1entry -side left -pady 2 2429 2449 ··· 2448 2468 image create bitmap bm-right -data $bm_right_data -foreground $uifgcolor 2449 2469 image create bitmap bm-right-gray -data $bm_right_data -foreground $uifgdisabledcolor 2450 2470 2451 - ${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26 2452 - if {$use_ttk} { 2453 - .tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray] 2454 - } else { 2455 - .tf.bar.leftbut configure -image bm-left 2456 - } 2471 + ttk::button .tf.bar.leftbut -command goback -state disabled -width 26 2472 + .tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray] 2457 2473 pack .tf.bar.leftbut -side left -fill y 2458 - ${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26 2459 - if {$use_ttk} { 2460 - .tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray] 2461 - } else { 2462 - .tf.bar.rightbut configure -image bm-right 2463 - } 2474 + ttk::button .tf.bar.rightbut -command goforw -state disabled -width 26 2475 + .tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray] 2464 2476 pack .tf.bar.rightbut -side left -fill y 2465 2477 2466 - ${NS}::label .tf.bar.rowlabel -text [mc "Row"] 2478 + ttk::label .tf.bar.rowlabel -text [mc "Row"] 2467 2479 set rownumsel {} 2468 - ${NS}::label .tf.bar.rownum -width 7 -textvariable rownumsel \ 2480 + ttk::label .tf.bar.rownum -width 7 -textvariable rownumsel \ 2469 2481 -relief sunken -anchor e 2470 - ${NS}::label .tf.bar.rowlabel2 -text "/" 2471 - ${NS}::label .tf.bar.numcommits -width 7 -textvariable numcommits \ 2482 + ttk::label .tf.bar.rowlabel2 -text "/" 2483 + ttk::label .tf.bar.numcommits -width 7 -textvariable numcommits \ 2472 2484 -relief sunken -anchor e 2473 2485 pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \ 2474 2486 -side left 2475 - if {!$use_ttk} { 2476 - foreach w {rownum numcommits} {.tf.bar.$w configure -font textfont} 2477 - } 2478 2487 global selectedline 2479 2488 trace add variable selectedline write selectedline_change 2480 2489 2481 2490 # Status label and progress bar 2482 2491 set statusw .tf.bar.status 2483 - ${NS}::label $statusw -width 15 -relief sunken 2492 + ttk::label $statusw -width 15 -relief sunken 2484 2493 pack $statusw -side left -padx 5 2485 - if {$use_ttk} { 2486 - set progresscanv [ttk::progressbar .tf.bar.progress] 2487 - } else { 2488 - set h [expr {[font metrics uifont -linespace] + 2}] 2489 - set progresscanv .tf.bar.progress 2490 - canvas $progresscanv -relief sunken -height $h -borderwidth 2 2491 - set progressitem [$progresscanv create rect -1 0 0 $h -fill "#00ff00"] 2492 - set fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow] 2493 - set rprogitem [$progresscanv create rect -1 0 0 $h -fill red] 2494 - } 2494 + set progresscanv [ttk::progressbar .tf.bar.progress] 2495 2495 pack $progresscanv -side right -expand 1 -fill x -padx {0 2} 2496 2496 set progresscoords {0 0} 2497 2497 set fprogcoord 0 ··· 2501 2501 set progupdatepending 0 2502 2502 2503 2503 # build up the bottom bar of upper window 2504 - ${NS}::label .tf.lbar.flabel -text "[mc "Find"] " 2504 + ttk::label .tf.lbar.flabel -text "[mc "Find"] " 2505 2505 2506 2506 set bm_down_data { 2507 2507 #define down_width 16 ··· 2513 2513 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01}; 2514 2514 } 2515 2515 image create bitmap bm-down -data $bm_down_data -foreground $uifgcolor 2516 - ${NS}::button .tf.lbar.fnext -width 26 -command {dofind 1 1} 2516 + ttk::button .tf.lbar.fnext -width 26 -command {dofind 1 1} 2517 2517 .tf.lbar.fnext configure -image bm-down 2518 2518 2519 2519 set bm_up_data { ··· 2526 2526 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01}; 2527 2527 } 2528 2528 image create bitmap bm-up -data $bm_up_data -foreground $uifgcolor 2529 - ${NS}::button .tf.lbar.fprev -width 26 -command {dofind -1 1} 2529 + ttk::button .tf.lbar.fprev -width 26 -command {dofind -1 1} 2530 2530 .tf.lbar.fprev configure -image bm-up 2531 2531 2532 - ${NS}::label .tf.lbar.flab2 -text " [mc "commit"] " 2532 + ttk::label .tf.lbar.flab2 -text " [mc "commit"] " 2533 2533 2534 2534 pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \ 2535 2535 -side left -fill y ··· 2545 2545 set findstring {} 2546 2546 set fstring .tf.lbar.findstring 2547 2547 lappend entries $fstring 2548 - ${NS}::entry $fstring -width 30 -textvariable findstring 2548 + ttk::entry $fstring -width 30 -textvariable findstring 2549 2549 trace add variable findstring write find_change 2550 2550 set findtype [mc "Exact"] 2551 2551 set findtypemenu [makedroplist .tf.lbar.findtype \ ··· 2564 2564 pack .tf.bar -in .tf -side bottom -fill x 2565 2565 pack .tf.histframe -fill both -side top -expand 1 2566 2566 .ctop add .tf 2567 - if {!$use_ttk} { 2568 - .ctop paneconfigure .tf -height $geometry(topheight) 2569 - .ctop paneconfigure .tf -width $geometry(topwidth) 2570 - } 2571 2567 2572 2568 # now build up the bottom 2573 - ${NS}::panedwindow .pwbottom -orient horizontal 2569 + ttk::panedwindow .pwbottom -orient horizontal 2574 2570 2575 2571 # lower left, a text box over search bar, scroll bar to the right 2576 2572 # if we know window height, then that will set the lower text height, otherwise 2577 2573 # we set lower text height which will drive window height 2578 2574 if {[info exists geometry(main)]} { 2579 - ${NS}::frame .bleft -width $geometry(botwidth) 2575 + ttk::frame .bleft -width $geometry(botwidth) 2580 2576 } else { 2581 - ${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight) 2577 + ttk::frame .bleft -width $geometry(botwidth) -height $geometry(botheight) 2582 2578 } 2583 - ${NS}::frame .bleft.top 2584 - ${NS}::frame .bleft.mid 2585 - ${NS}::frame .bleft.bottom 2579 + ttk::frame .bleft.top 2580 + ttk::frame .bleft.mid 2581 + ttk::frame .bleft.bottom 2586 2582 2587 2583 # gap between sub-widgets 2588 2584 set wgap [font measure uifont "i"] 2589 2585 2590 - ${NS}::button .bleft.top.search -text [mc "Search"] -command dosearch 2586 + ttk::button .bleft.top.search -text [mc "Search"] -command dosearch 2591 2587 pack .bleft.top.search -side left -padx 5 2592 2588 set sstring .bleft.top.sstring 2593 2589 set searchstring "" 2594 - ${NS}::entry $sstring -width 20 -textvariable searchstring 2590 + ttk::entry $sstring -width 20 -textvariable searchstring 2595 2591 lappend entries $sstring 2596 2592 trace add variable searchstring write incrsearch 2597 2593 pack $sstring -side left -expand 1 -fill x 2598 - ${NS}::radiobutton .bleft.mid.diff -text [mc "Diff"] \ 2594 + ttk::radiobutton .bleft.mid.diff -text [mc "Diff"] \ 2599 2595 -command changediffdisp -variable diffelide -value {0 0} 2600 - ${NS}::radiobutton .bleft.mid.old -text [mc "Old version"] \ 2596 + ttk::radiobutton .bleft.mid.old -text [mc "Old version"] \ 2601 2597 -command changediffdisp -variable diffelide -value {0 1} 2602 - ${NS}::radiobutton .bleft.mid.new -text [mc "New version"] \ 2598 + ttk::radiobutton .bleft.mid.new -text [mc "New version"] \ 2603 2599 -command changediffdisp -variable diffelide -value {1 0} 2604 2600 2605 - ${NS}::label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " 2601 + ttk::label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " 2606 2602 pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap 2607 2603 spinbox .bleft.mid.diffcontext -width 5 \ 2608 2604 -from 0 -increment 1 -to 10000000 \ ··· 2612 2608 trace add variable diffcontextstring write diffcontextchange 2613 2609 lappend entries .bleft.mid.diffcontext 2614 2610 pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap 2615 - ${NS}::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \ 2611 + ttk::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \ 2616 2612 -command changeignorespace -variable ignorespace 2617 2613 pack .bleft.mid.ignspace -side left -padx 5 2618 2614 2619 2615 set worddiff [mc "Line diff"] 2620 - if {[package vcompare $git_version "1.7.2"] >= 0} { 2621 - makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \ 2622 - [mc "Markup words"] [mc "Color words"] 2623 - trace add variable worddiff write changeworddiff 2624 - pack .bleft.mid.worddiff -side left -padx 5 2625 - } 2616 + makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \ 2617 + [mc "Markup words"] [mc "Color words"] 2618 + trace add variable worddiff write changeworddiff 2619 + pack .bleft.mid.worddiff -side left -padx 5 2626 2620 2627 2621 set ctext .bleft.bottom.ctext 2628 2622 text $ctext -background $bgcolor -foreground $fgcolor \ 2629 2623 -state disabled -undo 0 -font textfont \ 2630 2624 -yscrollcommand scrolltext -wrap $wrapdefault \ 2631 2625 -xscrollcommand ".bleft.bottom.sbhorizontal set" 2632 - if {$have_tk85} { 2633 - $ctext conf -tabstyle wordprocessor 2634 - } 2635 - ${NS}::scrollbar .bleft.bottom.sb -command "$ctext yview" 2636 - ${NS}::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h 2626 + $ctext conf -tabstyle wordprocessor 2627 + ttk::scrollbar .bleft.bottom.sb -command "$ctext yview" 2628 + ttk::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h 2637 2629 pack .bleft.top -side top -fill x 2638 2630 pack .bleft.mid -side top -fill x 2639 2631 grid $ctext .bleft.bottom.sb -sticky nsew ··· 2684 2676 $ctext tag lower d0 2685 2677 2686 2678 .pwbottom add .bleft 2687 - if {!$use_ttk} { 2688 - .pwbottom paneconfigure .bleft -width $geometry(botwidth) 2689 - } 2690 2679 2691 2680 # lower right 2692 - ${NS}::frame .bright 2693 - ${NS}::frame .bright.mode 2694 - ${NS}::radiobutton .bright.mode.patch -text [mc "Patch"] \ 2681 + ttk::frame .bright 2682 + ttk::frame .bright.mode 2683 + ttk::radiobutton .bright.mode.patch -text [mc "Patch"] \ 2695 2684 -command reselectline -variable cmitmode -value "patch" 2696 - ${NS}::radiobutton .bright.mode.tree -text [mc "Tree"] \ 2685 + ttk::radiobutton .bright.mode.tree -text [mc "Tree"] \ 2697 2686 -command reselectline -variable cmitmode -value "tree" 2698 2687 grid .bright.mode.patch .bright.mode.tree -sticky ew 2699 2688 pack .bright.mode -side top -fill x ··· 2709 2698 -spacing1 1 -spacing3 1 2710 2699 lappend bglist $cflist 2711 2700 lappend fglist $cflist 2712 - ${NS}::scrollbar .bright.sb -command "$cflist yview" 2701 + ttk::scrollbar .bright.sb -command "$cflist yview" 2713 2702 pack .bright.sb -side right -fill y 2714 2703 pack $cflist -side left -fill both -expand 1 2715 2704 $cflist tag configure highlight \ ··· 2744 2733 set ::BM "2" 2745 2734 } 2746 2735 2747 - if {$use_ttk} { 2748 - bind .ctop <Map> { 2749 - bind %W <Map> {} 2750 - %W sashpos 0 $::geometry(topheight) 2751 - } 2752 - bind .pwbottom <Map> { 2753 - bind %W <Map> {} 2754 - %W sashpos 0 $::geometry(botwidth) 2755 - } 2756 - bind .pwbottom <Configure> {resizecdetpanes %W %w} 2736 + bind .ctop <Map> { 2737 + bind %W <Map> {} 2738 + %W sashpos 0 $::geometry(topheight) 2739 + } 2740 + bind .pwbottom <Map> { 2741 + bind %W <Map> {} 2742 + %W sashpos 0 $::geometry(botwidth) 2757 2743 } 2744 + bind .pwbottom <Configure> {resizecdetpanes %W %w} 2758 2745 2759 2746 pack .ctop -fill both -expand 1 2760 2747 bindall <1> {selcanvline %W %x %y} 2761 - #bindall <B1-Motion> {selcanvline %W %x %y} 2748 + 2749 + #Mouse / touchpad scrolling 2762 2750 if {[tk windowingsystem] == "win32"} { 2763 - bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D } 2764 - bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break } 2751 + set scroll_D0 120 2752 + bind_mousewheel 2753 + } elseif {[tk windowingsystem] == "x11"} { 2754 + set scroll_D0 1 2755 + bind_mousewheel_buttons 2756 + } elseif {[tk windowingsystem] == "aqua"} { 2757 + set scroll_D0 1 2758 + bind_mousewheel 2765 2759 } else { 2766 - bindall <ButtonRelease-4> "allcanvs yview scroll -5 units" 2767 - bindall <ButtonRelease-5> "allcanvs yview scroll 5 units" 2768 - bind $ctext <Button> { 2769 - if {"%b" eq 6} { 2770 - $ctext xview scroll -5 units 2771 - } elseif {"%b" eq 7} { 2772 - $ctext xview scroll 5 units 2773 - } 2774 - } 2775 - if {[tk windowingsystem] eq "aqua"} { 2776 - bindall <MouseWheel> { 2777 - set delta [expr {- (%D)}] 2778 - allcanvs yview scroll $delta units 2779 - } 2780 - bindall <Shift-MouseWheel> { 2781 - set delta [expr {- (%D)}] 2782 - $canv xview scroll $delta units 2783 - } 2784 - } 2760 + puts stderr [mc "Unknown windowing system, cannot bind mouse"] 2785 2761 } 2786 2762 bindall <$::BM> "canvscan mark %W %x %y" 2787 2763 bindall <B$::BM-Motion> "canvscan dragto %W %x %y" ··· 2793 2769 bind . <Key-Down> "selnextline 1" 2794 2770 bind . <Shift-Key-Up> "dofind -1 0" 2795 2771 bind . <Shift-Key-Down> "dofind 1 0" 2796 - if {$have_tk86} { 2797 - bindkey <<NextChar>> "goforw" 2798 - bindkey <<PrevChar>> "goback" 2799 - } else { 2800 - bindkey <Key-Right> "goforw" 2801 - bindkey <Key-Left> "goback" 2802 - } 2772 + bindkey <<NextChar>> "goforw" 2773 + bindkey <<PrevChar>> "goback" 2803 2774 bind . <Key-Prior> "selnextpage -1" 2804 2775 bind . <Key-Next> "selnextpage 1" 2805 2776 bind . <$M1B-Home> "allcanvs yview moveto 0.0" ··· 2926 2897 $diff_menu configure -tearoff 0 2927 2898 } 2928 2899 2929 - # Windows sends all mouse wheel events to the current focused window, not 2930 - # the one where the mouse hovers, so bind those events here and redirect 2931 - # to the correct window 2932 - proc windows_mousewheel_redirector {W X Y D} { 2933 - global canv canv2 canv3 2934 - set w [winfo containing -displayof $W $X $Y] 2935 - if {$w ne ""} { 2936 - set u [expr {$D < 0 ? 5 : -5}] 2937 - if {$w == $canv || $w == $canv2 || $w == $canv3} { 2938 - allcanvs yview scroll $u units 2939 - } else { 2940 - catch { 2941 - $w yview scroll $u units 2942 - } 2943 - } 2944 - } 2945 - } 2946 - 2947 2900 # Update row number label when selectedline changes 2948 2901 proc selectedline_change {n1 n2 op} { 2949 2902 global selectedline rownumsel ··· 3006 2959 3007 2960 # Adjust the progress bar for a change in requested extent or canvas size 3008 2961 proc adjustprogress {} { 3009 - global progresscanv progressitem progresscoords 3010 - global fprogitem fprogcoord lastprogupdate progupdatepending 3011 - global rprogitem rprogcoord use_ttk 2962 + global progresscanv 2963 + global fprogcoord 3012 2964 3013 - if {$use_ttk} { 3014 - $progresscanv configure -value [expr {int($fprogcoord * 100)}] 3015 - return 3016 - } 3017 - 3018 - set w [expr {[winfo width $progresscanv] - 4}] 3019 - set x0 [expr {$w * [lindex $progresscoords 0]}] 3020 - set x1 [expr {$w * [lindex $progresscoords 1]}] 3021 - set h [winfo height $progresscanv] 3022 - $progresscanv coords $progressitem $x0 0 $x1 $h 3023 - $progresscanv coords $fprogitem 0 0 [expr {$w * $fprogcoord}] $h 3024 - $progresscanv coords $rprogitem 0 0 [expr {$w * $rprogcoord}] $h 3025 - set now [clock clicks -milliseconds] 3026 - if {$now >= $lastprogupdate + 100} { 3027 - set progupdatepending 0 3028 - update 3029 - } elseif {!$progupdatepending} { 3030 - set progupdatepending 1 3031 - after [expr {$lastprogupdate + 100 - $now}] doprogupdate 3032 - } 2965 + $progresscanv configure -value [expr {int($fprogcoord * 100)}] 3033 2966 } 3034 2967 3035 2968 proc doprogupdate {} { ··· 3088 3021 upvar #0 viewargscmd current_viewargscmd 3089 3022 upvar #0 viewperm current_viewperm 3090 3023 upvar #0 nextviewnum current_nextviewnum 3091 - upvar #0 use_ttk current_use_ttk 3092 3024 3093 3025 if {$stuffsaved} return 3094 3026 if {![winfo viewable .]} return ··· 3122 3054 puts $f "set geometry(state) [wm state .]" 3123 3055 puts $f "set geometry(topwidth) [winfo width .tf]" 3124 3056 puts $f "set geometry(topheight) [winfo height .tf]" 3125 - if {$current_use_ttk} { 3126 - puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sashpos 0] 1\"" 3127 - puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\"" 3128 - } else { 3129 - puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\"" 3130 - puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\"" 3131 - } 3057 + puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sashpos 0] 1\"" 3058 + puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\"" 3132 3059 puts $f "set geometry(botwidth) [winfo width .bleft]" 3133 3060 puts $f "set geometry(botheight) [winfo height .bleft]" 3134 3061 ··· 3174 3101 } 3175 3102 3176 3103 proc resizeclistpanes {win w} { 3177 - global oldwidth oldsash use_ttk 3104 + global oldwidth oldsash 3178 3105 if {[info exists oldwidth($win)]} { 3179 3106 if {[info exists oldsash($win)]} { 3180 3107 set s0 [lindex $oldsash($win) 0] 3181 3108 set s1 [lindex $oldsash($win) 1] 3182 - } elseif {$use_ttk} { 3109 + } else { 3183 3110 set s0 [$win sashpos 0] 3184 3111 set s1 [$win sashpos 1] 3185 - } else { 3186 - set s0 [$win sash coord 0] 3187 - set s1 [$win sash coord 1] 3188 3112 } 3189 3113 if {$w < 60} { 3190 3114 set sash0 [expr {int($w/2 - 2)}] ··· 3206 3130 } 3207 3131 } 3208 3132 } 3209 - if {$use_ttk} { 3210 - $win sashpos 0 $sash0 3211 - $win sashpos 1 $sash1 3212 - } else { 3213 - $win sash place 0 $sash0 [lindex $s0 1] 3214 - $win sash place 1 $sash1 [lindex $s1 1] 3215 - set sash0 [list $sash0 [lindex $s0 1]] 3216 - set sash1 [list $sash1 [lindex $s1 1]] 3217 - } 3133 + $win sashpos 0 $sash0 3134 + $win sashpos 1 $sash1 3218 3135 set oldsash($win) [list $sash0 $sash1] 3219 3136 } 3220 3137 set oldwidth($win) $w 3221 3138 } 3222 3139 3223 3140 proc resizecdetpanes {win w} { 3224 - global oldwidth oldsash use_ttk 3141 + global oldwidth oldsash 3225 3142 if {[info exists oldwidth($win)]} { 3226 3143 if {[info exists oldsash($win)]} { 3227 3144 set s0 $oldsash($win) 3228 - } elseif {$use_ttk} { 3145 + } else { 3229 3146 set s0 [$win sashpos 0] 3230 - } else { 3231 - set s0 [$win sash coord 0] 3232 3147 } 3233 3148 if {$w < 60} { 3234 3149 set sash0 [expr {int($w*3/4 - 2)}] ··· 3242 3157 set sash0 [expr {$w - 15}] 3243 3158 } 3244 3159 } 3245 - if {$use_ttk} { 3246 - $win sashpos 0 $sash0 3247 - } else { 3248 - $win sash place 0 $sash0 [lindex $s0 1] 3249 - set sash0 [list $sash0 [lindex $s0 1]] 3250 - } 3160 + $win sashpos 0 $sash0 3251 3161 set oldsash($win) $sash0 3252 3162 } 3253 3163 set oldwidth($win) $w ··· 3268 3178 } 3269 3179 3270 3180 proc about {} { 3271 - global bgcolor NS 3181 + global bgcolor 3272 3182 set w .about 3273 3183 if {[winfo exists $w]} { 3274 3184 raise $w ··· 3285 3195 Use and redistribute under the terms of the GNU General Public License"] \ 3286 3196 -justify center -aspect 400 -border 2 -bg $bgcolor -relief groove 3287 3197 pack $w.m -side top -fill x -padx 2 -pady 2 3288 - ${NS}::button $w.ok -text [mc "Close"] -command "destroy $w" -default active 3198 + ttk::button $w.ok -text [mc "Close"] -command "destroy $w" -default active 3289 3199 pack $w.ok -side bottom 3290 3200 bind $w <Visibility> "focus $w.ok" 3291 3201 bind $w <Key-Escape> "destroy $w" ··· 3294 3204 } 3295 3205 3296 3206 proc keys {} { 3297 - global bgcolor NS 3207 + global bgcolor 3298 3208 set w .keys 3299 3209 if {[winfo exists $w]} { 3300 3210 raise $w ··· 3352 3262 " \ 3353 3263 -justify left -bg $bgcolor -border 2 -relief groove 3354 3264 pack $w.m -side top -fill both -padx 2 -pady 2 3355 - ${NS}::button $w.ok -text [mc "Close"] -command "destroy $w" -default active 3265 + ttk::button $w.ok -text [mc "Close"] -command "destroy $w" -default active 3356 3266 bind $w <Key-Escape> [list destroy $w] 3357 3267 pack $w.ok -side bottom 3358 3268 bind $w <Visibility> "focus $w.ok" ··· 4497 4407 4498 4408 proc vieweditor {top n title} { 4499 4409 global newviewname newviewopts viewfiles bgcolor 4500 - global known_view_options NS 4410 + global known_view_options 4501 4411 4502 4412 ttk_toplevel $top 4503 4413 wm title $top [concat $title [mc "-- criteria for selecting revisions"]] 4504 4414 make_transient $top . 4505 4415 4506 4416 # View name 4507 - ${NS}::frame $top.nfr 4508 - ${NS}::label $top.nl -text [mc "View Name"] 4509 - ${NS}::entry $top.name -width 20 -textvariable newviewname($n) 4417 + ttk::frame $top.nfr 4418 + ttk::label $top.nl -text [mc "View Name"] 4419 + ttk::entry $top.name -width 20 -textvariable newviewname($n) 4510 4420 pack $top.nfr -in $top -fill x -pady 5 -padx 3 4511 4421 pack $top.nl -in $top.nfr -side left -padx {0 5} 4512 4422 pack $top.name -in $top.nfr -side left -padx {0 25} ··· 4525 4435 if {$flags eq "+" || $flags eq "*"} { 4526 4436 set cframe $top.fr$cnt 4527 4437 incr cnt 4528 - ${NS}::frame $cframe 4438 + ttk::frame $cframe 4529 4439 pack $cframe -in $top -fill x -pady 3 -padx 3 4530 4440 set cexpand [expr {$flags eq "*"}] 4531 4441 } elseif {$flags eq ".." || $flags eq "*."} { 4532 4442 set cframe $top.fr$cnt 4533 4443 incr cnt 4534 - ${NS}::frame $cframe 4444 + ttk::frame $cframe 4535 4445 pack $cframe -in $top -fill x -pady 3 -padx [list 15 3] 4536 4446 set cexpand [expr {$flags eq "*."}] 4537 4447 } else { ··· 4539 4449 } 4540 4450 4541 4451 if {$type eq "l"} { 4542 - ${NS}::label $cframe.l_$id -text $title 4452 + ttk::label $cframe.l_$id -text $title 4543 4453 pack $cframe.l_$id -in $cframe -side left -pady [list 3 0] -anchor w 4544 4454 } elseif {$type eq "b"} { 4545 - ${NS}::checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id) 4455 + ttk::checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id) 4546 4456 pack $cframe.c_$id -in $cframe -side left \ 4547 4457 -padx [list $lxpad 0] -expand $cexpand -anchor w 4548 4458 } elseif {[regexp {^r(\d+)$} $type type sz]} { 4549 4459 regexp {^(.*_)} $id uselessvar button_id 4550 - ${NS}::radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz 4460 + ttk::radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz 4551 4461 pack $cframe.c_$id -in $cframe -side left \ 4552 4462 -padx [list $lxpad 0] -expand $cexpand -anchor w 4553 4463 } elseif {[regexp {^t(\d+)$} $type type sz]} { 4554 - ${NS}::label $cframe.l_$id -text $title 4555 - ${NS}::entry $cframe.e_$id -width $sz -background $bgcolor \ 4464 + ttk::label $cframe.l_$id -text $title 4465 + ttk::entry $cframe.e_$id -width $sz -background $bgcolor \ 4556 4466 -textvariable newviewopts($n,$id) 4557 4467 pack $cframe.l_$id -in $cframe -side left -padx [list $lxpad 0] 4558 4468 pack $cframe.e_$id -in $cframe -side left -expand 1 -fill x 4559 4469 } elseif {[regexp {^t(\d+)=$} $type type sz]} { 4560 - ${NS}::label $cframe.l_$id -text $title 4561 - ${NS}::entry $cframe.e_$id -width $sz -background $bgcolor \ 4470 + ttk::label $cframe.l_$id -text $title 4471 + ttk::entry $cframe.e_$id -width $sz -background $bgcolor \ 4562 4472 -textvariable newviewopts($n,$id) 4563 4473 pack $cframe.l_$id -in $cframe -side top -pady [list 3 0] -anchor w 4564 4474 pack $cframe.e_$id -in $cframe -side top -fill x 4565 4475 } elseif {$type eq "path"} { 4566 - ${NS}::label $top.l -text $title 4476 + ttk::label $top.l -text $title 4567 4477 pack $top.l -in $top -side top -pady [list 3 0] -anchor w -padx 3 4568 4478 text $top.t -width 40 -height 5 -background $bgcolor 4569 4479 if {[info exists viewfiles($n)]} { ··· 4578 4488 } 4579 4489 } 4580 4490 4581 - ${NS}::frame $top.buts 4582 - ${NS}::button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] 4583 - ${NS}::button $top.buts.apply -text [mc "Apply (F5)"] -command [list newviewok $top $n 1] 4584 - ${NS}::button $top.buts.can -text [mc "Cancel"] -command [list destroy $top] 4491 + ttk::frame $top.buts 4492 + ttk::button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] 4493 + ttk::button $top.buts.apply -text [mc "Apply (F5)"] -command [list newviewok $top $n 1] 4494 + ttk::button $top.buts.can -text [mc "Cancel"] -command [list destroy $top] 4585 4495 bind $top <Control-Return> [list newviewok $top $n] 4586 4496 bind $top <F5> [list newviewok $top $n 1] 4587 4497 bind $top <Escape> [list destroy $top] ··· 5543 5453 # spawn off a process to do git diff-index --cached HEAD 5544 5454 proc dodiffindex {} { 5545 5455 global lserial showlocalchanges vfilelimit curview 5546 - global hasworktree git_version 5456 + global hasworktree 5547 5457 5548 5458 if {!$showlocalchanges || !$hasworktree} return 5549 5459 incr lserial 5550 - if {[package vcompare $git_version "1.7.2"] >= 0} { 5551 - set cmd "git diff-index --cached --ignore-submodules=dirty HEAD" 5552 - } else { 5553 - set cmd "git diff-index --cached HEAD" 5554 - } 5460 + set cmd "git diff-index --cached --ignore-submodules=dirty HEAD" 5555 5461 if {$vfilelimit($curview) ne {}} { 5556 5462 set cmd [concat $cmd -- $vfilelimit($curview)] 5557 5463 } ··· 6779 6685 } 6780 6686 6781 6687 proc graph_pane_width {} { 6782 - global use_ttk 6783 - 6784 - if {$use_ttk} { 6785 - set g [.tf.histframe.pwclist sashpos 0] 6786 - } else { 6787 - set g [.tf.histframe.pwclist sash coord 0] 6788 - } 6688 + set g [.tf.histframe.pwclist sashpos 0] 6789 6689 return [lindex $g 0] 6790 6690 } 6791 6691 ··· 8101 8001 } 8102 8002 8103 8003 proc diffcmd {ids flags} { 8104 - global log_showroot nullid nullid2 git_version 8004 + global log_showroot nullid nullid2 8105 8005 8106 8006 set i [lsearch -exact $ids $nullid] 8107 8007 set j [lsearch -exact $ids $nullid2] ··· 8122 8022 } 8123 8023 } 8124 8024 } elseif {$j >= 0} { 8125 - if {[package vcompare $git_version "1.7.2"] >= 0} { 8126 - set flags "$flags --ignore-submodules=dirty" 8127 - } 8025 + set flags "$flags --ignore-submodules=dirty" 8128 8026 set cmd [concat git diff-index --cached $flags] 8129 8027 if {[llength $ids] > 1} { 8130 8028 # comparing index with specific revision ··· 8253 8151 global ignorespace 8254 8152 global worddiff 8255 8153 global limitdiffs vfilelimit curview 8256 - global git_version 8257 8154 8258 - set textconv {} 8259 - if {[package vcompare $git_version "1.6.1"] >= 0} { 8260 - set textconv "--textconv" 8261 - } 8262 - set submodule {} 8263 - if {[package vcompare $git_version "1.6.6"] >= 0} { 8264 - set submodule "--submodule" 8265 - } 8266 - set cmd [diffcmd $ids "-p $textconv $submodule -C --cc --no-commit-id -U$diffcontext"] 8155 + set cmd [diffcmd $ids "-p --textconv --submodule -C --cc --no-commit-id -U$diffcontext"] 8267 8156 if {$ignorespace} { 8268 8157 append cmd " -w" 8269 8158 } ··· 8668 8557 } 8669 8558 8670 8559 proc settabs {{firstab {}}} { 8671 - global firsttabstop tabstop ctext have_tk85 8560 + global firsttabstop tabstop ctext 8672 8561 8673 - if {$firstab ne {} && $have_tk85} { 8562 + if {$firstab ne {}} { 8674 8563 set firsttabstop $firstab 8675 8564 } 8676 8565 set w [font measure textfont "0"] 8677 8566 if {$firsttabstop != 0} { 8678 8567 $ctext conf -tabs [list [expr {($firsttabstop + $tabstop) * $w}] \ 8679 8568 [expr {($firsttabstop + 2 * $tabstop) * $w}]] 8680 - } elseif {$have_tk85 || $tabstop != 8} { 8681 - $ctext conf -tabs [expr {$tabstop * $w}] 8682 8569 } else { 8683 - $ctext conf -tabs {} 8570 + $ctext conf -tabs [expr {$tabstop * $w}] 8684 8571 } 8685 8572 } 8686 8573 ··· 9471 9358 } 9472 9359 9473 9360 proc mkpatch {} { 9474 - global rowmenuid currentid commitinfo patchtop patchnum NS 9361 + global rowmenuid currentid commitinfo patchtop patchnum 9475 9362 global hashlength 9476 9363 9477 9364 if {![info exists currentid]} return ··· 9484 9371 catch {destroy $top} 9485 9372 ttk_toplevel $top 9486 9373 make_transient $top . 9487 - ${NS}::label $top.title -text [mc "Generate patch"] 9374 + ttk::label $top.title -text [mc "Generate patch"] 9488 9375 grid $top.title - -pady 10 9489 - ${NS}::label $top.from -text [mc "From:"] 9490 - ${NS}::entry $top.fromsha1 -width $hashlength 9376 + ttk::label $top.from -text [mc "From:"] 9377 + ttk::entry $top.fromsha1 -width $hashlength 9491 9378 $top.fromsha1 insert 0 $oldid 9492 9379 $top.fromsha1 conf -state readonly 9493 9380 grid $top.from $top.fromsha1 -sticky w 9494 - ${NS}::entry $top.fromhead -width 60 9381 + ttk::entry $top.fromhead -width 60 9495 9382 $top.fromhead insert 0 $oldhead 9496 9383 $top.fromhead conf -state readonly 9497 9384 grid x $top.fromhead -sticky w 9498 - ${NS}::label $top.to -text [mc "To:"] 9499 - ${NS}::entry $top.tosha1 -width $hashlength 9385 + ttk::label $top.to -text [mc "To:"] 9386 + ttk::entry $top.tosha1 -width $hashlength 9500 9387 $top.tosha1 insert 0 $newid 9501 9388 $top.tosha1 conf -state readonly 9502 9389 grid $top.to $top.tosha1 -sticky w 9503 - ${NS}::entry $top.tohead -width 60 9390 + ttk::entry $top.tohead -width 60 9504 9391 $top.tohead insert 0 $newhead 9505 9392 $top.tohead conf -state readonly 9506 9393 grid x $top.tohead -sticky w 9507 - ${NS}::button $top.rev -text [mc "Reverse"] -command mkpatchrev 9394 + ttk::button $top.rev -text [mc "Reverse"] -command mkpatchrev 9508 9395 grid $top.rev x -pady 10 -padx 5 9509 - ${NS}::label $top.flab -text [mc "Output file:"] 9510 - ${NS}::entry $top.fname -width 60 9396 + ttk::label $top.flab -text [mc "Output file:"] 9397 + ttk::entry $top.fname -width 60 9511 9398 $top.fname insert 0 [file normalize "patch$patchnum.patch"] 9512 9399 incr patchnum 9513 9400 grid $top.flab $top.fname -sticky w 9514 - ${NS}::frame $top.buts 9515 - ${NS}::button $top.buts.gen -text [mc "Generate"] -command mkpatchgo 9516 - ${NS}::button $top.buts.can -text [mc "Cancel"] -command mkpatchcan 9401 + ttk::frame $top.buts 9402 + ttk::button $top.buts.gen -text [mc "Generate"] -command mkpatchgo 9403 + ttk::button $top.buts.can -text [mc "Cancel"] -command mkpatchcan 9517 9404 bind $top <Key-Return> mkpatchgo 9518 9405 bind $top <Key-Escape> mkpatchcan 9519 9406 grid $top.buts.gen $top.buts.can ··· 9561 9448 } 9562 9449 9563 9450 proc mktag {} { 9564 - global rowmenuid mktagtop commitinfo NS 9451 + global rowmenuid mktagtop commitinfo 9565 9452 global hashlength 9566 9453 9567 9454 set top .maketag ··· 9569 9456 catch {destroy $top} 9570 9457 ttk_toplevel $top 9571 9458 make_transient $top . 9572 - ${NS}::label $top.title -text [mc "Create tag"] 9459 + ttk::label $top.title -text [mc "Create tag"] 9573 9460 grid $top.title - -pady 10 9574 - ${NS}::label $top.id -text [mc "ID:"] 9575 - ${NS}::entry $top.sha1 -width $hashlength 9461 + ttk::label $top.id -text [mc "ID:"] 9462 + ttk::entry $top.sha1 -width $hashlength 9576 9463 $top.sha1 insert 0 $rowmenuid 9577 9464 $top.sha1 conf -state readonly 9578 9465 grid $top.id $top.sha1 -sticky w 9579 - ${NS}::entry $top.head -width 60 9466 + ttk::entry $top.head -width 60 9580 9467 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] 9581 9468 $top.head conf -state readonly 9582 9469 grid x $top.head -sticky w 9583 - ${NS}::label $top.tlab -text [mc "Tag name:"] 9584 - ${NS}::entry $top.tag -width 60 9470 + ttk::label $top.tlab -text [mc "Tag name:"] 9471 + ttk::entry $top.tag -width 60 9585 9472 grid $top.tlab $top.tag -sticky w 9586 - ${NS}::label $top.op -text [mc "Tag message is optional"] 9473 + ttk::label $top.op -text [mc "Tag message is optional"] 9587 9474 grid $top.op -columnspan 2 -sticky we 9588 - ${NS}::label $top.mlab -text [mc "Tag message:"] 9589 - ${NS}::entry $top.msg -width 60 9475 + ttk::label $top.mlab -text [mc "Tag message:"] 9476 + ttk::entry $top.msg -width 60 9590 9477 grid $top.mlab $top.msg -sticky w 9591 - ${NS}::frame $top.buts 9592 - ${NS}::button $top.buts.gen -text [mc "Create"] -command mktaggo 9593 - ${NS}::button $top.buts.can -text [mc "Cancel"] -command mktagcan 9478 + ttk::frame $top.buts 9479 + ttk::button $top.buts.gen -text [mc "Create"] -command mktaggo 9480 + ttk::button $top.buts.can -text [mc "Cancel"] -command mktagcan 9594 9481 bind $top <Key-Return> mktaggo 9595 9482 bind $top <Key-Escape> mktagcan 9596 9483 grid $top.buts.gen $top.buts.can ··· 9694 9581 } 9695 9582 9696 9583 proc writecommit {} { 9697 - global rowmenuid wrcomtop commitinfo wrcomcmd NS 9584 + global rowmenuid wrcomtop commitinfo wrcomcmd 9698 9585 global hashlength 9699 9586 9700 9587 set top .writecommit ··· 9702 9589 catch {destroy $top} 9703 9590 ttk_toplevel $top 9704 9591 make_transient $top . 9705 - ${NS}::label $top.title -text [mc "Write commit to file"] 9592 + ttk::label $top.title -text [mc "Write commit to file"] 9706 9593 grid $top.title - -pady 10 9707 - ${NS}::label $top.id -text [mc "ID:"] 9708 - ${NS}::entry $top.sha1 -width $hashlength 9594 + ttk::label $top.id -text [mc "ID:"] 9595 + ttk::entry $top.sha1 -width $hashlength 9709 9596 $top.sha1 insert 0 $rowmenuid 9710 9597 $top.sha1 conf -state readonly 9711 9598 grid $top.id $top.sha1 -sticky w 9712 - ${NS}::entry $top.head -width 60 9599 + ttk::entry $top.head -width 60 9713 9600 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] 9714 9601 $top.head conf -state readonly 9715 9602 grid x $top.head -sticky w 9716 - ${NS}::label $top.clab -text [mc "Command:"] 9717 - ${NS}::entry $top.cmd -width 60 -textvariable wrcomcmd 9603 + ttk::label $top.clab -text [mc "Command:"] 9604 + ttk::entry $top.cmd -width 60 -textvariable wrcomcmd 9718 9605 grid $top.clab $top.cmd -sticky w -pady 10 9719 - ${NS}::label $top.flab -text [mc "Output file:"] 9720 - ${NS}::entry $top.fname -width 60 9606 + ttk::label $top.flab -text [mc "Output file:"] 9607 + ttk::entry $top.fname -width 60 9721 9608 $top.fname insert 0 [file normalize "commit-[string range $rowmenuid 0 6]"] 9722 9609 grid $top.flab $top.fname -sticky w 9723 - ${NS}::frame $top.buts 9724 - ${NS}::button $top.buts.gen -text [mc "Write"] -command wrcomgo 9725 - ${NS}::button $top.buts.can -text [mc "Cancel"] -command wrcomcan 9610 + ttk::frame $top.buts 9611 + ttk::button $top.buts.gen -text [mc "Write"] -command wrcomgo 9612 + ttk::button $top.buts.can -text [mc "Cancel"] -command wrcomcan 9726 9613 bind $top <Key-Return> wrcomgo 9727 9614 bind $top <Key-Escape> wrcomcan 9728 9615 grid $top.buts.gen $top.buts.can ··· 9753 9640 } 9754 9641 9755 9642 proc mkbranch {} { 9756 - global NS rowmenuid 9643 + global rowmenuid 9757 9644 9758 9645 set top .branchdialog 9759 9646 ··· 9768 9655 } 9769 9656 9770 9657 proc mvbranch {} { 9771 - global NS 9772 9658 global headmenuid headmenuhead 9773 9659 9774 9660 set top .branchdialog ··· 9784 9670 } 9785 9671 9786 9672 proc branchdia {top valvar uivar} { 9787 - global NS commitinfo 9673 + global commitinfo 9788 9674 global hashlength 9789 9675 upvar $valvar val $uivar ui 9790 9676 9791 9677 catch {destroy $top} 9792 9678 ttk_toplevel $top 9793 9679 make_transient $top . 9794 - ${NS}::label $top.title -text $ui(title) 9680 + ttk::label $top.title -text $ui(title) 9795 9681 grid $top.title - -pady 10 9796 - ${NS}::label $top.id -text [mc "ID:"] 9797 - ${NS}::entry $top.sha1 -width $hashlength 9682 + ttk::label $top.id -text [mc "ID:"] 9683 + ttk::entry $top.sha1 -width $hashlength 9798 9684 $top.sha1 insert 0 $val(id) 9799 9685 $top.sha1 conf -state readonly 9800 9686 grid $top.id $top.sha1 -sticky w 9801 - ${NS}::entry $top.head -width 60 9687 + ttk::entry $top.head -width 60 9802 9688 $top.head insert 0 [lindex $commitinfo($val(id)) 0] 9803 9689 $top.head conf -state readonly 9804 9690 grid x $top.head -sticky ew 9805 9691 grid columnconfigure $top 1 -weight 1 9806 - ${NS}::label $top.nlab -text [mc "Name:"] 9807 - ${NS}::entry $top.name -width $hashlength 9692 + ttk::label $top.nlab -text [mc "Name:"] 9693 + ttk::entry $top.name -width $hashlength 9808 9694 $top.name insert 0 $val(name) 9809 9695 grid $top.nlab $top.name -sticky w 9810 - ${NS}::frame $top.buts 9811 - ${NS}::button $top.buts.go -text $ui(accept) -command $val(command) 9812 - ${NS}::button $top.buts.can -text [mc "Cancel"] -command "catch {destroy $top}" 9696 + ttk::frame $top.buts 9697 + ttk::button $top.buts.go -text $ui(accept) -command $val(command) 9698 + ttk::button $top.buts.can -text [mc "Cancel"] -command "catch {destroy $top}" 9813 9699 bind $top <Key-Return> $val(command) 9814 9700 bind $top <Key-Escape> "catch {destroy $top}" 9815 9701 grid $top.buts.go $top.buts.can ··· 10056 9942 } 10057 9943 10058 9944 proc resethead {} { 10059 - global mainhead rowmenuid confirm_ok resettype NS 9945 + global mainhead rowmenuid confirm_ok resettype 10060 9946 10061 9947 set confirm_ok 0 10062 9948 set w ".confirmreset" 10063 9949 ttk_toplevel $w 10064 9950 make_transient $w . 10065 9951 wm title $w [mc "Confirm reset"] 10066 - ${NS}::label $w.m -text \ 9952 + ttk::label $w.m -text \ 10067 9953 [mc "Reset branch %s to %s?" $mainhead [string range $rowmenuid 0 7]] 10068 9954 pack $w.m -side top -fill x -padx 20 -pady 20 10069 - ${NS}::labelframe $w.f -text [mc "Reset type:"] 9955 + ttk::labelframe $w.f -text [mc "Reset type:"] 10070 9956 set resettype mixed 10071 - ${NS}::radiobutton $w.f.soft -value soft -variable resettype \ 9957 + ttk::radiobutton $w.f.soft -value soft -variable resettype \ 10072 9958 -text [mc "Soft: Leave working tree and index untouched"] 10073 9959 grid $w.f.soft -sticky w 10074 - ${NS}::radiobutton $w.f.mixed -value mixed -variable resettype \ 9960 + ttk::radiobutton $w.f.mixed -value mixed -variable resettype \ 10075 9961 -text [mc "Mixed: Leave working tree untouched, reset index"] 10076 9962 grid $w.f.mixed -sticky w 10077 - ${NS}::radiobutton $w.f.hard -value hard -variable resettype \ 9963 + ttk::radiobutton $w.f.hard -value hard -variable resettype \ 10078 9964 -text [mc "Hard: Reset working tree and index\n(discard ALL local changes)"] 10079 9965 grid $w.f.hard -sticky w 10080 9966 pack $w.f -side top -fill x -padx 4 10081 - ${NS}::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" 9967 + ttk::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" 10082 9968 pack $w.ok -side left -fill x -padx 20 -pady 20 10083 - ${NS}::button $w.cancel -text [mc Cancel] -command "destroy $w" 9969 + ttk::button $w.cancel -text [mc Cancel] -command "destroy $w" 10084 9970 bind $w <Key-Escape> [list destroy $w] 10085 9971 pack $w.cancel -side right -fill x -padx 20 -pady 20 10086 9972 bind $w <Visibility> "grab $w; focus $w" ··· 10257 10143 10258 10144 # Display a list of tags and heads 10259 10145 proc showrefs {} { 10260 - global showrefstop bgcolor fgcolor selectbgcolor NS 10146 + global showrefstop bgcolor fgcolor selectbgcolor 10261 10147 global bglist fglist reflistfilter reflist maincursor 10262 10148 10263 10149 set top .showrefs ··· 10280 10166 lappend bglist $top.list 10281 10167 lappend fglist $top.list 10282 10168 } 10283 - ${NS}::scrollbar $top.ysb -command "$top.list yview" -orient vertical 10284 - ${NS}::scrollbar $top.xsb -command "$top.list xview" -orient horizontal 10169 + ttk::scrollbar $top.ysb -command "$top.list yview" -orient vertical 10170 + ttk::scrollbar $top.xsb -command "$top.list xview" -orient horizontal 10285 10171 grid $top.list $top.ysb -sticky nsew 10286 10172 grid $top.xsb x -sticky ew 10287 - ${NS}::frame $top.f 10288 - ${NS}::label $top.f.l -text "[mc "Filter"]: " 10289 - ${NS}::entry $top.f.e -width 20 -textvariable reflistfilter 10173 + ttk::frame $top.f 10174 + ttk::label $top.f.l -text "[mc "Filter"]: " 10175 + ttk::entry $top.f.e -width 20 -textvariable reflistfilter 10290 10176 set reflistfilter "*" 10291 10177 trace add variable reflistfilter write reflistfilter_change 10292 10178 pack $top.f.e -side right -fill x -expand 1 10293 10179 pack $top.f.l -side left 10294 10180 grid $top.f - -sticky ew -pady 2 10295 - ${NS}::checkbutton $top.sort -text [mc "Sort refs by type"] \ 10181 + ttk::checkbutton $top.sort -text [mc "Sort refs by type"] \ 10296 10182 -variable sortrefsbytype -command {refill_reflist} 10297 10183 grid $top.sort - -sticky w -pady 2 10298 - ${NS}::button $top.close -command [list destroy $top] -text [mc "Close"] 10184 + ttk::button $top.close -command [list destroy $top] -text [mc "Close"] 10299 10185 bind $top <Key-Escape> [list destroy $top] 10300 10186 grid $top.close - 10301 10187 grid columnconfigure $top 0 -weight 1 ··· 11661 11547 } 11662 11548 11663 11549 proc mkfontdisp {font top which} { 11664 - global fontattr fontpref $font NS use_ttk 11550 + global fontattr fontpref $font 11665 11551 11666 11552 set fontpref($font) [set $font] 11667 - ${NS}::button $top.${font}but -text $which \ 11553 + ttk::button $top.${font}but -text $which \ 11668 11554 -command [list choosefont $font $which] 11669 - ${NS}::label $top.$font -relief flat -font $font \ 11555 + ttk::label $top.$font -relief flat -font $font \ 11670 11556 -text $fontattr($font,family) -justify left 11671 11557 grid x $top.${font}but $top.$font -sticky w 11672 11558 } 11673 11559 11674 - proc choosefont {font which} { 11675 - global fontparam fontlist fonttop fontattr 11676 - global prefstop NS 11677 - 11678 - set fontparam(which) $which 11679 - set fontparam(font) $font 11680 - set fontparam(family) [font actual $font -family] 11681 - set fontparam(size) $fontattr($font,size) 11682 - set fontparam(weight) $fontattr($font,weight) 11683 - set fontparam(slant) $fontattr($font,slant) 11684 - set top .gitkfont 11685 - set fonttop $top 11686 - if {![winfo exists $top]} { 11687 - font create sample 11688 - eval font config sample [font actual $font] 11689 - ttk_toplevel $top 11690 - make_transient $top $prefstop 11691 - wm title $top [mc "Gitk font chooser"] 11692 - ${NS}::label $top.l -textvariable fontparam(which) 11693 - pack $top.l -side top 11694 - set fontlist [lsort [font families]] 11695 - ${NS}::frame $top.f 11696 - listbox $top.f.fam -listvariable fontlist \ 11697 - -yscrollcommand [list $top.f.sb set] 11698 - bind $top.f.fam <<ListboxSelect>> selfontfam 11699 - ${NS}::scrollbar $top.f.sb -command [list $top.f.fam yview] 11700 - pack $top.f.sb -side right -fill y 11701 - pack $top.f.fam -side left -fill both -expand 1 11702 - pack $top.f -side top -fill both -expand 1 11703 - ${NS}::frame $top.g 11704 - spinbox $top.g.size -from 4 -to 40 -width 4 \ 11705 - -textvariable fontparam(size) \ 11706 - -validatecommand {string is integer -strict %s} 11707 - checkbutton $top.g.bold -padx 5 \ 11708 - -font {{Times New Roman} 12 bold} -text [mc "B"] -indicatoron 0 \ 11709 - -variable fontparam(weight) -onvalue bold -offvalue normal 11710 - checkbutton $top.g.ital -padx 5 \ 11711 - -font {{Times New Roman} 12 italic} -text [mc "I"] -indicatoron 0 \ 11712 - -variable fontparam(slant) -onvalue italic -offvalue roman 11713 - pack $top.g.size $top.g.bold $top.g.ital -side left 11714 - pack $top.g -side top 11715 - canvas $top.c -width 150 -height 50 -border 2 -relief sunk \ 11716 - -background white 11717 - $top.c create text 100 25 -anchor center -text $which -font sample \ 11718 - -fill black -tags text 11719 - bind $top.c <Configure> [list centertext $top.c] 11720 - pack $top.c -side top -fill x 11721 - ${NS}::frame $top.buts 11722 - ${NS}::button $top.buts.ok -text [mc "OK"] -command fontok -default active 11723 - ${NS}::button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal 11724 - bind $top <Key-Return> fontok 11725 - bind $top <Key-Escape> fontcan 11726 - grid $top.buts.ok $top.buts.can 11727 - grid columnconfigure $top.buts 0 -weight 1 -uniform a 11728 - grid columnconfigure $top.buts 1 -weight 1 -uniform a 11729 - pack $top.buts -side bottom -fill x 11730 - trace add variable fontparam write chg_fontparam 11731 - } else { 11732 - raise $top 11733 - $top.c itemconf text -text $which 11734 - } 11735 - set i [lsearch -exact $fontlist $fontparam(family)] 11736 - if {$i >= 0} { 11737 - $top.f.fam selection set $i 11738 - $top.f.fam see $i 11739 - } 11740 - } 11741 - 11742 11560 proc centertext {w} { 11743 11561 $w coords text [expr {[winfo width $w] / 2}] [expr {[winfo height $w] / 2}] 11744 11562 } ··· 11771 11589 } 11772 11590 } 11773 11591 11774 - if {[package vsatisfies [package provide Tk] 8.6]} { 11775 - # In Tk 8.6 we have a native font chooser dialog. Overwrite the above 11776 - # function to make use of it. 11777 - proc choosefont {font which} { 11778 - tk fontchooser configure -title $which -font $font \ 11779 - -command [list on_choosefont $font $which] 11780 - tk fontchooser show 11781 - } 11782 - proc on_choosefont {font which newfont} { 11783 - global fontparam 11784 - array set f [font actual $newfont] 11785 - set fontparam(which) $which 11786 - set fontparam(font) $font 11787 - set fontparam(family) $f(-family) 11788 - set fontparam(size) $f(-size) 11789 - set fontparam(weight) $f(-weight) 11790 - set fontparam(slant) $f(-slant) 11791 - fontok 11792 - } 11592 + proc choosefont {font which} { 11593 + tk fontchooser configure -title $which -font $font \ 11594 + -command [list on_choosefont $font $which] 11595 + tk fontchooser show 11596 + } 11597 + proc on_choosefont {font which newfont} { 11598 + global fontparam 11599 + array set f [font actual $newfont] 11600 + set fontparam(which) $which 11601 + set fontparam(font) $font 11602 + set fontparam(family) $f(-family) 11603 + set fontparam(size) $f(-size) 11604 + set fontparam(weight) $f(-weight) 11605 + set fontparam(slant) $f(-slant) 11606 + fontok 11793 11607 } 11794 11608 11795 11609 proc selfontfam {} { ··· 11809 11623 11810 11624 # Create a property sheet tab page 11811 11625 proc create_prefs_page {w} { 11812 - global NS 11813 - set parent [join [lrange [split $w .] 0 end-1] .] 11814 - if {[winfo class $parent] eq "TNotebook"} { 11815 - ${NS}::frame $w 11816 - } else { 11817 - ${NS}::labelframe $w 11818 - } 11626 + ttk::frame $w 11819 11627 } 11820 11628 11821 11629 proc prefspage_general {notebook} { 11822 - global NS maxwidth maxgraphpct showneartags showlocalchanges 11823 - global tabstop wrapcomment wrapdefault limitdiffs 11824 - global autocopy autoselect autosellen extdifftool perfile_attrs 11825 - global hideremotes want_ttk have_ttk maxrefs web_browser 11630 + global {*}$::config_variables 11826 11631 global hashlength 11827 11632 11828 11633 set page [create_prefs_page $notebook.general] 11829 11634 11830 - ${NS}::label $page.ldisp -text [mc "Commit list display options"] -font mainfontbold 11635 + ttk::label $page.ldisp -text [mc "Commit list display options"] -font mainfontbold 11831 11636 grid $page.ldisp - -sticky w -pady 10 11832 - ${NS}::label $page.spacer -text " " 11833 - ${NS}::label $page.maxwidthl -text [mc "Maximum graph width (lines)"] 11637 + ttk::label $page.spacer -text " " 11638 + ttk::label $page.maxwidthl -text [mc "Maximum graph width (lines)"] 11834 11639 spinbox $page.maxwidth -from 0 -to 100 -width 4 -textvariable maxwidth 11835 11640 grid $page.spacer $page.maxwidthl $page.maxwidth -sticky w 11836 11641 #xgettext:no-tcl-format 11837 - ${NS}::label $page.maxpctl -text [mc "Maximum graph width (% of pane)"] 11642 + ttk::label $page.maxpctl -text [mc "Maximum graph width (% of pane)"] 11838 11643 spinbox $page.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct 11839 11644 grid x $page.maxpctl $page.maxpct -sticky w 11840 - ${NS}::checkbutton $page.showlocal -text [mc "Show local changes"] \ 11645 + ttk::checkbutton $page.showlocal -text [mc "Show local changes"] \ 11841 11646 -variable showlocalchanges 11842 11647 grid x $page.showlocal -sticky w 11843 - ${NS}::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \ 11648 + ttk::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \ 11844 11649 -variable hideremotes 11845 11650 grid x $page.hideremotes -sticky w 11846 11651 11847 - ${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \ 11652 + ttk::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \ 11848 11653 -variable autocopy 11849 11654 grid x $page.autocopy -sticky w 11850 11655 if {[haveselectionclipboard]} { 11851 - ${NS}::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \ 11656 + ttk::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \ 11852 11657 -variable autoselect 11853 11658 grid x $page.autoselect -sticky w 11854 11659 } 11855 11660 11856 11661 spinbox $page.autosellen -from 1 -to $hashlength -width 4 -textvariable autosellen 11857 - ${NS}::label $page.autosellenl -text [mc "Length of commit ID to copy"] 11662 + ttk::label $page.autosellenl -text [mc "Length of commit ID to copy"] 11858 11663 grid x $page.autosellenl $page.autosellen -sticky w 11664 + ttk::label $page.kscroll1 -text [mc "Wheel scrolling multiplier"] 11665 + spinbox $page.kscroll -from 1 -to 20 -width 4 -textvariable kscroll 11666 + grid x $page.kscroll1 $page.kscroll -sticky w 11859 11667 11860 - ${NS}::label $page.ddisp -text [mc "Diff display options"] -font mainfontbold 11668 + ttk::label $page.ddisp -text [mc "Diff display options"] -font mainfontbold 11861 11669 grid $page.ddisp - -sticky w -pady 10 11862 - ${NS}::label $page.tabstopl -text [mc "Tab spacing"] 11670 + ttk::label $page.tabstopl -text [mc "Tab spacing"] 11863 11671 spinbox $page.tabstop -from 1 -to 20 -width 4 -textvariable tabstop 11864 11672 grid x $page.tabstopl $page.tabstop -sticky w 11865 11673 11866 - ${NS}::label $page.wrapcommentl -text [mc "Wrap comment text"] 11674 + ttk::label $page.wrapcommentl -text [mc "Wrap comment text"] 11867 11675 makedroplist $page.wrapcomment wrapcomment none char word 11868 11676 grid x $page.wrapcommentl $page.wrapcomment -sticky w 11869 11677 11870 - ${NS}::label $page.wrapdefaultl -text [mc "Wrap other text"] 11678 + ttk::label $page.wrapdefaultl -text [mc "Wrap other text"] 11871 11679 makedroplist $page.wrapdefault wrapdefault none char word 11872 11680 grid x $page.wrapdefaultl $page.wrapdefault -sticky w 11873 11681 11874 - ${NS}::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \ 11682 + ttk::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \ 11875 11683 -variable showneartags 11876 11684 grid x $page.ntag -sticky w 11877 - ${NS}::label $page.maxrefsl -text [mc "Maximum # tags/heads to show"] 11685 + ttk::label $page.maxrefsl -text [mc "Maximum # tags/heads to show"] 11878 11686 spinbox $page.maxrefs -from 1 -to 1000 -width 4 -textvariable maxrefs 11879 11687 grid x $page.maxrefsl $page.maxrefs -sticky w 11880 - ${NS}::checkbutton $page.ldiff -text [mc "Limit diffs to listed paths"] \ 11688 + ttk::checkbutton $page.ldiff -text [mc "Limit diffs to listed paths"] \ 11881 11689 -variable limitdiffs 11882 11690 grid x $page.ldiff -sticky w 11883 - ${NS}::checkbutton $page.lattr -text [mc "Support per-file encodings"] \ 11691 + ttk::checkbutton $page.lattr -text [mc "Support per-file encodings"] \ 11884 11692 -variable perfile_attrs 11885 11693 grid x $page.lattr -sticky w 11886 11694 11887 - ${NS}::entry $page.extdifft -textvariable extdifftool 11888 - ${NS}::frame $page.extdifff 11889 - ${NS}::label $page.extdifff.l -text [mc "External diff tool" ] 11890 - ${NS}::button $page.extdifff.b -text [mc "Choose..."] -command choose_extdiff 11695 + ttk::entry $page.extdifft -textvariable extdifftool 11696 + ttk::frame $page.extdifff 11697 + ttk::label $page.extdifff.l -text [mc "External diff tool" ] 11698 + ttk::button $page.extdifff.b -text [mc "Choose..."] -command choose_extdiff 11891 11699 pack $page.extdifff.l $page.extdifff.b -side left 11892 11700 pack configure $page.extdifff.l -padx 10 11893 11701 grid x $page.extdifff $page.extdifft -sticky ew 11894 11702 11895 - ${NS}::entry $page.webbrowser -textvariable web_browser 11896 - ${NS}::frame $page.webbrowserf 11897 - ${NS}::label $page.webbrowserf.l -text [mc "Web browser" ] 11703 + ttk::entry $page.webbrowser -textvariable web_browser 11704 + ttk::frame $page.webbrowserf 11705 + ttk::label $page.webbrowserf.l -text [mc "Web browser" ] 11898 11706 pack $page.webbrowserf.l -side left 11899 11707 pack configure $page.webbrowserf.l -padx 10 11900 11708 grid x $page.webbrowserf $page.webbrowser -sticky ew 11901 11709 11902 - ${NS}::label $page.lgen -text [mc "General options"] -font mainfontbold 11710 + ttk::label $page.lgen -text [mc "General options"] -font mainfontbold 11903 11711 grid $page.lgen - -sticky w -pady 10 11904 - ${NS}::checkbutton $page.want_ttk -variable want_ttk \ 11905 - -text [mc "Use themed widgets"] 11906 - if {$have_ttk} { 11907 - ${NS}::label $page.ttk_note -text [mc "(change requires restart)"] 11908 - } else { 11909 - ${NS}::label $page.ttk_note -text [mc "(currently unavailable)"] 11910 - } 11911 - grid x $page.want_ttk $page.ttk_note -sticky w 11912 11712 return $page 11913 11713 } 11914 11714 11915 11715 proc prefspage_colors {notebook} { 11916 - global NS uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor 11716 + global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor 11917 11717 global diffbgcolors 11918 11718 11919 11719 set page [create_prefs_page $notebook.colors] 11920 11720 11921 - ${NS}::label $page.cdisp -text [mc "Colors: press to choose"] -font mainfontbold 11721 + ttk::label $page.cdisp -text [mc "Colors: press to choose"] -font mainfontbold 11922 11722 grid $page.cdisp - -sticky w -pady 10 11923 11723 label $page.ui -padx 40 -relief sunk -background $uicolor 11924 - ${NS}::button $page.uibut -text [mc "Interface"] \ 11724 + ttk::button $page.uibut -text [mc "Interface"] \ 11925 11725 -command [list choosecolor uicolor {} $page.ui [mc "interface"] setui] 11926 11726 grid x $page.uibut $page.ui -sticky w 11927 11727 label $page.bg -padx 40 -relief sunk -background $bgcolor 11928 - ${NS}::button $page.bgbut -text [mc "Background"] \ 11728 + ttk::button $page.bgbut -text [mc "Background"] \ 11929 11729 -command [list choosecolor bgcolor {} $page.bg [mc "background"] setbg] 11930 11730 grid x $page.bgbut $page.bg -sticky w 11931 11731 label $page.fg -padx 40 -relief sunk -background $fgcolor 11932 - ${NS}::button $page.fgbut -text [mc "Foreground"] \ 11732 + ttk::button $page.fgbut -text [mc "Foreground"] \ 11933 11733 -command [list choosecolor fgcolor {} $page.fg [mc "foreground"] setfg] 11934 11734 grid x $page.fgbut $page.fg -sticky w 11935 11735 label $page.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0] 11936 - ${NS}::button $page.diffoldbut -text [mc "Diff: old lines"] \ 11736 + ttk::button $page.diffoldbut -text [mc "Diff: old lines"] \ 11937 11737 -command [list choosecolor diffcolors 0 $page.diffold [mc "diff old lines"] \ 11938 11738 [list $ctext tag conf d0 -foreground]] 11939 11739 grid x $page.diffoldbut $page.diffold -sticky w 11940 11740 label $page.diffoldbg -padx 40 -relief sunk -background [lindex $diffbgcolors 0] 11941 - ${NS}::button $page.diffoldbgbut -text [mc "Diff: old lines bg"] \ 11741 + ttk::button $page.diffoldbgbut -text [mc "Diff: old lines bg"] \ 11942 11742 -command [list choosecolor diffbgcolors 0 $page.diffoldbg \ 11943 11743 [mc "diff old lines bg"] \ 11944 11744 [list $ctext tag conf d0 -background]] 11945 11745 grid x $page.diffoldbgbut $page.diffoldbg -sticky w 11946 11746 label $page.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1] 11947 - ${NS}::button $page.diffnewbut -text [mc "Diff: new lines"] \ 11747 + ttk::button $page.diffnewbut -text [mc "Diff: new lines"] \ 11948 11748 -command [list choosecolor diffcolors 1 $page.diffnew [mc "diff new lines"] \ 11949 11749 [list $ctext tag conf dresult -foreground]] 11950 11750 grid x $page.diffnewbut $page.diffnew -sticky w 11951 11751 label $page.diffnewbg -padx 40 -relief sunk -background [lindex $diffbgcolors 1] 11952 - ${NS}::button $page.diffnewbgbut -text [mc "Diff: new lines bg"] \ 11752 + ttk::button $page.diffnewbgbut -text [mc "Diff: new lines bg"] \ 11953 11753 -command [list choosecolor diffbgcolors 1 $page.diffnewbg \ 11954 11754 [mc "diff new lines bg"] \ 11955 11755 [list $ctext tag conf dresult -background]] 11956 11756 grid x $page.diffnewbgbut $page.diffnewbg -sticky w 11957 11757 label $page.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2] 11958 - ${NS}::button $page.hunksepbut -text [mc "Diff: hunk header"] \ 11758 + ttk::button $page.hunksepbut -text [mc "Diff: hunk header"] \ 11959 11759 -command [list choosecolor diffcolors 2 $page.hunksep \ 11960 11760 [mc "diff hunk header"] \ 11961 11761 [list $ctext tag conf hunksep -foreground]] 11962 11762 grid x $page.hunksepbut $page.hunksep -sticky w 11963 11763 label $page.markbgsep -padx 40 -relief sunk -background $markbgcolor 11964 - ${NS}::button $page.markbgbut -text [mc "Marked line bg"] \ 11764 + ttk::button $page.markbgbut -text [mc "Marked line bg"] \ 11965 11765 -command [list choosecolor markbgcolor {} $page.markbgsep \ 11966 11766 [mc "marked line background"] \ 11967 11767 [list $ctext tag conf omark -background]] 11968 11768 grid x $page.markbgbut $page.markbgsep -sticky w 11969 11769 label $page.selbgsep -padx 40 -relief sunk -background $selectbgcolor 11970 - ${NS}::button $page.selbgbut -text [mc "Select bg"] \ 11770 + ttk::button $page.selbgbut -text [mc "Select bg"] \ 11971 11771 -command [list choosecolor selectbgcolor {} $page.selbgsep [mc "background"] setselbg] 11972 11772 grid x $page.selbgbut $page.selbgsep -sticky w 11973 11773 return $page 11974 11774 } 11975 11775 11976 11776 proc prefspage_fonts {notebook} { 11977 - global NS 11978 11777 set page [create_prefs_page $notebook.fonts] 11979 - ${NS}::label $page.cfont -text [mc "Fonts: press to choose"] -font mainfontbold 11778 + ttk::label $page.cfont -text [mc "Fonts: press to choose"] -font mainfontbold 11980 11779 grid $page.cfont - -sticky w -pady 10 11981 11780 mkfontdisp mainfont $page [mc "Main font"] 11982 11781 mkfontdisp textfont $page [mc "Diff display font"] ··· 11985 11784 } 11986 11785 11987 11786 proc doprefs {} { 11988 - global maxwidth maxgraphpct use_ttk NS 11989 - global oldprefs prefstop showneartags showlocalchanges 11990 - global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor 11991 - global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs 11992 - global hideremotes want_ttk have_ttk wrapcomment wrapdefault 11787 + global oldprefs prefstop 11788 + global {*}$::config_variables 11993 11789 11994 11790 set top .gitkprefs 11995 11791 set prefstop $top ··· 11997 11793 raise $top 11998 11794 return 11999 11795 } 12000 - foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ 12001 - limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { 11796 + foreach v $::config_variables { 12002 11797 set oldprefs($v) [set $v] 12003 11798 } 12004 11799 ttk_toplevel $top 12005 11800 wm title $top [mc "Gitk preferences"] 12006 11801 make_transient $top . 12007 11802 12008 - if {[set use_notebook [expr {$use_ttk && [info command ::ttk::notebook] ne ""}]]} { 12009 - set notebook [ttk::notebook $top.notebook] 12010 - } else { 12011 - set notebook [${NS}::frame $top.notebook -borderwidth 0 -relief flat] 12012 - } 11803 + set notebook [ttk::notebook $top.notebook] 12013 11804 12014 11805 lappend pages [prefspage_general $notebook] [mc "General"] 12015 11806 lappend pages [prefspage_colors $notebook] [mc "Colors"] 12016 11807 lappend pages [prefspage_fonts $notebook] [mc "Fonts"] 12017 11808 set col 0 12018 11809 foreach {page title} $pages { 12019 - if {$use_notebook} { 12020 - $notebook add $page -text $title 12021 - } else { 12022 - set btn [${NS}::button $notebook.b_[string map {. X} $page] \ 12023 - -text $title -command [list raise $page]] 12024 - $page configure -text $title 12025 - grid $btn -row 0 -column [incr col] -sticky w 12026 - grid $page -row 1 -column 0 -sticky news -columnspan 100 12027 - } 11810 + $notebook add $page -text $title 12028 11811 } 12029 11812 12030 - if {!$use_notebook} { 12031 - grid columnconfigure $notebook 0 -weight 1 12032 - grid rowconfigure $notebook 1 -weight 1 12033 - raise [lindex $pages 0] 12034 - } 11813 + grid columnconfigure $notebook 0 -weight 1 11814 + grid rowconfigure $notebook 1 -weight 1 11815 + raise [lindex $pages 0] 12035 11816 12036 11817 grid $notebook -sticky news -padx 2 -pady 2 12037 11818 grid rowconfigure $top 0 -weight 1 12038 11819 grid columnconfigure $top 0 -weight 1 12039 11820 12040 - ${NS}::frame $top.buts 12041 - ${NS}::button $top.buts.ok -text [mc "OK"] -command prefsok -default active 12042 - ${NS}::button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal 11821 + ttk::frame $top.buts 11822 + ttk::button $top.buts.ok -text [mc "OK"] -command prefsok -default active 11823 + ttk::button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal 12043 11824 bind $top <Key-Return> prefsok 12044 11825 bind $top <Key-Escape> prefscan 12045 11826 grid $top.buts.ok $top.buts.can ··· 12122 11903 12123 11904 proc prefscan {} { 12124 11905 global oldprefs prefstop 11906 + global {*}$::config_variables 12125 11907 12126 - foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ 12127 - limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} { 12128 - global $v 11908 + foreach v $::config_variables { 12129 11909 set $v $oldprefs($v) 12130 11910 } 12131 11911 catch {destroy $prefstop} ··· 12134 11914 } 12135 11915 12136 11916 proc prefsok {} { 12137 - global maxwidth maxgraphpct 12138 - global oldprefs prefstop showneartags showlocalchanges 12139 - global fontpref mainfont textfont uifont 12140 - global limitdiffs treediffs perfile_attrs 12141 - global hideremotes wrapcomment wrapdefault 11917 + global oldprefs prefstop fontpref treediffs 11918 + global {*}$::config_variables 12142 11919 global ctext 12143 11920 12144 11921 catch {destroy $prefstop} ··· 12580 12357 ## And eventually load the actual message catalog 12581 12358 ::msgcat::mcload $gitk_msgsdir 12582 12359 12583 - # First check that Tcl/Tk is recent enough 12584 - if {[catch {package require Tk 8.4} err]} { 12585 - show_error {} . [mc "Sorry, gitk cannot run with this version of Tcl/Tk.\n\ 12586 - Gitk requires at least Tcl/Tk 8.4."] 12587 - exit 1 12588 - } 12589 - 12590 12360 # on OSX bring the current Wish process window to front 12591 12361 if {[tk windowingsystem] eq "aqua"} { 12592 12362 safe_exec [list osascript -e [format { ··· 12682 12452 set maxlinelen 200 12683 12453 set showlocalchanges 1 12684 12454 set limitdiffs 1 12455 + set kscroll 3 12685 12456 set datetimeformat "%Y-%m-%d %H:%M:%S" 12686 12457 set autocopy 0 12687 12458 set autoselect 1 12688 12459 set autosellen $hashlength 12689 12460 set perfile_attrs 0 12690 - set want_ttk 1 12691 12461 12692 12462 if {[tk windowingsystem] eq "aqua"} { 12693 12463 set extdifftool "opendiff" ··· 12780 12550 config_check_tmp_exists 50 12781 12551 12782 12552 set config_variables { 12783 - mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth 12784 - cmitmode wrapcomment wrapdefault autocopy autoselect autosellen 12785 - showneartags maxrefs visiblerefs 12786 - hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk 12787 - bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors 12788 - markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor 12789 - extdifftool perfile_attrs headbgcolor headfgcolor headoutlinecolor 12790 - remotebgcolor tagbgcolor tagfgcolor tagoutlinecolor reflinecolor 12791 - filesepbgcolor filesepfgcolor linehoverbgcolor linehoverfgcolor 12792 - linehoveroutlinecolor mainheadcirclecolor workingfilescirclecolor 12793 - indexcirclecolor circlecolors linkfgcolor circleoutlinecolor diffbgcolors 12794 - sortrefsbytype web_browser 12553 + autocopy 12554 + autoselect 12555 + autosellen 12556 + bgcolor 12557 + circlecolors 12558 + circleoutlinecolor 12559 + cmitmode 12560 + colors 12561 + currentsearchhitbgcolor 12562 + datetimeformat 12563 + diffbgcolors 12564 + diffcolors 12565 + diffcontext 12566 + extdifftool 12567 + fgcolor 12568 + filesepbgcolor 12569 + filesepfgcolor 12570 + findmergefiles 12571 + foundbgcolor 12572 + headbgcolor 12573 + headfgcolor 12574 + headoutlinecolor 12575 + hideremotes 12576 + indexcirclecolor 12577 + kscroll 12578 + limitdiffs 12579 + linehoverbgcolor 12580 + linehoverfgcolor 12581 + linehoveroutlinecolor 12582 + linkfgcolor 12583 + mainfont 12584 + mainheadcirclecolor 12585 + markbgcolor 12586 + maxgraphpct 12587 + maxrefs 12588 + maxwidth 12589 + mergecolors 12590 + perfile_attrs 12591 + reflinecolor 12592 + remotebgcolor 12593 + selectbgcolor 12594 + showlocalchanges 12595 + showneartags 12596 + sortrefsbytype 12597 + tabstop 12598 + tagbgcolor 12599 + tagfgcolor 12600 + tagoutlinecolor 12601 + textfont 12602 + uicolor 12603 + uifgcolor 12604 + uifgdisabledcolor 12605 + uifont 12606 + visiblerefs 12607 + web_browser 12608 + workingfilescirclecolor 12609 + wrapcomment 12610 + wrapdefault 12795 12611 } 12612 + 12796 12613 foreach var $config_variables { 12797 12614 config_init_trace $var 12798 12615 trace add variable $var write config_variable_change_cb ··· 12883 12700 set nullid2 "0000000000000000000000000000000000000001" 12884 12701 set nullfile "/dev/null" 12885 12702 12886 - set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}] 12887 - set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}] 12888 - if {![info exists have_ttk]} { 12889 - set have_ttk [llength [info commands ::ttk::style]] 12890 - } 12891 - set use_ttk [expr {$have_ttk && $want_ttk}] 12892 - set NS [expr {$use_ttk ? "ttk" : ""}] 12893 - 12894 - if {$use_ttk} { 12895 - setttkstyle 12896 - } 12897 - 12898 - regexp {^git version ([\d.]*\d)} [exec git version] _ git_version 12899 - 12900 - set show_notes {} 12901 - if {[package vcompare $git_version "1.6.6.2"] >= 0} { 12902 - set show_notes "--show-notes" 12903 - } 12904 - 12703 + setttkstyle 12905 12704 set appname "gitk" 12906 12705 12907 12706 set runq {}