]> git.lyx.org Git - features.git/commitdiff
display key binding in native UI style
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 26 Mar 2004 15:12:35 +0000 (15:12 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 26 Mar 2004 15:12:35 +0000 (15:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8532 a592a061-630c-0410-9148-cb99ea01b6c8

14 files changed:
src/ChangeLog
src/frontends/LyXKeySym.h
src/frontends/gtk/ChangeLog
src/frontends/gtk/GLyXKeySym.C
src/frontends/gtk/GLyXKeySym.h
src/frontends/qt2/ChangeLog
src/frontends/qt2/QLyXKeySym.C
src/frontends/qt2/QLyXKeySym.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/XLyXKeySym.C
src/frontends/xforms/XLyXKeySym.h
src/kbmap.C
src/kbmap.h
src/kbsequence.C

index 2acaf85e29953e8206502004b1eeef53d5e9d817..ec916b78c0636b2a4a402e2ce5a3d31691c5848d 100644 (file)
@@ -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
index b027b07f387b2f4ce9676b50db776b05d15601b4..12373c156e26befb4d2c02f963ccaaf46eddddf1 100644 (file)
@@ -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;
 };
 
 
index 6f7b26a4fb544541daacc214121cdecb58a3a66d..5e3d9fd408648df8e7ff7e65e0ad6c1c1055601e 100644 (file)
@@ -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
index bf50a7ab6f55713f7831df3d399375db4167ae26..37b5330adcc08cb3c9d71a5e3c792eb5c82f6d79 100644 (file)
@@ -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()
index 3ee53bcff000d58555b78f3d9be8d51e9278a221..d4c54c71d480a921e31ec7a7d7ca16a63f93affa 100644 (file)
@@ -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_;
 };
index b217d52f64032fa0fa006776835cc9527a419940..342f85fde26b8df5eb8047d342733b19625ef6c8 100644 (file)
@@ -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.
index bef0f54c3221b6050a1473d1981022e359435d50..a7de8ed629e7834e6ab8da9fb6b5b34753da30ea 100644 (file)
@@ -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()) {
index e27cfff3ad59faf536a326b39bc4bd618e977e30..96f359c9d185361600b1606d36183e829e068cd5 100644 (file)
@@ -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_;
index 517e664cb72f5093389f984c48a48fe04eba43fd..4d8f60dacec95ec2dff1ae5c72ea99b0e0a44323 100644 (file)
@@ -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:
index c883aec10202553d145066a35b250f32f4980871..5a71008dabc9a4c617f91fb93763f907f7cb6f3b 100644 (file)
@@ -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()
index d1dd7c63c514ee8b4acbba020d6121a2bf6243de..93944204a2798e135f2f5b7a589b9e69a453f950 100644 (file)
@@ -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_;
index 1278af359d46ce00e44e2787901c95846d7a3d99..81fb7060685d091d118f8d65ca3b1e0b46368f77 100644 (file)
@@ -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);
 }
 
 
index a9da168d31c7e597e9bd4e0d90f78e2c472eff62..b8eabff92d5db56af79b0c4c992b48f942e3711e 100644 (file)
@@ -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;
 
index 46aa4b8e869a456409bd8a400b4016ea3d009d76..ffe1661c5b562dc05d1cf60df5f9e9e068c57a21 100644 (file)
@@ -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) {