]> 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 d0a49e5d669999fa68fd031225ea32a470740e02..43e34bce3c955739c4d125000a5c55a3310696e2 100644 (file)
@@ -1,26 +1,29 @@
+// -*- 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"
-#include "debug.h"
+
 /**
  * Return true if the key event is a modifier.
  */
 bool q_is_modifier(int qkey)
 {
-       lyxerr[Debug::GUI] << "check modifier " << qkey << std::endl;
        switch (qkey) {
                case Qt::Key_Hyper_L:
                case Qt::Key_Hyper_R:
@@ -31,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;
@@ -60,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 ?
@@ -293,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;
@@ -302,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
  *