summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a495e5a)
raw | patch | inline | side by side (parent: a495e5a)
author | Paul Mackerras <paulus@samba.org> | |
Sun, 6 Jan 2008 04:54:46 +0000 (15:54 +1100) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Sun, 6 Jan 2008 04:55:39 +0000 (15:55 +1100) |
The default options for panedwindows in Tk 8.5 make the sash
virtually invisible -- the handle is not shown and the relief is
flat. This puts the defaults back to showing the handle and a
raised relief on the sash, as in Tk 8.4.
This uses the option command to do this, and also uses the option
command to set the default font for various UI elements to the
UI font ("uifont").
Signed-off-by: Paul Mackerras <paulus@samba.org>
virtually invisible -- the handle is not shown and the relief is
flat. This puts the defaults back to showing the handle and a
raised relief on the sash, as in Tk 8.4.
This uses the option command to do this, and also uses the option
command to set the default font for various UI elements to the
UI font ("uifont").
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk | patch | blob | history |
index 684e6141ebb7c6363c7c1d279807144e8f961e4e..4a923afdf3198ef0086c30f1ae84fb6bdd606f5d 100755 (executable)
--- a/gitk
+++ b/gitk
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
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 "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
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 white
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
}
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
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."]