Emulation::Emulation(TEWidget* gui) { this->gui = gui; this->scr = new TEScreen(gui->Lines(),gui->Columns()); 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(keyPressedSignal(QKeyEvent*)), this,SLOT(onKeyPress(QKeyEvent*))); QObject::connect(gui,SIGNAL(beginSelectionSignal(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)) ); QObject::connect(gui,SIGNAL(endSelectionSignal(const BOOL)), this,SLOT(setSelection(const BOOL)) ); QObject::connect(gui,SIGNAL(clearSelectionSignal()), this,SLOT(clearSelection()) ); }
void Emulation::onImageSizeChange(int lines, int columns) { if (!connected) return; scr->resizeImage(lines,columns); showBulk(); emit ImageSizeChanged(lines,columns); // propagate event to serial line }
void Emulation::bulkEnd() { if ( bulk_nlcnt > gui->Lines() || bulk_incnt > 20 ) showBulk(); // resets bulk_??cnt to 0, too. else bulk_timer.start(BULK_TIMEOUT,TRUE); }
Emulation::Emulation() : _currentScreen(0), _codec(0), _decoder(0), _keyTranslator(0), _usesMouse(false) { // create screens with a default size _screen[0] = new Screen(40,80); _screen[1] = new Screen(40,80); _currentScreen = _screen[0]; QObject::connect(&_bulkTimer1, SIGNAL(timeout()), this, SLOT(showBulk()) ); QObject::connect(&_bulkTimer2, SIGNAL(timeout()), this, SLOT(showBulk()) ); // listen for mouse status changes connect( this , SIGNAL(programUsesMouseChanged(bool)) , SLOT(usesMouseChanged(bool)) ); }
void Emulation::clearSelection() { if (!connected) return; _currentScreen->clearSelection(); showBulk(); }
void Emulation::onSelectionExtend(const int x, const int y) { if (!connected) return; _currentScreen->setSelectionEnd(x,y); showBulk(); }
void Emulation::onSelectionBegin(const int x, const int y, const bool columnmode) { if (!connected) return; _currentScreen->setSelectionStart( x,y,columnmode); showBulk(); }
void Emulation::setHistory(const HistoryType& t) { _screen[0]->setScroll(t); showBulk(); }
void Emulation::onHistoryCursorChange(int cursor) { if (!connected) return; scr->setHistCursor(cursor); showBulk(); }
void Emulation::setConnect(bool c) { connected = c; if ( connected) showBulk(); if (!connected) scr->clearSelection(); }
void Emulation::clearSelection() { if (!connected) return; scr->clearSelection(); showBulk(); }
void Emulation::onSelectionExtend(const int x, const int y) { if (!connected) return; scr->setSelExtentXY(x,y); showBulk(); }
// Selection --------------------------- void Emulation::onSelectionBegin(const int x, const int y) { if (!connected) return; scr->setSelBeginXY(x,y); showBulk(); }