Re: Re: Add new option in the right click menu in git gui
- From
Heiko Voigt <hvoigt@hvoigt.net>
- Date
- Mar 26, 2010, 13:53 UTC
- Message-ID
- <20100326135346.GB22339@book.hvoigt.net>
- In-Reply-To
- <36ca99e91003011345n43aad0c5m5c02eaf692d54efd@mail.gmail.com>
Hi,
this email has been lying in my mailbox for while ...
On Mon, Mar 01, 2010 at 10:45:10PM +0100, Bert Wesarg wrote:
Show 6 quoted lines
> Actually, I would like to be able to have a right click menu for the > path too and have access to the guitool entries in the Tools menu > which require a path (ie. needsfile=true). That would reduce by mouse > movements drastically. > > I have looked into this issue by myself, but I'm not that familiar with tcl/tk.
Just try it. The "Tcl Introduction" sample chapter from this book[1] explains the tcl language in 17 pages quite nicely.
I thought of this myself but never had the time to do it. If you are still interested in implementing it take a look at the 'bind' command. It lets you bind procedures to events that occur on widgets or the application. For the diff view this is done in git-gui.sh on around line 3465 with this command:
bind_button3 $ui_diff [list popup_diff_menu $ctxm $ctxmmg $ctxmsm %x %y %X %Y]
bind_button3 is just a wrapper so bind is platform independent. So you probably want to implement a method similar to popup_diff_menu which popups the right menu for the selected file.
BTW, the widgets for the files are of the same type (text) as $ui_diff and are stored in the variables: $ui_index and $ui_workdir for the index and working directory respectively.
Hope that helps.
cheers Heiko
[1] http://www.beedub.com/book/