gitk: Fixes for Mac OS X TkAqua
- middle button is B3 on TkAqua - add horizontal mousehweel scrolling - nicer default fonts - use OSX-specific extdifftool - remove quit menu item, call doquit on quit event - move about & preferences menu items into apple menu - don't set menu font Signed-off-by: Daniel A. Steffen <das@users.sourceforge.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Daniel A. Steffen committed
Mar 23, 2009 at 12:17 UTC
5fdcbb13904e6447cad9611b9c75943bbbcc7db4
1 file changed
+50
-12
gitk
+50
-12
@@ -1830,7 +1830,9 @@ proc setoptions {} {
1830
option add *Button.font uifont startupFile
1831
option add *Checkbutton.font uifont startupFile
1832
option add *Radiobutton.font uifont startupFile
1833
- option add *Menu.font uifont startupFile
1833
+ if {[tk windowingsystem] ne "aqua"} {
1834
+ option add *Menu.font uifont startupFile
1835
+ }
1836
option add *Menubutton.font uifont startupFile
1837
option add *Label.font uifont startupFile
1838
option add *Message.font uifont startupFile
@@ -1910,8 +1912,8 @@ proc makewindow {} {
1912
1913
# The "mc" arguments here are purely so that xgettext
1914
# sees the following string as needing to be translated
1913
- makemenu .bar {
1914
- {mc "File" cascade {
1915
+ set file {
1916
+ mc "File" cascade {
1917
{mc "Update" command updatecommits -accelerator F5}
1918
{mc "Reload" command reloadcommits -accelerator Meta1-F5}
1919
{mc "Reread references" command rereadrefs}
@@ -1921,21 +1923,41 @@ proc makewindow {} {
1923
{xx "" separator}
1924
{mc "Quit" command doquit -accelerator Meta1-Q}
1925
}}
1924
- {mc "Edit" cascade {
1926
+ set edit {
1927
+ mc "Edit" cascade {
1928
{mc "Preferences" command doprefs}
1929
}}
1927
- {mc "View" cascade {
1930
+ set view {
1931
+ mc "View" cascade {
1932
{mc "New view..." command {newview 0} -accelerator Shift-F4}
1933
{mc "Edit view..." command editview -state disabled -accelerator F4}
1934
{mc "Delete view" command delview -state disabled}
1935
{xx "" separator}
1936
{mc "All files" radiobutton {selectedview 0} -command {showview 0}}
1937
}}
1934
- {mc "Help" cascade {
1938
+ if {[tk windowingsystem] ne "aqua"} {
1939
+ set help {
1940
+ mc "Help" cascade {
1941
+ {mc "About gitk" command about}
1942
+ {mc "Key bindings" command keys}
1943
+ }}
1944
+ set bar [list $file $edit $view $help]
1945
+ } else {
1946
+ proc ::tk::mac::ShowPreferences {} {doprefs}
1947
+ proc ::tk::mac::Quit {} {doquit}
1948
+ lset file end [lreplace [lindex $file end] end-1 end]
1949
+ set apple {
1950
+ xx "Apple" cascade {
1951
{mc "About gitk" command about}
1952
+ {xx "" separator}
1953
+ }}
1954
+ set help {
1955
+ mc "Help" cascade {
1956
{mc "Key bindings" command keys}
1957
}}
1958
+ set bar [list $apple $file $view $help]
1959
}
1960
+ makemenu .bar $bar
1961
. configure -menu .bar
1962
1963
# the gui has upper and lower half, parts of a paned window.
@@ -2231,8 +2253,10 @@ proc makewindow {} {
2253
2254
if {[tk windowingsystem] eq {aqua}} {
2255
set M1B M1
2256
+ set ::BM "3"
2257
} else {
2258
set M1B Control
2259
+ set ::BM "2"
2260
}
2261
2262
bind .pwbottom <Configure> {resizecdetpanes %W %w}
@@ -2250,10 +2274,14 @@ proc makewindow {} {
2274
set delta [expr {- (%D)}]
2275
allcanvs yview scroll $delta units
2276
}
2277
+ bindall <Shift-MouseWheel> {
2278
+ set delta [expr {- (%D)}]
2279
+ $canv xview scroll $delta units
2280
+ }
2281
}
2282
}
2255
- bindall <2> "canvscan mark %W %x %y"
2256
- bindall <B2-Motion> "canvscan dragto %W %x %y"
2283
+ bindall <$::BM> "canvscan mark %W %x %y"
2284
+ bindall <B$::BM-Motion> "canvscan dragto %W %x %y"
2285
bindkey <Home> selfirstline
2286
bindkey <End> sellastline
2287
bind . <Key-Up> "selnextline -1"
@@ -10690,9 +10718,15 @@ catch {
10718
}
10719
}
10720
10693
-set mainfont {Helvetica 9}
10694
-set textfont {Courier 9}
10695
-set uifont {Helvetica 9 bold}
10721
+if {[tk windowingsystem] eq "aqua"} {
10722
+ set mainfont {{Lucida Grande} 9}
10723
+ set textfont {Monaco 9}
10724
+ set uifont {{Lucida Grande} 9 bold}
10725
+} else {
10726
+ set mainfont {Helvetica 9}
10727
+ set textfont {Courier 9}
10728
+ set uifont {Helvetica 9 bold}
10729
+}
10730
set tabstop 8
10731
set findmergefiles 0
10732
set maxgraphpct 50
@@ -10713,7 +10747,11 @@ set datetimeformat "%Y-%m-%d %H:%M:%S"
10747
set autoselect 1
10748
set perfile_attrs 0
10749
10716
-set extdifftool "meld"
10750
+if {[tk windowingsystem] eq "aqua"} {
10751
+ set extdifftool "opendiff"
10752
+} else {
10753
+ set extdifftool "meld"
10754
+}
10755
10756
set colors {green red blue magenta darkgrey brown orange}
10757
set bgcolor white