Skip to content

Commit 5fdcbb1

Browse files
daspaulusmack
authored andcommitted
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>
1 parent d38d7d4 commit 5fdcbb1

1 file changed

Lines changed: 50 additions & 12 deletions

File tree

gitk

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,9 @@ proc setoptions {} {
18301830
option add *Button.font uifont startupFile
18311831
option add *Checkbutton.font uifont startupFile
18321832
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+
}
18341836
option add *Menubutton.font uifont startupFile
18351837
option add *Label.font uifont startupFile
18361838
option add *Message.font uifont startupFile
@@ -1910,8 +1912,8 @@ proc makewindow {} {
19101912

19111913
# The "mc" arguments here are purely so that xgettext
19121914
# sees the following string as needing to be translated
1913-
makemenu .bar {
1914-
{mc "File" cascade {
1915+
set file {
1916+
mc "File" cascade {
19151917
{mc "Update" command updatecommits -accelerator F5}
19161918
{mc "Reload" command reloadcommits -accelerator Meta1-F5}
19171919
{mc "Reread references" command rereadrefs}
@@ -1921,21 +1923,41 @@ proc makewindow {} {
19211923
{xx "" separator}
19221924
{mc "Quit" command doquit -accelerator Meta1-Q}
19231925
}}
1924-
{mc "Edit" cascade {
1926+
set edit {
1927+
mc "Edit" cascade {
19251928
{mc "Preferences" command doprefs}
19261929
}}
1927-
{mc "View" cascade {
1930+
set view {
1931+
mc "View" cascade {
19281932
{mc "New view..." command {newview 0} -accelerator Shift-F4}
19291933
{mc "Edit view..." command editview -state disabled -accelerator F4}
19301934
{mc "Delete view" command delview -state disabled}
19311935
{xx "" separator}
19321936
{mc "All files" radiobutton {selectedview 0} -command {showview 0}}
19331937
}}
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 {
19351951
{mc "About gitk" command about}
1952+
{xx "" separator}
1953+
}}
1954+
set help {
1955+
mc "Help" cascade {
19361956
{mc "Key bindings" command keys}
19371957
}}
1958+
set bar [list $apple $file $view $help]
19381959
}
1960+
makemenu .bar $bar
19391961
. configure -menu .bar
19401962

19411963
# the gui has upper and lower half, parts of a paned window.
@@ -2231,8 +2253,10 @@ proc makewindow {} {
22312253

22322254
if {[tk windowingsystem] eq {aqua}} {
22332255
set M1B M1
2256+
set ::BM "3"
22342257
} else {
22352258
set M1B Control
2259+
set ::BM "2"
22362260
}
22372261

22382262
bind .pwbottom <Configure> {resizecdetpanes %W %w}
@@ -2250,10 +2274,14 @@ proc makewindow {} {
22502274
set delta [expr {- (%D)}]
22512275
allcanvs yview scroll $delta units
22522276
}
2277+
bindall <Shift-MouseWheel> {
2278+
set delta [expr {- (%D)}]
2279+
$canv xview scroll $delta units
2280+
}
22532281
}
22542282
}
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"
22572285
bindkey <Home> selfirstline
22582286
bindkey <End> sellastline
22592287
bind . <Key-Up> "selnextline -1"
@@ -10690,9 +10718,15 @@ catch {
1069010718
}
1069110719
}
1069210720

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+
}
1069610730
set tabstop 8
1069710731
set findmergefiles 0
1069810732
set maxgraphpct 50
@@ -10713,7 +10747,11 @@ set datetimeformat "%Y-%m-%d %H:%M:%S"
1071310747
set autoselect 1
1071410748
set perfile_attrs 0
1071510749

10716-
set extdifftool "meld"
10750+
if {[tk windowingsystem] eq "aqua"} {
10751+
set extdifftool "opendiff"
10752+
} else {
10753+
set extdifftool "meld"
10754+
}
1071710755

1071810756
set colors {green red blue magenta darkgrey brown orange}
1071910757
set bgcolor white

0 commit comments

Comments
 (0)