mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
display key binding in native UI style
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8532 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c158a7987b
commit
500fa5f591
@ -1,3 +1,10 @@
|
||||
2004-03-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* kbsequence.C (print): adjust
|
||||
|
||||
* kbmap.C (printKeySym): rename and change signature
|
||||
(printKey): use LyXKeySym::print()
|
||||
|
||||
2004-03-26 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* undo.C: add using std::advance to compile for stlport
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "key_state.h"
|
||||
|
||||
/**
|
||||
* This is a base class for representing a keypress.
|
||||
* Each frontend has to implement this to provide
|
||||
@ -47,6 +49,12 @@ public:
|
||||
* This relies on user to use the right encoding.
|
||||
*/
|
||||
virtual char getISOEncoded(std::string const & encoding) const = 0;
|
||||
|
||||
/**
|
||||
* Return a string describing the KeySym with modifier mod.
|
||||
* This should use the native UI format when applicable
|
||||
*/
|
||||
virtual std::string const print(key_modifier::state mod) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-03-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* GLyXKeySym.C (print): new method; print a keysym using
|
||||
kb_keymap::printKeySym (should use some native gtk method instead)
|
||||
|
||||
2004-03-24 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GMenubar.C (submenuDisabled, onSubMenuActivate): compile fixes
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "GLyXKeySym.h"
|
||||
|
||||
#include "kbmap.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
@ -92,6 +94,12 @@ char GLyXKeySym::getISOEncoded(string const & /*encoding*/) const
|
||||
}
|
||||
|
||||
|
||||
string const GLyXKeySym::print(key_modifier::state mod) const
|
||||
{
|
||||
return kb_keymap::printKeySym(*this, mod);
|
||||
}
|
||||
|
||||
|
||||
bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
|
||||
{
|
||||
return static_cast<GLyXKeySym const &>(k1).getKeyval()
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
virtual bool isModifier() const;
|
||||
virtual std::string getSymbolName() const;
|
||||
virtual char getISOEncoded(std::string const & encoding) const;
|
||||
virtual std::string const print(key_modifier::state mod) const;
|
||||
private:
|
||||
unsigned int keyval_;
|
||||
};
|
||||
|
@ -1,3 +1,7 @@
|
||||
2004-03-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* QLyXKeySym.C (print): new method; print a KeySym using Qt syntax
|
||||
|
||||
2004-03-17 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs2.C, lyx_gui.C: remove mention of the forks dialog.
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "qlkey.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include <qaccel.h>
|
||||
#include <qevent.h>
|
||||
#include <qtextcodec.h>
|
||||
|
||||
@ -167,6 +168,22 @@ char QLyXKeySym::getISOEncoded(string const & encoding) const
|
||||
}
|
||||
|
||||
|
||||
string const QLyXKeySym::print(key_modifier::state mod) const
|
||||
{
|
||||
int tmpkey = key_;
|
||||
|
||||
|
||||
if (mod & key_modifier::shift)
|
||||
tmpkey += Qt::SHIFT;
|
||||
if (mod & key_modifier::ctrl)
|
||||
tmpkey += Qt::CTRL;
|
||||
if (mod & key_modifier::alt)
|
||||
tmpkey += Qt::ALT;
|
||||
|
||||
return fromqstr(QAccel::keyToString(tmpkey));
|
||||
}
|
||||
|
||||
|
||||
bool QLyXKeySym::isText() const
|
||||
{
|
||||
if (text_.isEmpty()) {
|
||||
|
@ -54,6 +54,10 @@ public:
|
||||
* This relies on user to use the right encoding.
|
||||
*/
|
||||
virtual char getISOEncoded(std::string const & encoding) const;
|
||||
|
||||
///
|
||||
virtual std::string const print(key_modifier::state mod) const;
|
||||
|
||||
///
|
||||
int key() const {
|
||||
return key_;
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-03-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* XLyXKeySym.C (print): new method; print a keysym using
|
||||
kb_keymap::printKeySym.
|
||||
|
||||
2004-03-17 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs2.C, FormForks.[Ch], Makefile.am:
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "XLyXKeySym.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "kbmap.h"
|
||||
|
||||
#include <X11/keysym.h>
|
||||
|
||||
@ -100,6 +101,12 @@ char XLyXKeySym::getISOEncoded(string const &) const
|
||||
}
|
||||
|
||||
|
||||
string const XLyXKeySym::print(key_modifier::state mod) const
|
||||
{
|
||||
return kb_keymap::printKeySym(*this, mod);
|
||||
}
|
||||
|
||||
|
||||
bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
|
||||
{
|
||||
return static_cast<XLyXKeySym const &>(k1).keysym()
|
||||
|
@ -44,6 +44,9 @@ public:
|
||||
*/
|
||||
virtual char getISOEncoded(std::string const & encoding) const;
|
||||
|
||||
///
|
||||
virtual std::string const print(key_modifier::state mod) const;
|
||||
|
||||
///
|
||||
unsigned int keysym() const {
|
||||
return keysym_;
|
||||
|
@ -30,12 +30,12 @@ using std::endl;
|
||||
using std::string;
|
||||
|
||||
|
||||
string const kb_keymap::printKeysym(LyXKeySymPtr key,
|
||||
string const kb_keymap::printKeySym(LyXKeySym const & key,
|
||||
key_modifier::state mod)
|
||||
{
|
||||
string buf;
|
||||
|
||||
string const s = key->getSymbolName();
|
||||
string const s = key.getSymbolName();
|
||||
|
||||
if (mod & key_modifier::shift)
|
||||
buf += "S-";
|
||||
@ -51,7 +51,7 @@ string const kb_keymap::printKeysym(LyXKeySymPtr key,
|
||||
|
||||
string const kb_keymap::printKey(kb_key const & key) const
|
||||
{
|
||||
return printKeysym(key.code, key.mod.first);
|
||||
return key.code->print(key.mod.first);
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,8 +64,8 @@ public:
|
||||
* @param key the key as a keysym
|
||||
* @param mod the modifiers
|
||||
*/
|
||||
static std::string const printKeysym(LyXKeySymPtr key,
|
||||
key_modifier::state mod);
|
||||
static std::string const printKeySym(LyXKeySym const & key,
|
||||
key_modifier::state mod);
|
||||
|
||||
typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
|
||||
|
||||
|
@ -137,7 +137,7 @@ string const kb_sequence::print() const
|
||||
KeySequence::size_type i, length = sequence.size();
|
||||
|
||||
for (i = 0; i < length; ++i) {
|
||||
buf += kb_keymap::printKeysym(sequence[i], modifiers[i].first);
|
||||
buf += kb_keymap::printKeySym(*sequence[i], modifiers[i].first);
|
||||
|
||||
// append a blank
|
||||
if (i + 1 < length) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user