global mainheadid viewmainheadid viewmainheadid_orig pending_select
global hasworktree
global varcid vposids vnegids vflags vrevs
- global show_notes
+ global hashlength
set hasworktree [hasworktree]
rereadrefs
global headctxmenu progresscanv progressitem progresscoords statusw
global fprogitem fprogcoord lastprogupdate progupdatepending
global rprogitem rprogcoord rownumsel numcommits
- global have_tk85 have_tk86 use_ttk NS
- global git_version
global worddiff
- global hashlength
- global scroll_D0
++ global hashlength scroll_D0
# The "mc" arguments here are purely so that xgettext
# sees the following string as needing to be translated
-command gotocommit -width 8
$sha1but conf -disabledforeground [$sha1but cget -foreground]
pack .tf.bar.sha1label -side left
- ${NS}::entry $sha1entry -width $hashlength -font textfont -textvariable sha1string
- ttk::entry $sha1entry -width 40 -font textfont -textvariable sha1string
++ ttk::entry $sha1entry -width $hashlength -font textfont -textvariable sha1string
trace add variable sha1string write sha1change
pack $sha1entry -side left -pady 2
}
proc mkpatch {} {
- global rowmenuid currentid commitinfo patchtop patchnum NS
+ global rowmenuid currentid commitinfo patchtop patchnum
+ global hashlength
if {![info exists currentid]} return
set oldid $currentid
catch {destroy $top}
ttk_toplevel $top
make_transient $top .
- ${NS}::label $top.title -text [mc "Generate patch"]
+ ttk::label $top.title -text [mc "Generate patch"]
grid $top.title - -pady 10
- ${NS}::label $top.from -text [mc "From:"]
- ${NS}::entry $top.fromsha1 -width $hashlength
+ ttk::label $top.from -text [mc "From:"]
- ttk::entry $top.fromsha1 -width 40
++ ttk::entry $top.fromsha1 -width $hashlength
$top.fromsha1 insert 0 $oldid
$top.fromsha1 conf -state readonly
grid $top.from $top.fromsha1 -sticky w
$top.fromhead insert 0 $oldhead
$top.fromhead conf -state readonly
grid x $top.fromhead -sticky w
- ${NS}::label $top.to -text [mc "To:"]
- ${NS}::entry $top.tosha1 -width $hashlength
+ ttk::label $top.to -text [mc "To:"]
- ttk::entry $top.tosha1 -width 40
++ ttk::entry $top.tosha1 -width $hashlength
$top.tosha1 insert 0 $newid
$top.tosha1 conf -state readonly
grid $top.to $top.tosha1 -sticky w
}
proc mktag {} {
- global rowmenuid mktagtop commitinfo NS
+ global rowmenuid mktagtop commitinfo
+ global hashlength
set top .maketag
set mktagtop $top
catch {destroy $top}
ttk_toplevel $top
make_transient $top .
- ${NS}::label $top.title -text [mc "Create tag"]
+ ttk::label $top.title -text [mc "Create tag"]
grid $top.title - -pady 10
- ${NS}::label $top.id -text [mc "ID:"]
- ${NS}::entry $top.sha1 -width $hashlength
+ ttk::label $top.id -text [mc "ID:"]
- ttk::entry $top.sha1 -width 40
++ ttk::entry $top.sha1 -width $hashlength
$top.sha1 insert 0 $rowmenuid
$top.sha1 conf -state readonly
grid $top.id $top.sha1 -sticky w
}
proc writecommit {} {
- global rowmenuid wrcomtop commitinfo wrcomcmd NS
+ global rowmenuid wrcomtop commitinfo wrcomcmd
+ global hashlength
set top .writecommit
set wrcomtop $top
catch {destroy $top}
ttk_toplevel $top
make_transient $top .
- ${NS}::label $top.title -text [mc "Write commit to file"]
+ ttk::label $top.title -text [mc "Write commit to file"]
grid $top.title - -pady 10
- ${NS}::label $top.id -text [mc "ID:"]
- ${NS}::entry $top.sha1 -width $hashlength
+ ttk::label $top.id -text [mc "ID:"]
- ttk::entry $top.sha1 -width 40
++ ttk::entry $top.sha1 -width $hashlength
$top.sha1 insert 0 $rowmenuid
$top.sha1 conf -state readonly
grid $top.id $top.sha1 -sticky w
}
proc branchdia {top valvar uivar} {
- global NS commitinfo
+ global commitinfo
+ global hashlength
upvar $valvar val $uivar ui
catch {destroy $top}
ttk_toplevel $top
make_transient $top .
- ${NS}::label $top.title -text $ui(title)
+ ttk::label $top.title -text $ui(title)
grid $top.title - -pady 10
- ${NS}::label $top.id -text [mc "ID:"]
- ${NS}::entry $top.sha1 -width $hashlength
+ ttk::label $top.id -text [mc "ID:"]
- ttk::entry $top.sha1 -width 40
++ ttk::entry $top.sha1 -width $hashlength
$top.sha1 insert 0 $val(id)
$top.sha1 conf -state readonly
grid $top.id $top.sha1 -sticky w
$top.head conf -state readonly
grid x $top.head -sticky ew
grid columnconfigure $top 1 -weight 1
- ${NS}::label $top.nlab -text [mc "Name:"]
- ${NS}::entry $top.name -width $hashlength
+ ttk::label $top.nlab -text [mc "Name:"]
- ttk::entry $top.name -width 40
++ ttk::entry $top.name -width $hashlength
$top.name insert 0 $val(name)
grid $top.nlab $top.name -sticky w
- ${NS}::frame $top.buts
- ${NS}::button $top.buts.go -text $ui(accept) -command $val(command)
- ${NS}::button $top.buts.can -text [mc "Cancel"] -command "catch {destroy $top}"
+ ttk::frame $top.buts
+ ttk::button $top.buts.go -text $ui(accept) -command $val(command)
+ ttk::button $top.buts.can -text [mc "Cancel"] -command "catch {destroy $top}"
bind $top <Key-Return> $val(command)
bind $top <Key-Escape> "catch {destroy $top}"
grid $top.buts.go $top.buts.can
pack $top.f.e -side right -fill x -expand 1
pack $top.f.l -side left
grid $top.f - -sticky ew -pady 2
- ${NS}::checkbutton $top.sort -text [mc "Sort refs by type"] \
++ ttk::checkbutton $top.sort -text [mc "Sort refs by type"] \
+ -variable sortrefsbytype -command {refill_reflist}
+ grid $top.sort - -sticky w -pady 2
- ${NS}::button $top.close -command [list destroy $top] -text [mc "Close"]
+ ttk::button $top.close -command [list destroy $top] -text [mc "Close"]
bind $top <Key-Escape> [list destroy $top]
grid $top.close -
grid columnconfigure $top 0 -weight 1
}
}
- if {[package vsatisfies [package provide Tk] 8.6]} {
- # In Tk 8.6 we have a native font chooser dialog. Overwrite the above
- # function to make use of it.
- proc choosefont {font which} {
- tk fontchooser configure -title $which -font $font \
- -command [list on_choosefont $font $which]
- tk fontchooser show
- }
- proc on_choosefont {font which newfont} {
- global fontparam
- array set f [font actual $newfont]
- set fontparam(which) $which
- set fontparam(font) $font
- set fontparam(family) $f(-family)
- set fontparam(size) $f(-size)
- set fontparam(weight) $f(-weight)
- set fontparam(slant) $f(-slant)
- fontok
- }
+ proc choosefont {font which} {
+ tk fontchooser configure -title $which -font $font \
+ -command [list on_choosefont $font $which]
+ tk fontchooser show
+ }
+ proc on_choosefont {font which newfont} {
+ global fontparam
- puts stderr "$font $newfont"
+ array set f [font actual $newfont]
+ set fontparam(which) $which
+ set fontparam(font) $font
+ set fontparam(family) $f(-family)
+ set fontparam(size) $f(-size)
+ set fontparam(weight) $f(-weight)
+ set fontparam(slant) $f(-slant)
+ fontok
}
proc selfontfam {} {
}
proc prefspage_general {notebook} {
- global NS maxwidth maxgraphpct showneartags showlocalchanges
- global tabstop wrapcomment wrapdefault limitdiffs
- global autocopy autoselect autosellen extdifftool perfile_attrs
- global hideremotes want_ttk have_ttk maxrefs web_browser
+ global {*}$::config_variables
+ global hashlength
set page [create_prefs_page $notebook.general]
-variable autoselect
grid x $page.autoselect -sticky w
}
- spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
+
+ spinbox $page.autosellen -from 1 -to $hashlength -width 4 -textvariable autosellen
- ${NS}::label $page.autosellenl -text [mc "Length of commit ID to copy"]
+ ttk::label $page.autosellenl -text [mc "Length of commit ID to copy"]
grid x $page.autosellenl $page.autosellen -sticky w
+ ttk::label $page.kscroll1 -text [mc "Wheel scrolling multiplier"]
+ spinbox $page.kscroll -from 1 -to 20 -width 4 -textvariable kscroll
+ grid x $page.kscroll1 $page.kscroll -sticky w
- ${NS}::label $page.ddisp -text [mc "Diff display options"] -font mainfontbold
+ ttk::label $page.ddisp -text [mc "Diff display options"] -font mainfontbold
grid $page.ddisp - -sticky w -pady 10
- ${NS}::label $page.tabstopl -text [mc "Tab spacing"]
+ ttk::label $page.tabstopl -text [mc "Tab spacing"]
spinbox $page.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
grid x $page.tabstopl $page.tabstop -sticky w
set datetimeformat "%Y-%m-%d %H:%M:%S"
set autocopy 0
set autoselect 1
-set autosellen 40
+set autosellen $hashlength
set perfile_attrs 0
- set want_ttk 1
if {[tk windowingsystem] eq "aqua"} {
set extdifftool "opendiff"
config_check_tmp_exists 50
set config_variables {
- mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth
- cmitmode wrapcomment wrapdefault autocopy autoselect autosellen
- showneartags maxrefs visiblerefs
- hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk
- bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors
- markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor
- extdifftool perfile_attrs headbgcolor headfgcolor headoutlinecolor
- remotebgcolor tagbgcolor tagfgcolor tagoutlinecolor reflinecolor
- filesepbgcolor filesepfgcolor linehoverbgcolor linehoverfgcolor
- linehoveroutlinecolor mainheadcirclecolor workingfilescirclecolor
- indexcirclecolor circlecolors linkfgcolor circleoutlinecolor diffbgcolors
- sortrefsbytype web_browser
+ autocopy
+ autoselect
+ autosellen
+ bgcolor
+ circlecolors
+ circleoutlinecolor
+ cmitmode
+ colors
+ currentsearchhitbgcolor
+ datetimeformat
+ diffbgcolors
+ diffcolors
+ diffcontext
+ extdifftool
+ fgcolor
+ filesepbgcolor
+ filesepfgcolor
+ findmergefiles
+ foundbgcolor
+ headbgcolor
+ headfgcolor
+ headoutlinecolor
+ hideremotes
+ indexcirclecolor
+ kscroll
+ limitdiffs
+ linehoverbgcolor
+ linehoverfgcolor
+ linehoveroutlinecolor
+ linkfgcolor
+ mainfont
+ mainheadcirclecolor
+ markbgcolor
+ maxgraphpct
+ maxrefs
+ maxwidth
+ mergecolors
+ perfile_attrs
+ reflinecolor
+ remotebgcolor
+ selectbgcolor
+ showlocalchanges
+ showneartags
++ sortrefsbytype
+ tabstop
+ tagbgcolor
+ tagfgcolor
+ tagoutlinecolor
+ textfont
+ uicolor
+ uifgcolor
+ uifgdisabledcolor
+ uifont
+ visiblerefs
+ web_browser
+ workingfilescirclecolor
+ wrapcomment
+ wrapdefault
}
+
foreach var $config_variables {
config_init_trace $var
trace add variable $var write config_variable_change_cb