summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/common.h10
-rw-r--r--noncore/apps/opie-console/emulation_layer.cpp48
-rw-r--r--noncore/apps/opie-console/emulation_layer.h6
-rw-r--r--noncore/apps/opie-console/screen.cpp22
-rw-r--r--noncore/apps/opie-console/screen.h6
-rw-r--r--noncore/apps/opie-console/vt102emulation.cpp18
-rw-r--r--noncore/apps/opie-console/vt102emulation.h2
-rw-r--r--noncore/apps/opie-console/widget_layer.h11
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,48 +1,48 @@
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 */
10/* */ 10/* */
11/* -------------------------------------------------------------------------- */ 11/* -------------------------------------------------------------------------- */
12/* */ 12/* */
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
29typedef bool BOOL; 29typedef bool BOOL;
30#endif 30#endif
31 31
32#ifndef FALSE 32#ifndef FALSE
33#define FALSE 0 33#define FALSE 0
34#endif 34#endif
35 35
36#ifndef TRUE 36#ifndef TRUE
37#define TRUE 1 37#define TRUE 1
38#endif 38#endif
39 39
40#ifndef UINT8 40#ifndef UINT8
41typedef unsigned char UINT8; 41typedef unsigned char UINT8;
42#endif 42#endif
43 43
44#ifndef UINT16 44#ifndef UINT16
45typedef unsigned short UINT16; 45typedef unsigned short UINT16;
46#endif 46#endif
47 47
48// Attributed Character Representations /////////////////////////////// 48// Attributed Character Representations ///////////////////////////////
@@ -90,25 +90,25 @@ inline BOOL operator == (Character a, Character b)
90 return a.c == b.c && a.f == b.f && a.b == b.b && a.r == b.r; 90 return a.c == b.c && a.f == b.f && a.b == b.b && a.r == b.r;
91} 91}
92 92
93inline BOOL operator != (Character a, Character b) 93inline BOOL operator != (Character a, Character b)
94{ 94{
95 return a.c != b.c || a.f != b.f || a.b != b.b || a.r != b.r; 95 return a.c != b.c || a.f != b.f || a.b != b.b || a.r != b.r;
96} 96}
97 97
98/*! 98/*!
99*/ 99*/
100struct ColorEntry 100struct ColorEntry
101{ 101{
102 ColorEntry(QColor c, bool tr, bool b) : color(c), transparent(tr), bold(b) {} 102 ColorEntry(QColor c, bool tr, bool b) : color(c), transparent(tr), bold(b) {}
103 ColorEntry() : transparent(false), bold(false) {} // default constructors 103 ColorEntry() : transparent(false), bold(false) {} // default constructors
104 void operator=(const ColorEntry& rhs) { 104 void operator=(const ColorEntry& rhs) {
105 color = rhs.color; 105 color = rhs.color;
106 transparent = rhs.transparent; 106 transparent = rhs.transparent;
107 bold = rhs.bold; 107 bold = rhs.bold;
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
@@ -55,95 +55,95 @@
55 55
56 We use a refreshing algorithm here that has been adoped from rxvt/kvt. 56 We use a refreshing algorithm here that has been adoped from rxvt/kvt.
57 57
58 By this, refreshing is driven by a timer, which is (re)started whenever 58 By this, refreshing is driven by a timer, which is (re)started whenever
59 a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. 59 a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'.
60 As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger 60 As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger
61 refresh. This rule suits both bulk display operation as done by curses as 61 refresh. This rule suits both bulk display operation as done by curses as
62 well as individual characters typed. 62 well as individual characters typed.
63 (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). 63 (BULK_TIMEOUT < 1000 / max characters received from keyboard per second).
64 64
65 Additionally, we trigger refreshing by newlines comming in to make visual 65 Additionally, we trigger refreshing by newlines comming in to make visual
66 snapshots of lists as produced by `cat', `ls' and likely programs, thereby 66 snapshots of lists as produced by `cat', `ls' and likely programs, thereby
67 producing the illusion of a permanent and immediate display operation. 67 producing the illusion of a permanent and immediate display operation.
68 68
69 As a sort of catch-all needed for cases where none of the above 69 As a sort of catch-all needed for cases where none of the above
70 conditions catch, the screen refresh is also triggered by a count 70 conditions catch, the screen refresh is also triggered by a count
71 of incoming bulks (`bulk_incnt'). 71 of incoming bulks (`bulk_incnt').
72*/ 72*/
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
86 86
87/* ------------------------------------------------------------------------- */ 87/* ------------------------------------------------------------------------- */
88/* */ 88/* */
89/* EmulationLayer */ 89/* EmulationLayer */
90/* */ 90/* */
91/* ------------------------------------------------------------------------- */ 91/* ------------------------------------------------------------------------- */
92 92
93#define CNTL(c) ((c)-'@') 93#define CNTL(c) ((c)-'@')
94 94
95/*! 95/*!
96*/ 96*/
97 97
98EmulationLayer::EmulationLayer(Widget* gui) 98EmulationLayer::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
131EmulationLayer::~EmulationLayer() 131EmulationLayer::~EmulationLayer()
132{ 132{
133 delete screen[0]; 133 delete screen[0];
134 delete screen[1]; 134 delete screen[1];
135 bulk_timer.stop(); 135 bulk_timer.stop();
136} 136}
137 137
138/*! change between primary and alternate screen 138/*! change between primary and alternate screen
139*/ 139*/
140 140
141void EmulationLayer::setScreen(int n) 141void EmulationLayer::setScreen(int n)
142{ 142{
143 scr = screen[n&1]; 143 scr = screen[n&1];
144} 144}
145 145
146void EmulationLayer::setHistory(bool on) 146void EmulationLayer::setHistory(bool on)
147{ 147{
148 screen[0]->setScroll(on); 148 screen[0]->setScroll(on);
149 if (!connected) return; 149 if (!connected) return;
@@ -176,49 +176,49 @@ void EmulationLayer::setKeytrans(const char * no)
176 176
177// Interpreting Codes --------------------------------------------------------- 177// Interpreting Codes ---------------------------------------------------------
178 178
179/* 179/*
180 This section deals with decoding the incoming character stream. 180 This section deals with decoding the incoming character stream.
181 Decoding means here, that the stream is first seperated into `tokens' 181 Decoding means here, that the stream is first seperated into `tokens'
182 which are then mapped to a `meaning' provided as operations by the 182 which are then mapped to a `meaning' provided as operations by the
183 `Screen' class. 183 `Screen' class.
184*/ 184*/
185 185
186/*! 186/*!
187*/ 187*/
188 188
189void EmulationLayer::onRcvChar(int c) 189void EmulationLayer::onRcvChar(int c)
190// process application unicode input to terminal 190// process application unicode input to terminal
191// this is a trivial scanner 191// this is a trivial scanner
192{ 192{
193 c &= 0xff; 193 c &= 0xff;
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/* */
207/* Keyboard Handling */ 207/* Keyboard Handling */
208/* */ 208/* */
209/* ------------------------------------------------------------------------- */ 209/* ------------------------------------------------------------------------- */
210 210
211/*! 211/*!
212*/ 212*/
213 213
214void EmulationLayer::onKeyPress( QKeyEvent* ev ) 214void EmulationLayer::onKeyPress( QKeyEvent* ev )
215{ 215{
216 if (!connected) return; // someone else gets the keys 216 if (!connected) return; // someone else gets the keys
217 if (scr->getHistCursor() != scr->getHistLines()); 217 if (scr->getHistCursor() != scr->getHistLines());
218 scr->setHistCursor(scr->getHistLines()); 218 scr->setHistCursor(scr->getHistLines());
219 if (!ev->text().isEmpty()) 219 if (!ev->text().isEmpty())
220 { // A block of text 220 { // A block of text
221 // Note that the text is proper unicode. 221 // Note that the text is proper unicode.
222 // We should do a conversion here, but since this 222 // We should do a conversion here, but since this
223 // routine will never be used, we simply emit plain ascii. 223 // routine will never be used, we simply emit plain ascii.
224 sendString( ev->text().ascii() ); //,ev->text().length()); 224 sendString( ev->text().ascii() ); //,ev->text().length());
@@ -282,77 +282,77 @@ void EmulationLayer::clearSelection() {
282 282
283// Refreshing -------------------------------------------------------------- -- 283// Refreshing -------------------------------------------------------------- --
284 284
285#define BULK_TIMEOUT 20 285#define BULK_TIMEOUT 20
286 286
287/*! 287/*!
288 called when \n comes in. Evtl. triggers showBulk at endBulk 288 called when \n comes in. Evtl. triggers showBulk at endBulk
289*/ 289*/
290 290
291void EmulationLayer::bulkNewline() 291void EmulationLayer::bulkNewline()
292{ 292{
293 bulk_nlcnt += 1; 293 bulk_nlcnt += 1;
294 bulk_incnt = 0; // reset bulk counter since `nl' rule applies 294 bulk_incnt = 0; // reset bulk counter since `nl' rule applies
295} 295}
296 296
297/*! 297/*!
298*/ 298*/
299 299
300void EmulationLayer::showBulk() 300void 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
316void EmulationLayer::bulkStart() 316void EmulationLayer::bulkStart()
317{ 317{
318 if (bulk_timer.isActive()) bulk_timer.stop(); 318 if (bulk_timer.isActive()) bulk_timer.stop();
319} 319}
320 320
321void EmulationLayer::bulkEnd() 321void 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
329void EmulationLayer::setConnect(bool c) 329void 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 }
341} 341}
342 342
343// --------------------------------------------------------------------------- 343// ---------------------------------------------------------------------------
344 344
345/*! triggered by image size change of the Widget `gui'. 345/*! triggered by image size change of the Widget `gui'.
346 346
347 This event is simply propagated to the attached screens 347 This event is simply propagated to the attached screens
348 and to the related serial line. 348 and to the related serial line.
349*/ 349*/
350 350
351void EmulationLayer::onImageSizeChange(int lines, int columns) 351void EmulationLayer::onImageSizeChange(int lines, int columns)
352{ 352{
353 if (!connected) return; 353 if (!connected) return;
354 screen[0]->resizeImage(lines,columns); 354 screen[0]->resizeImage(lines,columns);
355 screen[1]->resizeImage(lines,columns); 355 screen[1]->resizeImage(lines,columns);
356 showBulk(); 356 showBulk();
357 emit ImageSizeChanged(lines,columns); // propagate event to serial line 357 emit ImageSizeChanged(lines,columns); // propagate event to serial line
358} 358}
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
@@ -17,65 +17,65 @@
17/* -------------------------------------------------------------------------- */ 17/* -------------------------------------------------------------------------- */
18/* -------------------------------------------------------------------------- */ 18/* -------------------------------------------------------------------------- */
19 /* */ 19 /* */
20/* made to a layer between io_layer and widget */ 20/* made to a layer between io_layer and widget */
21 /* */ 21 /* */
22/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ 22/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */
23 /* */ 23 /* */
24/* -------------------------------------------------------------------------- */ 24/* -------------------------------------------------------------------------- */
25 25
26#ifndef EMULATION_LAYER_H 26#ifndef EMULATION_LAYER_H
27#define EMULATION_LAYER_H 27#define EMULATION_LAYER_H
28 28
29#include "widget_layer.h" 29#include "widget_layer.h"
30#include "screen.h" 30#include "screen.h"
31#include <qtimer.h> 31#include <qtimer.h>
32#include <stdio.h> 32#include <stdio.h>
33#include <qtextcodec.h> 33#include <qtextcodec.h>
34#include "keytrans.h" 34#include "keytrans.h"
35 35
36class EmulationLayer : public QObject 36class EmulationLayer : public QObject
37{ Q_OBJECT 37{ Q_OBJECT
38 38
39public: 39public:
40 40
41 EmulationLayer(Widget* gui); 41 EmulationLayer( WidgetLayer* gui );
42 ~EmulationLayer(); 42 ~EmulationLayer();
43 43
44public: 44public:
45 virtual void setHistory(bool on); 45 virtual void setHistory(bool on);
46 virtual bool history(); 46 virtual bool history();
47 47
48public slots: // signals incoming from Widget 48public slots: // signals incoming from Widget
49 49
50 virtual void onImageSizeChange(int lines, int columns); 50 virtual void onImageSizeChange(int lines, int columns);
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
59public slots: // signals incoming from data source 59public 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 */
64 void onRcvBlock(const QByteArray&); 64 void onRcvBlock(const QByteArray&);
65 65
66signals: 66signals:
67 67
68 /** 68 /**
69 * will send data, encoded to suit emulation 69 * will send data, encoded to suit emulation
70 */ 70 */
71 void sndBlock(const QByteArray&); 71 void sndBlock(const QByteArray&);
72 72
73 void ImageSizeChanged(int lines, int columns); 73 void ImageSizeChanged(int lines, int columns);
74 74
75 void changeColumns(int columns); 75 void changeColumns(int columns);
76 76
77 void changeTitle(int arg, const char* str); 77 void changeTitle(int arg, const char* str);
78 78
79 79
80public: 80public:
81 81
@@ -85,49 +85,49 @@ public:
85 virtual void onRcvChar(int); 85 virtual void onRcvChar(int);
86 86
87 virtual void setMode (int) = 0; 87 virtual void setMode (int) = 0;
88 virtual void resetMode(int) = 0; 88 virtual void resetMode(int) = 0;
89 89
90 /** 90 /**
91 * @deprecated use qbytearray instead 91 * @deprecated use qbytearray instead
92 */ 92 */
93 virtual void sendString(const char*) = 0; 93 virtual void sendString(const char*) = 0;
94 94
95 /** 95 /**
96 * sends a string to IOLayer 96 * sends a string to IOLayer
97 * encodes to suit emulation before 97 * encodes to suit emulation before
98 */ 98 */
99 virtual void sendString(const QByteArray&) = 0; 99 virtual void sendString(const QByteArray&) = 0;
100 100
101 virtual void setConnect(bool r); 101 virtual void setConnect(bool r);
102 void setColumns(int columns); 102 void setColumns(int columns);
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
107protected: 107protected:
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
116 void setCodec(int c); // codec number, 0 = locale, 1=utf8 116 void setCodec(int c); // codec number, 0 = locale, 1=utf8
117 117
118 QTextCodec* codec; 118 QTextCodec* codec;
119 QTextCodec* localeCodec; 119 QTextCodec* localeCodec;
120 QTextDecoder* decoder; 120 QTextDecoder* decoder;
121 121
122 KeyTrans* keytrans; 122 KeyTrans* keytrans;
123 123
124// refreshing related material. 124// refreshing related material.
125// this is localized in the class. 125// this is localized in the class.
126private slots: // triggered by timer 126private slots: // triggered by timer
127 127
128 void showBulk(); 128 void showBulk();
129 129
130private: 130private:
131 131
132 void bulkNewline(); 132 void bulkNewline();
133 void bulkStart(); 133 void bulkStart();
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
@@ -47,63 +47,63 @@
47// #include <kdebug.h> 47// #include <kdebug.h>
48 48
49#include <assert.h> 49#include <assert.h>
50#include <string.h> 50#include <string.h>
51#include <ctype.h> 51#include <ctype.h>
52 52
53#include "screen.h" 53#include "screen.h"
54 54
55#define HERE printf("%s(%d): here\n",__FILE__,__LINE__) 55#define HERE printf("%s(%d): here\n",__FILE__,__LINE__)
56 56
57//FIXME: this is emulation specific. Use FALSE for xterm, TRUE for ANSI. 57//FIXME: this is emulation specific. Use FALSE for xterm, TRUE for ANSI.
58//FIXME: see if we can get this from terminfo. 58//FIXME: see if we can get this from terminfo.
59#define BS_CLEARS FALSE 59#define BS_CLEARS FALSE
60 60
61#define loc(X,Y) ((Y)*columns+(X)) 61#define loc(X,Y) ((Y)*columns+(X))
62 62
63/*! creates a `Screen' of `lines' lines and `columns' columns. 63/*! creates a `Screen' of `lines' lines and `columns' columns.
64*/ 64*/
65 65
66Screen::Screen(int lines, int columns) 66Screen::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();
78} 78}
79 79
80/*! Destructor 80/*! Destructor
81*/ 81*/
82 82
83Screen::~Screen() 83Screen::~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 */
92/* */ 92/* */
93/* ------------------------------------------------------------------------- */ 93/* ------------------------------------------------------------------------- */
94 94
95// Cursor Setting -------------------------------------------------------------- 95// Cursor Setting --------------------------------------------------------------
96 96
97/*! \section Cursor 97/*! \section Cursor
98 98
99 The `cursor' is a location within the screen that is implicitely used in 99 The `cursor' is a location within the screen that is implicitely used in
100 many operations. The operations within this section allow to manipulate 100 many operations. The operations within this section allow to manipulate
101 the cursor explicitly and to obtain it's value. 101 the cursor explicitly and to obtain it's value.
102 102
103 The position of the cursor is guarantied to be between (including) 0 and 103 The position of the cursor is guarantied to be between (including) 0 and
104 `columns-1' and `lines-1'. 104 `columns-1' and `lines-1'.
105*/ 105*/
106 106
107/*! 107/*!
108 Move the cursor up. 108 Move the cursor up.
109 109
@@ -373,202 +373,204 @@ void Screen::restoreCursor()
373 373
374/*! Assing a new size to the screen. 374/*! Assing a new size to the screen.
375 375
376 The topmost left position is maintained, while lower lines 376 The topmost left position is maintained, while lower lines
377 or right hand side columns might be removed or filled with 377 or right hand side columns might be removed or filled with
378 spaces to fit the new size. 378 spaces to fit the new size.
379 379
380 The region setting is reset to the whole screen and the 380 The region setting is reset to the whole screen and the
381 tab positions reinitialized. 381 tab positions reinitialized.
382*/ 382*/
383 383
384void Screen::resizeImage(int new_lines, int new_columns) 384void Screen::resizeImage(int new_lines, int new_columns)
385{ 385{
386 386
387 if (cuY > new_lines-1) 387 if (cuY > new_lines-1)
388 { // attempt to preserve focus and lines 388 { // attempt to preserve focus and lines
389 bmargin = lines-1; //FIXME: margin lost 389 bmargin = lines-1; //FIXME: margin lost
390 for (int i = 0; i < cuY-(new_lines-1); i++) 390 for (int i = 0; i < cuY-(new_lines-1); i++)
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++)
404 { 404 {
405 newimg[y*new_columns+x].c = ' '; 405 newimg[y*new_columns+x].c = ' ';
406 newimg[y*new_columns+x].f = DEFAULT_FORE_COLOR; 406 newimg[y*new_columns+x].f = DEFAULT_FORE_COLOR;
407 newimg[y*new_columns+x].b = DEFAULT_BACK_COLOR; 407 newimg[y*new_columns+x].b = DEFAULT_BACK_COLOR;
408 newimg[y*new_columns+x].r = DEFAULT_RENDITION; 408 newimg[y*new_columns+x].r = DEFAULT_RENDITION;
409 } 409 }
410 int cpy_lines = QMIN(new_lines, lines); 410 int cpy_lines = QMIN(new_lines, lines);
411 int cpy_columns = QMIN(new_columns,columns); 411 int cpy_columns = QMIN(new_columns,columns);
412 // copy to new image 412 // copy to new image
413 for (int y = 0; y < cpy_lines; y++) 413 for (int y = 0; y < cpy_lines; y++)
414 for (int x = 0; x < cpy_columns; x++) 414 for (int x = 0; x < cpy_columns; x++)
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
428 // FIXME: try to keep values, evtl. 428 // FIXME: try to keep values, evtl.
429 tmargin=0; 429 tmargin=0;
430 bmargin=lines-1; 430 bmargin=lines-1;
431 initTabStops(); 431 initTabStops();
432 clearSelection(); 432 clearSelection();
433} 433}
434 434
435/* 435/*
436 Clarifying rendition here and in TEWidget. 436 Clarifying rendition here and in TEWidget.
437 437
438 currently, TEWidget's color table is 438 currently, TEWidget's color table is
439 0 1 2 .. 9 10 .. 17 439 0 1 2 .. 9 10 .. 17
440 dft_fg, dft_bg, dim 0..7, intensive 0..7 440 dft_fg, dft_bg, dim 0..7, intensive 0..7
441 441
442 cu_fg, cu_bg contain values 0..8; 442 cu_fg, cu_bg contain values 0..8;
443 - 0 = default color 443 - 0 = default color
444 - 1..8 = ansi specified color 444 - 1..8 = ansi specified color
445 445
446 re_fg, re_bg contain values 0..17 446 re_fg, re_bg contain values 0..17
447 due to the TEWidget's color table 447 due to the TEWidget's color table
448 448
449 rendition attributes are 449 rendition attributes are
450 450
451 attr widget screen 451 attr widget screen
452 -------------- ------ ------ 452 -------------- ------ ------
453 RE_UNDERLINE XX XX affects foreground only 453 RE_UNDERLINE XX XX affects foreground only
454 RE_BLINK XX XX affects foreground only 454 RE_BLINK XX XX affects foreground only
455 RE_BOLD XX XX affects foreground only 455 RE_BOLD XX XX affects foreground only
456 RE_REVERSE -- XX 456 RE_REVERSE -- XX
457 RE_TRANSPARENT XX -- affects background only 457 RE_TRANSPARENT XX -- affects background only
458 RE_INTENSIVE XX -- affects foreground only 458 RE_INTENSIVE XX -- affects foreground only
459 459
460 Note that RE_BOLD is used in both widget 460 Note that RE_BOLD is used in both widget
461 and screen rendition. Since xterm/vt102 461 and screen rendition. Since xterm/vt102
462 is to poor to distinguish between bold 462 is to poor to distinguish between bold
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
469void Screen::reverseRendition(Character* p) 469void 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
474void Screen::effectiveRendition() 474void Screen::effectiveRendition()
475// calculate rendition 475// calculate rendition
476{ 476{
477 ef_re = cu_re & (RE_UNDERLINE | RE_BLINK); 477 ef_re = cu_re & (RE_UNDERLINE | RE_BLINK);
478 if (cu_re & RE_REVERSE) 478 if (cu_re & RE_REVERSE)
479 { 479 {
480 ef_fg = cu_bg; 480 ef_fg = cu_bg;
481 ef_bg = cu_fg; 481 ef_bg = cu_fg;
482 } 482 }
483 else 483 else
484 { 484 {
485 ef_fg = cu_fg; 485 ef_fg = cu_fg;
486 ef_bg = cu_bg; 486 ef_bg = cu_bg;
487 } 487 }
488 if (cu_re & RE_BOLD) 488 if (cu_re & RE_BOLD)
489 { 489 {
490 if (ef_fg < BASE_COLORS) 490 if (ef_fg < BASE_COLORS)
491 ef_fg += BASE_COLORS; 491 ef_fg += BASE_COLORS;
492 else 492 else
493 ef_fg -= BASE_COLORS; 493 ef_fg -= BASE_COLORS;
494 } 494 }
495} 495}
496 496
497/*! 497/*!
498 returns the image. 498 returns the image.
499 499
500 Get the size of the image by \sa getLines and \sa getColumns. 500 Get the size of the image by \sa getLines and \sa getColumns.
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
507Character* Screen::getCookedImage() 507QArray<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 }
525 } 525 }
526 if (lines >= hist.getLines()-histCursor) 526 if (lines >= hist.getLines()-histCursor)
527 { 527 {
528 for (y = (hist.getLines()-histCursor); y < lines ; y++) 528 for (y = (hist.getLines()-histCursor); y < lines ; y++)
529 { 529 {
530 int yp = y*columns; 530 int yp = y*columns;
531 int yq = (y+histCursor)*columns; 531 int yq = (y+histCursor)*columns;
532 int yr = (y-hist.getLines()+histCursor)*columns; 532 int yr = (y-hist.getLines()+histCursor)*columns;
533 for (x = 0; x < columns; x++) 533 for (x = 0; x < columns; x++)
534 { int p = x + yp; int q = x + yq; int r = x + yr; 534 { int p = x + yp; int q = x + yq; int r = x + yr;
535 merged[p] = image[r]; 535 merged[p] = image[r];
536 if ( q >= sel_TL && q <= sel_BR ) 536 if ( q >= sel_TL && q <= sel_BR )
537 reverseRendition(&merged[p]); // for selection 537 reverseRendition(&merged[p]); // for selection
538 } 538 }
539 539
540 } 540 }
541 } 541 }
542 // evtl. inverse display 542 // evtl. inverse display
543 if (getMode(MODE_Screen)) 543 if (getMode(MODE_Screen))
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
557void Screen::reset() 559void Screen::reset()
558{ 560{
559 setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin 561 setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin
560 resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1] 562 resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1]
561 resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke 563 resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke
562 setMode(MODE_Cursor); // cursor visible 564 setMode(MODE_Cursor); // cursor visible
563 resetMode(MODE_Screen); // screen not inverse 565 resetMode(MODE_Screen); // screen not inverse
564 resetMode(MODE_NewLine); 566 resetMode(MODE_NewLine);
565 567
566 tmargin=0; 568 tmargin=0;
567 bmargin=lines-1; 569 bmargin=lines-1;
568 570
569 setDefaultRendition(); 571 setDefaultRendition();
570 saveCursor(); 572 saveCursor();
571 573
572 clear(); 574 clear();
573} 575}
574 576
@@ -1138,49 +1140,49 @@ FIXME:
1138 or because it's an ASCII paragraph delimiter, so even when 1140 or because it's an ASCII paragraph delimiter, so even when
1139 not preserving line_breaks, you want to preserve paragraph breaks. 1141 not preserving line_breaks, you want to preserve paragraph breaks.
1140 1142
1141 3) else --> partially filled line 1143 3) else --> partially filled line
1142 insert a \n in preserve line break mode, else a space 1144 insert a \n in preserve line break mode, else a space
1143 The space prevents concatenation of the last word of one 1145 The space prevents concatenation of the last word of one
1144 line with the first of the next. 1146 line with the first of the next.
1145 1147
1146*/ 1148*/
1147 1149
1148void Screen::addHistLine() 1150void Screen::addHistLine()
1149{ 1151{
1150 assert(hasScroll() || histCursor == 0); 1152 assert(hasScroll() || histCursor == 0);
1151 1153
1152 // add to hist buffer 1154 // add to hist buffer
1153 // we have to take care about scrolling, too... 1155 // we have to take care about scrolling, too...
1154 1156
1155 if (hasScroll()) 1157 if (hasScroll())
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
1169 if (!hasScroll()) histCursor = 0; //FIXME: a poor workaround 1171 if (!hasScroll()) histCursor = 0; //FIXME: a poor workaround
1170} 1172}
1171 1173
1172void Screen::setHistCursor(int cursor) 1174void Screen::setHistCursor(int cursor)
1173{ 1175{
1174 histCursor = cursor; //FIXME:rangecheck 1176 histCursor = cursor; //FIXME:rangecheck
1175} 1177}
1176 1178
1177int Screen::getHistCursor() 1179int Screen::getHistCursor()
1178{ 1180{
1179 return histCursor; 1181 return histCursor;
1180} 1182}
1181 1183
1182int Screen::getHistLines() 1184int Screen::getHistLines()
1183{ 1185{
1184 return hist.getLines(); 1186 return hist.getLines();
1185} 1187}
1186 1188
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
@@ -115,106 +115,106 @@ public: // these are all `Screen' operations
115 // 115 //
116 void setDefaultRendition(); 116 void setDefaultRendition();
117 void setForeColorToDefault(); 117 void setForeColorToDefault();
118 void setBackColorToDefault(); 118 void setBackColorToDefault();
119 // 119 //
120 // ------------------------------------- 120 // -------------------------------------
121 // 121 //
122 BOOL getMode (int n); 122 BOOL getMode (int n);
123 // 123 //
124 // only for report cursor position 124 // only for report cursor position
125 // 125 //
126 int getCursorX(); 126 int getCursorX();
127 int getCursorY(); 127 int getCursorY();
128 // 128 //
129 // ------------------------------------- 129 // -------------------------------------
130 // 130 //
131 void clear(); 131 void clear();
132 void home(); 132 void home();
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
146 /*! set the position of the history cursor. */ 146 /*! set the position of the history cursor. */
147 void setHistCursor(int cursor); 147 void setHistCursor(int cursor);
148 /*! return the position of the history cursor. */ 148 /*! return the position of the history cursor. */
149 int getHistCursor(); 149 int getHistCursor();
150 150
151 int getHistLines (); 151 int getHistLines ();
152 void setScroll(bool on); 152 void setScroll(bool on);
153 bool hasScroll(); 153 bool hasScroll();
154 154
155 // 155 //
156 // Selection 156 // Selection
157 // 157 //
158 void setSelBeginXY(const int x, const int y); 158 void setSelBeginXY(const int x, const int y);
159 void setSelExtentXY(const int x, const int y); 159 void setSelExtentXY(const int x, const int y);
160 void clearSelection(); 160 void clearSelection();
161 QString getSelText(const BOOL preserve_line_breaks); 161 QString getSelText(const BOOL preserve_line_breaks);
162 162
163 void checkSelection(int from, int to); 163 void checkSelection(int from, int to);
164 164
165private: // helper 165private: // helper
166 166
167 void clearImage(int loca, int loce, char c); 167 void clearImage(int loca, int loce, char c);
168 void moveImage(int dst, int loca, int loce); 168 void moveImage(int dst, int loca, int loce);
169 169
170 void scrollUp(int from, int i); 170 void scrollUp(int from, int i);
171 void scrollDown(int from, int i); 171 void scrollDown(int from, int i);
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
180private: 180private:
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
185 emulation providing state informations in form of modes, 185 emulation providing state informations in form of modes,
186 margins, tabulators, cursor etc. 186 margins, tabulators, cursor etc.
187 187
188 Even more unexpected are variables to save and restore 188 Even more unexpected are variables to save and restore
189 parts of the state. 189 parts of the state.
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
203 // cursor location 203 // cursor location
204 204
205 int cuX; 205 int cuX;
206 int cuY; 206 int cuY;
207 207
208 // cursor color and rendition info 208 // cursor color and rendition info
209 209
210 UINT8 cu_fg; // foreground 210 UINT8 cu_fg; // foreground
211 UINT8 cu_bg; // background 211 UINT8 cu_bg; // background
212 UINT8 cu_re; // rendition 212 UINT8 cu_re; // rendition
213 213
214 // margins ---------------- 214 // margins ----------------
215 215
216 int tmargin; // top margin 216 int tmargin; // top margin
217 int bmargin; // bottom margin 217 int bmargin; // bottom margin
218 218
219 // states ---------------- 219 // states ----------------
220 220
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
@@ -44,49 +44,49 @@
44 44
45 - Constructor/Destructor 45 - Constructor/Destructor
46 - Incoming Bytes Event pipeline 46 - Incoming Bytes Event pipeline
47 - Outgoing Bytes 47 - Outgoing Bytes
48 - Mouse Events 48 - Mouse Events
49 - Keyboard Events 49 - Keyboard Events
50 - Modes and Charset State 50 - Modes and Charset State
51 - Diagnostics 51 - Diagnostics
52*/ 52*/
53 53
54 54
55/* ------------------------------------------------------------------------- */ 55/* ------------------------------------------------------------------------- */
56/* */ 56/* */
57/* Constructor / Destructor */ 57/* Constructor / Destructor */
58/* */ 58/* */
59/* ------------------------------------------------------------------------- */ 59/* ------------------------------------------------------------------------- */
60 60
61/* 61/*
62 Nothing really intesting happens here. 62 Nothing really intesting happens here.
63*/ 63*/
64 64
65/*! 65/*!
66*/ 66*/
67 67
68Vt102Emulation::Vt102Emulation(Widget* gui) : EmulationLayer(gui) 68Vt102Emulation::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}
75 75
76/*! 76/*!
77*/ 77*/
78 78
79Vt102Emulation::~Vt102Emulation() 79Vt102Emulation::~Vt102Emulation()
80{ 80{
81} 81}
82 82
83/*! 83/*!
84*/ 84*/
85 85
86void Vt102Emulation::reset() 86void Vt102Emulation::reset()
87{ 87{
88 resetToken(); 88 resetToken();
89 resetModes(); 89 resetModes();
90 resetCharset(0); screen[0]->reset(); 90 resetCharset(0); screen[0]->reset();
91 resetCharset(1); screen[0]->reset(); 91 resetCharset(1); screen[0]->reset();
92 setCodec(0); 92 setCodec(0);
@@ -328,49 +328,49 @@ void Vt102Emulation::XtermHack()
328 328
329 The technical reference manual provides more informations 329 The technical reference manual provides more informations
330 about this mapping. 330 about this mapping.
331*/ 331*/
332 332
333void Vt102Emulation::tau( int token, int p, int q ) 333void Vt102Emulation::tau( int token, int p, int q )
334{ 334{
335//scan_buffer_report(); 335//scan_buffer_report();
336//if (token == TY_CHR___()) printf("%c",p); else 336//if (token == TY_CHR___()) printf("%c",p); else
337//printf("tau(%d,%d,%d, %d,%d)\n",(token>>0)&0xff,(token>>8)&0xff,(token>>16)&0xffff,p,q); 337//printf("tau(%d,%d,%d, %d,%d)\n",(token>>0)&0xff,(token>>8)&0xff,(token>>16)&0xffff,p,q);
338 switch (token) 338 switch (token)
339 { 339 {
340 340
341 case TY_CHR___( ) : scr->ShowCharacter (p ); break; //UTF16 341 case TY_CHR___( ) : scr->ShowCharacter (p ); break; //UTF16
342 342
343 // 127 DEL : ignored on input 343 // 127 DEL : ignored on input
344 344
345 case TY_CTL___('@' ) : /* NUL: ignored */ break; 345 case TY_CTL___('@' ) : /* NUL: ignored */ break;
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
359 359
360 case TY_CTL___('N' ) : useCharset ( 1); break; //VT100 360 case TY_CTL___('N' ) : useCharset ( 1); break; //VT100
361 case TY_CTL___('O' ) : useCharset ( 0); break; //VT100 361 case TY_CTL___('O' ) : useCharset ( 0); break; //VT100
362 362
363 case TY_CTL___('P' ) : /* DLE: ignored */ break; 363 case TY_CTL___('P' ) : /* DLE: ignored */ break;
364 case TY_CTL___('Q' ) : /* DC1: XON continue */ break; //VT100 364 case TY_CTL___('Q' ) : /* DC1: XON continue */ break; //VT100
365 case TY_CTL___('R' ) : /* DC2: ignored */ break; 365 case TY_CTL___('R' ) : /* DC2: ignored */ break;
366 case TY_CTL___('S' ) : /* DC3: XOFF halt */ break; //VT100 366 case TY_CTL___('S' ) : /* DC3: XOFF halt */ break; //VT100
367 case TY_CTL___('T' ) : /* DC4: ignored */ break; 367 case TY_CTL___('T' ) : /* DC4: ignored */ break;
368 case TY_CTL___('U' ) : /* NAK: ignored */ break; 368 case TY_CTL___('U' ) : /* NAK: ignored */ break;
369 case TY_CTL___('V' ) : /* SYN: ignored */ break; 369 case TY_CTL___('V' ) : /* SYN: ignored */ break;
370 case TY_CTL___('W' ) : /* ETB: ignored */ break; 370 case TY_CTL___('W' ) : /* ETB: ignored */ break;
371 case TY_CTL___('X' ) : scr->ShowCharacter ( 0x2592); break; //VT100 371 case TY_CTL___('X' ) : scr->ShowCharacter ( 0x2592); break; //VT100
372 case TY_CTL___('Y' ) : /* EM : ignored */ break; 372 case TY_CTL___('Y' ) : /* EM : ignored */ break;
373 case TY_CTL___('Z' ) : scr->ShowCharacter ( 0x2592); break; //VT100 373 case TY_CTL___('Z' ) : scr->ShowCharacter ( 0x2592); break; //VT100
374 case TY_CTL___('[' ) : /* ESC: cannot be seen here. */ break; 374 case TY_CTL___('[' ) : /* ESC: cannot be seen here. */ break;
375 case TY_CTL___('\\' ) : /* FS : ignored */ break; 375 case TY_CTL___('\\' ) : /* FS : ignored */ break;
376 case TY_CTL___(']' ) : /* GS : ignored */ break; 376 case TY_CTL___(']' ) : /* GS : ignored */ break;
@@ -716,53 +716,53 @@ void Vt102Emulation::onMouse( int cb, int cx, int cy )
716 716
717void Vt102Emulation::onKeyPress( QKeyEvent* ev ) 717void Vt102Emulation::onKeyPress( QKeyEvent* ev )
718{ 718{
719 if (!connected) return; // someone else gets the keys 719 if (!connected) return; // someone else gets the keys
720 720
721//printf("State/Key: 0x%04x 0x%04x (%d,%d)\n",ev->state(),ev->key(),ev->text().length(),ev->text().length()?ev->text().ascii()[0]:0); 721//printf("State/Key: 0x%04x 0x%04x (%d,%d)\n",ev->state(),ev->key(),ev->text().length(),ev->text().length()?ev->text().ascii()[0]:0);
722 722
723 // revert to non-history when typing 723 // revert to non-history when typing
724 if (scr->getHistCursor() != scr->getHistLines()); 724 if (scr->getHistCursor() != scr->getHistLines());
725 scr->setHistCursor(scr->getHistLines()); 725 scr->setHistCursor(scr->getHistLines());
726 726
727 // lookup in keyboard translation table ... 727 // lookup in keyboard translation table ...
728 int cmd; const char* txt; int len; 728 int cmd; const char* txt; int len;
729 if (keytrans->findEntry(ev->key(), encodeMode(MODE_NewLine , BITS_NewLine ) + // OLD, 729 if (keytrans->findEntry(ev->key(), encodeMode(MODE_NewLine , BITS_NewLine ) + // OLD,
730 encodeMode(MODE_Ansi , BITS_Ansi ) + // OBSOLETE, 730 encodeMode(MODE_Ansi , BITS_Ansi ) + // OBSOLETE,
731 encodeMode(MODE_AppCuKeys, BITS_AppCuKeys ) + // VT100 stuff 731 encodeMode(MODE_AppCuKeys, BITS_AppCuKeys ) + // VT100 stuff
732 encodeStat(ControlButton , BITS_Control ) + 732 encodeStat(ControlButton , BITS_Control ) +
733 encodeStat(ShiftButton , BITS_Shift ) + 733 encodeStat(ShiftButton , BITS_Shift ) +
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
751 if (!ev->text().isEmpty()) 751 if (!ev->text().isEmpty())
752 { 752 {
753 if (ev->state() & AltButton) sendString("\033"); // ESC, this is the ALT prefix 753 if (ev->state() & AltButton) sendString("\033"); // ESC, this is the ALT prefix
754 /// very hacky 754 /// very hacky
755 if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='A')) sendString("\01"); 755 if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='A')) sendString("\01");
756 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='B')) sendString("\02"); 756 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='B')) sendString("\02");
757 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='C')) sendString("\03"); 757 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='C')) sendString("\03");
758 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='D')) sendString("\04"); 758 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='D')) sendString("\04");
759 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='E')) sendString("\05"); 759 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='E')) sendString("\05");
760 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='F')) sendString("\06"); 760 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='F')) sendString("\06");
761 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='G')) sendString("\07"); 761 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='G')) sendString("\07");
762 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='H')) sendString("\010"); 762 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='H')) sendString("\010");
763 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='I')) sendString("\011"); 763 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='I')) sendString("\011");
764 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='J')) sendString("\012"); 764 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='J')) sendString("\012");
765 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='K')) sendString("\013"); 765 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='K')) sendString("\013");
766 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='L')) sendString("\014"); 766 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='L')) sendString("\014");
767 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='M')) sendString("\015"); 767 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='M')) sendString("\015");
768 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='N')) sendString("\016"); 768 else if ((ev->state() & ControlButton) && (ev->text().upper().ascii()[0]=='N')) sendString("\016");
@@ -903,68 +903,68 @@ void Vt102Emulation::restoreCursor()
903 903
904 For strange reasons, the extend of the rendition attributes ranges over 904 For strange reasons, the extend of the rendition attributes ranges over
905 all screens and not over the actual screen. 905 all screens and not over the actual screen.
906 906
907 We decided on the precise precise extend, somehow. 907 We decided on the precise precise extend, somehow.
908*/ 908*/
909 909
910// "Mode" related part of the state. These are all booleans. 910// "Mode" related part of the state. These are all booleans.
911 911
912void Vt102Emulation::resetModes() 912void Vt102Emulation::resetModes()
913{ 913{
914 resetMode(MODE_Mouse1000); saveMode(MODE_Mouse1000); 914 resetMode(MODE_Mouse1000); saveMode(MODE_Mouse1000);
915 resetMode(MODE_AppScreen); saveMode(MODE_AppScreen); 915 resetMode(MODE_AppScreen); saveMode(MODE_AppScreen);
916 // here come obsolete modes 916 // here come obsolete modes
917 resetMode(MODE_AppCuKeys); saveMode(MODE_AppCuKeys); 917 resetMode(MODE_AppCuKeys); saveMode(MODE_AppCuKeys);
918 resetMode(MODE_NewLine ); 918 resetMode(MODE_NewLine );
919 setMode(MODE_Ansi ); 919 setMode(MODE_Ansi );
920} 920}
921 921
922void Vt102Emulation::setMode(int m) 922void 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 }
934 if (m < MODES_SCREEN || m == MODE_NewLine) 934 if (m < MODES_SCREEN || m == MODE_NewLine)
935 { 935 {
936 screen[0]->setMode(m); 936 screen[0]->setMode(m);
937 screen[1]->setMode(m); 937 screen[1]->setMode(m);
938 } 938 }
939} 939}
940 940
941void Vt102Emulation::resetMode(int m) 941void 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)
953 { 953 {
954 screen[0]->resetMode(m); 954 screen[0]->resetMode(m);
955 screen[1]->resetMode(m); 955 screen[1]->resetMode(m);
956 } 956 }
957} 957}
958 958
959void Vt102Emulation::saveMode(int m) 959void Vt102Emulation::saveMode(int m)
960{ 960{
961 saveParm.mode[m] = currParm.mode[m]; 961 saveParm.mode[m] = currParm.mode[m];
962} 962}
963 963
964void Vt102Emulation::restoreMode(int m) 964void Vt102Emulation::restoreMode(int m)
965{ 965{
966 if(saveParm.mode[m]) setMode(m); else resetMode(m); 966 if(saveParm.mode[m]) setMode(m); else resetMode(m);
967} 967}
968 968
969BOOL Vt102Emulation::getMode(int m) 969BOOL Vt102Emulation::getMode(int m)
970{ 970{
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
@@ -39,49 +39,49 @@
39#define MODE_Ansi (MODES_SCREEN+4) 39#define MODE_Ansi (MODES_SCREEN+4)
40#define MODE_total (MODES_SCREEN+5) 40#define MODE_total (MODES_SCREEN+5)
41 41
42struct DECpar 42struct DECpar
43{ 43{
44 BOOL mode[MODE_total]; 44 BOOL mode[MODE_total];
45}; 45};
46 46
47struct CharCodes 47struct CharCodes
48{ 48{
49 // coding info 49 // coding info
50 char charset[4]; // 50 char charset[4]; //
51 int cu_cs; // actual charset. 51 int cu_cs; // actual charset.
52 bool graphic; // Some VT100 tricks 52 bool graphic; // Some VT100 tricks
53 bool pound ; // Some VT100 tricks 53 bool pound ; // Some VT100 tricks
54 bool sa_graphic; // saved graphic 54 bool sa_graphic; // saved graphic
55 bool sa_pound; // saved pound 55 bool sa_pound; // saved pound
56}; 56};
57 57
58class Vt102Emulation: public EmulationLayer 58class Vt102Emulation: public EmulationLayer
59{ Q_OBJECT 59{ Q_OBJECT
60 60
61public: 61public:
62 62
63 Vt102Emulation(Widget* gui); 63 Vt102Emulation(WidgetLayer* gui);
64 ~Vt102Emulation(); 64 ~Vt102Emulation();
65 65
66public slots: // signals incoming from Widget 66public 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);
70 70
71signals: 71signals:
72 72
73 void changeTitle(int,const QString&); 73 void changeTitle(int,const QString&);
74 void prevSession(); 74 void prevSession();
75 void nextSession(); 75 void nextSession();
76 76
77public: 77public:
78 78
79 void reset(); 79 void reset();
80 80
81 /** 81 /**
82 * receive a char from IOLayer 82 * receive a char from IOLayer
83 */ 83 */
84 void onRcvChar(int cc); 84 void onRcvChar(int cc);
85 85
86 /** 86 /**
87 * sends a list of bytes to the IOLayer 87 * sends a list of bytes to the IOLayer
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
@@ -85,48 +85,59 @@ public:
85 /** 85 /**
86 * insert text 86 * insert text
87 * @param QString text, the text to be inserted 87 * @param QString text, the text to be inserted
88 */ 88 */
89 void insertText( QString text ); 89 void insertText( QString text );
90 90
91 /** 91 /**
92 * set selection (clipboard) to text 92 * set selection (clipboard) to text
93 * @param const QString &text, the text to be selected 93 * @param const QString &text, the text to be selected
94 */ 94 */
95 void setSelection( const QString &text ); 95 void setSelection( const QString &text );
96 96
97 /** 97 /**
98 * paste content of clipboard 98 * paste content of clipboard
99 */ 99 */
100 void pasteClipboard(); 100 void pasteClipboard();
101 101
102 102
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
109signals: 120signals:
110 121
111 /** 122 /**
112 * key was pressed 123 * key was pressed
113 */ 124 */
114 void keyPressed( QKeyEvent *e ); 125 void keyPressed( QKeyEvent *e );
115 126
116 /** 127 /**
117 * whenever Mouse selects something 128 * whenever Mouse selects something
118 * @param int button, the button that us pressed : 129 * @param int button, the button that us pressed :
119 * 0left Button 130 * 0left Button
120 * 3Button released 131 * 3Button released
121 * @param int x, x position 132 * @param int x, x position
122 * @param int y, y position 133 * @param int y, y position
123 * 134 *
124 * // numbering due to layout in old TEWidget 135 * // numbering due to layout in old TEWidget
125 */ 136 */
126 void mousePressed( int button, int x, int y ); 137 void mousePressed( int button, int x, int y );
127 138
128 /** 139 /**
129 * size of image changed 140 * size of image changed
130 * @param int lines, line count of new size 141 * @param int lines, line count of new size
131 * @param int columns, column count of new size 142 * @param int columns, column count of new size
132 */ 143 */