@@ -1750,12 +1750,20 @@ proc setoptions {} {
1750
1750
option add *Entry.font uifont startupFile
1751
1751
}
1752
1752
1753
+ # Make a menu and submenus.
1754
+ # m is the window name for the menu, items is the list of menu items to add.
1755
+ # Each item is a list {mc label type description options...}
1756
+ # mc is ignored; it's so we can put mc there to alert xgettext
1757
+ # label is the string that appears in the menu
1758
+ # type is cascade, command or radiobutton (should add checkbutton)
1759
+ # description depends on type; it's the sublist for cascade, the
1760
+ # command to invoke for command, or {variable value} for radiobutton
1753
1761
proc makemenu {m items} {
1754
1762
menu $m
1755
1763
foreach i $items {
1756
- set name [mc [lindex $i 0 ]]
1757
- set type [lindex $i 1 ]
1758
- set thing [lindex $i 2 ]
1764
+ set name [mc [lindex $i 1 ]]
1765
+ set type [lindex $i 2 ]
1766
+ set thing [lindex $i 3 ]
1759
1767
set params [list $type ]
1760
1768
if {$name ne {}} {
1761
1769
set u [string first " &" [string map {&& x} $name ]]
@@ -1766,7 +1774,7 @@ proc makemenu {m items} {
1766
1774
}
1767
1775
switch -- $type {
1768
1776
" cascade" {
1769
- set submenu [string tolower [string map {& " " } [lindex $i 0 ]]]
1777
+ set submenu [string tolower [string map {& " " } [lindex $i 1 ]]]
1770
1778
lappend params -menu $m .$submenu
1771
1779
}
1772
1780
" command" {
@@ -1777,7 +1785,7 @@ proc makemenu {m items} {
1777
1785
-value [lindex $thing 1]
1778
1786
}
1779
1787
}
1780
- eval $m add $params [lrange $i 3 end]
1788
+ eval $m add $params [lrange $i 4 end]
1781
1789
if {$type eq " cascade" } {
1782
1790
makemenu $m .$submenu $thing
1783
1791
}
@@ -1806,27 +1814,29 @@ proc makewindow {} {
1806
1814
global rprogitem rprogcoord rownumsel numcommits
1807
1815
global have_tk85
1808
1816
1817
+ # The "mc" arguments here are purely so that xgettext
1818
+ # sees the following string as needing to be translated
1809
1819
makemenu .bar {
1810
- {" File" cascade {
1811
- {" Update" command updatecommits -accelerator F5}
1812
- {" Reload" command reloadcommits}
1813
- {" Reread references" command rereadrefs}
1814
- {" List references" command showrefs}
1815
- {" Quit" command doquit}
1820
+ {mc " File" cascade {
1821
+ {mc " Update" command updatecommits -accelerator F5}
1822
+ {mc " Reload" command reloadcommits}
1823
+ {mc " Reread references" command rereadrefs}
1824
+ {mc " List references" command showrefs}
1825
+ {mc " Quit" command doquit}
1816
1826
}}
1817
- {" Edit" cascade {
1818
- {" Preferences" command doprefs}
1827
+ {mc " Edit" cascade {
1828
+ {mc " Preferences" command doprefs}
1819
1829
}}
1820
- {" View" cascade {
1821
- {" New view..." command {newview 0}}
1822
- {" Edit view..." command editview -state disabled}
1823
- {" Delete view" command delview -state disabled}
1824
- {" " separator}
1825
- {" All files" radiobutton {selectedview 0} -command {showview 0}}
1830
+ {mc " View" cascade {
1831
+ {mc " New view..." command {newview 0}}
1832
+ {mc " Edit view..." command editview -state disabled}
1833
+ {mc " Delete view" command delview -state disabled}
1834
+ {xx " " separator}
1835
+ {mc " All files" radiobutton {selectedview 0} -command {showview 0}}
1826
1836
}}
1827
- {" Help" cascade {
1828
- {" About gitk" command about}
1829
- {" Key bindings" command keys}
1837
+ {mc " Help" cascade {
1838
+ {mc " About gitk" command about}
1839
+ {mc " Key bindings" command keys}
1830
1840
}}
1831
1841
}
1832
1842
. configure -menu .bar
@@ -2210,39 +2220,39 @@ proc makewindow {} {
2210
2220
2211
2221
set rowctxmenu .rowctxmenu
2212
2222
makemenu $rowctxmenu {
2213
- {" Diff this -> selected" command {diffvssel 0}}
2214
- {" Diff selected -> this" command {diffvssel 1}}
2215
- {" Make patch" command mkpatch}
2216
- {" Create tag" command mktag}
2217
- {" Write commit to file" command writecommit}
2218
- {" Create new branch" command mkbranch}
2219
- {" Cherry-pick this commit" command cherrypick}
2220
- {" Reset HEAD branch to here" command resethead}
2223
+ {mc " Diff this -> selected" command {diffvssel 0}}
2224
+ {mc " Diff selected -> this" command {diffvssel 1}}
2225
+ {mc " Make patch" command mkpatch}
2226
+ {mc " Create tag" command mktag}
2227
+ {mc " Write commit to file" command writecommit}
2228
+ {mc " Create new branch" command mkbranch}
2229
+ {mc " Cherry-pick this commit" command cherrypick}
2230
+ {mc " Reset HEAD branch to here" command resethead}
2221
2231
}
2222
2232
$rowctxmenu configure -tearoff 0
2223
2233
2224
2234
set fakerowmenu .fakerowmenu
2225
2235
makemenu $fakerowmenu {
2226
- {" Diff this -> selected" command {diffvssel 0}}
2227
- {" Diff selected -> this" command {diffvssel 1}}
2228
- {" Make patch" command mkpatch}
2236
+ {mc " Diff this -> selected" command {diffvssel 0}}
2237
+ {mc " Diff selected -> this" command {diffvssel 1}}
2238
+ {mc " Make patch" command mkpatch}
2229
2239
}
2230
2240
$fakerowmenu configure -tearoff 0
2231
2241
2232
2242
set headctxmenu .headctxmenu
2233
2243
makemenu $headctxmenu {
2234
- {" Check out this branch" command cobranch}
2235
- {" Remove this branch" command rmbranch}
2244
+ {mc " Check out this branch" command cobranch}
2245
+ {mc " Remove this branch" command rmbranch}
2236
2246
}
2237
2247
$headctxmenu configure -tearoff 0
2238
2248
2239
2249
global flist_menu
2240
2250
set flist_menu .flistctxmenu
2241
2251
makemenu $flist_menu {
2242
- {" Highlight this too" command {flist_hl 0}}
2243
- {" Highlight this only" command {flist_hl 1}}
2244
- {" External diff" command {external_diff}}
2245
- {" Blame parent commit" command {external_blame 1}}
2252
+ {mc " Highlight this too" command {flist_hl 0}}
2253
+ {mc " Highlight this only" command {flist_hl 1}}
2254
+ {mc " External diff" command {external_diff}}
2255
+ {mc " Blame parent commit" command {external_blame 1}}
2246
2256
}
2247
2257
$flist_menu configure -tearoff 0
2248
2258
}
0 commit comments