2002-06-19 05:20:29 +00:00
|
|
|
/**
|
|
|
|
* \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"
|
2002-07-30 00:53:57 +00:00
|
|
|
#include "debug.h"
|
2002-06-19 05:20:29 +00:00
|
|
|
|
|
|
|
QLyXKeySym::QLyXKeySym()
|
2002-07-30 00:53:57 +00:00
|
|
|
: LyXKeySym(), key_(0), shift_(false)
|
2002-06-19 05:20:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-30 00:53:57 +00:00
|
|
|
void QLyXKeySym::set(int key, bool shift)
|
2002-06-19 05:20:29 +00:00
|
|
|
{
|
|
|
|
key_ = key;
|
2002-07-30 00:53:57 +00:00
|
|
|
shift_ = shift;
|
2002-06-19 05:20:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QLyXKeySym::init(string const & symbolname)
|
|
|
|
{
|
|
|
|
key_ = string_to_qkey(symbolname);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool QLyXKeySym::isOK() const
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
return key_ != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool QLyXKeySym::isModifier() const
|
|
|
|
{
|
|
|
|
return q_is_modifier(key_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string QLyXKeySym::getSymbolName() const
|
|
|
|
{
|
2002-07-30 00:53:57 +00:00
|
|
|
return qkey_to_string(key_, shift_);
|
2002-06-19 05:20:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char QLyXKeySym::getISOEncoded() const
|
|
|
|
{
|
2002-07-30 00:53:57 +00:00
|
|
|
/* Even though we could try to use QKeyEvent->text(),
|
|
|
|
* it won't work, because it returns something other
|
|
|
|
* than 'Z' for things like C-S-z. Do not ask me why,
|
|
|
|
* just more Qt bullshit.
|
|
|
|
*/
|
|
|
|
return qkey_to_char(key_, shift_);
|
2002-06-19 05:20:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool QLyXKeySym::operator==(LyXKeySym const & k) const
|
|
|
|
{
|
|
|
|
QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k);
|
2002-07-22 18:22:35 +00:00
|
|
|
return o.key_ == key_;
|
2002-06-19 05:20:29 +00:00
|
|
|
}
|