public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Changing keyboard bindings
@ 2013-02-23  0:33 Bruce Dawson
  2013-02-23  0:52 ` Keith Seitz
  0 siblings, 1 reply; 5+ messages in thread
From: Bruce Dawson @ 2013-02-23  0:33 UTC (permalink / raw)
  To: insight

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?

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.

As an example Run/Continue on Visual Studio are bound to F5, step-over is bound to F10, step-in is bound to F11, etc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Changing keyboard bindings
  2013-02-23  0:33 Changing keyboard bindings Bruce Dawson
@ 2013-02-23  0:52 ` Keith Seitz
  2013-02-23  2:00   ` Bruce Dawson
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2013-02-23  0:52 UTC (permalink / raw)
  To: Bruce Dawson; +Cc: insight

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Changing keyboard bindings
  2013-02-23  0:52 ` Keith Seitz
@ 2013-02-23  2:00   ` Bruce Dawson
  2013-02-23  2:17     ` Keith Seitz
  0 siblings, 1 reply; 5+ messages in thread
From: Bruce Dawson @ 2013-02-23  2:00 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

I found three places in srcbar.itcl where "accelerator N" is specified -- twice for the Control menu and once for the "trace" menu which I assume is the toolbar with the step and next buttons. However when I change all three occurrences of N to Q and do make/make install it affects the Control menu but not the toolbar.

I also noticed that srctextwin.itb does some binding with bind_plain_key -- it looks like that is what affects what is actually processed, as opposed to what is actually shown.

-----Original Message-----
From: Keith Seitz [mailto:keiths@redhat.com] 
Sent: Friday, February 22, 2013 4:52 PM
To: Bruce Dawson
Cc: insight@sourceware.org
Subject: Re: Changing keyboard bindings

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Changing keyboard bindings
  2013-02-23  2:00   ` Bruce Dawson
@ 2013-02-23  2:17     ` Keith Seitz
  2013-02-26  0:51       ` Bruce Dawson
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2013-02-23  2:17 UTC (permalink / raw)
  To: Bruce Dawson; +Cc: insight

On 02/22/2013 06:00 PM, Bruce Dawson wrote:
> I found three places in srcbar.itcl where "accelerator N" is
> specified -- twice for the Control menu and once for the "trace" menu
> which I assume is the toolbar with the step and next buttons. However
> when I change all three occurrences of N to Q and do make/make
> install it affects the Control menu but not the toolbar.

Gah! Yes, I forgot that those get displayed on the balloon help. Those 
are in srcbar.itcl, scattered in various places. TBH, I wouldn't care if 
we deleted the key bindings from being displayed in the balloons. It's a 
very unusual thing to do. Maybe it made sense to someone a fifteen years 
ago.

> I also noticed that srctextwin.itb does some binding with
> bind_plain_key -- it looks like that is what affects what is actually
> processed, as opposed to what is actually shown.

Doh! Yes, that is where those bindings would be useful, no? I completely 
spaced on that, sorry.

Keith

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Changing keyboard bindings
  2013-02-23  2:17     ` Keith Seitz
@ 2013-02-26  0:51       ` Bruce Dawson
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Dawson @ 2013-02-26  0:51 UTC (permalink / raw)
  To: 'Keith Seitz'; +Cc: insight

I actually like the balloon help -- it's a great way to learn the keyboard shortcuts. It took me a while to find where the balloon help for the buttons was being created. It's in method create_control_buttons() in srcbar.itcl -- obvious once you get there.

I had some time to experiment with the bind_plain_key calls in srctextwin.itb. I bound F10 and F11 to 'next' and 'step', which works great, however two problems then cropped up:

1) The first time I press F10 it opens up the menus. After that it works as a shortcut, but... weird.
2) I can't map Shift+F11 to Finish. Well, I can't map it at the same time that I have F11 mapped to step. I tried doing the mapping of F11 before the mapping of Shift-F11 but it still doesn't seem to work. Pity.

Getting close however.

-----Original Message-----
From: Keith Seitz [mailto:keiths@redhat.com] 
Sent: Friday, February 22, 2013 6:18 PM
To: Bruce Dawson
Cc: insight@sourceware.org
Subject: Re: Changing keyboard bindings

On 02/22/2013 06:00 PM, Bruce Dawson wrote:
> I found three places in srcbar.itcl where "accelerator N" is specified 
> -- twice for the Control menu and once for the "trace" menu which I 
> assume is the toolbar with the step and next buttons. However when I 
> change all three occurrences of N to Q and do make/make install it 
> affects the Control menu but not the toolbar.

Gah! Yes, I forgot that those get displayed on the balloon help. Those are in srcbar.itcl, scattered in various places. TBH, I wouldn't care if we deleted the key bindings from being displayed in the balloons. It's a very unusual thing to do. Maybe it made sense to someone a fifteen years ago.

> I also noticed that srctextwin.itb does some binding with 
> bind_plain_key -- it looks like that is what affects what is actually 
> processed, as opposed to what is actually shown.

Doh! Yes, that is where those bindings would be useful, no? I completely spaced on that, sorry.

Keith

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-26  0:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-23  0:33 Changing keyboard bindings Bruce Dawson
2013-02-23  0:52 ` Keith Seitz
2013-02-23  2:00   ` Bruce Dawson
2013-02-23  2:17     ` Keith Seitz
2013-02-26  0:51       ` Bruce Dawson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).