author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/apps/opie-console/TEmulation.cpp | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/apps/opie-console/TEmulation.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/TEmulation.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp index d0169d7..6ff73af 100644 --- a/noncore/apps/opie-console/TEmulation.cpp +++ b/noncore/apps/opie-console/TEmulation.cpp | |||
@@ -49,48 +49,54 @@ | |||
49 | 49 | ||
50 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. | 50 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. |
51 | 51 | ||
52 | By this, refreshing is driven by a timer, which is (re)started whenever | 52 | By this, refreshing is driven by a timer, which is (re)started whenever |
53 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. | 53 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. |
54 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger | 54 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger |
55 | refresh. This rule suits both bulk display operation as done by curses as | 55 | refresh. This rule suits both bulk display operation as done by curses as |
56 | well as individual characters typed. | 56 | well as individual characters typed. |
57 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). | 57 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). |
58 | 58 | ||
59 | Additionally, we trigger refreshing by newlines comming in to make visual | 59 | Additionally, we trigger refreshing by newlines comming in to make visual |
60 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby | 60 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby |
61 | producing the illusion of a permanent and immediate display operation. | 61 | producing the illusion of a permanent and immediate display operation. |
62 | 62 | ||
63 | As a sort of catch-all needed for cases where none of the above | 63 | As a sort of catch-all needed for cases where none of the above |
64 | conditions catch, the screen refresh is also triggered by a count | 64 | conditions catch, the screen refresh is also triggered by a count |
65 | of incoming bulks (`bulk_incnt'). | 65 | of incoming bulks (`bulk_incnt'). |
66 | */ | 66 | */ |
67 | 67 | ||
68 | /* FIXME | 68 | /* FIXME |
69 | - evtl. the bulk operations could be made more transparent. | 69 | - evtl. the bulk operations could be made more transparent. |
70 | */ | 70 | */ |
71 | 71 | ||
72 | #include "TEmulation.h" | 72 | #include "TEmulation.h" |
73 | |||
74 | /* OPIE */ | ||
75 | #include <opie2/odebug.h> | ||
76 | using namespace Opie::Core; | ||
77 | |||
78 | /* STD */ | ||
73 | #include <stdio.h> | 79 | #include <stdio.h> |
74 | #include <stdlib.h> | 80 | #include <stdlib.h> |
75 | #include <unistd.h> | 81 | #include <unistd.h> |
76 | 82 | ||
77 | 83 | ||
78 | /* ------------------------------------------------------------------------- */ | 84 | /* ------------------------------------------------------------------------- */ |
79 | /* */ | 85 | /* */ |
80 | /* TEmulation */ | 86 | /* TEmulation */ |
81 | /* */ | 87 | /* */ |
82 | /* ------------------------------------------------------------------------- */ | 88 | /* ------------------------------------------------------------------------- */ |
83 | 89 | ||
84 | #define CNTL(c) ((c)-'@') | 90 | #define CNTL(c) ((c)-'@') |
85 | 91 | ||
86 | /*! | 92 | /*! |
87 | */ | 93 | */ |
88 | 94 | ||
89 | TEmulation::TEmulation(TEWidget* gui) | 95 | TEmulation::TEmulation(TEWidget* gui) |
90 | : decoder((QTextDecoder*)NULL) | 96 | : decoder((QTextDecoder*)NULL) |
91 | { | 97 | { |
92 | this->gui = gui; | 98 | this->gui = gui; |
93 | 99 | ||
94 | screen[0] = new TEScreen(gui->Lines(),gui->Columns()); | 100 | screen[0] = new TEScreen(gui->Lines(),gui->Columns()); |
95 | screen[1] = new TEScreen(gui->Lines(),gui->Columns()); | 101 | screen[1] = new TEScreen(gui->Lines(),gui->Columns()); |
96 | scr = screen[0]; | 102 | scr = screen[0]; |
@@ -183,49 +189,49 @@ void TEmulation::onRcvChar(int c) | |||
183 | { | 189 | { |
184 | c &= 0xff; | 190 | c &= 0xff; |
185 | switch (c) | 191 | switch (c) |
186 | { | 192 | { |
187 | case '\b' : scr->BackSpace(); break; | 193 | case '\b' : scr->BackSpace(); break; |
188 | case '\t' : scr->Tabulate(); break; | 194 | case '\t' : scr->Tabulate(); break; |
189 | case '\n' : scr->NewLine(); break; | 195 | case '\n' : scr->NewLine(); break; |
190 | case '\r' : scr->Return(); break; | 196 | case '\r' : scr->Return(); break; |
191 | case 0x07 : gui->Bell(); break; | 197 | case 0x07 : gui->Bell(); break; |
192 | default : scr->ShowCharacter(c); break; | 198 | default : scr->ShowCharacter(c); break; |
193 | }; | 199 | }; |
194 | } | 200 | } |
195 | 201 | ||
196 | /* ------------------------------------------------------------------------- */ | 202 | /* ------------------------------------------------------------------------- */ |
197 | /* */ | 203 | /* */ |
198 | /* Keyboard Handling */ | 204 | /* Keyboard Handling */ |
199 | /* */ | 205 | /* */ |
200 | /* ------------------------------------------------------------------------- */ | 206 | /* ------------------------------------------------------------------------- */ |
201 | 207 | ||
202 | /*! | 208 | /*! |
203 | */ | 209 | */ |
204 | 210 | ||
205 | void TEmulation::onKeyPress( QKeyEvent* ev ) | 211 | void TEmulation::onKeyPress( QKeyEvent* ev ) |
206 | { | 212 | { |
207 | qWarning("onKeyPress,...."); | 213 | owarn << "onKeyPress,...." << oendl; |
208 | if (!connected) return; // someone else gets the keys | 214 | if (!connected) return; // someone else gets the keys |
209 | if (scr->getHistCursor() != scr->getHistLines()); | 215 | if (scr->getHistCursor() != scr->getHistLines()); |
210 | scr->setHistCursor(scr->getHistLines()); | 216 | scr->setHistCursor(scr->getHistLines()); |
211 | if (!ev->text().isEmpty()) | 217 | if (!ev->text().isEmpty()) |
212 | { // A block of text | 218 | { // A block of text |
213 | // Note that the text is proper unicode. | 219 | // Note that the text is proper unicode. |
214 | // We should do a conversion here, but since this | 220 | // We should do a conversion here, but since this |
215 | // routine will never be used, we simply emit plain ascii. | 221 | // routine will never be used, we simply emit plain ascii. |
216 | emit sndBlock(ev->text().ascii(),ev->text().length()); | 222 | emit sndBlock(ev->text().ascii(),ev->text().length()); |
217 | } | 223 | } |
218 | else if (ev->ascii()>0) | 224 | else if (ev->ascii()>0) |
219 | { unsigned char c[1]; | 225 | { unsigned char c[1]; |
220 | c[0] = ev->ascii(); | 226 | c[0] = ev->ascii(); |
221 | emit sndBlock((char*)c,1); | 227 | emit sndBlock((char*)c,1); |
222 | } | 228 | } |
223 | } | 229 | } |
224 | 230 | ||
225 | // Unblocking, Byte to Unicode translation --------------------------------- -- | 231 | // Unblocking, Byte to Unicode translation --------------------------------- -- |
226 | 232 | ||
227 | /* | 233 | /* |
228 | We are doing code conversion from locale to unicode first. | 234 | We are doing code conversion from locale to unicode first. |
229 | */ | 235 | */ |
230 | 236 | ||
231 | void TEmulation::onRcvBlock(const char *s, int len) | 237 | void TEmulation::onRcvBlock(const char *s, int len) |