-rw-r--r-- | noncore/apps/opie-console/common.h | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_layer.cpp | 48 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_layer.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/screen.cpp | 22 | ||||
-rw-r--r-- | noncore/apps/opie-console/screen.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/vt102emulation.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/opie-console/vt102emulation.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/widget_layer.h | 11 |
8 files changed, 68 insertions, 55 deletions
diff --git a/noncore/apps/opie-console/common.h b/noncore/apps/opie-console/common.h index 979c2bd..a621ff5 100644 --- a/noncore/apps/opie-console/common.h +++ b/noncore/apps/opie-console/common.h @@ -2,3 +2,3 @@ /* */ -/* [TECommon.h] Common Definitions */ +/* [Common.h] Common Definitions */ /* */ @@ -18,3 +18,3 @@ -/*! \file TECommon.h +/*! \file Common.h \brief Definitions shared between TEScreen and TEWidget. @@ -22,4 +22,4 @@ -#ifndef TECOMMON_H -#define TECOMMON_H +#ifndef COMMON_H +#define COMMON_H @@ -113,2 +113,2 @@ struct ColorEntry -#endif // TECOMMON_H +#endif // COMMON_H diff --git a/noncore/apps/opie-console/emulation_layer.cpp b/noncore/apps/opie-console/emulation_layer.cpp index 6c420e0..5baf05c 100644 --- a/noncore/apps/opie-console/emulation_layer.cpp +++ b/noncore/apps/opie-console/emulation_layer.cpp @@ -78,3 +78,3 @@ #include "emulation_layer.h" -#include "widget.h" +#include "widget_layer.h" #include "screen.h" @@ -97,3 +97,3 @@ -EmulationLayer::EmulationLayer(Widget* gui) +EmulationLayer::EmulationLayer( WidgetLayer* gui ) : decoder((QTextDecoder*)NULL) @@ -102,4 +102,4 @@ EmulationLayer::EmulationLayer(Widget* gui) - screen[0] = new Screen(gui->Lines(),gui->Columns()); - screen[1] = new Screen(gui->Lines(),gui->Columns()); + screen[0] = new Screen(gui->lines(),gui->columns()); + screen[1] = new Screen(gui->lines(),gui->columns()); scr = screen[0]; @@ -110,17 +110,17 @@ EmulationLayer::EmulationLayer(Widget* gui) - 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()) ); + QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); + QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), + this,SLOT( onImageSizeChange( int, int ) ) ); + QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), + this,SLOT( historyCursorChange( int ) ) ); + QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ), + this,SLOT( onKeyPress( QKeyEvent* ) ) ); + QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ), + this,SLOT( onSelectionBegin( const int, const int ) ) ); + QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ), + this,SLOT( onSelectionExtend( const int,const int ) ) ); + QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ), + this,SLOT( setSelection( const bool ) ) ); + QObject::connect(gui,SIGNAL( selectionCleared() ), + this,SLOT( clearSelection() ) ); } @@ -199,3 +199,3 @@ void EmulationLayer::onRcvChar(int c) case '\r' : scr->Return(); break; - case 0x07 : gui->Bell(); break; + case 0x07 : gui->bell(); break; default : scr->ShowCharacter(c); break; @@ -305,3 +305,3 @@ void EmulationLayer::showBulk() { - Character* image = scr->getCookedImage(); // get the image + QArray<Character> image = scr->getCookedImage(); // get the image gui->setImage(image, @@ -309,3 +309,3 @@ void EmulationLayer::showBulk() scr->getColumns()); // actual refresh - free(image); + delete image; //FIXME: check that we do not trigger other draw event here. @@ -322,3 +322,3 @@ void EmulationLayer::bulkEnd() { - if ( bulk_nlcnt > gui->Lines() || bulk_incnt > 20 ) + if ( bulk_nlcnt > gui->lines() || bulk_incnt > 20 ) showBulk(); // resets bulk_??cnt to 0, too. @@ -333,3 +333,3 @@ void EmulationLayer::setConnect(bool c) { - onImageSizeChange(gui->Lines(), gui->Columns()); + onImageSizeChange(gui->lines(), gui->columns()); showBulk(); diff --git a/noncore/apps/opie-console/emulation_layer.h b/noncore/apps/opie-console/emulation_layer.h index 5781acc..91a4856 100644 --- a/noncore/apps/opie-console/emulation_layer.h +++ b/noncore/apps/opie-console/emulation_layer.h @@ -40,3 +40,3 @@ public: - EmulationLayer(Widget* gui); + EmulationLayer( WidgetLayer* gui ); ~EmulationLayer(); @@ -56,3 +56,3 @@ public slots: // signals incoming from Widget virtual void onSelectionExtend(const int x, const int y); - virtual void setSelection(const BOOL preserve_line_breaks); + virtual void setSelection(const bool preserve_line_breaks); @@ -108,3 +108,3 @@ protected: - Widget* gui; + WidgetLayer* gui; Screen* scr; // referes to one `screen' diff --git a/noncore/apps/opie-console/screen.cpp b/noncore/apps/opie-console/screen.cpp index 8ebc47d..a796ba1 100644 --- a/noncore/apps/opie-console/screen.cpp +++ b/noncore/apps/opie-console/screen.cpp @@ -70,3 +70,3 @@ Screen::Screen(int lines, int columns) - image = (Character*) malloc(lines*columns*sizeof(Character)); + image = QArray<Character>( lines*columns ); tabstops = NULL; initTabStops(); @@ -84,3 +84,3 @@ Screen::~Screen() { - free(image); + delete image; if (tabstops) free(tabstops); @@ -396,3 +396,3 @@ void Screen::resizeImage(int new_lines, int new_columns) // make new image - Character* newimg = (Character*) malloc(new_lines*new_columns*sizeof(Character)); + QArray<Character> newimg = QArray<Character>( new_lines * new_columns ); @@ -420,3 +420,3 @@ void Screen::resizeImage(int new_lines, int new_columns) } - free(image); + delete image; image = newimg; @@ -468,3 +468,3 @@ void Screen::resizeImage(int new_lines, int new_columns) -void Screen::reverseRendition(Character* p) +void Screen::reverseRendition(Character *p) { UINT8 f = p->f; UINT8 b = p->b; @@ -506,5 +506,5 @@ void Screen::effectiveRendition() -Character* Screen::getCookedImage() +QArray<Character> Screen::getCookedImage() { int x,y; - Character* merged = (Character*) malloc(lines*columns*sizeof(Character)); + Character* merged = (Character*) malloc( lines * columns * sizeof( Character ) ); Character dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); @@ -517,3 +517,3 @@ Character* Screen::getCookedImage() - hist.getCells(y+histCursor,0,len,merged+yp); + hist.getCells( y+histCursor, 0, len, merged+yp ); for (x = len; x < columns; x++) merged[yp+x] = dft; @@ -549,3 +549,5 @@ Character* Screen::getCookedImage() reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); - return merged; + QArray<Character> res( sizeof( merged ) / sizeof( Character ) ); + res.assign( merged, sizeof( merged ) / sizeof( Character ) ); + return res; } @@ -1161,3 +1163,3 @@ void Screen::addHistLine() - hist.addCells(image,end+1); + hist.addCells(image.data(), end+1); hist.addLine(); diff --git a/noncore/apps/opie-console/screen.h b/noncore/apps/opie-console/screen.h index cd7422a..38b84ab 100644 --- a/noncore/apps/opie-console/screen.h +++ b/noncore/apps/opie-console/screen.h @@ -138,3 +138,3 @@ public: // these are all `Screen' operations // - Character* getCookedImage(); + QArray<Character> getCookedImage(); @@ -177,3 +177,3 @@ private: // helper void effectiveRendition(); - void reverseRendition(Character* p); + void reverseRendition( Character *p ); @@ -195,3 +195,3 @@ private: int columns; - Character *image; // [lines][columns] + QArray<Character> image; // [lines][columns] diff --git a/noncore/apps/opie-console/vt102emulation.cpp b/noncore/apps/opie-console/vt102emulation.cpp index 2220f4e..7eecef3 100644 --- a/noncore/apps/opie-console/vt102emulation.cpp +++ b/noncore/apps/opie-console/vt102emulation.cpp @@ -67,3 +67,3 @@ -Vt102Emulation::Vt102Emulation(Widget* gui) : EmulationLayer(gui) +Vt102Emulation::Vt102Emulation(WidgetLayer* gui) : EmulationLayer(gui) { @@ -351,3 +351,3 @@ void Vt102Emulation::tau( int token, int p, int q ) case TY_CTL___('F' ) : /* ACK: ignored */ break; - case TY_CTL___('G' ) : gui->Bell ( ); break; //VT100 + case TY_CTL___('G' ) : gui->bell ( ); break; //VT100 case TY_CTL___('H' ) : scr->BackSpace ( ); break; //VT100 @@ -739,7 +739,7 @@ void Vt102Emulation::onKeyPress( QKeyEvent* ev ) { - 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_emitSelection : gui->insertSelection(); return; + case CMD_scrollPageUp : gui->scroll(-gui->lines()/2); return; + case CMD_scrollPageDown : gui->scroll(+gui->lines()/2); return; + case CMD_scrollLineUp : gui->scroll(-1 ); return; + case CMD_scrollLineDown : gui->scroll(+1 ); return; case CMD_send : sendString( txt ); return; @@ -926,3 +926,3 @@ void Vt102Emulation::setMode(int m) { - case MODE_Mouse1000 : gui->setMouseMarks(FALSE); + case MODE_Mouse1000 : //gui->setMouseMarks(FALSE); break; @@ -945,3 +945,3 @@ void Vt102Emulation::resetMode(int m) { - case MODE_Mouse1000 : gui->setMouseMarks(TRUE); + case MODE_Mouse1000 : //gui->setMouseMarks(TRUE); break; diff --git a/noncore/apps/opie-console/vt102emulation.h b/noncore/apps/opie-console/vt102emulation.h index a3d0ae6..de4a62f 100644 --- a/noncore/apps/opie-console/vt102emulation.h +++ b/noncore/apps/opie-console/vt102emulation.h @@ -62,3 +62,3 @@ public: - Vt102Emulation(Widget* gui); + Vt102Emulation(WidgetLayer* gui); ~Vt102Emulation(); diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h index 6e2e61e..5bd2ef9 100644 --- a/noncore/apps/opie-console/widget_layer.h +++ b/noncore/apps/opie-console/widget_layer.h @@ -108,2 +108,13 @@ public: + /** + * sets the scrollbar (if implemented by successor of this class) + */ + virtual void setScroll( int cursor, int slines ); + + /** + * scrolls (if implemented, by successor of this class) + * @param int value, how much the widget should scroll up (positive value) or down (negative value) + */ + virtual void scroll( int value ); + signals: |