summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/TEmulation.cpp
Side-by-side diff
Diffstat (limited to 'core/apps/embeddedkonsole/TEmulation.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEmulation.cpp43
1 files changed, 29 insertions, 14 deletions
diff --git a/core/apps/embeddedkonsole/TEmulation.cpp b/core/apps/embeddedkonsole/TEmulation.cpp
index 6f3ad32..c19f2a1 100644
--- a/core/apps/embeddedkonsole/TEmulation.cpp
+++ b/core/apps/embeddedkonsole/TEmulation.cpp
@@ -1,28 +1,28 @@
/* -------------------------------------------------------------------------- */
/* */
/* [TEmulation.cpp] Terminal Emulation Decoder */
/* */
/* -------------------------------------------------------------------------- */
/* */
/* 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 TEmulation
\brief Mediator between TEWidget and TEScreen.
This class is responsible to scan the escapes sequences of the terminal
emulation and to map it to their corresponding semantic complements.
Thus this module knows mainly about decoding escapes sequences and
is a stateless device w.r.t. the semantics.
It is also responsible to refresh the TEWidget by certain rules.
@@ -94,38 +94,48 @@ TEmulation::TEmulation(TEWidget* gui)
{
this->gui = gui;
screen[0] = new TEScreen(gui->Lines(),gui->Columns());
screen[1] = new TEScreen(gui->Lines(),gui->Columns());
scr = screen[0];
bulk_nlcnt = 0; // reset bulk newline counter
bulk_incnt = 0; // reset bulk counter
connected = FALSE;
QObject::connect(&bulk_timer, SIGNAL(timeout()), this, SLOT(showBulk()) );
+
QObject::connect(gui,SIGNAL(changedImageSizeSignal(int,int)),
this,SLOT(onImageSizeChange(int,int)));
+
QObject::connect(gui,SIGNAL(changedHistoryCursor(int)),
this,SLOT(onHistoryCursorChange(int)));
+
+ QObject::connect(gui,SIGNAL(changedHorzCursor(int)),
+ this,SLOT(onHorzCursorChange(int)));
+
QObject::connect(gui,SIGNAL(keyPressedSignal(QKeyEvent*)),
this,SLOT(onKeyPress(QKeyEvent*)));
+
QObject::connect(gui,SIGNAL(beginSelectionSignal(const int,const int)),
- this,SLOT(onSelectionBegin(const int,const int)) );
+ this,SLOT(onSelectionBegin(const int,const int)) );
+
QObject::connect(gui,SIGNAL(extendSelectionSignal(const int,const int)),
- this,SLOT(onSelectionExtend(const int,const int)) );
+ this,SLOT(onSelectionExtend(const int,const int)) );
+
QObject::connect(gui,SIGNAL(endSelectionSignal(const BOOL)),
- this,SLOT(setSelection(const BOOL)) );
+ this,SLOT(setSelection(const BOOL)) );
+
QObject::connect(gui,SIGNAL(clearSelectionSignal()),
- this,SLOT(clearSelection()) );
+ this,SLOT(clearSelection()) );
}
/*!
*/
TEmulation::~TEmulation()
{
delete screen[0];
delete screen[1];
bulk_timer.stop();
}
@@ -290,26 +300,28 @@ void TEmulation::bulkNewline()
void TEmulation::showBulk()
{
bulk_nlcnt = 0; // reset bulk newline counter
bulk_incnt = 0; // reset bulk counter
if (connected)
{
ca* image = scr->getCookedImage(); // get the image
gui->setImage(image,
scr->getLines(),
scr->getColumns()); // actual refresh
free(image);
- //FIXME: check that we do not trigger other draw event here.
+
+ //FIXME: check that we do not trigger other draw event here.
gui->setScroll(scr->getHistCursor(),scr->getHistLines());
+
}
}
void TEmulation::bulkStart()
{
if (bulk_timer.isActive()) bulk_timer.stop();
}
void TEmulation::bulkEnd()
{
if ( bulk_nlcnt > gui->Lines() || bulk_incnt > 20 )
showBulk(); // resets bulk_??cnt to 0, too.
@@ -330,34 +342,37 @@ void TEmulation::setConnect(bool c)
scr->clearSelection();
}
}
// ---------------------------------------------------------------------------
/*! triggered by image size change of the TEWidget `gui'.
This event is simply propagated to the attached screens
and to the related serial line.
*/
-void TEmulation::onImageSizeChange(int lines, int columns)
-{
+void TEmulation::onImageSizeChange(int lines, int columns) {
if (!connected) return;
screen[0]->resizeImage(lines,columns);
screen[1]->resizeImage(lines,columns);
showBulk();
emit ImageSizeChanged(lines,columns); // propagate event to serial line
}
-void TEmulation::onHistoryCursorChange(int cursor)
-{
+void TEmulation::onHistoryCursorChange(int cursor) {
if (!connected) return;
scr->setHistCursor(cursor);
showBulk();
}
-void TEmulation::setColumns(int columns)
-{
+void TEmulation::onHorzCursorChange(int cursor) {
+ if (!connected) return;
+ scr->setHorzCursor(cursor);
+ showBulk();
+}
+
+void TEmulation::setColumns(int columns) {
//FIXME: this goes strange ways.
// Can we put this straight or explain it at least?
emit changeColumns(columns);
}