mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
85aca478e1
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5100 a592a061-630c-0410-9148-cb99ea01b6c8
81 lines
1.3 KiB
C
81 lines
1.3 KiB
C
/**
|
|
* \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 "qlkey.h"
|
|
#include "debug.h"
|
|
|
|
#include <qevent.h>
|
|
|
|
QLyXKeySym::QLyXKeySym()
|
|
: LyXKeySym(), key_(0)
|
|
{
|
|
}
|
|
|
|
|
|
void QLyXKeySym::set(QKeyEvent * ev)
|
|
{
|
|
key_ = ev->key();
|
|
text_ = ev->text();
|
|
}
|
|
|
|
|
|
void QLyXKeySym::init(string const & symbolname)
|
|
{
|
|
key_ = string_to_qkey(symbolname);
|
|
text_ = symbolname.c_str();
|
|
lyxerr[Debug::KEY] << "Init key to " << key_ << ", " << text_ << endl;
|
|
}
|
|
|
|
|
|
bool QLyXKeySym::isOK() const
|
|
{
|
|
return ! key_ == 0;
|
|
}
|
|
|
|
|
|
bool QLyXKeySym::isModifier() const
|
|
{
|
|
return q_is_modifier(key_);
|
|
}
|
|
|
|
|
|
string QLyXKeySym::getSymbolName() const
|
|
{
|
|
string sym(qkey_to_string(key_));
|
|
|
|
if (sym.empty()) {
|
|
lyxerr[Debug::KEY] << "sym empty in getSymbolName()" << endl;
|
|
sym = text_.latin1();
|
|
}
|
|
lyxerr[Debug::KEY] << "getSymbolName() -> " << sym << endl;
|
|
return sym;
|
|
}
|
|
|
|
|
|
char QLyXKeySym::getISOEncoded() const
|
|
{
|
|
lyxerr[Debug::KEY] << "getISO returning " << text_.latin1()[0] << endl;
|
|
return text_.latin1()[0];
|
|
}
|
|
|
|
|
|
bool QLyXKeySym::operator==(LyXKeySym const & k) const
|
|
{
|
|
QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k);
|
|
// ignore text_ !
|
|
return o.key_ == key_;
|
|
}
|