]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLyXKeySym.C
Remove crap again. Make redo key binding work.
[lyx.git] / src / frontends / qt2 / QLyXKeySym.C
1 /**
2  * \file QLyXKeySym.C
3  * Copyright 2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author Asger and Juergen
7  * \author John Levon <moz@compsoc.man.ac.uk>
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "QLyXKeySym.h"
17 #include "qlkey.h"
18 #include "debug.h"
19  
20 #include <qevent.h>
21  
22 QLyXKeySym::QLyXKeySym()
23         : LyXKeySym(), key_(0)
24 {
25 }
26  
27  
28 void QLyXKeySym::set(QKeyEvent * ev)
29 {
30         key_ = ev->key();
31         text_ = ev->text(); 
32 }
33  
34
35 void QLyXKeySym::init(string const & symbolname)
36 {
37         key_ = string_to_qkey(symbolname);
38         text_ = symbolname.c_str();
39         lyxerr[Debug::KEY] << "Init key to " << key_ << ", " << text_ << endl;
40 }
41
42  
43 bool QLyXKeySym::isOK() const
44 {
45         return ! key_ == 0;
46 }
47  
48
49 bool QLyXKeySym::isModifier() const
50 {
51         return q_is_modifier(key_);
52 }
53
54
55 string QLyXKeySym::getSymbolName() const
56 {
57         string sym(qkey_to_string(key_));
58
59         if (sym.empty()) {
60                 lyxerr[Debug::KEY] << "sym empty in getSymbolName()" << endl;
61                 sym = text_.latin1();
62         }
63         lyxerr[Debug::KEY] << "getSymbolName() -> " << sym << endl;
64         return sym;
65 }
66
67  
68 char QLyXKeySym::getISOEncoded() const
69 {
70         lyxerr[Debug::KEY] << "getISO returning " << text_.latin1()[0] << endl;
71         return text_.latin1()[0]; 
72 }
73  
74
75 bool QLyXKeySym::operator==(LyXKeySym const & k) const
76 {
77         QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k);
78         // ignore text_ ! 
79         return o.key_ == key_;
80 }