summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp148
-rw-r--r--inputmethods/multikey/keyboard.h6
2 files changed, 153 insertions, 1 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 28d5cab..1dd8ca1 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -42,5 +42,5 @@
Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0),
- meta(0), circumflex(0), diaeresis(0),
+ meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0),
useLargeKeys(TRUE), usePicks(0), useRepeat(0),
pressedKeyRow(-1), pressedKeyCol(-1),
@@ -191,4 +191,8 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
else if (diaeresis && keys->diaeresis(keys->shift(c)))
c = keys->diaeresis(keys->shift(c));
+ else if (baccent && keys->baccent(keys->shift(c)))
+ c = keys->baccent(keys->shift(c));
+ else if (accent && keys->accent(keys->shift(c)))
+ c = keys->accent(keys->shift(c));
else if (meta && keys->meta(keys->shift(c)))
c = keys->meta(keys->shift(c));
@@ -200,4 +204,8 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
else if (circumflex && keys->circumflex(c))
c = keys->circumflex(c);
+ else if (baccent && keys->baccent(c))
+ c = keys->baccent(c);
+ else if (accent && keys->accent(c))
+ c = keys->accent(c);
else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) {
@@ -261,4 +269,8 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
else if (diaeresis && keys->diaeresis(keys->shift(c)))
c = keys->diaeresis(keys->shift(c));
+ else if (baccent && keys->baccent(keys->shift(c)))
+ c = keys->baccent(keys->shift(c));
+ else if (accent && keys->accent(keys->shift(c)))
+ c = keys->accent(keys->shift(c));
else if (meta && keys->meta(keys->shift(c)))
c = keys->meta(keys->shift(c));
@@ -270,4 +282,8 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
else if (circumflex && keys->circumflex(c))
c = keys->circumflex(c);
+ else if (baccent && keys->baccent(c))
+ c = keys->baccent(c);
+ else if (accent && keys->accent(c))
+ c = keys->accent(c);
else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) {
@@ -347,4 +363,39 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
}
+ // Back accent character support
+
+ if (unicode == 0x60) {
+
+ unicode = 0;
+ if (shift || lock) {
+
+ // circumblex
+ qkeycode = 0x2000;
+ }
+ else {
+
+ // back accent
+ qkeycode = 0x2002;
+ }
+ }
+
+ // Accent character support
+
+ if (unicode == 0xb4) {
+
+ unicode = 0;
+ if (shift || lock) {
+
+ // diaeresis
+ qkeycode = 0x2001;
+ }
+ else {
+
+ // accent
+ qkeycode = 0x2003;
+ }
+ }
+
+
if (unicode == 0) { // either Qt char, or nothing
@@ -473,4 +524,6 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
if (circumflex) { *circumflex = 0; circumflex = 0; }
if (diaeresis) { *diaeresis = 0; diaeresis = 0; }
+ if (baccent) { *baccent = 0; baccent = 0; }
+ if (accent) { *accent = 0; accent = 0; }
// dont need to emit this key... acts same as alt
@@ -552,4 +605,48 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
qkeycode = 0;
+
+ // Back accent
+ } else if (qkeycode == 0x2002) {
+ need_repaint = TRUE;
+
+ if (baccent) {
+
+ *baccent = 0;
+ baccent = 0;
+
+ } else {
+
+ baccent = keys->pressedPtr(row, col);
+ *baccent = true;
+ }
+
+
+ if (shift) { *shift = 0; shift = 0; }
+ if (meta) { *meta = 0; meta = 0; }
+ if (accent) { *accent = 0; accent = 0; }
+
+ qkeycode = 0;
+
+ // Accent
+ } else if (qkeycode == 0x2003) {
+ need_repaint = TRUE;
+
+ if (accent) {
+
+ *accent = 0;
+ accent = 0;
+
+ } else {
+
+ accent = keys->pressedPtr(row, col);
+ *accent = true;
+ }
+
+
+ if (shift) { *shift = 0; shift = 0; }
+ if (meta) { *meta = 0; meta = 0; }
+ if (baccent) { *baccent = 0; }
+
+ qkeycode = 0;
}
@@ -565,4 +662,8 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
else if (diaeresis && keys->diaeresis(keys->shift(unicode)))
unicode = keys->diaeresis(keys->shift(unicode));
+ else if (baccent && keys->baccent(keys->shift(unicode)))
+ unicode = keys->baccent(keys->shift(unicode));
+ else if (accent && keys->accent(keys->shift(unicode)))
+ unicode = keys->accent(keys->shift(unicode));
else if (meta && keys->meta(keys->shift(unicode)))
unicode = keys->meta(keys->shift(unicode));
@@ -580,4 +681,10 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
unicode = keys->diaeresis(unicode);
}
+ else if (baccent && keys->baccent(unicode)) {
+ unicode = keys->baccent(unicode);
+ }
+ else if (accent && keys->accent(unicode)) {
+ unicode = keys->accent(unicode);
+ }
}
@@ -734,4 +841,6 @@ void Keyboard::resetState()
if (circumflex) { *circumflex = 0; circumflex = 0; }
if (diaeresis) { *diaeresis = 0; diaeresis = 0; }
+ if (baccent) { *baccent = 0; baccent = 0; }
+ if (accent) { *accent = 0; accent = 0; }
schar = mchar = echar = 0;
@@ -1341,4 +1450,29 @@ void Keys::setKeysFromFile(const char * filename) {
buf = t.readLine();
}
+ // back accent
+ else if (buf.contains(QRegExp("^\\s*b\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) {
+
+ QTextStream tmp (buf, IO_ReadOnly);
+ ushort lower, shift;
+ QChar d;
+ tmp >> d >> lower >> shift;
+
+ baccentMap.insert(lower, shift);
+
+ qDebug ("Estoy añadiendo %i con %i", lower, shift);
+ buf = t.readLine();
+ }
+ // accent
+ else if (buf.contains(QRegExp("^\\s*a\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) {
+
+ QTextStream tmp (buf, IO_ReadOnly);
+ ushort lower, shift;
+ QChar d;
+ tmp >> d >> lower >> shift;
+
+ accentMap.insert(lower, shift);
+
+ buf = t.readLine();
+ }
// other variables like lang & title
@@ -1490,4 +1624,16 @@ ushort Keys::diaeresis(const ushort uni) {
}
+ushort Keys::baccent(const ushort uni) {
+
+ if(baccentMap[uni]) return baccentMap[uni];
+ else return 0;
+}
+
+ushort Keys::accent(const ushort uni) {
+
+ if(accentMap[uni]) return accentMap[uni];
+ else return 0;
+}
+
bool *Keys::pressedPtr(const int row, const int col) {
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index 8af80d0..bc74e71 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -67,4 +67,6 @@ public:
ushort circumflex(const ushort);
ushort diaeresis(const ushort);
+ ushort baccent(const ushort);
+ ushort accent(const ushort);
QImage *pix(const int row, const int col);
int numKeys(const int row);
@@ -93,4 +95,6 @@ private:
QMap<ushort,ushort> circumflexMap;
QMap<ushort,ushort> diaeresisMap;
+ QMap<ushort,ushort> baccentMap;
+ QMap<ushort,ushort> accentMap;
};
@@ -139,4 +143,6 @@ private:
bool *circumflex;
bool *diaeresis;
+ bool *baccent;
+ bool *accent;
uint useLargeKeys:1;