@@ -1877,8 +1877,11 @@ proc setoptions {} {
1877
1877
option add *Menubutton.font uifont startupFile
1878
1878
option add *Label.font uifont startupFile
1879
1879
option add *Message.font uifont startupFile
1880
- option add *Entry.font uifont startupFile
1880
+ option add *Entry.font textfont startupFile
1881
+ option add *Text.font textfont startupFile
1881
1882
option add *Labelframe.font uifont startupFile
1883
+ option add *Spinbox.font textfont startupFile
1884
+ option add *Listbox.font mainfont startupFile
1882
1885
}
1883
1886
1884
1887
# Make a menu and submenus.
@@ -2174,7 +2177,7 @@ proc makewindow {} {
2174
2177
set findstring {}
2175
2178
set fstring .tf.lbar.findstring
2176
2179
lappend entries $fstring
2177
- ${NS} ::entry $fstring -width 30 -font textfont - textvariable findstring
2180
+ ${NS} ::entry $fstring -width 30 -textvariable findstring
2178
2181
trace add variable findstring write find_change
2179
2182
set findtype [mc " Exact" ]
2180
2183
set findtypemenu [makedroplist .tf.lbar.findtype \
@@ -2217,7 +2220,7 @@ proc makewindow {} {
2217
2220
pack .bleft.top.search -side left -padx 5
2218
2221
set sstring .bleft.top.sstring
2219
2222
set searchstring " "
2220
- ${NS} ::entry $sstring -width 20 -font textfont - textvariable searchstring
2223
+ ${NS} ::entry $sstring -width 20 -textvariable searchstring
2221
2224
lappend entries $sstring
2222
2225
trace add variable searchstring write incrsearch
2223
2226
pack $sstring -side left -expand 1 -fill x
@@ -2229,7 +2232,7 @@ proc makewindow {} {
2229
2232
-command changediffdisp -variable diffelide -value {1 0}
2230
2233
${NS} ::label .bleft.mid.labeldiffcontext -text " [ mc " Lines of context" ] : "
2231
2234
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
2232
- spinbox .bleft.mid.diffcontext -width 5 -font textfont \
2235
+ spinbox .bleft.mid.diffcontext -width 5 \
2233
2236
-from 0 -increment 1 -to 10000000 \
2234
2237
-validate all -validatecommand " diffcontextvalidate %P" \
2235
2238
-textvariable diffcontextstring
@@ -2383,6 +2386,8 @@ proc makewindow {} {
2383
2386
}
2384
2387
bindall <$::BM > " canvscan mark %W %x %y"
2385
2388
bindall <B$::BM -Motion> " canvscan dragto %W %x %y"
2389
+ bind all <$M1B -Key-w> {destroy [winfo toplevel %W]}
2390
+ bind . <$M1B -Key-w> doquit
2386
2391
bindkey <Home> selfirstline
2387
2392
bindkey <End> sellastline
2388
2393
bind . <Key-Up> " selnextline -1"
@@ -2782,7 +2787,7 @@ proc about {} {
2782
2787
message $w .m -text [mc "
2783
2788
Gitk - a commit viewer for git
2784
2789
2785
- Copyright © 2005-2009 Paul Mackerras
2790
+ Copyright \u00a9 2005-2010 Paul Mackerras
2786
2791
2787
2792
Use and redistribute under the terms of the GNU General Public License" ] \
2788
2793
-justify center -aspect 400 -border 2 -bg white -relief groove
@@ -2814,6 +2819,7 @@ proc keys {} {
2814
2819
[ mc " Gitk key bindings:" ]
2815
2820
2816
2821
[ mc " <%s-Q> Quit" $M1T ]
2822
+ [ mc " <%s-W> Close window" $M1T ]
2817
2823
[ mc " <Home> Move to first commit" ]
2818
2824
[ mc " <End> Move to last commit" ]
2819
2825
[ mc " <Up>, p, i Move up one commit" ]
@@ -3805,10 +3811,10 @@ proc newview {ishighlight} {
3805
3811
raise $top
3806
3812
return
3807
3813
}
3814
+ decode_view_opts $nextviewnum $revtreeargs
3808
3815
set newviewname($nextviewnum ) " [ mc " View" ] $nextviewnum "
3809
3816
set newviewopts($nextviewnum ,perm) 0
3810
3817
set newviewopts($nextviewnum ,cmd) $viewargscmd($curview)
3811
- decode_view_opts $nextviewnum $revtreeargs
3812
3818
vieweditor $top $nextviewnum [mc " Gitk view definition" ]
3813
3819
}
3814
3820
@@ -3845,6 +3851,7 @@ set known_view_options {
3845
3851
{cmd t50= + {} {mc " Command to generate more commits to include:" }}
3846
3852
}
3847
3853
3854
+ # Convert $newviewopts($n, ...) into args for git log.
3848
3855
proc encode_view_opts {n} {
3849
3856
global known_view_options newviewopts
3850
3857
@@ -3878,6 +3885,7 @@ proc encode_view_opts {n} {
3878
3885
return [concat $rargs [shellsplit $newviewopts($n,args) ]]
3879
3886
}
3880
3887
3888
+ # Fill $newviewopts($n, ...) based on args for git log.
3881
3889
proc decode_view_opts {n view_args} {
3882
3890
global known_view_options newviewopts
3883
3891
@@ -3960,10 +3968,10 @@ proc editview {} {
3960
3968
raise $top
3961
3969
return
3962
3970
}
3971
+ decode_view_opts $curview $viewargs($curview)
3963
3972
set newviewname($curview ) $viewname($curview)
3964
3973
set newviewopts($curview ,perm) $viewperm($curview)
3965
3974
set newviewopts($curview ,cmd) $viewargscmd($curview)
3966
- decode_view_opts $curview $viewargs($curview)
3967
3975
vieweditor $top $curview " [ mc " Gitk: edit view" ] $viewname($curview) "
3968
3976
}
3969
3977
@@ -4037,7 +4045,7 @@ proc vieweditor {top n title} {
4037
4045
} elseif {$type eq " path" } {
4038
4046
${NS} ::label $top .l -text $title
4039
4047
pack $top .l -in $top -side top -pady [list 3 0] -anchor w -padx 3
4040
- text $top .t -width 40 -height 5 -background $bgcolor -font uifont
4048
+ text $top .t -width 40 -height 5 -background $bgcolor
4041
4049
if {[info exists viewfiles($n )]} {
4042
4050
foreach f $viewfiles($n) {
4043
4051
$top .t insert end $f
@@ -7501,7 +7509,7 @@ proc getblobdiffs {ids} {
7501
7509
global ignorespace
7502
7510
global limitdiffs vfilelimit curview
7503
7511
global diffencoding targetline diffnparents
7504
- global git_version
7512
+ global git_version currdiffsubmod
7505
7513
7506
7514
set textconv {}
7507
7515
if {[package vcompare $git_version " 1.6.1" ] >= 0} {
@@ -7528,6 +7536,7 @@ proc getblobdiffs {ids} {
7528
7536
set diffencoding [get_path_encoding {}]
7529
7537
fconfigure $bdf -blocking 0 -encoding binary -eofchar {}
7530
7538
set blobdifffd($ids ) $bdf
7539
+ set currdiffsubmod " "
7531
7540
filerun $bdf [list getblobdiffline $bdf $diffids ]
7532
7541
}
7533
7542
@@ -7598,7 +7607,7 @@ proc getblobdiffline {bdf ids} {
7598
7607
global diffnexthead diffnextnote difffilestart
7599
7608
global ctext_file_names ctext_file_lines
7600
7609
global diffinhdr treediffs mergemax diffnparents
7601
- global diffencoding jump_to_here targetline diffline
7610
+ global diffencoding jump_to_here targetline diffline currdiffsubmod
7602
7611
7603
7612
set nr 0
7604
7613
$ctext conf -state normal
@@ -7679,19 +7688,30 @@ proc getblobdiffline {bdf ids} {
7679
7688
7680
7689
} elseif {![string compare -length 10 " Submodule " $line ]} {
7681
7690
# start of a new submodule
7682
- if {[string compare [$ctext get " end - 4c" end] " \n \n\n " ]} {
7691
+ if {[regexp -indices "\[ 0-9a-f\] +\\ .\\ ." $line nameend]} {
7692
+ set fname [string range $line 10 [expr [lindex $nameend 0] - 2]]
7693
+ } else {
7694
+ set fname [string range $line 10 [expr [string first " contains " $line ] - 2]]
7695
+ }
7696
+ if {$currdiffsubmod != $fname } {
7683
7697
$ctext insert end " \n " ; # Add newline after commit message
7684
7698
}
7685
7699
set curdiffstart [$ctext index " end - 1c" ]
7686
7700
lappend ctext_file_names " "
7687
- set fname [string range $line 10 [expr [string last " " $line ] - 1]]
7688
- lappend ctext_file_lines $fname
7689
- makediffhdr $fname $ids
7690
- $ctext insert end " \n $line \n " filesep
7701
+ if {$currdiffsubmod != $fname } {
7702
+ lappend ctext_file_lines $fname
7703
+ makediffhdr $fname $ids
7704
+ set currdiffsubmod $fname
7705
+ $ctext insert end " \n $line \n " filesep
7706
+ } else {
7707
+ $ctext insert end " $line \n " filesep
7708
+ }
7691
7709
} elseif {![string compare -length 3 " >" $line ]} {
7710
+ set $currdiffsubmod " "
7692
7711
set line [encoding convertfrom $diffencoding $line ]
7693
7712
$ctext insert end " $line \n " dresult
7694
7713
} elseif {![string compare -length 3 " <" $line ]} {
7714
+ set $currdiffsubmod " "
7695
7715
set line [encoding convertfrom $diffencoding $line ]
7696
7716
$ctext insert end " $line \n " d0
7697
7717
} elseif {$diffinhdr } {
@@ -8527,7 +8547,7 @@ proc do_cmp_commits {a b} {
8527
8547
}
8528
8548
8529
8549
proc diffcommits {a b} {
8530
- global diffcontext diffids blobdifffd diffinhdr
8550
+ global diffcontext diffids blobdifffd diffinhdr currdiffsubmod
8531
8551
8532
8552
set tmpdir [gitknewtmpdir]
8533
8553
set fna [file join $tmpdir " commit-[ string range $a 0 7] " ]
@@ -8548,6 +8568,7 @@ proc diffcommits {a b} {
8548
8568
set diffids [list commits $a $b ]
8549
8569
set blobdifffd($diffids ) $fd
8550
8570
set diffinhdr 0
8571
+ set currdiffsubmod " "
8551
8572
filerun $fd [list getblobdiffline $fd $diffids ]
8552
8573
}
8553
8574
@@ -10528,7 +10549,6 @@ proc mkfontdisp {font top which} {
10528
10549
set fontpref($font ) [set $font ]
10529
10550
${NS} ::button $top .${font} but -text $which \
10530
10551
-command [list choosefont $font $which ]
10531
- if {!$use_ttk } {$top .${font} but configure -font optionfont}
10532
10552
${NS} ::label $top .$font -relief flat -font $font \
10533
10553
-text $fontattr($font,family) -justify left
10534
10554
grid x $top .${font} but $top .$font -sticky w
@@ -10791,15 +10811,6 @@ proc doprefs {} {
10791
10811
mkfontdisp textfont $top [mc " Diff display font" ]
10792
10812
mkfontdisp uifont $top [mc " User interface font" ]
10793
10813
10794
- if {!$use_ttk } {
10795
- foreach w {maxpctl maxwidthl showlocal autoselect tabstopl ntag
10796
- ldiff lattr extdifff.l extdifff.b bgbut fgbut
10797
- diffoldbut diffnewbut hunksepbut markbgbut selbgbut
10798
- want_ttk ttk_note} {
10799
- $top .$w configure -font optionfont
10800
- }
10801
- }
10802
-
10803
10814
${NS} ::frame $top .buts
10804
10815
${NS} ::button $top .buts.ok -text [mc " OK" ] -command prefsok -default active
10805
10816
${NS} ::button $top .buts.can -text [mc " Cancel" ] -command prefscan -default normal
@@ -10849,6 +10860,7 @@ proc setselbg {c} {
10849
10860
# radiobuttons look bad. This chooses white for selectColor if the
10850
10861
# background color is light, or black if it is dark.
10851
10862
proc setui {c} {
10863
+ if {[tk windowingsystem] eq " win32" } { return }
10852
10864
set bg [winfo rgb . $c ]
10853
10865
set selc black
10854
10866
if {[lindex $bg 0] + 1.5 * [lindex $bg 1] + 0.5 * [lindex $bg 2] > 100000} {
@@ -11411,8 +11423,6 @@ namespace import ::msgcat::mc
11411
11423
11412
11424
catch {source ~/.gitk}
11413
11425
11414
- font create optionfont -family sans-serif -size -12
11415
-
11416
11426
parsefont mainfont $mainfont
11417
11427
eval font create mainfont [fontflags mainfont]
11418
11428
eval font create mainfontbold [fontflags mainfont 1]
@@ -11613,3 +11623,9 @@ if {[tk windowingsystem] eq "win32"} {
11613
11623
}
11614
11624
11615
11625
getcommits {}
11626
+
11627
+ # Local variables:
11628
+ # mode: tcl
11629
+ # indent-tabs-mode: t
11630
+ # tab-width: 8
11631
+ # End:
0 commit comments