|
2 | 2 | # Tcl ignores the next line -*- tcl -*- \
|
3 | 3 | exec wish "$0" -- "$@"
|
4 | 4 |
|
5 |
| -# Copyright © 2005-2011 Paul Mackerras. All rights reserved. |
| 5 | +# Copyright © 2005-2014 Paul Mackerras. All rights reserved. |
6 | 6 | # This program is free software; it may be used, copied, modified
|
7 | 7 | # and distributed under the terms of the GNU General Public Licence,
|
8 | 8 | # either version 2, or (at your option) any later version.
|
@@ -2263,9 +2263,35 @@ proc makewindow {} {
|
2263 | 2263 |
|
2264 | 2264 | # build up the bottom bar of upper window
|
2265 | 2265 | ${NS}::label .tf.lbar.flabel -text "[mc "Find"] "
|
2266 |
| - ${NS}::button .tf.lbar.fnext -text [mc "next"] -command {dofind 1 1} |
2267 |
| - ${NS}::button .tf.lbar.fprev -text [mc "prev"] -command {dofind -1 1} |
| 2266 | + |
| 2267 | + set bm_down_data { |
| 2268 | + #define down_width 16 |
| 2269 | + #define down_height 16 |
| 2270 | + static unsigned char down_bits[] = { |
| 2271 | + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, |
| 2272 | + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, |
| 2273 | + 0x87, 0xe1, 0x8e, 0x71, 0x9c, 0x39, 0xb8, 0x1d, |
| 2274 | + 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01}; |
| 2275 | + } |
| 2276 | + image create bitmap bm-down -data $bm_down_data -foreground $uifgcolor |
| 2277 | + ${NS}::button .tf.lbar.fnext -width 26 -command {dofind 1 1} |
| 2278 | + .tf.lbar.fnext configure -image bm-down |
| 2279 | + |
| 2280 | + set bm_up_data { |
| 2281 | + #define up_width 16 |
| 2282 | + #define up_height 16 |
| 2283 | + static unsigned char up_bits[] = { |
| 2284 | + 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, |
| 2285 | + 0xb8, 0x1d, 0x9c, 0x39, 0x8e, 0x71, 0x87, 0xe1, |
| 2286 | + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, |
| 2287 | + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01}; |
| 2288 | + } |
| 2289 | + image create bitmap bm-up -data $bm_up_data -foreground $uifgcolor |
| 2290 | + ${NS}::button .tf.lbar.fprev -width 26 -command {dofind -1 1} |
| 2291 | + .tf.lbar.fprev configure -image bm-up |
| 2292 | + |
2268 | 2293 | ${NS}::label .tf.lbar.flab2 -text " [mc "commit"] "
|
| 2294 | + |
2269 | 2295 | pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \
|
2270 | 2296 | -side left -fill y
|
2271 | 2297 | set gdttype [mc "containing:"]
|
@@ -2403,7 +2429,7 @@ proc makewindow {} {
|
2403 | 2429 | $ctext tag conf msep -font textfontbold
|
2404 | 2430 | $ctext tag conf found -back $foundbgcolor
|
2405 | 2431 | $ctext tag conf currentsearchhit -back $currentsearchhitbgcolor
|
2406 |
| - $ctext tag conf wwrap -wrap word |
| 2432 | + $ctext tag conf wwrap -wrap word -lmargin2 1c |
2407 | 2433 | $ctext tag conf bold -font textfontbold
|
2408 | 2434 |
|
2409 | 2435 | .pwbottom add .bleft
|
@@ -2761,14 +2787,17 @@ proc savestuff {w} {
|
2761 | 2787 | global linkfgcolor circleoutlinecolor
|
2762 | 2788 | global autoselect autosellen extdifftool perfile_attrs markbgcolor use_ttk
|
2763 | 2789 | global hideremotes want_ttk maxrefs
|
| 2790 | + global config_file config_file_tmp |
2764 | 2791 |
|
2765 | 2792 | if {$stuffsaved} return
|
2766 | 2793 | if {![winfo viewable .]} return
|
2767 | 2794 | catch {
|
2768 |
| - if {[file exists ~/.gitk-new]} {file delete -force ~/.gitk-new} |
2769 |
| - set f [open "~/.gitk-new" w] |
| 2795 | + if {[file exists $config_file_tmp]} { |
| 2796 | + file delete -force $config_file_tmp |
| 2797 | + } |
| 2798 | + set f [open $config_file_tmp w] |
2770 | 2799 | if {$::tcl_platform(platform) eq {windows}} {
|
2771 |
| - file attributes "~/.gitk-new" -hidden true |
| 2800 | + file attributes $config_file_tmp -hidden true |
2772 | 2801 | }
|
2773 | 2802 | puts $f [list set mainfont $mainfont]
|
2774 | 2803 | puts $f [list set textfont $textfont]
|
@@ -2845,7 +2874,7 @@ proc savestuff {w} {
|
2845 | 2874 | }
|
2846 | 2875 | puts $f "}"
|
2847 | 2876 | close $f
|
2848 |
| - file rename -force "~/.gitk-new" "~/.gitk" |
| 2877 | + file rename -force $config_file_tmp $config_file |
2849 | 2878 | }
|
2850 | 2879 | set stuffsaved 1
|
2851 | 2880 | }
|
@@ -2947,7 +2976,7 @@ proc about {} {
|
2947 | 2976 | message $w.m -text [mc "
|
2948 | 2977 | Gitk - a commit viewer for git
|
2949 | 2978 |
|
2950 |
| -Copyright \u00a9 2005-2011 Paul Mackerras |
| 2979 | +Copyright \u00a9 2005-2014 Paul Mackerras |
2951 | 2980 |
|
2952 | 2981 | Use and redistribute under the terms of the GNU General Public License"] \
|
2953 | 2982 | -justify center -aspect 400 -border 2 -bg white -relief groove
|
@@ -7922,7 +7951,7 @@ proc blobdiffmaybeseehere {ateof} {
|
7922 | 7951 | if {$diffseehere >= 0} {
|
7923 | 7952 | mark_ctext_line [lindex [split $diffseehere .] 0]
|
7924 | 7953 | }
|
7925 |
| - maybe_scroll_ctext ateof |
| 7954 | + maybe_scroll_ctext $ateof |
7926 | 7955 | }
|
7927 | 7956 |
|
7928 | 7957 | proc getblobdiffline {bdf ids} {
|
@@ -12058,7 +12087,29 @@ namespace import ::msgcat::mc
|
12058 | 12087 | ## And eventually load the actual message catalog
|
12059 | 12088 | ::msgcat::mcload $gitk_msgsdir
|
12060 | 12089 |
|
12061 |
| -catch {source ~/.gitk} |
| 12090 | +catch { |
| 12091 | + # follow the XDG base directory specification by default. See |
| 12092 | + # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html |
| 12093 | + if {[info exists env(XDG_CONFIG_HOME)] && $env(XDG_CONFIG_HOME) ne ""} { |
| 12094 | + # XDG_CONFIG_HOME environment variable is set |
| 12095 | + set config_file [file join $env(XDG_CONFIG_HOME) git gitk] |
| 12096 | + set config_file_tmp [file join $env(XDG_CONFIG_HOME) git gitk-tmp] |
| 12097 | + } else { |
| 12098 | + # default XDG_CONFIG_HOME |
| 12099 | + set config_file "~/.config/git/gitk" |
| 12100 | + set config_file_tmp "~/.config/git/gitk-tmp" |
| 12101 | + } |
| 12102 | + if {![file exists $config_file]} { |
| 12103 | + # for backward compatibility use the old config file if it exists |
| 12104 | + if {[file exists "~/.gitk"]} { |
| 12105 | + set config_file "~/.gitk" |
| 12106 | + set config_file_tmp "~/.gitk-tmp" |
| 12107 | + } elseif {![file exists [file dirname $config_file]]} { |
| 12108 | + file mkdir [file dirname $config_file] |
| 12109 | + } |
| 12110 | + } |
| 12111 | + source $config_file |
| 12112 | +} |
12062 | 12113 |
|
12063 | 12114 | parsefont mainfont $mainfont
|
12064 | 12115 | eval font create mainfont [fontflags mainfont]
|
|
0 commit comments