+2002-11-20 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * QLPopupMenu.C (getLabel): show labels for menu entries
+
+ * qlkey.h (string_to_qkey): add support for KP_xxx keysyms
+
2002-11-20 John Levon <levon@movementarian.org>
* ui/QDelimiterDialog.ui: geometry fix
#pragma implementation
#endif
+#include "support/lstrings.h"
#include "MenuBackend.h"
#include "lyxfunc.h"
+#include "kbmap.h"
#include "debug.h"
-
+
#include "QtView.h"
#include "QLPopupMenu.h"
-#include "support/lstrings.h"
-
+#include <boost/scoped_ptr.hpp>
+
using std::pair;
using std::make_pair;
-
+
+extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
+
namespace {
string const getLabel(MenuItem const & mi)
if (pos == string::npos)
return label;
label.insert(pos, "&");
+
+ if (mi.kind() == MenuItem::Command) {
+ // FIXME: backend should do this
+ string const accel(toplevel_keymap->findbinding(mi.action()));
+
+ if (!accel.empty()) {
+ label += "\t" + accel.substr(1, accel.find(']') - 1);
+ }
+
+ lyxerr[Debug::GUI] << "Label: " << mi.label()
+ << " Shortcut: " << mi.shortcut()
+ << " Accel: " << accel << endl;
+ } else
+ lyxerr[Debug::GUI] << "Label: " << mi.label()
+ << " Shortcut: " << mi.shortcut() << endl;
return label;
}
if (str == "Return") return Qt::Key_Return;
if (str == "KP_Enter") return Qt::Key_Enter; // correct ?
if (str == "Insert") return Qt::Key_Insert;
+ if (str == "KP_Insert") return Qt::Key_Insert;
if (str == "Delete") return Qt::Key_Delete;
+ if (str == "KP_Delete") return Qt::Key_Delete;
if (str == "Pause") return Qt::Key_Pause;
if (str == "Print") return Qt::Key_Print;
if (str == "Sys_Req") return Qt::Key_SysReq;
if (str == "Down") return Qt::Key_Down;
if (str == "Prior") return Qt::Key_Prior;
if (str == "Next") return Qt::Key_Next;
+ if (str == "KP_Home") return Qt::Key_Home;
+ if (str == "KP_End") return Qt::Key_End;
+ if (str == "KP_Left") return Qt::Key_Left;
+ if (str == "KP_Up") return Qt::Key_Up;
+ if (str == "KP_Right") return Qt::Key_Right;
+ if (str == "KP_Down") return Qt::Key_Down;
+ if (str == "KP_Prior") return Qt::Key_Prior;
+ if (str == "KP_Next") return Qt::Key_Next;
if (str == "Shift_L") return Qt::Key_Shift;
if (str == "Control_L") return Qt::Key_Control;
if (str == "Alt_L") return Qt::Key_Meta; // correct ?