]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/qlkey.h
Some string(widget->text()) fixes. Weirdness
[lyx.git] / src / frontends / qt2 / qlkey.h
index 8048e80a0d2298711eac755491360b4597d73588..43e34bce3c955739c4d125000a5c55a3310696e2 100644 (file)
@@ -1,19 +1,24 @@
+// -*- C++ -*-
 /**
  * \file qlkey.h
- * Copyright 2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author John Levon <moz@compsoc.man.ac.uk>
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #ifndef QLKEY_H
 #define QLKEY_H
-#include <config.h>
-#include <qnamespace.h>
 
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <qnamespace.h>
 #include "LString.h"
+
 /**
  * Return true if the key event is a modifier.
  */
@@ -29,24 +34,32 @@ bool q_is_modifier(int qkey)
                case Qt::Key_Meta:
                case Qt::Key_Alt:
                        return true;
+
+               // AltGr becomes Key_unknown on at least one keyboard
+               case Qt::Key_unknown:
+                       return true;
        }
        return false;
 }
 
+
 /**
  * Return the numeric Qt Key corresponding to the
  * given symbol name.
  */
 int string_to_qkey(string const & str)
 {
+       // FIX! (Lgb)
+       
        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") 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;
@@ -58,10 +71,18 @@ 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 ?
-       if (str == "Alt_L") return Qt::Key_Alt;
+       if (str == "Alt_R") 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;
@@ -291,7 +312,7 @@ int string_to_qkey(string const & str)
        if (str == "thorn") return Qt::Key_thorn;
        if (str == "ydiaeresis") return Qt::Key_ydiaeresis;
 
-       // FIXME, correct for all these ? 
+       // FIXME, correct for all these ?
        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;
@@ -300,11 +321,11 @@ int string_to_qkey(string const & str)
        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;
 }
 
+
 /**
  * qkey_to_string - convert Qt keypress into LyX
  *
@@ -332,7 +353,7 @@ string const qkey_to_string(int lkey)
        case Qt::Key_Shift: return "Shift_L";
        case Qt::Key_Control: return "Control_L";
        case Qt::Key_Meta: return "Alt_L"; // correct ?
-       case Qt::Key_Alt: return "Alt_L";
+       case Qt::Key_Alt: return "Alt_R";
        case Qt::Key_CapsLock: return "Caps_Lock";
        case Qt::Key_NumLock: return "Num_Lock";
        case Qt::Key_ScrollLock: return "Scroll_Lock";