]> git.lyx.org Git - features.git/commitdiff
Missing files, get keyboard partly working
authorJohn Levon <levon@movementarian.org>
Wed, 19 Jun 2002 05:20:29 +0000 (05:20 +0000)
committerJohn Levon <levon@movementarian.org>
Wed, 19 Jun 2002 05:20:29 +0000 (05:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4429 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/frontends/qt2/ChangeLog
src/frontends/qt2/LyXKeySymFactory.C [new file with mode: 0644]
src/frontends/qt2/Makefile.am
src/frontends/qt2/Menubar_pimpl.C [new file with mode: 0644]
src/frontends/qt2/Menubar_pimpl.h [new file with mode: 0644]
src/frontends/qt2/QContentPane.C
src/frontends/qt2/QLyXKeySym.C [new file with mode: 0644]
src/frontends/qt2/QLyXKeySym.h [new file with mode: 0644]
src/frontends/qt2/lyx_gui.C [new file with mode: 0644]
src/frontends/qt2/qfont_loader.C
src/frontends/qt2/qfont_metrics.C
src/frontends/qt2/qlkey.h

index a319daf476dec7e2e121db9245ef64805e9c6795..d86a65feec85ed8ec9f911a7cd3f3aeda82fa93c 100644 (file)
@@ -1,3 +1,15 @@
+2002-06-19  John Levon  <moz@compsoc.man.ac.uk>
+
+       * LyXKeySymFactory.C: add
+
+       * Makefile.am:
+       * QContentPane.C:
+       * qlkey.h:
+       * QLyXKeySym.h:
+       * QLyXKeySym.C: get keyboard partly working
+
+       * qfont_metrics.C: fix compile 
 2002-06-19  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am: add the new files ...
diff --git a/src/frontends/qt2/LyXKeySymFactory.C b/src/frontends/qt2/LyXKeySymFactory.C
new file mode 100644 (file)
index 0000000..d748f31
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * \file LyXKeySymFactory.C
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Asger & Juergen
+ */
+
+#include <config.h>
+#include "frontends/LyXKeySymFactory.h"
+
+#include "QLyXKeySym.h"
+
+namespace LyXKeySymFactory {
+
+LyXKeySym * create()
+{
+       return new QLyXKeySym();
+}
+}
index ced80b9fd912d5ea96b91822d98ecfc3c076249f..1119f4c406db7f607507cc73fe51861d2cd31f8c 100644 (file)
@@ -23,6 +23,7 @@ libqt2_la_SOURCES = \
        Dialogs.C \
        FileDialog.C \
        FileDialog_private.C \
+       LyXKeySymFactory.C \
        LyXScreenFactory.C \
        Menubar_pimpl.C \
        Menubar_pimpl.h \
diff --git a/src/frontends/qt2/Menubar_pimpl.C b/src/frontends/qt2/Menubar_pimpl.C
new file mode 100644 (file)
index 0000000..666a776
--- /dev/null
@@ -0,0 +1,134 @@
+/**
+ * \file Menubar_pimpl.C
+ * Copyright 1999-2001 The LyX Team.
+ * See the file COPYING.
+ *
+ * \author  Lars Gullik Bjønnes, larsbj@lyx.org
+ */
+
+#include <config.h>
+
+#include <algorithm>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "Menubar_pimpl.h"
+#include "MenuBackend.h"
+#include "LyXAction.h"
+#include "kbmap.h"
+#include "buffer.h"
+#include "Dialogs.h"
+#include "lyxfunc.h"
+#include "FloatList.h"
+#include "support/lstrings.h"
+#include "support/LAssert.h"
+#include "gettext.h"
+#include "debug.h"
+
+#include "QtView.h"
+#include <qmenubar.h>
+#include <qpopupmenu.h>
+using std::endl;
+using std::vector;
+using std::max;
+using std::min;
+using std::for_each;
+
+typedef vector<int>::size_type size_type;
+
+extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
+extern LyXAction lyxaction;
+
+
+Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb) 
+       : owner_(static_cast<QtView*>(view)), menubackend_(mb)
+{
+       MenuBackend::const_iterator mb = menubackend_.begin(); 
+       MenuBackend::const_iterator mbend = menubackend_.end();
+       for (; mb != mbend; ++mb) {
+               if (mb->menubar() && mb->name() == "main") {
+                       Menu::const_iterator m = mb->begin();
+                       Menu::const_iterator end = mb->end();
+                       for (; m != end; ++m) {
+                               makeMenu(owner_->menuBar(), *m);
+                       }
+               }
+       }
+}
+
+
+void Menubar::Pimpl::makeMenu(QMenuData * parent, MenuItem const & menu)
+{
+       // FIXME: leak
+       QPopupMenu * pm = new QPopupMenu();
+       parent->insertItem(menu.label().c_str(), pm);
+       Menu md;
+       menubackend_.getMenu(menu.submenu()).expand(md, 0);
+       Menu::const_iterator m = md.begin();
+       Menu::const_iterator end = md.end();
+       for (; m != end; ++m) {
+               if (m->kind() == MenuItem::Separator) {
+                       pm->insertSeparator();
+               } else {
+                       pm->insertItem(m->label().c_str(), m->action());
+               } 
+       }
+}
+
+void Menubar::Pimpl::set(string const & menu_name) 
+{
+       lyxerr[Debug::GUI] << "Entering Menubar::Pimpl::set " 
+                          << "for menu `" << menu_name << "'" << endl;
+
+#if 0
+       if (menu_name != current_menu_name_) {
+               MenubarMap::iterator mbit = menubarmap_.find(menu_name);
+
+               if (mbit == menubarmap_.end()) {
+                       lyxerr << "ERROR:set: Unknown menu `" << menu_name
+                              << "'" << endl;
+                       return;
+               }
+
+               if (current_group_) {
+                       lyxerr[Debug::GUI] << "  hiding group "
+                                          << current_group_ << endl;
+                       fl_hide_object(current_group_);
+               }
+               
+               lyxerr[Debug::GUI] << "  showing group "
+                                  << mbit->second << endl;
+               fl_show_object(mbit->second);
+               current_menu_name_ = menu_name;
+               current_group_ = mbit->second;
+               lyxerr[Debug::GUI] << "Menubar::Pimpl::set: Menubar set."
+                                  << endl;
+       } else
+               lyxerr [Debug::GUI] << "Menubar::Pimpl::set: Nothing to do."
+                                   << endl;
+#endif
+} 
+
+
+void Menubar::Pimpl::openByName(string const & name)
+{
+       lyxerr << "Menubar::Pimpl::openByName: menu " << name << endl;
+
+#if 0
+       if (menubackend_->getMenu(current_menu_name_).hasSubmenu(name)) {
+               for (ButtonList::const_iterator cit = buttonlist_.begin();
+                    cit != buttonlist_.end(); ++cit) {
+                       if ((*cit)->item_->submenu() == name) {
+                               MenuCallback((*cit)->obj_, 1);
+                               return;
+                       }
+               }
+       }
+#endif
+}
diff --git a/src/frontends/qt2/Menubar_pimpl.h b/src/frontends/qt2/Menubar_pimpl.h
new file mode 100644 (file)
index 0000000..4c46b28
--- /dev/null
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+/**
+ * \file Menubar_pimpl.h
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Lars Gullik Bjønnes <larsbj@lyx.org>
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef MENUBAR_PIMPL_H
+#define MENUBAR_PIMPL_H
+
+#include <vector>
+#include <map>
+#include <boost/smart_ptr.hpp>
+
+#include <config.h>
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "LString.h"
+#include "frontends/Menubar.h"
+#include "commandtags.h"
+//#include "MenuBackend.h"
+
+class LyXView;
+class QtView;
+class QMenuData;
+class Menu;
+class MenuItem;
+class MenuBackend;
+
+struct Menubar::Pimpl {
+public:
+       ///
+       Pimpl(LyXView *, MenuBackend const &);
+       ///
+       void set(string const &);
+       /// Opens a top-level submenu given its name
+       void openByName(string const &);
+
+        /// update the state of the menuitems
+        void update() {}
+
+private:
+       void makeMenu(QMenuData * parent, MenuItem const & menu);
+       QtView * owner_;
+
+       MenuBackend const & menubackend_;
+};
+#endif
index c37e641783e7adbedbedd990f1d81ca2558992ca..b204275dd2223c5d7621fa1de39ca7556030be1a 100644 (file)
@@ -116,7 +116,9 @@ void QContentPane::keyPressEvent(QKeyEvent * e)
        char const * tmp = e->text().latin1();
        string const text = tmp ? tmp : "";
        lyxerr[Debug::GUI] << "key text " << text << endl;
-       wa_->workAreaKeyPress(LyXKeySymPtr(new QLyXKeySym(*e)), q_key_state(e->state()));
+       QLyXKeySym * sym = new QLyXKeySym();
+       sym->set(e->key(), e->text());
+       wa_->workAreaKeyPress(LyXKeySymPtr(sym), q_key_state(e->state()));
 }
 
  
diff --git a/src/frontends/qt2/QLyXKeySym.C b/src/frontends/qt2/QLyXKeySym.C
new file mode 100644 (file)
index 0000000..a8421f6
--- /dev/null
@@ -0,0 +1,74 @@
+/**
+ * \file QLyXKeySym.C
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Asger and Juergen
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "QLyXKeySym.h"
+
+#include "qevent.h"
+#include "qlkey.h"
+QLyXKeySym::QLyXKeySym()
+       : LyXKeySym(), key_(0), text_("")
+{
+}
+void QLyXKeySym::set(int key, QString const & text)
+{
+       key_ = key;
+       text_ = text;
+}
+
+void QLyXKeySym::init(string const & symbolname)
+{
+       // FIXME: ARGHH !
+       key_ = string_to_qkey(symbolname);
+}
+
+bool QLyXKeySym::isOK() const
+{
+       // FIXME
+       return key_ != 0;
+}
+
+bool QLyXKeySym::isModifier() const
+{
+       return q_is_modifier(key_);
+}
+
+string QLyXKeySym::getSymbolName() const
+{
+       // FIXME
+       return qkey_to_string(key_);
+}
+
+char QLyXKeySym::getISOEncoded() const
+{
+       // FIXME
+       return text_.latin1()[0];
+}
+
+bool QLyXKeySym::operator==(LyXKeySym const & k) const
+{
+       QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k);
+
+       // FIXME: UGHGHGHGGH
+       return o.key_ == key_ /*&& o.text_ == text_*/;
+}
diff --git a/src/frontends/qt2/QLyXKeySym.h b/src/frontends/qt2/QLyXKeySym.h
new file mode 100644 (file)
index 0000000..4865179
--- /dev/null
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+/**
+ * \file QLyXKeySym.h
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Asger and Juergen
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef QLYXKEYSYM_H
+#define QLYXKEYSYM_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "LString.h"
+#include "frontends/LyXKeySym.h"
+
+#include <qstring.h> 
+/**
+ * Qt-specific key press.
+ */
+class QLyXKeySym : public LyXKeySym {
+public:
+       QLyXKeySym();
+
+       void set(int key, QString const & text);
+
+       virtual void init(string const & symbolname);
+
+       virtual ~QLyXKeySym() {}
+
+       /// Is this a valid key?
+       virtual bool isOK() const;
+
+       /// Is this a modifier key only?
+       virtual bool isModifier() const;
+       
+       virtual string getSymbolName() const;
+
+       /**
+        * Return the value of the keysym into the local ISO encoding.
+        * This converts the LyXKeySym to a 8-bit encoded character.
+        * This relies on user to use the right encoding.
+        */
+       virtual char getISOEncoded() const;
+
+       virtual bool operator==(LyXKeySym const & k) const;
+
+private:
+       int key_;
+       QString text_;
+};
+
+#endif // QLYXKEYSYM_H
diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C
new file mode 100644 (file)
index 0000000..aa616e3
--- /dev/null
@@ -0,0 +1,113 @@
+/**
+ * \file lyx_gui.C
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
+ *
+ * \author unknown
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+#include "lyx_gui.h"
+#include "support/lyxlib.h"
+#include "support/os.h"
+#include "support/filetools.h"
+#include "debug.h"
+#include "gettext.h"
+#include "lyx_main.h"
+#include "lyxrc.h"
+
+// FIXME: move this stuff out again
+#include "bufferlist.h"
+#include "lyxfunc.h"
+#include "lyxserver.h"
+#include "BufferView.h"
+#include "QtView.h"
+#include <fcntl.h>
+
+#include <boost/bind.hpp>
+#include <qapplication.h>
+#ifndef CXX_GLOBAL_CSTD
+using std::exit;
+#endif
+
+using std::vector;
+using std::hex;
+using std::endl;
+extern bool finished;
+extern BufferList bufferlist;
+// FIXME: wrong place !
+LyXServer * lyxserver;
+void lyx_gui::parse_init(int & argc, char * argv[])
+{
+       static QApplication a(argc, argv);
+}
+
+void lyx_gui::parse_lyxrc()
+{
+       // FIXME !!!! 
+       lyxrc.dpi = 95;
+}
+
+void lyx_gui::start(string const & batch, vector<string> files)
+{
+       // initial geometry
+       int xpos = -1;
+       int ypos = -1;
+       unsigned int width = 690;
+       unsigned int height = 510;
+       QtView view(width, height);
+       view.show(xpos, ypos, "LyX");
+       view.init();
+
+       Buffer * last = 0;
+       // FIXME: some code below needs moving
+
+       lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes);
+       vector<string>::const_iterator cit = files.begin();
+       vector<string>::const_iterator end = files.end();
+       for (; cit != end; ++cit) {
+               Buffer * b = bufferlist.loadLyXFile(*cit);
+               if (b) {
+                       last = b;
+               }
+       }
+
+       // switch to the last buffer successfully loaded
+       if (last) {
+               view.view()->buffer(last);
+       }
+
+       // handle the batch commands the user asked for
+       if (!batch.empty()) {
+               view.getLyXFunc()->verboseDispatch(batch, false);
+       }
+
+       while (!finished) {
+               qApp->processEvents();
+       }
+                
+       // FIXME 
+       delete lyxserver;
+}
+void lyx_gui::init_graphics()
+{
+       // FIXME
+}
index 9679479c7be9c3ee103608438dbdb8f01498a53f..64eccb4a1288755f73678687574c1c8e47ec2a87 100644 (file)
@@ -18,8 +18,6 @@
 #include "debug.h"
 #include "lyxrc.h"
 #include "BufferView.h"
-#include "frontends/LyXView.h"
-
  
 qfont_loader::qfont_loader()
 {
index a2a181498c866fcf58d3465dfde8513431309462..2b3cf1c8aa1b023f7f1b7c59379be0440b9f2622 100644 (file)
 #include <qfontmetrics.h>
 #include <qfont.h>
 
-// FIXME ?
-extern qfont_loader * global_fontloader;
 namespace {
        QFontMetrics const & metrics(LyXFont const & f) {
-               return global_fontloader->metrics(f);
+               return fontloader.metrics(f);
        }
 };
 
@@ -86,8 +83,8 @@ int width(char const * s, size_t ls, LyXFont const & f)
        LyXFont smallfont(f);
        smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
 
-       QFontMetrics qm = global_fontloader->metrics(f);
-       QFontMetrics qsmallm = global_fontloader->metrics(smallfont);
+       QFontMetrics qm = fontloader.metrics(f);
+       QFontMetrics qsmallm = fontloader.metrics(smallfont);
 
        int w = 0;
 
index 5901e6d0009055acc32042d249ea0eabd8197df8..ddeb4d9fb2ff6a801eb59a682e3509ea2f17a373 100644 (file)
 
 #include "LString.h"
  
+int q_is_modifier(int qkey)
+{
+       switch (qkey) {
+               case Qt::Key_Hyper_L:
+               case Qt::Key_Hyper_R:
+               case Qt::Key_Super_L:
+               case Qt::Key_Super_R:
+               case Qt::Key_Shift:
+               case Qt::Key_Control:
+               case Qt::Key_Meta:
+               case Qt::Key_Alt:
+                       return true;
+       }
+       return false;
+}
+
+// FIXME
+int string_to_qkey(string const & str)
+{
+       if (str == "Escape") return Qt::Key_Escape;
+       if (str == "Tab") return Qt::Key_Tab;
+       if (str == "BackSpace") return Qt::Key_BackSpace;
+       if (str == "Return") return Qt::Key_Return;
+       if (str == "KP_Enter") // correct ?? return Qt::Key_Enter;
+       if (str == "Insert") return Qt::Key_Insert;
+       if (str == "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 == "Home") return Qt::Key_Home;
+       if (str == "End") return Qt::Key_End;
+       if (str == "Left") return Qt::Key_Left;
+       if (str == "Up") return Qt::Key_Up;
+       if (str == "Right") return Qt::Key_Right;
+       if (str == "Down") return Qt::Key_Down;
+       if (str == "Prior") return Qt::Key_Prior;
+       if (str == "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") // correct ? return Qt::Key_Meta;
+       if (str == "Alt_L") return Qt::Key_Alt;
+       if (str == "Caps_Lock") return Qt::Key_CapsLock;
+       if (str == "Num_Lock") return Qt::Key_NumLock;
+       if (str == "Scroll_Lock") return Qt::Key_ScrollLock;
+       if (str == "F1") return Qt::Key_F1;
+       if (str == "F2") return Qt::Key_F2;
+       if (str == "F3") return Qt::Key_F3;
+       if (str == "F4") return Qt::Key_F4;
+       if (str == "F5") return Qt::Key_F5;
+       if (str == "F6") return Qt::Key_F6;
+       if (str == "F7") return Qt::Key_F7;
+       if (str == "F8") return Qt::Key_F8;
+       if (str == "F9") return Qt::Key_F9;
+       if (str == "F10") return Qt::Key_F10;
+       if (str == "F11") return Qt::Key_F11;
+       if (str == "F12") return Qt::Key_F12;
+       if (str == "F13") return Qt::Key_F13;
+       if (str == "F14") return Qt::Key_F14;
+       if (str == "F15") return Qt::Key_F15;
+       if (str == "F16") return Qt::Key_F16;
+       if (str == "F17") return Qt::Key_F17;
+       if (str == "F18") return Qt::Key_F18;
+       if (str == "F19") return Qt::Key_F19;
+       if (str == "F20") return Qt::Key_F20;
+       if (str == "F21") return Qt::Key_F21;
+       if (str == "F22") return Qt::Key_F22;
+       if (str == "F23") return Qt::Key_F23;
+       if (str == "F24") return Qt::Key_F24;
+       if (str == "F25") return Qt::Key_F25;
+       if (str == "F26") return Qt::Key_F26;
+       if (str == "F27") return Qt::Key_F27;
+       if (str == "F28") return Qt::Key_F28;
+       if (str == "F29") return Qt::Key_F29;
+       if (str == "F30") return Qt::Key_F30;
+       if (str == "F31") return Qt::Key_F31;
+       if (str == "F32") return Qt::Key_F32;
+       if (str == "F33") return Qt::Key_F33;
+       if (str == "F34") return Qt::Key_F34;
+       if (str == "F35") return Qt::Key_F35;
+       if (str == "0") return Qt::Key_0;
+       if (str == "1") return Qt::Key_1;
+       if (str == "2") return Qt::Key_2;
+       if (str == "3") return Qt::Key_3;
+       if (str == "4") return Qt::Key_4;
+       if (str == "5") return Qt::Key_5;
+       if (str == "6") return Qt::Key_6;
+       if (str == "7") return Qt::Key_7;
+       if (str == "8") return Qt::Key_8;
+       if (str == "9") return Qt::Key_9;
+       if (str == "colon") return Qt::Key_Colon;
+       if (str == "semicolon") return Qt::Key_Semicolon;
+       if (str == "less") return Qt::Key_Less;
+       if (str == "equal") return Qt::Key_Equal;
+       if (str == "greater") return Qt::Key_Greater;
+       if (str == "question") return Qt::Key_Question;
+       if (str == "at") return Qt::Key_At;
+       if (str == "a") return Qt::Key_A;
+       if (str == "b") return Qt::Key_B;
+       if (str == "c") return Qt::Key_C;
+       if (str == "d") return Qt::Key_D;
+       if (str == "e") return Qt::Key_E;
+       if (str == "f") return Qt::Key_F;
+       if (str == "g") return Qt::Key_G;
+       if (str == "h") return Qt::Key_H;
+       if (str == "i") return Qt::Key_I;
+       if (str == "j") return Qt::Key_J;
+       if (str == "k") return Qt::Key_K;
+       if (str == "l") return Qt::Key_L;
+       if (str == "m") return Qt::Key_M;
+       if (str == "n") return Qt::Key_N;
+       if (str == "o") return Qt::Key_O;
+       if (str == "p") return Qt::Key_P;
+       if (str == "q") return Qt::Key_Q;
+       if (str == "r") return Qt::Key_R;
+       if (str == "s") return Qt::Key_S;
+       if (str == "t") return Qt::Key_T;
+       if (str == "u") return Qt::Key_U;
+       if (str == "v") return Qt::Key_V;
+       if (str == "w") return Qt::Key_W;
+       if (str == "x") return Qt::Key_X;
+       if (str == "y") return Qt::Key_Y;
+       if (str == "z") return Qt::Key_Z;
+       if (str == "bracketleft") return Qt::Key_BracketLeft;
+       if (str == "backslash") return Qt::Key_Backslash;
+       if (str == "bracketright") return Qt::Key_BracketRight;
+       if (str == "underscore") return Qt::Key_Underscore;
+       if (str == "space") return Qt::Key_Space;
+       if (str == "parenleft") return Qt::Key_ParenLeft;
+       if (str == "parenright") return Qt::Key_ParenRight;
+       if (str == "quotedbl") return Qt::Key_QuoteDbl;
+       if (str == "exclam") return Qt::Key_Exclam;
+       if (str == "numbersign") return Qt::Key_NumberSign;
+       if (str == "asciicircum") return Qt::Key_AsciiCircum;
+       if (str == "dollar") return Qt::Key_Dollar;
+       if (str == "percent") return Qt::Key_Percent;
+       if (str == "ampersand") return Qt::Key_Ampersand;
+       if (str == "asterisk") return Qt::Key_Asterisk;
+       if (str == "apostrophe") return Qt::Key_Apostrophe;
+       if (str == "plus") return Qt::Key_Plus;
+       if (str == "minus") return Qt::Key_Minus;
+       if (str == "comma") return Qt::Key_Comma;
+       if (str == "period") return Qt::Key_Period;
+       if (str == "slash") return Qt::Key_Slash;
+       if (str == "asciitilde") return Qt::Key_AsciiTilde;
+       if (str == "braceleft") return Qt::Key_BraceLeft;
+       if (str == "braceright") return Qt::Key_BraceRight;
+       if (str == "grave") // ??? return Qt::Key_QuoteLeft;
+       if (str == "notsign") return Qt::Key_notsign;
+       if (str == "nobreakspace") return Qt::Key_nobreakspace;
+       if (str == "exclamdown") return Qt::Key_exclamdown;
+       if (str == "cent") return Qt::Key_cent;
+       if (str == "sterling") return Qt::Key_sterling;
+       if (str == "currency") return Qt::Key_currency;
+       if (str == "yen") return Qt::Key_yen;
+       if (str == "brokenbar") return Qt::Key_brokenbar;
+       if (str == "section") return Qt::Key_section;
+       if (str == "diaeresis") return Qt::Key_diaeresis;
+       if (str == "copyright") return Qt::Key_copyright;
+       if (str == "ordfeminine") return Qt::Key_ordfeminine;
+       if (str == "guillemotleft") return Qt::Key_guillemotleft;
+       if (str == "hyphen") return Qt::Key_hyphen;
+       if (str == "registered") return Qt::Key_registered;
+       if (str == "macron") return Qt::Key_macron;
+       if (str == "degree") return Qt::Key_degree;
+       if (str == "plusminus") return Qt::Key_plusminus;
+       if (str == "twosuperior") return Qt::Key_twosuperior;
+       if (str == "threesuperior") return Qt::Key_threesuperior;
+       if (str == "acute") return Qt::Key_acute;
+       if (str == "mu") return Qt::Key_mu;
+       if (str == "paragraph") return Qt::Key_paragraph;
+       if (str == "periodcentered") return Qt::Key_periodcentered;
+       if (str == "cedilla") return Qt::Key_cedilla;
+       if (str == "onesuperior") return Qt::Key_onesuperior;
+       if (str == "masculine") return Qt::Key_masculine;
+       if (str == "guillemotright") return Qt::Key_guillemotright;
+       if (str == "onequarter") return Qt::Key_onequarter;
+       if (str == "onehalf") return Qt::Key_onehalf;
+       if (str == "threequarters") return Qt::Key_threequarters;
+       if (str == "questiondown") return Qt::Key_questiondown;
+       if (str == "Agrave") return Qt::Key_Agrave;
+       if (str == "Aacute") return Qt::Key_Aacute;
+       if (str == "Acircumflex") return Qt::Key_Acircumflex;
+       if (str == "Atilde") return Qt::Key_Atilde;
+       if (str == "Adiaeresis") return Qt::Key_Adiaeresis;
+       if (str == "Aring") return Qt::Key_Aring;
+       if (str == "AE") return Qt::Key_AE;
+       if (str == "Ccedilla") return Qt::Key_Ccedilla;
+       if (str == "Egrave") return Qt::Key_Egrave;
+       if (str == "Eacute") return Qt::Key_Eacute;
+       if (str == "Ecircumflex") return Qt::Key_Ecircumflex;
+       if (str == "Ediaeresis") return Qt::Key_Ediaeresis;
+       if (str == "Igrave") return Qt::Key_Igrave;
+       if (str == "Iacute") return Qt::Key_Iacute;
+       if (str == "Icircumflex") return Qt::Key_Icircumflex;
+       if (str == "Idiaeresis") return Qt::Key_Idiaeresis;
+       if (str == "ETH") return Qt::Key_ETH;
+       if (str == "Ntilde") return Qt::Key_Ntilde;
+       if (str == "Ograve") return Qt::Key_Ograve;
+       if (str == "Oacute") return Qt::Key_Oacute;
+       if (str == "Ocircumflex") return Qt::Key_Ocircumflex;
+       if (str == "Otilde") return Qt::Key_Otilde;
+       if (str == "Odiaeresis") return Qt::Key_Odiaeresis;
+       if (str == "multiply") return Qt::Key_multiply;
+       if (str == "Ooblique") return Qt::Key_Ooblique;
+       if (str == "Ugrave") return Qt::Key_Ugrave;
+       if (str == "Uacute") return Qt::Key_Uacute;
+       if (str == "Ucircumflex") return Qt::Key_Ucircumflex;
+       if (str == "Udiaeresis") return Qt::Key_Udiaeresis;
+       if (str == "Yacute") return Qt::Key_Yacute;
+       if (str == "THORN") return Qt::Key_THORN;
+       if (str == "ssharp") return Qt::Key_ssharp;
+       if (str == "agrave") return Qt::Key_agrave;
+       if (str == "aacute") return Qt::Key_aacute;
+       if (str == "acircumflex") return Qt::Key_acircumflex;
+       if (str == "atilde") return Qt::Key_atilde;
+       if (str == "adiaeresis") return Qt::Key_adiaeresis;
+       if (str == "aring") return Qt::Key_aring;
+       if (str == "ae") return Qt::Key_ae;
+       if (str == "ccedilla") return Qt::Key_ccedilla;
+       if (str == "egrave") return Qt::Key_egrave;
+       if (str == "eacute") return Qt::Key_eacute;
+       if (str == "ecircumflex") return Qt::Key_ecircumflex;
+       if (str == "ediaeresis") return Qt::Key_ediaeresis;
+       if (str == "igrave") return Qt::Key_igrave;
+       if (str == "iacute") return Qt::Key_iacute;
+       if (str == "icircumflex") return Qt::Key_icircumflex;
+       if (str == "idiaeresis") return Qt::Key_idiaeresis;
+       if (str == "eth") return Qt::Key_eth;
+       if (str == "ntilde") return Qt::Key_ntilde;
+       if (str == "ograve") return Qt::Key_ograve;
+       if (str == "oacute") return Qt::Key_oacute;
+       if (str == "ocircumflex") return Qt::Key_ocircumflex;
+       if (str == "otilde") return Qt::Key_otilde;
+       if (str == "odiaeresis") return Qt::Key_odiaeresis;
+       if (str == "division") return Qt::Key_division;
+       if (str == "oslash") return Qt::Key_oslash;
+       if (str == "ugrave") return Qt::Key_ugrave;
+       if (str == "uacute") return Qt::Key_uacute;
+       if (str == "ucircumflex") return Qt::Key_ucircumflex;
+       if (str == "udiaeresis") return Qt::Key_udiaeresis;
+       if (str == "yacute") return Qt::Key_yacute;
+       if (str == "thorn") return Qt::Key_thorn;
+       if (str == "ydiaeresis") return Qt::Key_ydiaeresis;
+
+       // FIXME: these ones I don't know the names of ... help !
+       // what's here is basically guesses ...
+       if (str == "Super_L") return Qt::Key_Super_L;
+       if (str == "Super_R") return Qt::Key_Super_R;
+       if (str == "Menu") return Qt::Key_Menu;
+       if (str == "Hyper_L") return Qt::Key_Hyper_L;
+       if (str == "Hyper_R") return Qt::Key_Hyper_R;
+       if (str == "Help") return Qt::Key_Help;
+       if (str == "Bar") return Qt::Key_Bar;
+       if (str == "BackTab") return Qt::Key_Backtab;
+       return Qt::Key_unknown;
+}
+
 /**
  * q_to_lkey - convert Qt keypress into LyX
  *
  * Convert the Qt keypress into a string understandable
  * by the LyX core (same as XKeysymToString)
  */
-string const q_to_lkey(int lkey) 
+string const qkey_to_string(int lkey) 
 {
        switch(lkey) {
        case Qt::Key_Escape: return "Escape";