@@ -10782,6 +10782,139 @@ proc chg_fontparam {v sub op} {
1078210782 font config sample -$sub $fontparam($sub)
1078310783}
1078410784
10785+ # Create a property sheet tab page
10786+ proc create_prefs_page {w} {
10787+ global NS
10788+ set parent [join [lrange [split $w .] 0 end-1] .]
10789+ if {[winfo class $parent ] eq " TNotebook" } {
10790+ ${NS} ::frame $w
10791+ } else {
10792+ ${NS} ::labelframe $w
10793+ }
10794+ }
10795+
10796+ proc prefspage_general {notebook} {
10797+ global NS maxwidth maxgraphpct showneartags showlocalchanges
10798+ global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
10799+ global hideremotes want_ttk have_ttk
10800+
10801+ set page [create_prefs_page $notebook .general]
10802+
10803+ ${NS} ::label $page .ldisp -text [mc " Commit list display options" ]
10804+ grid $page .ldisp - -sticky w -pady 10
10805+ ${NS} ::label $page .spacer -text " "
10806+ ${NS} ::label $page .maxwidthl -text [mc " Maximum graph width (lines)" ]
10807+ spinbox $page .maxwidth -from 0 -to 100 -width 4 -textvariable maxwidth
10808+ grid $page .spacer $page .maxwidthl $page .maxwidth -sticky w
10809+ ${NS} ::label $page .maxpctl -text [mc " Maximum graph width (% of pane)" ]
10810+ spinbox $page .maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct
10811+ grid x $page .maxpctl $page .maxpct -sticky w
10812+ ${NS} ::checkbutton $page .showlocal -text [mc " Show local changes" ] \
10813+ -variable showlocalchanges
10814+ grid x $page .showlocal -sticky w
10815+ ${NS} ::checkbutton $page .autoselect -text [mc " Auto-select SHA1 (length)" ] \
10816+ -variable autoselect
10817+ spinbox $page .autosellen -from 1 -to 40 -width 4 -textvariable autosellen
10818+ grid x $page .autoselect $page .autosellen -sticky w
10819+ ${NS} ::checkbutton $page .hideremotes -text [mc " Hide remote refs" ] \
10820+ -variable hideremotes
10821+ grid x $page .hideremotes -sticky w
10822+
10823+ ${NS} ::label $page .ddisp -text [mc " Diff display options" ]
10824+ grid $page .ddisp - -sticky w -pady 10
10825+ ${NS} ::label $page .tabstopl -text [mc " Tab spacing" ]
10826+ spinbox $page .tabstop -from 1 -to 20 -width 4 -textvariable tabstop
10827+ grid x $page .tabstopl $page .tabstop -sticky w
10828+ ${NS} ::checkbutton $page .ntag -text [mc " Display nearby tags" ] \
10829+ -variable showneartags
10830+ grid x $page .ntag -sticky w
10831+ ${NS} ::checkbutton $page .ldiff -text [mc " Limit diffs to listed paths" ] \
10832+ -variable limitdiffs
10833+ grid x $page .ldiff -sticky w
10834+ ${NS} ::checkbutton $page .lattr -text [mc " Support per-file encodings" ] \
10835+ -variable perfile_attrs
10836+ grid x $page .lattr -sticky w
10837+
10838+ ${NS} ::entry $page .extdifft -textvariable extdifftool
10839+ ${NS} ::frame $page .extdifff
10840+ ${NS} ::label $page .extdifff.l -text [mc " External diff tool" ]
10841+ ${NS} ::button $page .extdifff.b -text [mc " Choose..." ] -command choose_extdiff
10842+ pack $page .extdifff.l $page .extdifff.b -side left
10843+ pack configure $page .extdifff.l -padx 10
10844+ grid x $page .extdifff $page .extdifft -sticky ew
10845+
10846+ ${NS} ::label $page .lgen -text [mc " General options" ]
10847+ grid $page .lgen - -sticky w -pady 10
10848+ ${NS} ::checkbutton $page .want_ttk -variable want_ttk \
10849+ -text [mc " Use themed widgets" ]
10850+ if {$have_ttk } {
10851+ ${NS} ::label $page .ttk_note -text [mc " (change requires restart)" ]
10852+ } else {
10853+ ${NS} ::label $page .ttk_note -text [mc " (currently unavailable)" ]
10854+ }
10855+ grid x $page .want_ttk $page .ttk_note -sticky w
10856+ return $page
10857+ }
10858+
10859+ proc prefspage_colors {notebook} {
10860+ global NS uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
10861+
10862+ set page [create_prefs_page $notebook .colors]
10863+
10864+ ${NS} ::label $page .cdisp -text [mc " Colors: press to choose" ]
10865+ grid $page .cdisp - -sticky w -pady 10
10866+ label $page .ui -padx 40 -relief sunk -background $uicolor
10867+ ${NS} ::button $page .uibut -text [mc " Interface" ] \
10868+ -command [list choosecolor uicolor {} $page .ui [mc " interface" ] setui]
10869+ grid x $page .uibut $page .ui -sticky w
10870+ label $page .bg -padx 40 -relief sunk -background $bgcolor
10871+ ${NS} ::button $page .bgbut -text [mc " Background" ] \
10872+ -command [list choosecolor bgcolor {} $page .bg [mc " background" ] setbg]
10873+ grid x $page .bgbut $page .bg -sticky w
10874+ label $page .fg -padx 40 -relief sunk -background $fgcolor
10875+ ${NS} ::button $page .fgbut -text [mc " Foreground" ] \
10876+ -command [list choosecolor fgcolor {} $page .fg [mc " foreground" ] setfg]
10877+ grid x $page .fgbut $page .fg -sticky w
10878+ label $page .diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]
10879+ ${NS} ::button $page .diffoldbut -text [mc " Diff: old lines" ] \
10880+ -command [list choosecolor diffcolors 0 $page .diffold [mc " diff old lines" ] \
10881+ [list $ctext tag conf d0 -foreground]]
10882+ grid x $page .diffoldbut $page .diffold -sticky w
10883+ label $page .diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]
10884+ ${NS} ::button $page .diffnewbut -text [mc " Diff: new lines" ] \
10885+ -command [list choosecolor diffcolors 1 $page .diffnew [mc " diff new lines" ] \
10886+ [list $ctext tag conf dresult -foreground]]
10887+ grid x $page .diffnewbut $page .diffnew -sticky w
10888+ label $page .hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]
10889+ ${NS} ::button $page .hunksepbut -text [mc " Diff: hunk header" ] \
10890+ -command [list choosecolor diffcolors 2 $page .hunksep \
10891+ [mc " diff hunk header" ] \
10892+ [list $ctext tag conf hunksep -foreground]]
10893+ grid x $page .hunksepbut $page .hunksep -sticky w
10894+ label $page .markbgsep -padx 40 -relief sunk -background $markbgcolor
10895+ ${NS} ::button $page .markbgbut -text [mc " Marked line bg" ] \
10896+ -command [list choosecolor markbgcolor {} $page .markbgsep \
10897+ [mc " marked line background" ] \
10898+ [list $ctext tag conf omark -background]]
10899+ grid x $page .markbgbut $page .markbgsep -sticky w
10900+ label $page .selbgsep -padx 40 -relief sunk -background $selectbgcolor
10901+ ${NS} ::button $page .selbgbut -text [mc " Select bg" ] \
10902+ -command [list choosecolor selectbgcolor {} $page .selbgsep [mc " background" ] setselbg]
10903+ grid x $page .selbgbut $page .selbgsep -sticky w
10904+ return $page
10905+ }
10906+
10907+ proc prefspage_fonts {notebook} {
10908+ global NS
10909+ set page [create_prefs_page $notebook .fonts]
10910+ ${NS} ::label $page .cfont -text [mc " Fonts: press to choose" ]
10911+ grid $page .cfont - -sticky w -pady 10
10912+ mkfontdisp mainfont $page [mc " Main font" ]
10913+ mkfontdisp textfont $page [mc " Diff display font" ]
10914+ mkfontdisp uifont $page [mc " User interface font" ]
10915+ return $page
10916+ }
10917+
1078510918proc doprefs {} {
1078610919 global maxwidth maxgraphpct use_ttk NS
1078710920 global oldprefs prefstop showneartags showlocalchanges
@@ -10802,106 +10935,37 @@ proc doprefs {} {
1080210935 ttk_toplevel $top
1080310936 wm title $top [mc " Gitk preferences" ]
1080410937 make_transient $top .
10805- ${NS} ::label $top .ldisp -text [mc " Commit list display options" ]
10806- grid $top .ldisp - -sticky w -pady 10
10807- ${NS} ::label $top .spacer -text " "
10808- ${NS} ::label $top .maxwidthl -text [mc " Maximum graph width (lines)" ]
10809- spinbox $top .maxwidth -from 0 -to 100 -width 4 -textvariable maxwidth
10810- grid $top .spacer $top .maxwidthl $top .maxwidth -sticky w
10811- ${NS} ::label $top .maxpctl -text [mc " Maximum graph width (% of pane)" ]
10812- spinbox $top .maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct
10813- grid x $top .maxpctl $top .maxpct -sticky w
10814- ${NS} ::checkbutton $top .showlocal -text [mc " Show local changes" ] \
10815- -variable showlocalchanges
10816- grid x $top .showlocal -sticky w
10817- ${NS} ::checkbutton $top .autoselect -text [mc " Auto-select SHA1 (length)" ] \
10818- -variable autoselect
10819- spinbox $top .autosellen -from 1 -to 40 -width 4 -textvariable autosellen
10820- grid x $top .autoselect $top .autosellen -sticky w
10821- ${NS} ::checkbutton $top .hideremotes -text [mc " Hide remote refs" ] \
10822- -variable hideremotes
10823- grid x $top .hideremotes -sticky w
10824-
10825- ${NS} ::label $top .ddisp -text [mc " Diff display options" ]
10826- grid $top .ddisp - -sticky w -pady 10
10827- ${NS} ::label $top .tabstopl -text [mc " Tab spacing" ]
10828- spinbox $top .tabstop -from 1 -to 20 -width 4 -textvariable tabstop
10829- grid x $top .tabstopl $top .tabstop -sticky w
10830- ${NS} ::checkbutton $top .ntag -text [mc " Display nearby tags" ] \
10831- -variable showneartags
10832- grid x $top .ntag -sticky w
10833- ${NS} ::checkbutton $top .ldiff -text [mc " Limit diffs to listed paths" ] \
10834- -variable limitdiffs
10835- grid x $top .ldiff -sticky w
10836- ${NS} ::checkbutton $top .lattr -text [mc " Support per-file encodings" ] \
10837- -variable perfile_attrs
10838- grid x $top .lattr -sticky w
10839-
10840- ${NS} ::entry $top .extdifft -textvariable extdifftool
10841- ${NS} ::frame $top .extdifff
10842- ${NS} ::label $top .extdifff.l -text [mc " External diff tool" ]
10843- ${NS} ::button $top .extdifff.b -text [mc " Choose..." ] -command choose_extdiff
10844- pack $top .extdifff.l $top .extdifff.b -side left
10845- pack configure $top .extdifff.l -padx 10
10846- grid x $top .extdifff $top .extdifft -sticky ew
10847-
10848- ${NS} ::label $top .lgen -text [mc " General options" ]
10849- grid $top .lgen - -sticky w -pady 10
10850- ${NS} ::checkbutton $top .want_ttk -variable want_ttk \
10851- -text [mc " Use themed widgets" ]
10852- if {$have_ttk } {
10853- ${NS} ::label $top .ttk_note -text [mc " (change requires restart)" ]
10938+
10939+ if {[set use_notebook [expr {$use_ttk && [info command ::ttk::notebook] ne " " }]]} {
10940+ set notebook [ttk::notebook $top .notebook]
1085410941 } else {
10855- ${NS} ::label $top .ttk_note -text [mc " (currently unavailable)" ]
10856- }
10857- grid x $top .want_ttk $top .ttk_note -sticky w
10858-
10859- ${NS} ::label $top .cdisp -text [mc " Colors: press to choose" ]
10860- grid $top .cdisp - -sticky w -pady 10
10861- label $top .ui -padx 40 -relief sunk -background $uicolor
10862- ${NS} ::button $top .uibut -text [mc " Interface" ] \
10863- -command [list choosecolor uicolor {} $top .ui [mc " interface" ] setui]
10864- grid x $top .uibut $top .ui -sticky w
10865- label $top .bg -padx 40 -relief sunk -background $bgcolor
10866- ${NS} ::button $top .bgbut -text [mc " Background" ] \
10867- -command [list choosecolor bgcolor {} $top .bg [mc " background" ] setbg]
10868- grid x $top .bgbut $top .bg -sticky w
10869- label $top .fg -padx 40 -relief sunk -background $fgcolor
10870- ${NS} ::button $top .fgbut -text [mc " Foreground" ] \
10871- -command [list choosecolor fgcolor {} $top .fg [mc " foreground" ] setfg]
10872- grid x $top .fgbut $top .fg -sticky w
10873- label $top .diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]
10874- ${NS} ::button $top .diffoldbut -text [mc " Diff: old lines" ] \
10875- -command [list choosecolor diffcolors 0 $top .diffold [mc " diff old lines" ] \
10876- [list $ctext tag conf d0 -foreground]]
10877- grid x $top .diffoldbut $top .diffold -sticky w
10878- label $top .diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]
10879- ${NS} ::button $top .diffnewbut -text [mc " Diff: new lines" ] \
10880- -command [list choosecolor diffcolors 1 $top .diffnew [mc " diff new lines" ] \
10881- [list $ctext tag conf dresult -foreground]]
10882- grid x $top .diffnewbut $top .diffnew -sticky w
10883- label $top .hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]
10884- ${NS} ::button $top .hunksepbut -text [mc " Diff: hunk header" ] \
10885- -command [list choosecolor diffcolors 2 $top .hunksep \
10886- [mc " diff hunk header" ] \
10887- [list $ctext tag conf hunksep -foreground]]
10888- grid x $top .hunksepbut $top .hunksep -sticky w
10889- label $top .markbgsep -padx 40 -relief sunk -background $markbgcolor
10890- ${NS} ::button $top .markbgbut -text [mc " Marked line bg" ] \
10891- -command [list choosecolor markbgcolor {} $top .markbgsep \
10892- [mc " marked line background" ] \
10893- [list $ctext tag conf omark -background]]
10894- grid x $top .markbgbut $top .markbgsep -sticky w
10895- label $top .selbgsep -padx 40 -relief sunk -background $selectbgcolor
10896- ${NS} ::button $top .selbgbut -text [mc " Select bg" ] \
10897- -command [list choosecolor selectbgcolor {} $top .selbgsep [mc " background" ] setselbg]
10898- grid x $top .selbgbut $top .selbgsep -sticky w
10899-
10900- ${NS} ::label $top .cfont -text [mc " Fonts: press to choose" ]
10901- grid $top .cfont - -sticky w -pady 10
10902- mkfontdisp mainfont $top [mc " Main font" ]
10903- mkfontdisp textfont $top [mc " Diff display font" ]
10904- mkfontdisp uifont $top [mc " User interface font" ]
10942+ set notebook [${NS} ::frame $top .notebook -borderwidth 0 -relief flat]
10943+ }
10944+
10945+ lappend pages [prefspage_general $notebook ] [mc " General" ]
10946+ lappend pages [prefspage_colors $notebook ] [mc " Colors" ]
10947+ lappend pages [prefspage_fonts $notebook ] [mc " Fonts" ]
10948+ foreach {page title} $pages {
10949+ if {$use_notebook } {
10950+ $notebook add $page -text $title
10951+ } else {
10952+ set btn [${NS} ::button $notebook .b_[string map {. X} $page ] \
10953+ -text $title -command [list raise $page ]]
10954+ $page configure -text $title
10955+ grid $btn -row 0 -column [incr col] -sticky w
10956+ grid $page -row 1 -column 0 -sticky news -columnspan 100
10957+ }
10958+ }
10959+
10960+ if {!$use_notebook } {
10961+ grid columnconfigure $notebook 0 -weight 1
10962+ grid rowconfigure $notebook 1 -weight 1
10963+ raise [lindex $pages 0]
10964+ }
10965+
10966+ grid $notebook -sticky news -padx 2 -pady 2
10967+ grid rowconfigure $top 0 -weight 1
10968+ grid columnconfigure $top 0 -weight 1
1090510969
1090610970 ${NS} ::frame $top .buts
1090710971 ${NS} ::button $top .buts.ok -text [mc " OK" ] -command prefsok -default active
@@ -10913,7 +10977,7 @@ proc doprefs {} {
1091310977 grid columnconfigure $top .buts 1 -weight 1 -uniform a
1091410978 grid $top .buts - - -pady 10 -sticky ew
1091510979 grid columnconfigure $top 2 -weight 1
10916- bind $top <Visibility> " focus $top .buts.ok"
10980+ bind $top <Visibility> [ list focus $top .buts.ok]
1091710981}
1091810982
1091910983proc choose_extdiff {} {
0 commit comments