Remove crap again. Make redo key binding work.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5100 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-08-25 06:45:16 +00:00
parent f238a21d66
commit 85aca478e1
4 changed files with 34 additions and 42 deletions

View File

@ -1,3 +1,10 @@
2002-08-25 John Levon <levon@movementarian.org>
* qlkey.h: add A-Z into string_to_qkey
* QLyXKeySym.h:
* QLyXKeySym.C: remove crap again
2002-08-25 John Levon <levon@movementarian.org>
* QLyXKeySym.h:

View File

@ -29,7 +29,6 @@ void QLyXKeySym::set(QKeyEvent * ev)
{
key_ = ev->key();
text_ = ev->text();
ascii_ = ev->ascii();
}
@ -37,7 +36,6 @@ void QLyXKeySym::init(string const & symbolname)
{
key_ = string_to_qkey(symbolname);
text_ = symbolname.c_str();
ascii_ = 0;
lyxerr[Debug::KEY] << "Init key to " << key_ << ", " << text_ << endl;
}
@ -54,39 +52,13 @@ bool QLyXKeySym::isModifier() const
}
// This is one ALMIGHTY hack. When you press C-S-z, you get
// "Press key 90 text "?", ascii "26"
// where text is meaningless. So we check specifically
// for this case ! (90 is 'Z')
// We also check against 0 for when we're comparing
// against a stored binding.
bool QLyXKeySym::is_qt_bogon() const
{
if (ascii_ == 0)
return false;
return (ascii_ < 27 && !text_.isEmpty());
}
char QLyXKeySym::debogonify() const
{
return 'A' + ascii_ - 1;
}
string QLyXKeySym::getSymbolName() const
{
string sym(qkey_to_string(key_));
// deal with "A", "a" properly
if (sym.empty()) {
lyxerr[Debug::KEY] << "sym empty in getSymbolName()" << endl;
if (is_qt_bogon()) {
sym = debogonify();
} else {
sym = text_.latin1();
}
sym = text_.latin1();
}
lyxerr[Debug::KEY] << "getSymbolName() -> " << sym << endl;
return sym;
@ -96,11 +68,6 @@ string QLyXKeySym::getSymbolName() const
char QLyXKeySym::getISOEncoded() const
{
lyxerr[Debug::KEY] << "getISO returning " << text_.latin1()[0] << endl;
if (is_qt_bogon()) {
return debogonify();
}
return text_.latin1()[0];
}

View File

@ -58,18 +58,10 @@ public:
virtual bool operator==(LyXKeySym const & k) const;
private:
/// return true if bogon (see source)
bool is_qt_bogon() const;
/// return the fixed bogon (see source)
char debogonify() const;
/// the Qt sym value
int key_;
/// the event string value
QString text_;
/// hack-o-rama
int ascii_;
};
#endif // QLYXKEYSYM_H

View File

@ -117,6 +117,32 @@ int string_to_qkey(string const & str)
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 == "a") return Qt::Key_A;
if (str == "b") return Qt::Key_B;
if (str == "c") return Qt::Key_C;