summaryrefslogtreecommitdiff
path: root/lib/browser.tcl
AgeCommit message (Collapse)AuthorFilesLines
2016-10-06git-gui: unicode file name support on windowsLibravatar Karsten Blees1-1/+1
Assumes file names in git tree objects are UTF-8 encoded. On most unix systems, the system encoding (and thus the TCL system encoding) will be UTF-8, so file names will be displayed correctly. On Windows, it is impossible to set the system encoding to UTF-8. Changing the TCL system encoding (via 'encoding system ...', e.g. in the startup code) is explicitly discouraged by the TCL docs. Change git-gui functions dealing with file names to always convert from and to UTF-8. Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2016-10-03git-gui: fix incorrect use of Tcl append commandLibravatar Vasco Almeida1-2/+2
Fix wrong use of append command in strings marked for translation. According to Tcl/Tk Documentation [1], append varName ?value value value ...? appends all value arguments to the current value of variable varName. This means that append "[appname] ([reponame]): " [mc "File Viewer"] is setting a variable named "[appname] ([reponame]): " to the output of [mc "File Viewer"], rather than returning the concatenation of both expressions as one might expect. The format for some strings enables, for instance, a French translator to translate like "%s (%s) : Create Branch" (space before colon). Conversely, strings already translated will be marked as fuzzy and the translator must update them herself. For some cases, use alternative way for concatenation instead of using strcat procedure defined in git-gui.sh. Reference: 31bb1d1 ("git-gui: Paper bag fix missing translated strings", 2007-09-14) fixes the same issue slightly differently. [1] http://www.tcl.tk/man/tcl/TclCmd/append.htm Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-10-19git-gui: fix display of path in browser titleLibravatar Bert Wesarg1-1/+7
Ensure the browser path is shown on the title with a / suffix and escape any backslashes or newlines in path elements before display. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-11-22git-gui: fix browsers [Up To Parent] in sub-sub-directories.Libravatar Bert Wesarg1-1/+1
browser_path used to end with a slash, so the regexp matches the empty string and therefore removes nothing. Fix this. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-01-27git-gui: use themed tk widgets with Tk 8.5Libravatar Pat Thoyts1-18/+23
This patch enables the use of themed Tk widgets with Tk 8.5 and above. These make a significant difference on Windows in making the application appear native. On Windows and MacOSX ttk defaults to the native look as much as possible. On X11 the user may select a theme using the TkTheme XRDB resource class by adding an line to the .Xresources file. The set of installed theme names is available using the Tk command 'ttk::themes'. The default on X11 is similar to the current un-themed style - a kind of thin bordered motif look. A new git config variable 'gui.usettk' may be set to disable this if the user prefers the classic Tk look. Using Tk 8.4 will also avoid the use of themed widgets as these are only available since 8.5. Some support is included for Tk 8.6 features (themed spinbox and native font chooser for MacOSX and Windows). Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-24git-gui: Allow specifying an initial line for git gui blame.Libravatar Alexander Gavrilov1-1/+1
Add a command-line option to make git gui blame automatically scroll to a specific line in the file. Useful for integration with other tools. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-05git-gui: if a background colour is set, set foreground colour as wellLibravatar Philipp A. Hartmann1-1/+2
In several places, only the background colour is set to an explicit value, sometimes even "white". This does not work well with dark colour themes. This patch tries to set the foreground colour to "black" in those situations, where an explicit background colour is set without defining any foreground colour. Signed-off-by: Philipp A. Hartmann <ph@sorgh.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-16Merge branch 'maint'Libravatar Shawn O. Pearce1-1/+1
* maint: git-gui: Disable native platform text selection in "lists" Conflicts: lib/browser.tcl
2007-09-16git-gui: Disable native platform text selection in "lists"Libravatar Shawn O. Pearce1-3/+1
Sometimes we use a Tk text widget as though it were a listbox. This happens typically when we want to show an icon to the left of the text label or just when a text widget is generally a better choice then the native listbox widget. In these cases if we want the user to have control over the selection we implement our own "in_sel" tag that shows the selected region and we perform our own selection management in the background via keybindings and mouse bindings. In such uses we don't want the user to be able to activate the native platform selection by dragging their mouse through the text widget. Doing so creates a very confusing display and the user is left wondering what it may mean to have two different types of selection in the same widget. Tk doesn't allow us to delete the "sel" tag that it uses internally to manage the native selection but it will allow us to make it invisible by setting the tag to have the same display properties as unselected text. So long as we don't actually use the "sel" tag for anything in code its effectively invisible. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13git-gui: Make the tree browser also use lightgray selectionLibravatar Shawn O. Pearce1-3/+1
In 9adccb05 Matthijs Melchior changed our selection colors in the main index/working directory file lists to use a lightgray as the background color as this made the UI easier to read on all platforms. When we did that change we missed doing also doing in the file browser UI. Doing so just makes the entire thing UI consistent. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-02Mark strings for translation.Libravatar Christian Stimming1-11/+11
The procedure [mc ...] will translate the strings through msgcat. Strings must be enclosed in quotes, not in braces, because otherwise xgettext cannot extract them properly, although on the Tcl side both delimiters would work fine. [jes: I merged the later patches to that end.] Signed-off-by: Christian Stimming <stimming@tuhh.de> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-07-29git-gui: Use more modern looking icons in the tree browserLibravatar Shawn O. Pearce1-4/+18
This is a replacement of all of the icons in our tree browser window, as the prior icons just looked too 1980s Tk-ish. The icons used here are actually from a KDE themed look, so they might actually be familiar to some users of git-gui. Aside from using more modern looking icons we now have a special icon for executable blobs, to make them stand out from the normal non-executable blobs. We also denote symlinks now with a different icon, so they stand out from the other types of objects in the tree. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-18git-gui: Allow users to browse any branch, not just the current oneLibravatar Shawn O. Pearce1-0/+53
We now allow users to pick which commit they want to browse through our revision picking mega-widget. This opens up in a dialog first, and then opens a tree browser for that selected commit. It is a very simple approach and requires minimal code changes. I also clarified the language a bit in the Repository menu, to show that these actions will access files. Just in case a user is not quite sure what specific action they are looking for, but they know they want some sort of file thing. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-18git-gui: Allow browser subcommand to start in subdirectoryLibravatar Shawn O. Pearce1-3/+7
Like our blame subcommand the browser subcommand now accepts both a revision and a path, just a revision or just a path. This way the user can start the subcommand on any branch, or on any subtree. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09Merge branch 'maint'Libravatar Shawn O. Pearce1-9/+13
* maint: git-gui: Don't linewrap within console windows git-gui: Correct ls-tree buffering problem in browser
2007-07-09git-gui: Correct ls-tree buffering problem in browserLibravatar Shawn O. Pearce1-9/+13
Our file browser was showing bad output as it did not properly buffer a partial record when read from `ls-tree -z`. This did not show up on my Mac OS X system as most trees are small, the pipe buffers generally big and `ls-tree -z` was generally fast enough that all data was ready before Tcl started to read. However on my Cygwin system one of my production repositories had a large enough tree and packfile that it took a couple of pipe buffers for `ls-tree -z` to complete its dump. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Always use absolute path to all git executablesLibravatar Shawn O. Pearce1-2/+1
Rather than making the C library search for git every time we want to execute it we now search for the main git wrapper at startup, do symlink resolution, and then always use the absolute path that we found to execute the binary later on. This should save us some cycles, especially on stat challenged systems like Cygwin/Win32. While I was working on this change I also converted all of our existing pipes ([open "| git ..."]) to use two new pipe wrapper functions. These functions take additional options like --nice and --stderr which instructs Tcl to take special action, like running the underlying git program through `nice` (if available) or redirect stderr to stdout for capture in Tcl. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-11git-gui: Save geometry before the window layout is damagedLibravatar Shawn O. Pearce1-1/+0
Because Tk does not assure us the order that it will process children in before it destroys the main toplevel we cannot safely save our geometry data during a "bind . <Destroy>" event binding. The geometry may have already changed as a result of a one or more children being removed from the layout. This was pointed out in gitk by Mark Levedahl, and patched over there by commit b6047c5a8166a71e01c6b63ebbb67c6894d95114. So we now also use "wm protocol . WM_DELETE_WINDOW" to detect when the window is closed by the user, and forward that close event to our main do_quit routine. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-08git-gui: Convert blame to the "class" way of doing thingsLibravatar Shawn O. Pearce1-1/+1
Our blame viewer code has historically been a mess simply because the data for multiple viewers was all crammed into a single pair of Tcl arrays. This made the code hard to read and even harder to maintain. Now that we have a slightly better way of tracking the data for our "meta-widgets" we can make use of it here in the blame viewer to cleanup the code and make it easier to work with long term. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-08git-gui: Convert browser, console to "class" formatLibravatar Shawn O. Pearce1-113/+89
Now that we have a slightly easier method of working with per-widget data we should make use of that technique in our browser and console meta-widgets, as both have a decent amount of information that they store on a per-widget basis and our current approach of handling it is difficult to follow. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-07git-gui: Refactor into multiple files to save my sanityLibravatar Shawn O. Pearce1-0/+263
I'm finding it difficult to work with a 6,000+ line Tcl script and not go insane while looking for a particular block of code. Since most of the program is organized into different units of functionality and not all users will need all units immediately on startup we can improve things by splitting procs out into multiple files and let auto_load handle things for us. This should help not only to better organize the source, but it may also improve startup times for some users as the Tcl parser does not need to read as much script before it can show the UI. In many cases the user can avoid reading at least half of git-gui now. Unfortunately we now need a library directory in our runtime location. This is currently assumed to be $(sharedir)/git-gui/lib and its expected that the Makefile invoker will setup some sort of reasonable sharedir value for us, or let us assume its going to be $(gitexecdir)/../share. We now also require a tclsh (in TCL_PATH) to just run the Makefile, as we use tclsh to generate the tclIndex for our lib directory. I'm hoping this is not an unncessary burden on end-users who are building from source. I haven't really made any functionality changes here, this is just a huge migration of code from one file to many smaller files. All of the new changes are to setup the library path and install the library files. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>