From: John Levon Date: Wed, 20 Nov 2002 16:46:17 +0000 (+0000) Subject: jmarc's shortcut patch X-Git-Tag: 1.6.10~17930 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4e18f2cccd6952238bcd586d52ac527e3efce548;p=features.git jmarc's shortcut patch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5681 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 7357bd87d3..ab1ef0c62a 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,9 @@ +2002-11-20 Jean-Marc Lasgouttes + + * QLPopupMenu.C (getLabel): show labels for menu entries + + * qlkey.h (string_to_qkey): add support for KP_xxx keysyms + 2002-11-20 John Levon * ui/QDelimiterDialog.ui: geometry fix diff --git a/src/frontends/qt2/QLPopupMenu.C b/src/frontends/qt2/QLPopupMenu.C index be720517a5..9a623b0131 100644 --- a/src/frontends/qt2/QLPopupMenu.C +++ b/src/frontends/qt2/QLPopupMenu.C @@ -14,19 +14,23 @@ #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 + using std::pair; using std::make_pair; - + +extern boost::scoped_ptr toplevel_keymap; + namespace { string const getLabel(MenuItem const & mi) @@ -41,6 +45,21 @@ 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; } diff --git a/src/frontends/qt2/qlkey.h b/src/frontends/qt2/qlkey.h index 6b0a070829..43e34bce3c 100644 --- a/src/frontends/qt2/qlkey.h +++ b/src/frontends/qt2/qlkey.h @@ -57,7 +57,9 @@ int string_to_qkey(string const & str) 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; @@ -69,6 +71,14 @@ int string_to_qkey(string const & str) 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 ?