Re: Changing keyboard bindings

Keith Seitz <[email protected]> Fri, 22 Feb 2013 16:52:01 -0800
Newsgroups gmane.comp.debugging.insight
Message-ID <[email protected]>
On 02/22/2013 04:32 PM, Bruce Dawson wrote:
> I'm a long-time Windows developer and I'd like to make Insight easier
> to use for other long-time Windows developers. Can anybody point me
> to where I should look in order to try reconfiguring the keyboard
> bindings (step, run, etc.) to match Visual Studio bindings?

These are hiding in src/gdb/gdbtk/library/srcbar.itcl. The various menus 
there add the -accelarator, but right now, they are hard-coded.

> Such a change would have to be optional because I'm sure that the
> Linux community at large does not value Visual Studio compatibility,
> but for the initial test version I'm okay with having the change be
> unconditional.

Ideally, I would add a bunch of stuff for this to the Source 
Preferences, allowing the user to select from a standard list of 
preferences, such as "Traditional"/"Classic" for what we have now and 
"Windows/Visual Studio" or something. Selecting one of these would 
automatically fill-in all the accelerator fields, and APPLY/OK 
(dismissing the dialog) would then use this set to save the bindings 
into a bunch of new preferences, one for each accelerator (all 36 of 
them!). This is probably quite a bit of work to do, though.

Probably far more than you'd want to tackle. Probably more than I would 
want to tackle right now!

In any case, I would add a bunch of calls in srcbar.itcl to "pref get"
to get these preferences, one for each accelerator.

Replace each appearance of "-accelerator XXX" with "-accelerator [pref 
get gdb/src/accel/DESCRIPTION]", where DESCRIPTION is some simple 
description of the menu item, e.g., "run", "step", "next", "nexti", 
"open", "close", and so on.

Then in library/prefs.tcl, edit pref_set_defaults and add all of these 
with default values. [If you go the long-winded route of adding default 
sets, you'd set a default keyboard binding set as well.]

The code in that procedure is pretty easy to follow/mimic/cut-n-paste:

pref define gdb/src/accel/open   "Ctrl+O"
pref define gdb/src/accel/run    "R"
and so on

Keith