-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 @@ | |||
2 | /* */ | 2 | /* */ |
3 | /* [TECommon.h] Common Definitions */ | 3 | /* [Common.h] Common Definitions */ |
4 | /* */ | 4 | /* */ |
@@ -18,3 +18,3 @@ | |||
18 | 18 | ||
19 | /*! \file TECommon.h | 19 | /*! \file Common.h |
20 | \brief Definitions shared between TEScreen and TEWidget. | 20 | \brief Definitions shared between TEScreen and TEWidget. |
@@ -22,4 +22,4 @@ | |||
22 | 22 | ||
23 | #ifndef TECOMMON_H | 23 | #ifndef COMMON_H |
24 | #define TECOMMON_H | 24 | #define COMMON_H |
25 | 25 | ||
@@ -113,2 +113,2 @@ struct ColorEntry | |||
113 | 113 | ||
114 | #endif // TECOMMON_H | 114 | #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 @@ | |||
78 | #include "emulation_layer.h" | 78 | #include "emulation_layer.h" |
79 | #include "widget.h" | 79 | #include "widget_layer.h" |
80 | #include "screen.h" | 80 | #include "screen.h" |
@@ -97,3 +97,3 @@ | |||
97 | 97 | ||
98 | EmulationLayer::EmulationLayer(Widget* gui) | 98 | EmulationLayer::EmulationLayer( WidgetLayer* gui ) |
99 | : decoder((QTextDecoder*)NULL) | 99 | : decoder((QTextDecoder*)NULL) |
@@ -102,4 +102,4 @@ EmulationLayer::EmulationLayer(Widget* gui) | |||
102 | 102 | ||
103 | screen[0] = new Screen(gui->Lines(),gui->Columns()); | 103 | screen[0] = new Screen(gui->lines(),gui->columns()); |
104 | screen[1] = new Screen(gui->Lines(),gui->Columns()); | 104 | screen[1] = new Screen(gui->lines(),gui->columns()); |
105 | scr = screen[0]; | 105 | scr = screen[0]; |
@@ -110,17 +110,17 @@ EmulationLayer::EmulationLayer(Widget* gui) | |||
110 | 110 | ||
111 | QObject::connect(&bulk_timer, SIGNAL(timeout()), this, SLOT(showBulk()) ); | 111 | QObject::connect(&bulk_timer, SIGNAL( timeout() ), this, SLOT( showBulk() ) ); |
112 | QObject::connect(gui,SIGNAL(changedImageSizeSignal(int,int)), | 112 | QObject::connect(gui,SIGNAL( imageSizeChanged( int, int ) ), |
113 | this,SLOT(onImageSizeChange(int,int))); | 113 | this,SLOT( onImageSizeChange( int, int ) ) ); |
114 | QObject::connect(gui,SIGNAL(changedHistoryCursor(int)), | 114 | QObject::connect(gui,SIGNAL( changedHistoryCursor( int ) ), |
115 | this,SLOT(onHistoryCursorChange(int))); | 115 | this,SLOT( historyCursorChange( int ) ) ); |
116 | QObject::connect(gui,SIGNAL(keyPressedSignal(QKeyEvent*)), | 116 | QObject::connect(gui,SIGNAL( keyPressed( QKeyEvent* ) ), |
117 | this,SLOT(onKeyPress(QKeyEvent*))); | 117 | this,SLOT( onKeyPress( QKeyEvent* ) ) ); |
118 | QObject::connect(gui,SIGNAL(beginSelectionSignal(const int,const int)), | 118 | QObject::connect(gui,SIGNAL( selectionBegin( const int, const int) ), |
119 | this,SLOT(onSelectionBegin(const int,const int)) ); | 119 | this,SLOT( onSelectionBegin( const int, const int ) ) ); |
120 | QObject::connect(gui,SIGNAL(extendSelectionSignal(const int,const int)), | 120 | QObject::connect(gui,SIGNAL( selectionExtended( const int, const int ) ), |
121 | this,SLOT(onSelectionExtend(const int,const int)) ); | 121 | this,SLOT( onSelectionExtend( const int,const int ) ) ); |
122 | QObject::connect(gui,SIGNAL(endSelectionSignal(const BOOL)), | 122 | QObject::connect(gui,SIGNAL( selectionEnd( const bool ) ), |
123 | this,SLOT(setSelection(const BOOL)) ); | 123 | this,SLOT( setSelection( const bool ) ) ); |
124 | QObject::connect(gui,SIGNAL(clearSelectionSignal()), | 124 | QObject::connect(gui,SIGNAL( selectionCleared() ), |
125 | this,SLOT(clearSelection()) ); | 125 | this,SLOT( clearSelection() ) ); |
126 | } | 126 | } |
@@ -199,3 +199,3 @@ void EmulationLayer::onRcvChar(int c) | |||
199 | case '\r' : scr->Return(); break; | 199 | case '\r' : scr->Return(); break; |
200 | case 0x07 : gui->Bell(); break; | 200 | case 0x07 : gui->bell(); break; |
201 | default : scr->ShowCharacter(c); break; | 201 | default : scr->ShowCharacter(c); break; |
@@ -305,3 +305,3 @@ void EmulationLayer::showBulk() | |||
305 | { | 305 | { |
306 | Character* image = scr->getCookedImage(); // get the image | 306 | QArray<Character> image = scr->getCookedImage(); // get the image |
307 | gui->setImage(image, | 307 | gui->setImage(image, |
@@ -309,3 +309,3 @@ void EmulationLayer::showBulk() | |||
309 | scr->getColumns()); // actual refresh | 309 | scr->getColumns()); // actual refresh |
310 | free(image); | 310 | delete image; |
311 | //FIXME: check that we do not trigger other draw event here. | 311 | //FIXME: check that we do not trigger other draw event here. |
@@ -322,3 +322,3 @@ void EmulationLayer::bulkEnd() | |||
322 | { | 322 | { |
323 | if ( bulk_nlcnt > gui->Lines() || bulk_incnt > 20 ) | 323 | if ( bulk_nlcnt > gui->lines() || bulk_incnt > 20 ) |
324 | showBulk(); // resets bulk_??cnt to 0, too. | 324 | showBulk(); // resets bulk_??cnt to 0, too. |
@@ -333,3 +333,3 @@ void EmulationLayer::setConnect(bool c) | |||
333 | { | 333 | { |
334 | onImageSizeChange(gui->Lines(), gui->Columns()); | 334 | onImageSizeChange(gui->lines(), gui->columns()); |
335 | showBulk(); | 335 | 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: | |||
40 | 40 | ||
41 | EmulationLayer(Widget* gui); | 41 | EmulationLayer( WidgetLayer* gui ); |
42 | ~EmulationLayer(); | 42 | ~EmulationLayer(); |
@@ -56,3 +56,3 @@ public slots: // signals incoming from Widget | |||
56 | virtual void onSelectionExtend(const int x, const int y); | 56 | virtual void onSelectionExtend(const int x, const int y); |
57 | virtual void setSelection(const BOOL preserve_line_breaks); | 57 | virtual void setSelection(const bool preserve_line_breaks); |
58 | 58 | ||
@@ -108,3 +108,3 @@ protected: | |||
108 | 108 | ||
109 | Widget* gui; | 109 | WidgetLayer* gui; |
110 | Screen* scr; // referes to one `screen' | 110 | 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) | |||
70 | 70 | ||
71 | image = (Character*) malloc(lines*columns*sizeof(Character)); | 71 | image = QArray<Character>( lines*columns ); |
72 | tabstops = NULL; initTabStops(); | 72 | tabstops = NULL; initTabStops(); |
@@ -84,3 +84,3 @@ Screen::~Screen() | |||
84 | { | 84 | { |
85 | free(image); | 85 | delete image; |
86 | if (tabstops) free(tabstops); | 86 | if (tabstops) free(tabstops); |
@@ -396,3 +396,3 @@ void Screen::resizeImage(int new_lines, int new_columns) | |||
396 | // make new image | 396 | // make new image |
397 | Character* newimg = (Character*) malloc(new_lines*new_columns*sizeof(Character)); | 397 | QArray<Character> newimg = QArray<Character>( new_lines * new_columns ); |
398 | 398 | ||
@@ -420,3 +420,3 @@ void Screen::resizeImage(int new_lines, int new_columns) | |||
420 | } | 420 | } |
421 | free(image); | 421 | delete image; |
422 | image = newimg; | 422 | image = newimg; |
@@ -468,3 +468,3 @@ void Screen::resizeImage(int new_lines, int new_columns) | |||
468 | 468 | ||
469 | void Screen::reverseRendition(Character* p) | 469 | void Screen::reverseRendition(Character *p) |
470 | { UINT8 f = p->f; UINT8 b = p->b; | 470 | { UINT8 f = p->f; UINT8 b = p->b; |
@@ -506,5 +506,5 @@ void Screen::effectiveRendition() | |||
506 | 506 | ||
507 | Character* Screen::getCookedImage() | 507 | QArray<Character> Screen::getCookedImage() |
508 | { int x,y; | 508 | { int x,y; |
509 | Character* merged = (Character*) malloc(lines*columns*sizeof(Character)); | 509 | Character* merged = (Character*) malloc( lines * columns * sizeof( Character ) ); |
510 | Character dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); | 510 | Character dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); |
@@ -517,3 +517,3 @@ Character* Screen::getCookedImage() | |||
517 | 517 | ||
518 | hist.getCells(y+histCursor,0,len,merged+yp); | 518 | hist.getCells( y+histCursor, 0, len, merged+yp ); |
519 | for (x = len; x < columns; x++) merged[yp+x] = dft; | 519 | for (x = len; x < columns; x++) merged[yp+x] = dft; |
@@ -549,3 +549,5 @@ Character* Screen::getCookedImage() | |||
549 | reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); | 549 | reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); |
550 | return merged; | 550 | QArray<Character> res( sizeof( merged ) / sizeof( Character ) ); |
551 | res.assign( merged, sizeof( merged ) / sizeof( Character ) ); | ||
552 | return res; | ||
551 | } | 553 | } |
@@ -1161,3 +1163,3 @@ void Screen::addHistLine() | |||
1161 | 1163 | ||
1162 | hist.addCells(image,end+1); | 1164 | hist.addCells(image.data(), end+1); |
1163 | hist.addLine(); | 1165 | 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 | |||
138 | // | 138 | // |
139 | Character* getCookedImage(); | 139 | QArray<Character> getCookedImage(); |
140 | 140 | ||
@@ -177,3 +177,3 @@ private: // helper | |||
177 | void effectiveRendition(); | 177 | void effectiveRendition(); |
178 | void reverseRendition(Character* p); | 178 | void reverseRendition( Character *p ); |
179 | 179 | ||
@@ -195,3 +195,3 @@ private: | |||
195 | int columns; | 195 | int columns; |
196 | Character *image; // [lines][columns] | 196 | QArray<Character> image; // [lines][columns] |
197 | 197 | ||
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 @@ | |||
67 | 67 | ||
68 | Vt102Emulation::Vt102Emulation(Widget* gui) : EmulationLayer(gui) | 68 | Vt102Emulation::Vt102Emulation(WidgetLayer* gui) : EmulationLayer(gui) |
69 | { | 69 | { |
@@ -351,3 +351,3 @@ void Vt102Emulation::tau( int token, int p, int q ) | |||
351 | case TY_CTL___('F' ) : /* ACK: ignored */ break; | 351 | case TY_CTL___('F' ) : /* ACK: ignored */ break; |
352 | case TY_CTL___('G' ) : gui->Bell ( ); break; //VT100 | 352 | case TY_CTL___('G' ) : gui->bell ( ); break; //VT100 |
353 | case TY_CTL___('H' ) : scr->BackSpace ( ); break; //VT100 | 353 | case TY_CTL___('H' ) : scr->BackSpace ( ); break; //VT100 |
@@ -739,7 +739,7 @@ void Vt102Emulation::onKeyPress( QKeyEvent* ev ) | |||
739 | { | 739 | { |
740 | case CMD_emitSelection : gui->emitSelection(); return; | 740 | case CMD_emitSelection : gui->insertSelection(); return; |
741 | case CMD_scrollPageUp : gui->doScroll(-gui->Lines()/2); return; | 741 | case CMD_scrollPageUp : gui->scroll(-gui->lines()/2); return; |
742 | case CMD_scrollPageDown : gui->doScroll(+gui->Lines()/2); return; | 742 | case CMD_scrollPageDown : gui->scroll(+gui->lines()/2); return; |
743 | case CMD_scrollLineUp : gui->doScroll(-1 ); return; | 743 | case CMD_scrollLineUp : gui->scroll(-1 ); return; |
744 | case CMD_scrollLineDown : gui->doScroll(+1 ); return; | 744 | case CMD_scrollLineDown : gui->scroll(+1 ); return; |
745 | case CMD_send : sendString( txt ); return; | 745 | case CMD_send : sendString( txt ); return; |
@@ -926,3 +926,3 @@ void Vt102Emulation::setMode(int m) | |||
926 | { | 926 | { |
927 | case MODE_Mouse1000 : gui->setMouseMarks(FALSE); | 927 | case MODE_Mouse1000 : //gui->setMouseMarks(FALSE); |
928 | break; | 928 | break; |
@@ -945,3 +945,3 @@ void Vt102Emulation::resetMode(int m) | |||
945 | { | 945 | { |
946 | case MODE_Mouse1000 : gui->setMouseMarks(TRUE); | 946 | case MODE_Mouse1000 : //gui->setMouseMarks(TRUE); |
947 | break; | 947 | 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: | |||
62 | 62 | ||
63 | Vt102Emulation(Widget* gui); | 63 | Vt102Emulation(WidgetLayer* gui); |
64 | ~Vt102Emulation(); | 64 | ~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: | |||
108 | 108 | ||
109 | /** | ||
110 | * sets the scrollbar (if implemented by successor of this class) | ||
111 | */ | ||
112 | virtual void setScroll( int cursor, int slines ); | ||
113 | |||
114 | /** | ||
115 | * scrolls (if implemented, by successor of this class) | ||
116 | * @param int value, how much the widget should scroll up (positive value) or down (negative value) | ||
117 | */ | ||
118 | virtual void scroll( int value ); | ||
119 | |||
109 | signals: | 120 | signals: |