On Tue, 2004-09-28 at 15:08, Jean-Marc Lasgouttes wrote: > While I do not have anything useful to say about the errors, I'd like > to point you to GLyXKeySym::print, which is the right hook for > generating a correct string corresponding to a given keysym. Currently > it points to kb_keymap::printKeySym, which gives the C-S-n, but > you can rewrite it to your liking as is done in QLyXKeySym::print.
Thanks, it's much better for me to do it that way. Revised patch attached. Runtime warnings on destruction for each accelerator are now """ (lyx-gtk:13071): GLib-GObject-WARNING **: instance of invalid non-instantiatable type `<invalid>' (lyx-gtk:13071): GLib-GObject-CRITICAL **: file gsignal.c: line 1925 (g_signal_handlers_disconnect_matched): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed (lyx-gtk:13071): Gtk-CRITICAL **: file gtkaccelgroup.c: line 571 (gtk_accel_group_disconnect): assertion `GTK_IS_ACCEL_GROUP (accel_group)' failed """ I'm not sure why sometimes I'm getting the single line warning and sometimes these three lines (it's not because of moving the string generating function around). John
Index: GMenubar.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/gtk/GMenubar.C,v retrieving revision 1.14 diff -u -3 -p -r1.14 GMenubar.C --- GMenubar.C 2004/09/26 18:36:07 1.14 +++ GMenubar.C 2004/09/28 15:12:27 @@ -180,9 +180,6 @@ void GMenubar::onSubMenuActivate(MenuIte break; case MenuItem::Command: { -#ifdef WITH_WARNINGS -#warning Bindings are not inserted into the menu labels here. (Lgb) -#endif FuncStatus const flag = view_->getLyXFunc().getStatus(i->func()); bool on = flag.onoff(true); @@ -200,8 +197,8 @@ void GMenubar::onSubMenuActivate(MenuIte } else { gmenu->items().push_back( Gtk::Menu_Helpers::MenuElem( - labelTrans(i->label(), - i->shortcut()))); + labelTrans(i->label(), i->shortcut()), + Gtk::AccelKey(i->binding()))); } Gtk::MenuItem & item = gmenu->items().back(); item.signal_activate().connect( Index: GLyXKeySym.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/gtk/GLyXKeySym.C,v retrieving revision 1.5 diff -u -3 -p -r1.5 GLyXKeySym.C --- GLyXKeySym.C 2004/09/26 18:36:07 1.5 +++ GLyXKeySym.C 2004/09/28 15:12:27 @@ -94,9 +94,20 @@ char GLyXKeySym::getISOEncoded(string co } +//Produce a GTK+ style string specification of accelerator string const GLyXKeySym::print(key_modifier::state mod) const { - return kb_keymap::printKeySym(*this, mod); + string buf; + + if (mod & key_modifier::shift) + buf += "<shift>"; + if (mod & key_modifier::ctrl) + buf += "<control>"; + if (mod & key_modifier::alt) + buf += "<alt>"; + + buf += getSymbolName(); + return buf; }