author | ibotty <ibotty> | 2002-10-09 17:40:35 (UTC) |
---|---|---|
committer | ibotty <ibotty> | 2002-10-09 17:40:35 (UTC) |
commit | c80818d8388c07c1606a70306aea0c9a1e17ea3c (patch) (unidiff) | |
tree | c010af190b398b698299a42ce06217c950d6525d | |
parent | e0b4cca74ec611583c38901a83c448592e8ebec6 (diff) | |
download | opie-c80818d8388c07c1606a70306aea0c9a1e17ea3c.zip opie-c80818d8388c07c1606a70306aea0c9a1e17ea3c.tar.gz opie-c80818d8388c07c1606a70306aea0c9a1e17ea3c.tar.bz2 |
updated emulationLayer to use WidgetLayer (not Widget, which is b0rked)
default.cpp is broken, because there is still no new widget (coming
soon...)
-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 | |||
@@ -1,9 +1,9 @@ | |||
1 | /* -------------------------------------------------------------------------- */ | 1 | /* -------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* [TECommon.h] Common Definitions */ | 3 | /* [Common.h] Common Definitions */ |
4 | /* */ | 4 | /* */ |
5 | /* -------------------------------------------------------------------------- */ | 5 | /* -------------------------------------------------------------------------- */ |
6 | /* */ | 6 | /* */ |
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
8 | /* */ | 8 | /* */ |
9 | /* This file is part of Konsole - an X terminal for KDE */ | 9 | /* This file is part of Konsole - an X terminal for KDE */ |
@@ -13,18 +13,18 @@ | |||
13 | /* Ported Konsole to Qt/Embedded */ | 13 | /* Ported Konsole to Qt/Embedded */ |
14 | /* */ | 14 | /* */ |
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
16 | /* */ | 16 | /* */ |
17 | /* -------------------------------------------------------------------------- */ | 17 | /* -------------------------------------------------------------------------- */ |
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. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef TECOMMON_H | 23 | #ifndef COMMON_H |
24 | #define TECOMMON_H | 24 | #define COMMON_H |
25 | 25 | ||
26 | #include <qcolor.h> | 26 | #include <qcolor.h> |
27 | 27 | ||
28 | #ifndef BOOL | 28 | #ifndef BOOL |
29 | typedef bool BOOL; | 29 | typedef bool BOOL; |
30 | #endif | 30 | #endif |
@@ -108,7 +108,7 @@ struct ColorEntry | |||
108 | } | 108 | } |
109 | QColor color; | 109 | QColor color; |
110 | bool transparent; // if used on bg | 110 | bool transparent; // if used on bg |
111 | bool bold; // if used on fg | 111 | bool bold; // if used on fg |
112 | }; | 112 | }; |
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 | |||
@@ -73,13 +73,13 @@ | |||
73 | 73 | ||
74 | /* FIXME | 74 | /* FIXME |
75 | - evtl. the bulk operations could be made more transparent. | 75 | - evtl. the bulk operations could be made more transparent. |
76 | */ | 76 | */ |
77 | 77 | ||
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" |
81 | #include <stdio.h> | 81 | #include <stdio.h> |
82 | #include <stdlib.h> | 82 | #include <stdlib.h> |
83 | #include <unistd.h> | 83 | #include <unistd.h> |
84 | #include <qkeycode.h> | 84 | #include <qkeycode.h> |
85 | 85 | ||
@@ -92,40 +92,40 @@ | |||
92 | 92 | ||
93 | #define CNTL(c) ((c)-'@') | 93 | #define CNTL(c) ((c)-'@') |
94 | 94 | ||
95 | /*! | 95 | /*! |
96 | */ | 96 | */ |
97 | 97 | ||
98 | EmulationLayer::EmulationLayer(Widget* gui) | 98 | EmulationLayer::EmulationLayer( WidgetLayer* gui ) |
99 | : decoder((QTextDecoder*)NULL) | 99 | : decoder((QTextDecoder*)NULL) |
100 | { | 100 | { |
101 | this->gui = gui; | 101 | this->gui = 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]; |
106 | 106 | ||
107 | bulk_nlcnt = 0; // reset bulk newline counter | 107 | bulk_nlcnt = 0; // reset bulk newline counter |
108 | bulk_incnt = 0; // reset bulk counter | 108 | bulk_incnt = 0; // reset bulk counter |
109 | connected = FALSE; | 109 | connected = FALSE; |
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 | } |
127 | 127 | ||
128 | /*! | 128 | /*! |
129 | */ | 129 | */ |
130 | 130 | ||
131 | EmulationLayer::~EmulationLayer() | 131 | EmulationLayer::~EmulationLayer() |
@@ -194,13 +194,13 @@ void EmulationLayer::onRcvChar(int c) | |||
194 | switch (c) | 194 | switch (c) |
195 | { | 195 | { |
196 | case '\b' : scr->BackSpace(); break; | 196 | case '\b' : scr->BackSpace(); break; |
197 | case '\t' : scr->Tabulate(); break; | 197 | case '\t' : scr->Tabulate(); break; |
198 | case '\n' : scr->NewLine(); break; | 198 | case '\n' : scr->NewLine(); break; |
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; |
202 | }; | 202 | }; |
203 | } | 203 | } |
204 | 204 | ||
205 | /* ------------------------------------------------------------------------- */ | 205 | /* ------------------------------------------------------------------------- */ |
206 | /* */ | 206 | /* */ |
@@ -300,41 +300,41 @@ void EmulationLayer::bulkNewline() | |||
300 | void EmulationLayer::showBulk() | 300 | void EmulationLayer::showBulk() |
301 | { | 301 | { |
302 | bulk_nlcnt = 0; // reset bulk newline counter | 302 | bulk_nlcnt = 0; // reset bulk newline counter |
303 | bulk_incnt = 0; // reset bulk counter | 303 | bulk_incnt = 0; // reset bulk counter |
304 | if (connected) | 304 | if (connected) |
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, |
308 | scr->getLines(), | 308 | scr->getLines(), |
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. |
312 | gui->setScroll(scr->getHistCursor(),scr->getHistLines()); | 312 | gui->setScroll(scr->getHistCursor(),scr->getHistLines()); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | void EmulationLayer::bulkStart() | 316 | void EmulationLayer::bulkStart() |
317 | { | 317 | { |
318 | if (bulk_timer.isActive()) bulk_timer.stop(); | 318 | if (bulk_timer.isActive()) bulk_timer.stop(); |
319 | } | 319 | } |
320 | 320 | ||
321 | void EmulationLayer::bulkEnd() | 321 | 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. |
325 | else | 325 | else |
326 | bulk_timer.start(BULK_TIMEOUT,TRUE); | 326 | bulk_timer.start(BULK_TIMEOUT,TRUE); |
327 | } | 327 | } |
328 | 328 | ||
329 | void EmulationLayer::setConnect(bool c) | 329 | void EmulationLayer::setConnect(bool c) |
330 | { | 330 | { |
331 | connected = c; | 331 | connected = c; |
332 | if ( connected) | 332 | if ( connected) |
333 | { | 333 | { |
334 | onImageSizeChange(gui->Lines(), gui->Columns()); | 334 | onImageSizeChange(gui->lines(), gui->columns()); |
335 | showBulk(); | 335 | showBulk(); |
336 | } | 336 | } |
337 | else | 337 | else |
338 | { | 338 | { |
339 | scr->clearSelection(); | 339 | scr->clearSelection(); |
340 | } | 340 | } |
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 | |||
@@ -35,13 +35,13 @@ | |||
35 | 35 | ||
36 | class EmulationLayer : public QObject | 36 | class EmulationLayer : public QObject |
37 | { Q_OBJECT | 37 | { Q_OBJECT |
38 | 38 | ||
39 | public: | 39 | public: |
40 | 40 | ||
41 | EmulationLayer(Widget* gui); | 41 | EmulationLayer( WidgetLayer* gui ); |
42 | ~EmulationLayer(); | 42 | ~EmulationLayer(); |
43 | 43 | ||
44 | public: | 44 | public: |
45 | virtual void setHistory(bool on); | 45 | virtual void setHistory(bool on); |
46 | virtual bool history(); | 46 | virtual bool history(); |
47 | 47 | ||
@@ -51,13 +51,13 @@ public slots: // signals incoming from Widget | |||
51 | virtual void onHistoryCursorChange(int cursor); | 51 | virtual void onHistoryCursorChange(int cursor); |
52 | virtual void onKeyPress(QKeyEvent*); | 52 | virtual void onKeyPress(QKeyEvent*); |
53 | 53 | ||
54 | virtual void clearSelection(); | 54 | virtual void clearSelection(); |
55 | virtual void onSelectionBegin(const int x, const int y); | 55 | virtual void onSelectionBegin(const int x, const int y); |
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 | ||
59 | public slots: // signals incoming from data source | 59 | public slots: // signals incoming from data source |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * to be called, when new data arrives | 62 | * to be called, when new data arrives |
63 | */ | 63 | */ |
@@ -103,13 +103,13 @@ public: | |||
103 | 103 | ||
104 | void setKeytrans(int no); | 104 | void setKeytrans(int no); |
105 | void setKeytrans(const char * no); | 105 | void setKeytrans(const char * no); |
106 | 106 | ||
107 | protected: | 107 | protected: |
108 | 108 | ||
109 | Widget* gui; | 109 | WidgetLayer* gui; |
110 | Screen* scr; // referes to one `screen' | 110 | Screen* scr; // referes to one `screen' |
111 | Screen* screen[2]; // 0 = primary, 1 = alternate | 111 | Screen* screen[2]; // 0 = primary, 1 = alternate |
112 | void setScreen(int n); // set `scr' to `screen[n]' | 112 | void setScreen(int n); // set `scr' to `screen[n]' |
113 | 113 | ||
114 | bool connected; // communicate with widget | 114 | bool connected; // communicate with widget |
115 | 115 | ||
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 | |||
@@ -65,13 +65,13 @@ | |||
65 | 65 | ||
66 | Screen::Screen(int lines, int columns) | 66 | Screen::Screen(int lines, int columns) |
67 | { | 67 | { |
68 | this->lines = lines; | 68 | this->lines = lines; |
69 | this->columns = columns; | 69 | this->columns = 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(); |
73 | 73 | ||
74 | histCursor = 0; | 74 | histCursor = 0; |
75 | 75 | ||
76 | clearSelection(); | 76 | clearSelection(); |
77 | reset(); | 77 | reset(); |
@@ -79,13 +79,13 @@ Screen::Screen(int lines, int columns) | |||
79 | 79 | ||
80 | /*! Destructor | 80 | /*! Destructor |
81 | */ | 81 | */ |
82 | 82 | ||
83 | Screen::~Screen() | 83 | Screen::~Screen() |
84 | { | 84 | { |
85 | free(image); | 85 | delete image; |
86 | if (tabstops) free(tabstops); | 86 | if (tabstops) free(tabstops); |
87 | } | 87 | } |
88 | 88 | ||
89 | /* ------------------------------------------------------------------------- */ | 89 | /* ------------------------------------------------------------------------- */ |
90 | /* */ | 90 | /* */ |
91 | /* Normalized Screen Operations */ | 91 | /* Normalized Screen Operations */ |
@@ -391,13 +391,13 @@ void Screen::resizeImage(int new_lines, int new_columns) | |||
391 | { | 391 | { |
392 | addHistLine(); scrollUp(0,1); | 392 | addHistLine(); scrollUp(0,1); |
393 | } | 393 | } |
394 | } | 394 | } |
395 | 395 | ||
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 | ||
399 | clearSelection(); | 399 | clearSelection(); |
400 | 400 | ||
401 | // clear new image | 401 | // clear new image |
402 | for (int y = 0; y < new_lines; y++) | 402 | for (int y = 0; y < new_lines; y++) |
403 | for (int x = 0; x < new_columns; x++) | 403 | for (int x = 0; x < new_columns; x++) |
@@ -415,13 +415,13 @@ void Screen::resizeImage(int new_lines, int new_columns) | |||
415 | { | 415 | { |
416 | newimg[y*new_columns+x].c = image[loc(x,y)].c; | 416 | newimg[y*new_columns+x].c = image[loc(x,y)].c; |
417 | newimg[y*new_columns+x].f = image[loc(x,y)].f; | 417 | newimg[y*new_columns+x].f = image[loc(x,y)].f; |
418 | newimg[y*new_columns+x].b = image[loc(x,y)].b; | 418 | newimg[y*new_columns+x].b = image[loc(x,y)].b; |
419 | newimg[y*new_columns+x].r = image[loc(x,y)].r; | 419 | newimg[y*new_columns+x].r = image[loc(x,y)].r; |
420 | } | 420 | } |
421 | free(image); | 421 | delete image; |
422 | image = newimg; | 422 | image = newimg; |
423 | lines = new_lines; | 423 | lines = new_lines; |
424 | columns = new_columns; | 424 | columns = new_columns; |
425 | cuX = QMIN(cuX,columns-1); | 425 | cuX = QMIN(cuX,columns-1); |
426 | cuY = QMIN(cuY,lines-1); | 426 | cuY = QMIN(cuY,lines-1); |
427 | 427 | ||
@@ -463,13 +463,13 @@ void Screen::resizeImage(int new_lines, int new_columns) | |||
463 | (which is a font attribute) and intensive | 463 | (which is a font attribute) and intensive |
464 | (which is a color attribute), we translate | 464 | (which is a color attribute), we translate |
465 | this and RE_BOLD in falls eventually appart | 465 | this and RE_BOLD in falls eventually appart |
466 | into RE_BOLD and RE_INTENSIVE. | 466 | into RE_BOLD and RE_INTENSIVE. |
467 | */ | 467 | */ |
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; |
471 | p->f = b; p->b = f; //p->r &= ~RE_TRANSPARENT; | 471 | p->f = b; p->b = f; //p->r &= ~RE_TRANSPARENT; |
472 | } | 472 | } |
473 | 473 | ||
474 | void Screen::effectiveRendition() | 474 | void Screen::effectiveRendition() |
475 | // calculate rendition | 475 | // calculate rendition |
@@ -501,24 +501,24 @@ void Screen::effectiveRendition() | |||
501 | 501 | ||
502 | NOTE that the image returned by this function must later be | 502 | NOTE that the image returned by this function must later be |
503 | freed. | 503 | freed. |
504 | 504 | ||
505 | */ | 505 | */ |
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); |
511 | 511 | ||
512 | for (y = 0; (y < lines) && (y < (hist.getLines()-histCursor)); y++) | 512 | for (y = 0; (y < lines) && (y < (hist.getLines()-histCursor)); y++) |
513 | { | 513 | { |
514 | int len = QMIN(columns,hist.getLineLen(y+histCursor)); | 514 | int len = QMIN(columns,hist.getLineLen(y+histCursor)); |
515 | int yp = y*columns; | 515 | int yp = y*columns; |
516 | int yq = (y+histCursor)*columns; | 516 | int yq = (y+histCursor)*columns; |
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; |
520 | for (x = 0; x < columns; x++) | 520 | for (x = 0; x < columns; x++) |
521 | { int p=x + yp; int q=x + yq; | 521 | { int p=x + yp; int q=x + yq; |
522 | if ( ( q >= sel_TL ) && ( q <= sel_BR ) ) | 522 | if ( ( q >= sel_TL ) && ( q <= sel_BR ) ) |
523 | reverseRendition(&merged[p]); // for selection | 523 | reverseRendition(&merged[p]); // for selection |
524 | } | 524 | } |
@@ -544,13 +544,15 @@ Character* Screen::getCookedImage() | |||
544 | { int i,n = lines*columns; | 544 | { int i,n = lines*columns; |
545 | for (i = 0; i < n; i++) | 545 | for (i = 0; i < n; i++) |
546 | reverseRendition(&merged[i]); // for reverse display | 546 | reverseRendition(&merged[i]); // for reverse display |
547 | } | 547 | } |
548 | if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible | 548 | if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible |
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 | } |
552 | 554 | ||
553 | 555 | ||
554 | /*! | 556 | /*! |
555 | */ | 557 | */ |
556 | 558 | ||
@@ -1156,13 +1158,13 @@ void Screen::addHistLine() | |||
1156 | { Character dft; | 1158 | { Character dft; |
1157 | 1159 | ||
1158 | int end = columns-1; | 1160 | int end = columns-1; |
1159 | while (end >= 0 && image[end] == dft) | 1161 | while (end >= 0 && image[end] == dft) |
1160 | end -= 1; | 1162 | end -= 1; |
1161 | 1163 | ||
1162 | hist.addCells(image,end+1); | 1164 | hist.addCells(image.data(), end+1); |
1163 | hist.addLine(); | 1165 | hist.addLine(); |
1164 | 1166 | ||
1165 | // adjust history cursor | 1167 | // adjust history cursor |
1166 | histCursor += (hist.getLines()-1 == histCursor); | 1168 | histCursor += (hist.getLines()-1 == histCursor); |
1167 | } | 1169 | } |
1168 | 1170 | ||
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 | |||
@@ -133,13 +133,13 @@ public: // these are all `Screen' operations | |||
133 | void reset(); | 133 | void reset(); |
134 | // | 134 | // |
135 | void ShowCharacter(unsigned short c); | 135 | void ShowCharacter(unsigned short c); |
136 | // | 136 | // |
137 | void resizeImage(int new_lines, int new_columns); | 137 | void resizeImage(int new_lines, int new_columns); |
138 | // | 138 | // |
139 | Character* getCookedImage(); | 139 | QArray<Character> getCookedImage(); |
140 | 140 | ||
141 | /*! return the number of lines. */ | 141 | /*! return the number of lines. */ |
142 | int getLines() { return lines; } | 142 | int getLines() { return lines; } |
143 | /*! return the number of columns. */ | 143 | /*! return the number of columns. */ |
144 | int getColumns() { return columns; } | 144 | int getColumns() { return columns; } |
145 | 145 | ||
@@ -172,13 +172,13 @@ private: // helper | |||
172 | 172 | ||
173 | void addHistLine(); | 173 | void addHistLine(); |
174 | 174 | ||
175 | void initTabStops(); | 175 | void initTabStops(); |
176 | 176 | ||
177 | void effectiveRendition(); | 177 | void effectiveRendition(); |
178 | void reverseRendition(Character* p); | 178 | void reverseRendition( Character *p ); |
179 | 179 | ||
180 | private: | 180 | private: |
181 | 181 | ||
182 | /* | 182 | /* |
183 | The state of the screen is more complex as one would | 183 | The state of the screen is more complex as one would |
184 | expect first. The screem does really do part of the | 184 | expect first. The screem does really do part of the |
@@ -190,13 +190,13 @@ private: | |||
190 | */ | 190 | */ |
191 | 191 | ||
192 | // screen image ---------------- | 192 | // screen image ---------------- |
193 | 193 | ||
194 | int lines; | 194 | int lines; |
195 | int columns; | 195 | int columns; |
196 | Character *image; // [lines][columns] | 196 | QArray<Character> image; // [lines][columns] |
197 | 197 | ||
198 | // history buffer --------------- | 198 | // history buffer --------------- |
199 | 199 | ||
200 | int histCursor; // display position relative to start of the history buffer | 200 | int histCursor; // display position relative to start of the history buffer |
201 | HistoryScroll hist; | 201 | HistoryScroll hist; |
202 | 202 | ||
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 | |||
@@ -62,13 +62,13 @@ | |||
62 | Nothing really intesting happens here. | 62 | Nothing really intesting happens here. |
63 | */ | 63 | */ |
64 | 64 | ||
65 | /*! | 65 | /*! |
66 | */ | 66 | */ |
67 | 67 | ||
68 | Vt102Emulation::Vt102Emulation(Widget* gui) : EmulationLayer(gui) | 68 | Vt102Emulation::Vt102Emulation(WidgetLayer* gui) : EmulationLayer(gui) |
69 | { | 69 | { |
70 | QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)), | 70 | QObject::connect(gui,SIGNAL(mouseSignal(int,int,int)), |
71 | this,SLOT(onMouse(int,int,int))); | 71 | this,SLOT(onMouse(int,int,int))); |
72 | initTokenizer(); | 72 | initTokenizer(); |
73 | reset(); | 73 | reset(); |
74 | } | 74 | } |
@@ -346,13 +346,13 @@ void Vt102Emulation::tau( int token, int p, int q ) | |||
346 | case TY_CTL___('A' ) : /* SOH: ignored */ break; | 346 | case TY_CTL___('A' ) : /* SOH: ignored */ break; |
347 | case TY_CTL___('B' ) : /* STX: ignored */ break; | 347 | case TY_CTL___('B' ) : /* STX: ignored */ break; |
348 | case TY_CTL___('C' ) : /* ETX: ignored */ break; | 348 | case TY_CTL___('C' ) : /* ETX: ignored */ break; |
349 | case TY_CTL___('D' ) : /* EOT: ignored */ break; | 349 | case TY_CTL___('D' ) : /* EOT: ignored */ break; |
350 | case TY_CTL___('E' ) : reportAnswerBack ( ); break; //VT100 | 350 | case TY_CTL___('E' ) : reportAnswerBack ( ); break; //VT100 |
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 |
354 | case TY_CTL___('I' ) : scr->Tabulate ( ); break; //VT100 | 354 | case TY_CTL___('I' ) : scr->Tabulate ( ); break; //VT100 |
355 | case TY_CTL___('J' ) : scr->NewLine ( ); break; //VT100 | 355 | case TY_CTL___('J' ) : scr->NewLine ( ); break; //VT100 |
356 | case TY_CTL___('K' ) : scr->NewLine ( ); break; //VT100 | 356 | case TY_CTL___('K' ) : scr->NewLine ( ); break; //VT100 |
357 | case TY_CTL___('L' ) : scr->NewLine ( ); break; //VT100 | 357 | case TY_CTL___('L' ) : scr->NewLine ( ); break; //VT100 |
358 | case TY_CTL___('M' ) : scr->Return ( ); break; //VT100 | 358 | case TY_CTL___('M' ) : scr->Return ( ); break; //VT100 |
@@ -734,17 +734,17 @@ void Vt102Emulation::onKeyPress( QKeyEvent* ev ) | |||
734 | encodeStat(AltButton , BITS_Alt ), | 734 | encodeStat(AltButton , BITS_Alt ), |
735 | &cmd, &txt, &len )) | 735 | &cmd, &txt, &len )) |
736 | //printf("cmd: %d, %s, %d\n",cmd,txt,len); | 736 | //printf("cmd: %d, %s, %d\n",cmd,txt,len); |
737 | { | 737 | { |
738 | switch(cmd) // ... and execute if found. | 738 | switch(cmd) // ... and execute if found. |
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; |
746 | case CMD_prevSession : emit prevSession(); return; | 746 | case CMD_prevSession : emit prevSession(); return; |
747 | case CMD_nextSession : emit nextSession(); return; | 747 | case CMD_nextSession : emit nextSession(); return; |
748 | } | 748 | } |
749 | } | 749 | } |
750 | // fall back handling | 750 | // fall back handling |
@@ -921,13 +921,13 @@ void Vt102Emulation::resetModes() | |||
921 | 921 | ||
922 | void Vt102Emulation::setMode(int m) | 922 | void Vt102Emulation::setMode(int m) |
923 | { | 923 | { |
924 | currParm.mode[m] = TRUE; | 924 | currParm.mode[m] = TRUE; |
925 | switch (m) | 925 | switch (m) |
926 | { | 926 | { |
927 | case MODE_Mouse1000 : gui->setMouseMarks(FALSE); | 927 | case MODE_Mouse1000 : //gui->setMouseMarks(FALSE); |
928 | break; | 928 | break; |
929 | case MODE_AppScreen : screen[1]->clearSelection(); | 929 | case MODE_AppScreen : screen[1]->clearSelection(); |
930 | screen[1]->clearEntireScreen(); | 930 | screen[1]->clearEntireScreen(); |
931 | setScreen(1); | 931 | setScreen(1); |
932 | break; | 932 | break; |
933 | } | 933 | } |
@@ -940,13 +940,13 @@ void Vt102Emulation::setMode(int m) | |||
940 | 940 | ||
941 | void Vt102Emulation::resetMode(int m) | 941 | void Vt102Emulation::resetMode(int m) |
942 | { | 942 | { |
943 | currParm.mode[m] = FALSE; | 943 | currParm.mode[m] = FALSE; |
944 | switch (m) | 944 | switch (m) |
945 | { | 945 | { |
946 | case MODE_Mouse1000 : gui->setMouseMarks(TRUE); | 946 | case MODE_Mouse1000 : //gui->setMouseMarks(TRUE); |
947 | break; | 947 | break; |
948 | case MODE_AppScreen : screen[0]->clearSelection(); | 948 | case MODE_AppScreen : screen[0]->clearSelection(); |
949 | setScreen(0); | 949 | setScreen(0); |
950 | break; | 950 | break; |
951 | } | 951 | } |
952 | if (m < MODES_SCREEN || m == MODE_NewLine) | 952 | if (m < MODES_SCREEN || m == MODE_NewLine) |
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 | |||
@@ -57,13 +57,13 @@ struct CharCodes | |||
57 | 57 | ||
58 | class Vt102Emulation: public EmulationLayer | 58 | class Vt102Emulation: public EmulationLayer |
59 | { Q_OBJECT | 59 | { Q_OBJECT |
60 | 60 | ||
61 | public: | 61 | public: |
62 | 62 | ||
63 | Vt102Emulation(Widget* gui); | 63 | Vt102Emulation(WidgetLayer* gui); |
64 | ~Vt102Emulation(); | 64 | ~Vt102Emulation(); |
65 | 65 | ||
66 | public slots: // signals incoming from Widget | 66 | public slots: // signals incoming from Widget |
67 | 67 | ||
68 | void onKeyPress(QKeyEvent*); | 68 | void onKeyPress(QKeyEvent*); |
69 | void onMouse(int cb, int cx, int cy); | 69 | void onMouse(int cb, int cx, int cy); |
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 | |||
@@ -103,12 +103,23 @@ public: | |||
103 | /** | 103 | /** |
104 | * reload configuration | 104 | * reload configuration |
105 | */ | 105 | */ |
106 | virtual void reloadConfig() = 0; | 106 | virtual void reloadConfig() = 0; |
107 | 107 | ||
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: |
110 | 121 | ||
111 | /** | 122 | /** |
112 | * key was pressed | 123 | * key was pressed |
113 | */ | 124 | */ |
114 | void keyPressed( QKeyEvent *e ); | 125 | void keyPressed( QKeyEvent *e ); |