summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEmuVt102.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/core/apps/embeddedkonsole/TEmuVt102.cpp b/core/apps/embeddedkonsole/TEmuVt102.cpp
index 752c49f..275c18d 100644
--- a/core/apps/embeddedkonsole/TEmuVt102.cpp
+++ b/core/apps/embeddedkonsole/TEmuVt102.cpp
@@ -1,40 +1,40 @@
/* ------------------------------------------------------------------------- */
/* */
/* [TEmuVt102.C] VT102 Terminal Emulation */
/* */
/* ------------------------------------------------------------------------- */
/* */
/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
/* */
/* This file is part of Konsole - an X terminal for KDE */
/* */
/* ------------------------------------------------------------------------- */
-/* */
+/* */
/* Ported Konsole to Qt/Embedded */
-/* */
+/* */
/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
-/* */
+/* */
/* -------------------------------------------------------------------------- */
/*! \class TEmuVt102
\brief Actual Emulation for Konsole
\sa TEWidget \sa TEScreen
*/
#include "TEmuVt102.h"
#include "TEWidget.h"
#include "TEScreen.h"
#include "keytrans.h"
#include <stdio.h>
#include <unistd.h>
#include <qkeycode.h>
#include <qtextcodec.h>
/* VT102 Terminal Emulation
This class puts together the screens, the pty and the widget to a
complete terminal emulation. Beside combining it's componentes, it
@@ -722,50 +722,79 @@ void TEmuVt102::onKeyPress( QKeyEvent* ev )
if (keytrans->findEntry(ev->key(), encodeMode(MODE_NewLine , BITS_NewLine ) + // OLD,
encodeMode(MODE_Ansi , BITS_Ansi ) + // OBSOLETE,
encodeMode(MODE_AppCuKeys, BITS_AppCuKeys ) + // VT100 stuff
encodeStat(ControlButton , BITS_Control ) +
encodeStat(ShiftButton , BITS_Shift ) +
encodeStat(AltButton , BITS_Alt ),
&cmd, &txt, &len ))
//printf("cmd: %d, %s, %d\n",cmd,txt,len);
switch(cmd) // ... and execute if found.
{
case CMD_emitSelection : gui->emitSelection(); return;
case CMD_scrollPageUp : gui->doScroll(-gui->Lines()/2); return;
case CMD_scrollPageDown : gui->doScroll(+gui->Lines()/2); return;
case CMD_scrollLineUp : gui->doScroll(-1 ); return;
case CMD_scrollLineDown : gui->doScroll(+1 ); return;
case CMD_send : emit sndBlock(txt,len); return;
case CMD_prevSession : emit prevSession(); return;
case CMD_nextSession : emit nextSession(); return;
}
// fall back handling
if (!ev->text().isEmpty())
{
if (ev->state() & AltButton) sendString("\033"); // ESC, this is the ALT prefix
- QCString s = codec->fromUnicode(ev->text()); // encode for application
- emit sndBlock(s.data(),s.length()); // we may well have s.length() > 1
+ /// very hacky
+ if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='A')) sendString("\01");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='B')) sendString("\02");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='C')) sendString("\03");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='D')) sendString("\04");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='E')) sendString("\05");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='F')) sendString("\06");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='G')) sendString("\07");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='H')) sendString("\010");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='I')) sendString("\011");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='J')) sendString("\012");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='K')) sendString("\013");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='L')) sendString("\014");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='M')) sendString("\015");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='N')) sendString("\016");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='O')) sendString("\017");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='P')) sendString("\020");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='Q')) sendString("\021");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='R')) sendString("\022");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='S')) sendString("\023");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='T')) sendString("\024");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='U')) sendString("\025");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='V')) sendString("\026");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='W')) sendString("\027");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='X')) sendString("\030");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='Y')) sendString("\031");
+ else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='Z')) sendString("\032");
+ else {
+ QCString s = codec->fromUnicode(ev->text()); // encode for application
+ emit sndBlock(s.data(),s.length()); // we may well have s.length() > 1
+ }
return;
}
}
/* ------------------------------------------------------------------------- */
/* */
/* VT100 Charsets */
/* */
/* ------------------------------------------------------------------------- */
// Character Set Conversion ------------------------------------------------ --
/*
The processing contains a VT100 specific code translation layer.
It's still in use and mainly responsible for the line drawing graphics.
These and some other glyphs are assigned to codes (0x5f-0xfe)
normally occupied by the latin letters. Since this codes also
appear within control sequences, the extra code conversion
does not permute with the tokenizer and is placed behind it
in the pipeline. It only applies to tokens, which represent
plain characters.
This conversion it eventually continued in TEWidget.C, since
@@ -870,49 +899,49 @@ void TEmuVt102::restoreCursor()
*/
// "Mode" related part of the state. These are all booleans.
void TEmuVt102::resetModes()
{
resetMode(MODE_Mouse1000); saveMode(MODE_Mouse1000);
resetMode(MODE_AppScreen); saveMode(MODE_AppScreen);
// here come obsolete modes
resetMode(MODE_AppCuKeys); saveMode(MODE_AppCuKeys);
resetMode(MODE_NewLine );
setMode(MODE_Ansi );
}
void TEmuVt102::setMode(int m)
{
currParm.mode[m] = TRUE;
switch (m)
{
case MODE_Mouse1000 : gui->setMouseMarks(FALSE);
break;
case MODE_AppScreen : screen[1]->clearSelection();
screen[1]->clearEntireScreen();
setScreen(1);
- break;
+ break;
}
if (m < MODES_SCREEN || m == MODE_NewLine)
{
screen[0]->setMode(m);
screen[1]->setMode(m);
}
}
void TEmuVt102::resetMode(int m)
{
currParm.mode[m] = FALSE;
switch (m)
{
case MODE_Mouse1000 : gui->setMouseMarks(TRUE);
break;
case MODE_AppScreen : screen[0]->clearSelection();
setScreen(0);
break;
}
if (m < MODES_SCREEN || m == MODE_NewLine)
{
screen[0]->resetMode(m);
screen[1]->resetMode(m);
}