>>>>> "John" == John Spray <[EMAIL PROTECTED]> writes:

John> On Wed, 2004-09-29 at 08:44, Jean-Marc Lasgouttes wrote:
>> And what would be the right gtkmm method to get a nice
>> human-readable version?
John> Well, I'm currently using a modified GLyXKeySym::print to
John> produce gtk-style strings like "Ctrl+N" (in fact, this is also
John> the normal style for qt apps, so I don't know why the qt
John> frontend uses "C-n"). 

AFAIK it does not do so in 1.4.0cvs. Note that the qt frontend does
not use the Ctrl+n style on OSX, and I guess it uses local style on
windows too. 

John> The problem is that I also use a string like "<control>n" to
John> create GTK+ AccelKey objects for the menus. Right now I'm
John> converting from "Ctrl+N" to "<control>N" by string substitution
John> at the time of creating the menu item.

So gtk+ has two types of string representation for an accel, one being
the internal representation, and the other the user-visible one.
Right?

One can only create a AccelKey object from a "<string>n" type of
string. Right?

John> The key difference between this situation and the other
John> frontends is that I'm not just using a label that the backend
John> gives me for the menu accelerators, I'm describing the
John> accelerator to gtkmm and it's making up the label (which just
John> happens to be the same as what we would have given it, just that
John> the Gtk::MenuItem::add_accel_label function is protected so we
John> can't). 

Note that we do not really want to create accelerators for the menus
(since LyX does call the function itself). We just want to _display_
an accelerator in the menu, as a reminder to the user. I think that
getting access to Gtk::MenuItem::add_accel_label would be the right
solution. It might be that subclassing Gtk::MenuItem is the simplest
thing to do...

John> So to avoid the hackyness of string substitution, I would need
John> binding() to give me a LyXKeySym rather than a string.

Actually, what binding() should return to be useful is a kb_sequence
object, but unfortunately, these objects are not really usable from
the outside world. They need serious refactoring, I think.

John> So, I'm MenuItem::binding() I see that we're just showing the
John> first key of shortcut sequences. Are there a lot of these? Are
John> we that short on accelerator keys that we need to use sequences
John> for menu items?

There are two things at work here:
- a given function can be bound to several kb_sequences (for example, 
font-emph is either "C-e" or "M-c e".). For the menu, we select the
first such sequence.
- LyX supports multi-LyXKeysym keyboard sequences (think "C-x C-f" in
emacs bindings). Does Gtk+ AccelKey support that?

I guess it would be worth to reowrk kb_sequence now to look like a
normal container. I am not sure I will have time for it, though.

JMarc

Reply via email to