$viewargs($view)]
set viewincl($view) {}
foreach c $commits {
- if {![string match "^*" $c]} {
+ if {[regexp {^[0-9a-fA-F]{40}$} $c]} {
lappend viewincl($view) $c
}
}
$viewargs($view)]
set pos {}
set neg {}
+ set flags {}
foreach c $commits {
if {[string match "^*" $c]} {
lappend neg $c
- } else {
+ } elseif {[regexp {^[0-9a-fA-F]{40}$} $c]} {
if {!([info exists varcid($view,$c)] ||
[lsearch -exact $viewincl($view) $c] >= 0)} {
lappend pos $c
}
+ } else {
+ lappend flags $c
}
}
if {$pos eq {}} {
set viewincl($view) [concat $viewincl($view) $pos]
if {[catch {
set fd [open [concat | git log --no-color -z --pretty=raw --parents \
- --boundary $pos $neg "--" $viewfiles($view)] r]
+ --boundary $pos $neg $flags "--" $viewfiles($view)] r]
} err]} {
error_popup "Error executing git log: $err"
exit 1
proc reloadcommits {} {
global curview viewcomplete selectedline currentid thickerline
global showneartags treediffs commitinterest cached_commitrow
- global progresscoords
+ global progresscoords targetid
if {!$viewcomplete($curview)} {
stop_rev_list $curview
clear_display
catch {unset commitinterest}
catch {unset cached_commitrow}
+ catch {unset targetid}
setcanvscroll
getcommits
}
set tok $oldtok
}
set ka 0
- if {[llength $children($v,$id)] > 0} {
- set kid [lindex $children($v,$id) end]
+ set kid [last_real_child $v,$id]
+ if {$kid ne {}} {
set k $varcid($v,$kid)
if {[string compare [lindex $varctok($v) $k] $tok] > 0} {
set ki $kid
proc insertrow {id p v} {
global varcid varccommits parents children cmitlisted
- global commitidx varctok vtokmod
+ global commitidx varctok vtokmod targetid targetrow
set a $varcid($v,$p)
set i [lsearch -exact $varccommits($v,$a) $p]
if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {
modify_arc $v $a $i
}
+ if {[info exists targetid]} {
+ if {![comes_before $targetid $p]} {
+ incr targetrow
+ }
+ }
drawvisible
}
proc removerow {id v} {
global varcid varccommits parents children commitidx
global varctok vtokmod cmitlisted currentid selectedline
+ global targetid
if {[llength $parents($v,$id)] != 1} {
puts "oops: removerow [shortids $id] has [llength $parents($v,$id)] parents"
unset currentid
unset selectedline
}
+ if {[info exists targetid] && $targetid eq $id} {
+ set targetid $p
+ }
drawvisible
}
+proc first_real_child {vp} {
+ global children nullid nullid2
+
+ foreach id $children($vp) {
+ if {$id ne $nullid && $id ne $nullid2} {
+ return $id
+ }
+ }
+ return {}
+}
+
+proc last_real_child {vp} {
+ global children nullid nullid2
+
+ set kids $children($vp)
+ for {set i [llength $kids]} {[incr i -1] >= 0} {} {
+ set id [lindex $kids $i]
+ if {$id ne $nullid && $id ne $nullid2} {
+ return $id
+ }
+ }
+ return {}
+}
+
proc vtokcmp {v a b} {
global varctok varcid
proc modify_arc {v a {lim {}}} {
global varctok vtokmod varcmod varcrow vupptr curview vrowmod varccommits
- global vhighlights nhighlights fhighlights rhighlights
set vtokmod($v) [lindex $varctok($v) $a]
set varcmod($v) $a
set vrowmod($v) $r
undolayout $r
}
- catch {unset nhighlights}
- catch {unset fhighlights}
- catch {unset vhighlights}
- catch {unset rhighlights}
}
proc update_arcrows {v} {
return $i
}
+# Returns 1 if a is on an earlier row than b, otherwise 0
+proc comes_before {a b} {
+ global varcid varctok curview
+
+ set v $curview
+ if {$a eq $b || ![info exists varcid($v,$a)] || \
+ ![info exists varcid($v,$b)]} {
+ return 0
+ }
+ if {$varcid($v,$a) != $varcid($v,$b)} {
+ return [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \
+ [lindex $varctok($v) $varcid($v,$b)]] < 0}]
+ }
+ return [expr {[rowofcommit $a] < [rowofcommit $b]}]
+}
+
proc bsearch {l elt} {
if {[llength $l] == 0 || $elt <= [lindex $l 0]} {
return 0
return $confirm_ok
}
+proc setoptions {} {
+ option add *Panedwindow.showHandle 1 startupFile
+ option add *Panedwindow.sashRelief raised startupFile
+ option add *Button.font uifont startupFile
+ option add *Checkbutton.font uifont startupFile
+ option add *Radiobutton.font uifont startupFile
+ option add *Menu.font uifont startupFile
+ option add *Menubutton.font uifont startupFile
+ option add *Label.font uifont startupFile
+ option add *Message.font uifont startupFile
+ option add *Entry.font uifont startupFile
+}
+
proc makewindow {} {
global canv canv2 canv3 linespc charspc ctext cflist cscroll
global tabstop
menu .bar
.bar add cascade -label [mc "File"] -menu .bar.file
- .bar configure -font uifont
menu .bar.file
.bar.file add command -label [mc "Update"] -command updatecommits
.bar.file add command -label [mc "Reload"] -command reloadcommits
.bar.file add command -label [mc "Reread references"] -command rereadrefs
.bar.file add command -label [mc "List references"] -command showrefs
.bar.file add command -label [mc "Quit"] -command doquit
- .bar.file configure -font uifont
menu .bar.edit
.bar add cascade -label [mc "Edit"] -menu .bar.edit
.bar.edit add command -label [mc "Preferences"] -command doprefs
- .bar.edit configure -font uifont
- menu .bar.view -font uifont
+ menu .bar.view
.bar add cascade -label [mc "View"] -menu .bar.view
.bar.view add command -label [mc "New view..."] -command {newview 0}
.bar.view add command -label [mc "Edit view..."] -command editview \
.bar add cascade -label [mc "Help"] -menu .bar.help
.bar.help add command -label [mc "About gitk"] -command about
.bar.help add command -label [mc "Key bindings"] -command keys
- .bar.help configure -font uifont
+ .bar.help configure
. configure -menu .bar
# the gui has upper and lower half, parts of a paned window.
set entries $sha1entry
set sha1but .tf.bar.sha1label
button $sha1but -text [mc "SHA1 ID: "] -state disabled -relief flat \
- -command gotocommit -width 8 -font uifont
+ -command gotocommit -width 8
$sha1but conf -disabledforeground [$sha1but cget -foreground]
pack .tf.bar.sha1label -side left
entry $sha1entry -width 40 -font textfont -textvariable sha1string
# Status label and progress bar
set statusw .tf.bar.status
- label $statusw -width 15 -relief sunken -font uifont
+ label $statusw -width 15 -relief sunken
pack $statusw -side left -padx 5
set h [expr {[font metrics uifont -linespace] + 2}]
set progresscanv .tf.bar.progress
set progupdatepending 0
# build up the bottom bar of upper window
- label .tf.lbar.flabel -text "[mc "Find"] " -font uifont
- button .tf.lbar.fnext -text [mc "next"] -command {dofind 1 1} -font uifont
- button .tf.lbar.fprev -text [mc "prev"] -command {dofind -1 1} -font uifont
- label .tf.lbar.flab2 -text " [mc "commit"] " -font uifont
+ label .tf.lbar.flabel -text "[mc "Find"] "
+ button .tf.lbar.fnext -text [mc "next"] -command {dofind 1 1}
+ button .tf.lbar.fprev -text [mc "prev"] -command {dofind -1 1}
+ label .tf.lbar.flab2 -text " [mc "commit"] "
pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \
-side left -fill y
set gdttype [mc "containing:"]
[mc "touching paths:"] \
[mc "adding/removing string:"]]
trace add variable gdttype write gdttype_change
- $gm conf -font uifont
- .tf.lbar.gdttype conf -font uifont
pack .tf.lbar.gdttype -side left -fill y
set findstring {}
set findtypemenu [tk_optionMenu .tf.lbar.findtype \
findtype [mc "Exact"] [mc "IgnCase"] [mc "Regexp"]]
trace add variable findtype write findcom_change
- .tf.lbar.findtype configure -font uifont
- .tf.lbar.findtype.menu configure -font uifont
set findloc [mc "All fields"]
tk_optionMenu .tf.lbar.findloc findloc [mc "All fields"] [mc "Headline"] \
[mc "Comments"] [mc "Author"] [mc "Committer"]
trace add variable findloc write find_change
- .tf.lbar.findloc configure -font uifont
- .tf.lbar.findloc.menu configure -font uifont
pack .tf.lbar.findloc -side right
pack .tf.lbar.findtype -side right
pack $fstring -side left -expand 1 -fill x
frame .bleft.top
frame .bleft.mid
- button .bleft.top.search -text [mc "Search"] -command dosearch \
- -font uifont
+ button .bleft.top.search -text [mc "Search"] -command dosearch
pack .bleft.top.search -side left -padx 5
set sstring .bleft.top.sstring
entry $sstring -width 20 -font textfont -textvariable searchstring
lappend entries $sstring
trace add variable searchstring write incrsearch
pack $sstring -side left -expand 1 -fill x
- radiobutton .bleft.mid.diff -text [mc "Diff"] -font uifont \
+ radiobutton .bleft.mid.diff -text [mc "Diff"] \
-command changediffdisp -variable diffelide -value {0 0}
- radiobutton .bleft.mid.old -text [mc "Old version"] -font uifont \
+ radiobutton .bleft.mid.old -text [mc "Old version"] \
-command changediffdisp -variable diffelide -value {0 1}
- radiobutton .bleft.mid.new -text [mc "New version"] -font uifont \
+ radiobutton .bleft.mid.new -text [mc "New version"] \
-command changediffdisp -variable diffelide -value {1 0}
- label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " \
- -font uifont
+ label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: "
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
spinbox .bleft.mid.diffcontext -width 5 -font textfont \
-from 1 -increment 1 -to 10000000 \
frame .bright.mode
radiobutton .bright.mode.patch -text [mc "Patch"] \
-command reselectline -variable cmitmode -value "patch"
- .bright.mode.patch configure -font uifont
radiobutton .bright.mode.tree -text [mc "Tree"] \
-command reselectline -variable cmitmode -value "tree"
- .bright.mode.tree configure -font uifont
grid .bright.mode.patch .bright.mode.tree -sticky ew
pack .bright.mode -side top -fill x
set cflist .bright.cfiles
Use and redistribute under the terms of the GNU General Public License"] \
-justify center -aspect 400 -border 2 -bg white -relief groove
pack $w.m -side top -fill x -padx 2 -pady 2
- $w.m configure -font uifont
button $w.ok -text [mc "Close"] -command "destroy $w" -default active
pack $w.ok -side bottom
- $w.ok configure -font uifont
bind $w <Visibility> "focus $w.ok"
bind $w <Key-Escape> "destroy $w"
bind $w <Key-Return> "destroy $w"
}
proc keys {} {
- global uifont
set w .keys
if {[winfo exists $w]} {
raise $w
"] \
-justify left -bg white -border 2 -relief groove
pack $w.m -side top -fill both -padx 2 -pady 2
- $w.m configure -font uifont
button $w.ok -text [mc "Close"] -command "destroy $w" -default active
pack $w.ok -side bottom
- $w.ok configure -font uifont
bind $w <Visibility> "focus $w.ok"
bind $w <Key-Escape> "destroy $w"
bind $w <Key-Return> "destroy $w"
# Code to implement multiple views
proc newview {ishighlight} {
- global nextviewnum newviewname newviewperm uifont newishighlight
+ global nextviewnum newviewname newviewperm newishighlight
global newviewargs revtreeargs
set newishighlight $ishighlight
}
proc vieweditor {top n title} {
- global newviewname newviewperm viewfiles
- global uifont
+ global newviewname newviewperm viewfiles bgcolor
toplevel $top
wm title $top $title
- label $top.nl -text [mc "Name"] -font uifont
- entry $top.name -width 20 -textvariable newviewname($n) -font uifont
+ label $top.nl -text [mc "Name"]
+ entry $top.name -width 20 -textvariable newviewname($n)
grid $top.nl $top.name -sticky w -pady 5
- checkbutton $top.perm -text [mc "Remember this view"] -variable newviewperm($n) \
- -font uifont
+ checkbutton $top.perm -text [mc "Remember this view"] \
+ -variable newviewperm($n)
grid $top.perm - -pady 5 -sticky w
- message $top.al -aspect 1000 -font uifont \
+ message $top.al -aspect 1000 \
-text [mc "Commits to include (arguments to git rev-list):"]
grid $top.al - -sticky w -pady 5
entry $top.args -width 50 -textvariable newviewargs($n) \
- -background white -font uifont
+ -background $bgcolor
grid $top.args - -sticky ew -padx 5
- message $top.l -aspect 1000 -font uifont \
+ message $top.l -aspect 1000 \
-text [mc "Enter files and directories to include, one per line:"]
grid $top.l - -sticky w
- text $top.t -width 40 -height 10 -background white -font uifont
+ text $top.t -width 40 -height 10 -background $bgcolor -font uifont
if {[info exists viewfiles($n)]} {
foreach f $viewfiles($n) {
$top.t insert end $f
}
grid $top.t - -sticky ew -padx 5
frame $top.buts
- button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] \
- -font uifont
- button $top.buts.can -text [mc "Cancel"] -command [list destroy $top] \
- -font uifont
+ button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n]
+ button $top.buts.can -text [mc "Cancel"] -command [list destroy $top]
grid $top.buts.ok $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
# Stuff relating to the highlighting facility
-proc ishighlighted {row} {
+proc ishighlighted {id} {
global vhighlights fhighlights nhighlights rhighlights
- if {[info exists nhighlights($row)] && $nhighlights($row) > 0} {
- return $nhighlights($row)
+ if {[info exists nhighlights($id)] && $nhighlights($id) > 0} {
+ return $nhighlights($id)
}
- if {[info exists vhighlights($row)] && $vhighlights($row) > 0} {
- return $vhighlights($row)
+ if {[info exists vhighlights($id)] && $vhighlights($id) > 0} {
+ return $vhighlights($id)
}
- if {[info exists fhighlights($row)] && $fhighlights($row) > 0} {
- return $fhighlights($row)
+ if {[info exists fhighlights($id)] && $fhighlights($id) > 0} {
+ return $fhighlights($id)
}
- if {[info exists rhighlights($row)] && $rhighlights($row) > 0} {
- return $rhighlights($row)
+ if {[info exists rhighlights($id)] && $rhighlights($id) > 0} {
+ return $rhighlights($id)
}
return 0
}
set stillbold {}
foreach row $boldrows {
- if {![ishighlighted $row]} {
+ if {![ishighlighted [commitonrow $row]]} {
bolden $row mainfont
} else {
lappend stillbold $row
}
proc addvhighlight {n} {
- global hlview viewcomplete curview vhl_done vhighlights commitidx
+ global hlview viewcomplete curview vhl_done commitidx
if {[info exists hlview]} {
delvhighlight
if {![highlighted $row]} {
bolden $row mainfontbold
}
- set vhighlights($row) 1
+ set vhighlights($id) 1
}
}
}
global hlview vhighlights iddrawn
if {[commitinview $id $hlview]} {
- if {[info exists iddrawn($id)] && ![ishighlighted $row]} {
+ if {[info exists iddrawn($id)] && ![ishighlighted $id]} {
bolden $row mainfontbold
}
- set vhighlights($row) 1
+ set vhighlights($id) 1
} else {
- set vhighlights($row) 0
+ set vhighlights($id) 0
}
}
global filehighlight fhighlights fhl_list
lappend fhl_list $id
- set fhighlights($row) -1
+ set fhighlights($id) -1
puts $filehighlight $id
}
if {$i < 0} continue
for {set j 0} {$j < $i} {incr j} {
set id [lindex $fhl_list $j]
- if {[commitinview $id $curview]} {
- set fhighlights([rowofcommit $id]) 0
- }
+ set fhighlights($id) 0
}
set fhl_list [lrange $fhl_list [expr {$i+1}] end]
if {$line eq {}} continue
if {![commitinview $line $curview]} continue
set row [rowofcommit $line]
- if {[info exists iddrawn($line)] && ![ishighlighted $row]} {
+ if {[info exists iddrawn($line)] && ![ishighlighted $line]} {
bolden $row mainfontbold
}
- set fhighlights($row) 1
+ set fhighlights($line) 1
}
if {[eof $filehighlight]} {
# strange...
}
}
if {$isbold && [info exists iddrawn($id)]} {
- if {![ishighlighted $row]} {
+ if {![ishighlighted $id]} {
bolden $row mainfontbold
if {$isbold > 1} {
bolden_name $row mainfontbold
markrowmatches $row $id
}
}
- set nhighlights($row) $isbold
+ set nhighlights($id) $isbold
}
proc markrowmatches {row id} {
# prepare for testing whether commits are descendents or ancestors of a
proc rhighlight_sel {a} {
global descendent desc_todo ancestor anc_todo
- global highlight_related rhighlights
+ global highlight_related
catch {unset descendent}
set desc_todo [list $a]
}
}
if {[info exists iddrawn($id)]} {
- if {$isbold && ![ishighlighted $row]} {
+ if {$isbold && ![ishighlighted $id]} {
bolden $row mainfontbold
}
}
- set rhighlights($row) $isbold
+ set rhighlights($id) $isbold
}
# Graph layout functions
set tok $ordertok($p)
break
}
- if {[llength $children($curview,$p)] == 0} {
+ set id [first_real_child $curview,$p]
+ if {$id eq {}} {
# it's a root
set tok [lindex $varctok($curview) $a]
break
}
- set id [lindex $children($curview,$p) 0]
- if {$id eq $nullid || $id eq $nullid2} {
- # XXX treat it as a root
- set tok [lindex $varctok($curview) $a]
- break
- }
if {[llength $parents($curview,$id)] == 1} {
lappend todo [list $p {}]
} else {
set date [formatdate $date]
set font mainfont
set nfont mainfont
- set isbold [ishighlighted $row]
+ set isbold [ishighlighted $id]
if {$isbold > 0} {
lappend boldrows $row
set font mainfontbold
if {$row >= $numcommits} return
set id [lindex $displayorder $row]
- if {[info exists hlview] && ![info exists vhighlights($row)]} {
+ if {[info exists hlview] && ![info exists vhighlights($id)]} {
askvhighlight $row $id
}
- if {[info exists filehighlight] && ![info exists fhighlights($row)]} {
+ if {[info exists filehighlight] && ![info exists fhighlights($id)]} {
askfilehighlight $row $id
}
- if {$findpattern ne {} && ![info exists nhighlights($row)]} {
+ if {$findpattern ne {} && ![info exists nhighlights($id)]} {
askfindhighlight $row $id
}
- if {$highlight_related ne [mc "None"] && ![info exists rhighlights($row)]} {
+ if {$highlight_related ne [mc "None"] && ![info exists rhighlights($id)]} {
askrelhighlight $row $id
}
if {![info exists iddrawn($id)]} {
proc drawvisible {} {
global canv linespc curview vrowmod selectedline targetrow targetid
- global need_redisplay cscroll
+ global need_redisplay cscroll numcommits
set fs [$canv yview]
set ymax [lindex [$canv cget -scrollregion] 3]
set y1 [expr {int($f1 * $ymax)}]
if {[info exists targetid]} {
- set r [rowofcommit $targetid]
- if {$r != $targetrow} {
- # Fix up the scrollregion and change the scrolling position
- # now that our target row has moved.
- set diff [expr {($r - $targetrow) * $linespc}]
- set targetrow $r
- setcanvscroll
- set ymax [lindex [$canv cget -scrollregion] 3]
- incr y0 $diff
- incr y1 $diff
- set f0 [expr {$y0 / $ymax}]
- set f1 [expr {$y1 / $ymax}]
- allcanvs yview moveto $f0
- $cscroll set $f0 $f1
- set need_redisplay 1
+ if {[commitinview $targetid $curview]} {
+ set r [rowofcommit $targetid]
+ if {$r != $targetrow} {
+ # Fix up the scrollregion and change the scrolling position
+ # now that our target row has moved.
+ set diff [expr {($r - $targetrow) * $linespc}]
+ set targetrow $r
+ setcanvscroll
+ set ymax [lindex [$canv cget -scrollregion] 3]
+ incr y0 $diff
+ incr y1 $diff
+ set f0 [expr {$y0 / $ymax}]
+ set f1 [expr {$y1 / $ymax}]
+ allcanvs yview moveto $f0
+ $cscroll set $f0 $f1
+ set need_redisplay 1
+ }
+ } else {
+ unset targetid
}
}
} else {
set targetrow [expr {int(($row + $endrow) / 2)}]
}
+ if {$targetrow >= $numcommits} {
+ set targetrow [expr {$numcommits - 1}]
+ }
set targetid [commitonrow $targetrow]
drawcommits $row $endrow
}
global commitdata commitinfo numcommits findpattern findloc
global findstartline findcurline findallowwrap
global find_dirn gdttype fhighlights fprogcoord
- global curview varcorder vrownum varccommits
+ global curview varcorder vrownum varccommits vrowmod
if {![info exists find_dirn]} {
return 0
set n 500
set moretodo 1
}
+ if {$l + ($find_dirn > 0? $n: 1) > $vrowmod($curview)} {
+ update_arcrows $curview
+ }
set found 0
set domore 1
set ai [bsearch $vrownum($curview) $l]
set arowend [expr {$arow + [llength $ids]}]
}
set id [lindex $ids [expr {$l - $arow}]]
- if {![info exists fhighlights($l)]} {
+ if {![info exists fhighlights($id)]} {
+ # this sets fhighlights($id) to -1
askfilehighlight $l $id
+ }
+ if {$fhighlights($id) > 0} {
+ set found $domore
+ break
+ }
+ if {$fhighlights($id) < 0} {
if {$domore} {
set domore 0
set findcurline [expr {$l - $find_dirn}]
}
- } elseif {$fhighlights($l)} {
- set found $domore
- break
}
}
}
grid $top.list $top.ysb -sticky nsew
grid $top.xsb x -sticky ew
frame $top.f
- label $top.f.l -text "[mc "Filter"]: " -font uifont
- entry $top.f.e -width 20 -textvariable reflistfilter -font uifont
+ label $top.f.l -text "[mc "Filter"]: "
+ entry $top.f.e -width 20 -textvariable reflistfilter
set reflistfilter "*"
trace add variable reflistfilter write reflistfilter_change
pack $top.f.e -side right -fill x -expand 1
pack $top.f.l -side left
grid $top.f - -sticky ew -pady 2
- button $top.close -command [list destroy $top] -text [mc "Close"] \
- -font uifont
+ button $top.close -command [list destroy $top] -text [mc "Close"]
grid $top.close -
grid columnconfigure $top 0 -weight 1
grid rowconfigure $top 0 -weight 1
eval font config sample [font actual $font]
toplevel $top
wm title $top [mc "Gitk font chooser"]
- label $top.l -textvariable fontparam(which) -font uifont
+ label $top.l -textvariable fontparam(which)
pack $top.l -side top
set fontlist [lsort [font families]]
frame $top.f
bind $top.c <Configure> [list centertext $top.c]
pack $top.c -side top -fill x
frame $top.buts
- button $top.buts.ok -text [mc "OK"] -command fontok -default active \
- -font uifont
- button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal \
- -font uifont
+ button $top.buts.ok -text [mc "OK"] -command fontok -default active
+ button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal
grid $top.buts.ok $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
global maxwidth maxgraphpct
global oldprefs prefstop showneartags showlocalchanges
global bgcolor fgcolor ctext diffcolors selectbgcolor
- global uifont tabstop limitdiffs
+ global tabstop limitdiffs
set top .gitkprefs
set prefstop $top
toplevel $top
wm title $top [mc "Gitk preferences"]
label $top.ldisp -text [mc "Commit list display options"]
- $top.ldisp configure -font uifont
grid $top.ldisp - -sticky w -pady 10
label $top.spacer -text " "
label $top.maxwidthl -text [mc "Maximum graph width (lines)"] \
grid x $top.showlocal -sticky w
label $top.ddisp -text [mc "Diff display options"]
- $top.ddisp configure -font uifont
grid $top.ddisp - -sticky w -pady 10
label $top.tabstopl -text [mc "Tab spacing"] -font optionfont
spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
grid x $top.ldiff -sticky w
label $top.cdisp -text [mc "Colors: press to choose"]
- $top.cdisp configure -font uifont
grid $top.cdisp - -sticky w -pady 10
label $top.bg -padx 40 -relief sunk -background $bgcolor
button $top.bgbut -text [mc "Background"] -font optionfont \
grid x $top.selbgbut $top.selbgsep -sticky w
label $top.cfont -text [mc "Fonts: press to choose"]
- $top.cfont configure -font uifont
grid $top.cfont - -sticky w -pady 10
mkfontdisp mainfont $top [mc "Main font"]
mkfontdisp textfont $top [mc "Diff display font"]
frame $top.buts
button $top.buts.ok -text [mc "OK"] -command prefsok -default active
- $top.buts.ok configure -font uifont
button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal
- $top.buts.can configure -font uifont
grid $top.buts.ok $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
parsefont uifont $uifont
eval font create uifont [fontflags uifont]
+setoptions
+
# check that we can find a .git directory somewhere...
if {[catch {set gitdir [gitdir]}]} {
show_error {} . [mc "Cannot find a git repository here."]