summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-08 23:23:40 (UTC)
committer llornkcor <llornkcor>2002-07-08 23:23:40 (UTC)
commit647a6c7ec282ea9b0b45baf8935b8eefc3ff8269 (patch) (unidiff)
treea3b5b8f5d0f53b1adcb52623c34152472911f3f9
parent40a1b5f7519c70b5335937573e3425bbc9d0f690 (diff)
downloadopie-647a6c7ec282ea9b0b45baf8935b8eefc3ff8269.zip
opie-647a6c7ec282ea9b0b45baf8935b8eefc3ff8269.tar.gz
opie-647a6c7ec282ea9b0b45baf8935b8eefc3ff8269.tar.bz2
fixed by patch sent by Tim. Also fixed version in control file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReader.cpp766
-rw-r--r--noncore/apps/opie-reader/opie-reader.control4
2 files changed, 385 insertions, 385 deletions
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp
index 6251812..fc9cffb 100644
--- a/noncore/apps/opie-reader/QTReader.cpp
+++ b/noncore/apps/opie-reader/QTReader.cpp
@@ -79,48 +79,48 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e )
79{ 79{
80 if (textarray != NULL) 80 if (textarray != NULL)
81 { 81 {
82 //printf("(%u, %u)\n", _e->x(), _e->y()); 82// printf("(%u, %u)\n", _e->x(), _e->y());
83 QString wrd = QString::null; 83 QString wrd = QString::null;
84 int lineno = _e->y()/m_linespacing; 84 int lineno = _e->y()/m_linespacing;
85 if (m_bMonoSpaced) 85 if (m_bMonoSpaced)
86 { 86 {
87 int chno = _e->x()/m_charWidth; 87 int chno = _e->x()/m_charWidth;
88 if (chno < ustrlen(textarray[lineno]->data())) 88 if (chno < ustrlen(textarray[lineno]->data()))
89 { 89 {
90 wrd[0] = textarray[lineno]->data()[chno]; 90 wrd[0] = textarray[lineno]->data()[chno];
91 } 91 }
92 } 92 }
93 else 93 else
94 { 94 {
95 CBuffer* t = textarray[lineno]; 95 CBuffer* t = textarray[lineno];
96 int first = 0; 96 int first = 0;
97 while (1) 97 while (1)
98 { 98 {
99 int i = first+1; 99 int i = first+1;
100 // while ((*t)[i] != ' ' && (*t)[i] != 0) i++; 100// while ((*t)[i] != ' ' && (*t)[i] != 0) i++;
101 while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; 101 while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++;
102 if (m_fm->width(toQString(t->data()), i) > _e->x()) 102 if (m_fm->width(toQString(t->data()), i) > _e->x())
103 { 103 {
104 wrd = toQString(t->data()+first, i - first); 104 wrd = toQString(t->data()+first, i - first);
105 break; 105 break;
106 } 106 }
107 // while ((*t)[i] == ' ' && (*t)[i] != 0) i++; 107// while ((*t)[i] == ' ' && (*t)[i] != 0) i++;
108 while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; 108 while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++;
109 if ((*t)[i] == 0) break; 109 if ((*t)[i] == 0) break;
110 first = i; 110 first = i;
111 } 111 }
112 } 112 }
113 if (!wrd.isEmpty()) 113 if (!wrd.isEmpty())
114 { 114 {
115 QClipboard* cb = QApplication::clipboard(); 115 QClipboard* cb = QApplication::clipboard();
116 cb->setText(wrd); 116 cb->setText(wrd);
117 Global::statusMessage(wrd); 117 Global::statusMessage(wrd);
118 if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) 118 if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty())
119 { 119 {
120 QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); 120 QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8());
121 e << wrd; 121 e << wrd;
122 } 122 }
123 } 123 }
124 } 124 }
125} 125}
126 126
@@ -134,8 +134,8 @@ void QTReader::focusOutEvent(QFocusEvent* e)
134{ 134{
135 if (m_autoScroll) 135 if (m_autoScroll)
136 { 136 {
137 timer->stop(); 137 timer->stop();
138 m_scrolldy = 0; 138 m_scrolldy = 0;
139 } 139 }
140} 140}
141 141
@@ -147,11 +147,11 @@ void QTReader::goDown()
147{ 147{
148 if (m_bpagemode) 148 if (m_bpagemode)
149 { 149 {
150 dopagedn(); 150 dopagedn();
151 } 151 }
152 else 152 else
153 { 153 {
154 lineDown(); 154 lineDown();
155 } 155 }
156} 156}
157 157
@@ -159,11 +159,11 @@ void QTReader::goUp()
159{ 159{
160 if (m_bpagemode) 160 if (m_bpagemode)
161 { 161 {
162 dopageup(); 162 dopageup();
163 } 163 }
164 else 164 else
165 { 165 {
166 lineUp(); 166 lineUp();
167 } 167 }
168} 168}
169 169
@@ -172,120 +172,120 @@ void QTReader::keyPressEvent(QKeyEvent* e)
172 switch (e->key()) 172 switch (e->key())
173 { 173 {
174 case Key_Down: 174 case Key_Down:
175 { 175 {
176 e->accept(); 176 e->accept();
177 if (m_autoScroll) 177 if (m_autoScroll)
178 { 178 {
179 if (m_delay < 59049) 179 if (m_delay < 59049)
180 { 180 {
181 m_delay = (3*m_delay)/2; 181 m_delay = (3*m_delay)/2;
182 timer->changeInterval(real_delay()); 182 timer->changeInterval(real_delay());
183 } 183 }
184 else 184 else
185 { 185 {
186 m_delay = 59049; 186 m_delay = 59049;
187 } 187 }
188 } 188 }
189 else 189 else
190 { 190 {
191 goDown(); 191 goDown();
192 } 192 }
193 } 193 }
194 break; 194 break;
195 case Key_Up: 195 case Key_Up:
196 { 196 {
197 e->accept(); 197 e->accept();
198 if (m_autoScroll) 198 if (m_autoScroll)
199 { 199 {
200 if (m_delay > 1024) 200 if (m_delay > 1024)
201 { 201 {
202 m_delay = (2*m_delay)/3; 202 m_delay = (2*m_delay)/3;
203 timer->changeInterval(real_delay()); 203 timer->changeInterval(real_delay());
204 } 204 }
205 else 205 else
206 { 206 {
207 m_delay = 1024; 207 m_delay = 1024;
208 } 208 }
209 } 209 }
210 else 210 else
211 { 211 {
212 goUp(); 212 goUp();
213 } 213 }
214 } 214 }
215 break; 215 break;
216 /* 216 /*
217 case Key_Left: 217 case Key_Left:
218 { 218 {
219 e->accept(); 219 e->accept();
220 if (m_textfont > 0) 220 if (m_textfont > 0)
221 { 221 {
222 m_textfont--; 222 m_textfont--;
223 setfont(NULL); 223 setfont(NULL);
224 locate(pagelocate()); 224 locate(pagelocate());
225 update(); 225 update();
226 } 226 }
227 } 227 }
228 break; 228 break;
229 case Key_Right: 229 case Key_Right:
230 { 230 {
231 e->accept(); 231 e->accept();
232 if (fonts[++m_textfont] == 0) 232 if (fonts[++m_textfont] == 0)
233 { 233 {
234 m_textfont--; 234 m_textfont--;
235 } 235 }
236 else 236 else
237 { 237 {
238 setfont(NULL); 238 setfont(NULL);
239 locate(pagelocate()); 239 locate(pagelocate());
240 update(); 240 update();
241 } 241 }
242 } 242 }
243 break; 243 break;
244 */ 244 */
245 case Key_Right: 245 case Key_Right:
246 { 246 {
247 e->accept(); 247 e->accept();
248 if (fontsizes[++m_textsize] == 0) 248 if (fontsizes[++m_textsize] == 0)
249 { 249 {
250 m_textsize--; 250 m_textsize--;
251 } 251 }
252 else 252 else
253 { 253 {
254 bool sc = m_autoScroll; 254 bool sc = m_autoScroll;
255 m_autoScroll = false; 255 m_autoScroll = false;
256 setfont(NULL); 256 setfont(NULL);
257 locate(pagelocate()); 257 locate(pagelocate());
258 update(); 258 update();
259 m_autoScroll = sc; 259 m_autoScroll = sc;
260 if (m_autoScroll) autoscroll(); 260 if (m_autoScroll) autoscroll();
261 } 261 }
262 } 262 }
263 break; 263 break;
264 case Key_Left: 264 case Key_Left:
265 { 265 {
266 e->accept(); 266 e->accept();
267 if (m_textsize > 0) 267 if (m_textsize > 0)
268 { 268 {
269 bool sc = m_autoScroll; 269 bool sc = m_autoScroll;
270 m_autoScroll = false; 270 m_autoScroll = false;
271 m_textsize--; 271 m_textsize--;
272 setfont(NULL); 272 setfont(NULL);
273 locate(pagelocate()); 273 locate(pagelocate());
274 update(); 274 update();
275 m_autoScroll = sc; 275 m_autoScroll = sc;
276 if (m_autoScroll) autoscroll(); 276 if (m_autoScroll) autoscroll();
277 } 277 }
278 } 278 }
279 break; 279 break;
280 case Key_Space: 280 case Key_Space:
281 //case Key_Enter: 281// case Key_Enter:
282 case Key_Return: 282 case Key_Return:
283 { 283 {
284 e->accept(); 284 e->accept();
285 setautoscroll(!m_autoScroll); 285 setautoscroll(!m_autoScroll);
286 ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll); 286 ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll);
287 } 287 }
288 break; 288 break;
289 default: 289 default:
290 e->ignore(); 290 e->ignore();
291 } 291 }
@@ -296,12 +296,12 @@ void QTReader::setautoscroll(bool _sc)
296 if (_sc == m_autoScroll) return; 296 if (_sc == m_autoScroll) return;
297 if (m_autoScroll) 297 if (m_autoScroll)
298 { 298 {
299 m_autoScroll = false; 299 m_autoScroll = false;
300 } 300 }
301 else 301 else
302 { 302 {
303 m_autoScroll = true; 303 m_autoScroll = true;
304 autoscroll(); 304 autoscroll();
305 } 305 }
306} 306}
307 307
@@ -309,11 +309,11 @@ bool QTReader::getline(CBuffer *buff)
309{ 309{
310 if (m_bMonoSpaced) 310 if (m_bMonoSpaced)
311 { 311 {
312 return buffdoc.getline(buff ,width(), m_charWidth); 312 return buffdoc.getline(buff ,width(), m_charWidth);
313 } 313 }
314 else 314 else
315 { 315 {
316 return buffdoc.getline(buff, width()); 316 return buffdoc.getline(buff, width());
317 } 317 }
318} 318}
319 319
@@ -321,8 +321,8 @@ void QTReader::doscroll()
321{ 321{
322 if (!m_autoScroll) 322 if (!m_autoScroll)
323 { 323 {
324 timer->stop(); 324 timer->stop();
325 return; 325 return;
326 } 326 }
327// timer->changeInterval(real_delay()); 327// timer->changeInterval(real_delay());
328 QPainter p( this ); 328 QPainter p( this );
@@ -332,30 +332,30 @@ void QTReader::doscroll()
332 332
333 if (++m_scrolldy == m_linespacing) 333 if (++m_scrolldy == m_linespacing)
334 { 334 {
335 setfont(&p); 335 setfont(&p);
336 m_scrolldy = 0; 336 m_scrolldy = 0;
337 // qDrawPlainRect(&p,0,height() - m_linespacing,width(),m_linespacing,white,1,&b); 337// qDrawPlainRect(&p,0,height() - m_linespacing,width(),m_linespacing,white,1,&b);
338 pagepos = locnarray[1]; 338 pagepos = locnarray[1];
339 CBuffer* buff = textarray[0]; 339 CBuffer* buff = textarray[0];
340 for (int i = 1; i < numlines; i++) 340 for (int i = 1; i < numlines; i++)
341 { 341 {
342 textarray[i-1] = textarray[i]; 342 textarray[i-1] = textarray[i];
343 locnarray[i-1] = locnarray[i]; 343 locnarray[i-1] = locnarray[i];
344 } 344 }
345 locnarray[numlines-1] = locate(); 345 locnarray[numlines-1] = locate();
346 if (getline(buff)) 346 if (getline(buff))
347 { 347 {
348 textarray[numlines-1] = buff; 348 textarray[numlines-1] = buff;
349 drawText( p, 0, height() - m_descent - 2, buff->data()); 349 drawText( p, 0, height() - m_descent - 2, buff->data());
350 mylastpos = locate(); 350 mylastpos = locate();
351 } 351 }
352 else 352 else
353 { 353 {
354 // (*buff)[0] = '\0'; 354// (*buff)[0] = '\0';
355 textarray[numlines-1] = buff; 355 textarray[numlines-1] = buff;
356 m_autoScroll = false; 356 m_autoScroll = false;
357 ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll); 357 ((QTReaderApp*)parent()->parent())->setScrollState(m_autoScroll);
358 } 358 }
359 } 359 }
360} 360}
361 361
@@ -364,14 +364,14 @@ void QTReader::drawText(QPainter& p, int x, int y, tchar* _text)
364 QString text = toQString(_text); 364 QString text = toQString(_text);
365 if (m_bMonoSpaced) 365 if (m_bMonoSpaced)
366 { 366 {
367 for (int i = 0; i < text.length(); i++) 367 for (int i = 0; i < text.length(); i++)
368 { 368 {
369 p.drawText( x+i*m_charWidth, y, QString(text[i]) ); 369 p.drawText( x+i*m_charWidth, y, QString(text[i]) );
370 } 370 }
371 } 371 }
372 else 372 else
373 { 373 {
374 p.drawText( x, y, text ); 374 p.drawText( x, y, text );
375 } 375 }
376} 376}
377 377
@@ -392,12 +392,12 @@ void QTReader::setfont(QPainter* p)
392 if (p != NULL) p->setFont( font ); 392 if (p != NULL) p->setFont( font );
393 if (m_fm == NULL) 393 if (m_fm == NULL)
394 { 394 {
395 m_fm = new QFontMetrics(font); 395 m_fm = new QFontMetrics(font);
396 buffdoc.setfm(m_fm); 396 buffdoc.setfm(m_fm);
397 } 397 }
398 else 398 else
399 { 399 {
400 *m_fm = QFontMetrics(font); 400 *m_fm = QFontMetrics(font);
401 } 401 }
402 m_ascent = m_fm->ascent(); 402 m_ascent = m_fm->ascent();
403 m_descent = m_fm->descent(); 403 m_descent = m_fm->descent();
@@ -417,68 +417,68 @@ void QTReader::drawFonts( QPainter *p )
417 int sl = screenlines(); 417 int sl = screenlines();
418 if (sl < numlines) 418 if (sl < numlines)
419 { 419 {
420 //qDebug("df:<%u,%u>",sl,numlines); 420// qDebug("df:<%u,%u>",sl,numlines);
421 421
422 size_t newpos = locnarray[sl]; 422 size_t newpos = locnarray[sl];
423 CBuffer** nta = new CBuffer*[sl]; 423 CBuffer** nta = new CBuffer*[sl];
424 size_t* nla = new size_t[sl]; 424 size_t* nla = new size_t[sl];
425 for (int i = 0; i < sl; i++) 425 for (int i = 0; i < sl; i++)
426 { 426 {
427 nta[i] = textarray[i]; 427 nta[i] = textarray[i];
428 nla[i] = locnarray[i]; 428 nla[i] = locnarray[i];
429 } 429 }
430 for (int i = sl; i < numlines; i++) delete textarray[i]; 430 for (int i = sl; i < numlines; i++) delete textarray[i];
431 delete [] textarray; 431 delete [] textarray;
432 delete [] locnarray; 432 delete [] locnarray;
433 textarray = nta; 433 textarray = nta;
434 locnarray = nla; 434 locnarray = nla;
435 numlines = sl; 435 numlines = sl;
436 jumpto(mylastpos = newpos); 436 jumpto(mylastpos = newpos);
437 //locate(pagepos); 437// locate(pagepos);
438 } 438 }
439 if (sl > numlines) 439 if (sl > numlines)
440 { 440 {
441 //qDebug("df:<%u,%u>",sl,numlines); 441// qDebug("df:<%u,%u>",sl,numlines);
442 CBuffer** nta = new CBuffer*[sl]; 442 CBuffer** nta = new CBuffer*[sl];
443 size_t* nla = new size_t[sl]; 443 size_t* nla = new size_t[sl];
444 for (int i = 0; i < numlines; i++) 444 for (int i = 0; i < numlines; i++)
445 { 445 {
446 nta[i] = textarray[i]; 446 nta[i] = textarray[i];
447 nla[i] = locnarray[i]; 447 nla[i] = locnarray[i];
448 } 448 }
449 if (locate() != mylastpos) jumpto(mylastpos); 449 if (locate() != mylastpos) jumpto(mylastpos);
450 for (int i = numlines; i < sl; i++) 450 for (int i = numlines; i < sl; i++)
451 { 451 {
452 nta[i] = new CBuffer; 452 nta[i] = new CBuffer;
453 nla[i] = locate(); 453 nla[i] = locate();
454 getline(nta[i]); 454 getline(nta[i]);
455 } 455 }
456 mylastpos = locate(); 456 mylastpos = locate();
457 delete [] textarray; 457 delete [] textarray;
458 delete [] locnarray; 458 delete [] locnarray;
459 textarray = nta; 459 textarray = nta;
460 locnarray = nla; 460 locnarray = nla;
461 numlines = sl; 461 numlines = sl;
462 } 462 }
463 int ypos = (btight) ? 0 : m_ascent-m_linespacing; 463 int ypos = (btight) ? 0 : m_ascent-m_linespacing;
464 // int linespacing = (tight) ? m_ascent : m_ascent+m_descent; 464 // int linespacing = (tight) ? m_ascent : m_ascent+m_descent;
465 for (int i = 0; i < numlines; i++) 465 for (int i = 0; i < numlines; i++)
466 { 466 {
467 drawText( *p, 0, ypos += m_linespacing, textarray[i]->data()); 467 drawText( *p, 0, ypos += m_linespacing, textarray[i]->data());
468 } 468 }
469 /* 469 /*
470 470
471 471
472 472
473 int nlines = height()/(fontmetric.ascent()+fontmetric.descent()); 473 int nlines = height()/(fontmetric.ascent()+fontmetric.descent());
474 tchar buffer[1024]; 474 tchar buffer[1024];
475 for (int i = 0; i < nlines; i++) 475 for (int i = 0; i < nlines; i++)
476 { 476 {
477 y += fontmetric.ascent(); 477 y += fontmetric.ascent();
478 sprintf(buffer, "%d:%d:%s[%d]:Lines %d:%s", i+1, m_textfont, fonts[m_textfont], m_fs, nlines, (const tchar*)m_string); 478 sprintf(buffer, "%d:%d:%s[%d]:Lines %d:%s", i+1, m_textfont, fonts[m_textfont], m_fs, nlines, (const tchar*)m_string);
479 drawText( *p, 0, y, buffer ); 479 drawText( *p, 0, y, buffer );
480 y += fontmetric.descent(); 480 y += fontmetric.descent();
481 } 481 }
482 */ 482 */
483 } 483 }
484 m_scrolldy = 0; 484 m_scrolldy = 0;
@@ -488,27 +488,27 @@ QString QTReader::firstword()
488{ 488{
489 if (m_bMonoSpaced) 489 if (m_bMonoSpaced)
490 { 490 {
491 return toQString(textarray[0]->data()); 491 return toQString(textarray[0]->data());
492 } 492 }
493 else 493 else
494 { 494 {
495 int start, end, len, j; 495 int start, end, len, j;
496 for (j = 0; j < numlines; j++) 496 for (j = 0; j < numlines; j++)
497 { 497 {
498 len = textarray[j]->length(); 498 len = textarray[j]->length();
499 for (start = 0; start < len && !isalpha((*textarray[j])[start]); start++); 499 for (start = 0; start < len && !isalpha((*textarray[j])[start]); start++);
500 if (start < len) break; 500 if (start < len) break;
501 } 501 }
502 if (j < numlines) 502 if (j < numlines)
503 { 503 {
504 QString ret = ""; 504 QString ret = "";
505 for (end = start; end < len && isalpha((*textarray[j])[end]); end++) 505 for (end = start; end < len && isalpha((*textarray[j])[end]); end++)
506 ret += (*textarray[j])[end]; 506 ret += (*textarray[j])[end];
507 if (ret.isEmpty()) ret = "Current position"; 507 if (ret.isEmpty()) ret = "Current position";
508 return ret; 508 return ret;
509 } 509 }
510 else 510 else
511 return "Current position"; 511 return "Current position";
512 } 512 }
513} 513}
514 514
@@ -527,7 +527,7 @@ void QTReader::ChangeFont(int tgt)
527 QStringList styles = fdb.styles(m_fontname); 527 QStringList styles = fdb.styles(m_fontname);
528 for ( QStringList::Iterator it = styles.begin(); it != styles.end(); ++it ) 528 for ( QStringList::Iterator it = styles.begin(); it != styles.end(); ++it )
529 { 529 {
530 printf( "%s \n", (*it).latin1() ); 530 printf( "%s \n", (*it).latin1() );
531 } 531 }
532*/ 532*/
533 QValueList<int> sizes = fdb.pointSizes(m_fontname, (m_bBold) ? QString("Bold") : QString::null); 533 QValueList<int> sizes = fdb.pointSizes(m_fontname, (m_bBold) ? QString("Bold") : QString::null);
@@ -538,12 +538,12 @@ void QTReader::ChangeFont(int tgt)
538 uint best = 0; 538 uint best = 0;
539 for (it = sizes.begin(); it != sizes.end(); it++) 539 for (it = sizes.begin(); it != sizes.end(); it++)
540 { 540 {
541 fontsizes[i] = (*it)/10; 541 fontsizes[i] = (*it)/10;
542 if (abs(tgt-fontsizes[i]) < abs(tgt-fontsizes[best])) 542 if (abs(tgt-fontsizes[i]) < abs(tgt-fontsizes[best]))
543 { 543 {
544 best = i; 544 best = i;
545 } 545 }
546 i++; 546 i++;
547 } 547 }
548 m_textsize = best; 548 m_textsize = best;
549 fontsizes[i] = 0; 549 fontsizes[i] = 0;
@@ -551,8 +551,8 @@ void QTReader::ChangeFont(int tgt)
551 QFont font(m_fontname, fontsizes[m_textsize], (m_bBold) ? QFont::Bold : QFont::Normal ); 551 QFont font(m_fontname, fontsizes[m_textsize], (m_bBold) ? QFont::Bold : QFont::Normal );
552 if (m_fm == NULL) 552 if (m_fm == NULL)
553 { 553 {
554 m_fm = new QFontMetrics(font); 554 m_fm = new QFontMetrics(font);
555 buffdoc.setfm(m_fm); 555 buffdoc.setfm(m_fm);
556 } 556 }
557} 557}
558 558
@@ -574,8 +574,8 @@ void QTReader::init()
574 m_lastwidth = width(); 574 m_lastwidth = width();
575 if (!m_lastfile.isEmpty()) 575 if (!m_lastfile.isEmpty())
576 { 576 {
577 m_string = DocLnk(m_lastfile).name(); 577 m_string = DocLnk(m_lastfile).name();
578 load_file(m_lastfile); 578 load_file(m_lastfile);
579 } 579 }
580} 580}
581 581
@@ -682,11 +682,11 @@ bool QTReader::fillbuffer() {
682 if (delta != numlines) 682 if (delta != numlines)
683 { 683 {
684 if (textarray != NULL) 684 if (textarray != NULL)
685 { 685 {
686 for (int i = 0; i < numlines; i++) delete textarray[i]; 686 for (int i = 0; i < numlines; i++) delete textarray[i];
687 delete [] textarray; 687 delete [] textarray;
688 delete [] locnarray; 688 delete [] locnarray;
689 } 689 }
690 numlines = delta; 690 numlines = delta;
691 textarray = new CBuffer*[numlines]; 691 textarray = new CBuffer*[numlines];
692 locnarray = new size_t[numlines]; 692 locnarray = new size_t[numlines];
@@ -704,23 +704,23 @@ bool QTReader::fillbuffer() {
704 ch = getline(textarray[i]); 704 ch = getline(textarray[i]);
705 // if (ch == EOF) { 705 // if (ch == EOF) {
706 if (!ch) 706 if (!ch)
707 { 707 {
708 if (i == 0) 708 if (i == 0)
709 { 709 {
710 pagepos = oldpagepos; 710 locate(oldpagepos);
711 return false; 711 return false;
712 } 712 }
713 else 713 else
714 { 714 {
715 ret = true; 715 ret = true;
716 for (int j = i+1; j < delta; j++) 716 for (int j = i+1; j < delta; j++)
717 { 717 {
718 locnarray[j] = locnarray[j-1]; 718 locnarray[j] = locnarray[j-1];
719 (*(textarray[j]))[0] = '\0'; 719 (*(textarray[j]))[0] = '\0';
720 } 720 }
721 break; 721 break;
722 } 722 }
723 } 723 }
724 if (ch == '\012') ret = true; 724 if (ch == '\012') ret = true;
725 } 725 }
726 mylastpos = locate(); 726 mylastpos = locate();
@@ -733,16 +733,16 @@ void QTReader::dopagedn()
733{ 733{
734 if (m_overlap == 0) 734 if (m_overlap == 0)
735 { 735 {
736 if (locate() != mylastpos) jumpto(mylastpos); 736 if (locate() != mylastpos) jumpto(mylastpos);
737 } 737 }
738 else 738 else
739 { 739 {
740 if (m_overlap >= screenlines()) m_overlap = screenlines()/2; 740 if (m_overlap >= screenlines()) m_overlap = screenlines()/2;
741 jumpto(locnarray[screenlines()-m_overlap]); 741 jumpto(locnarray[screenlines()-m_overlap]);
742 } 742 }
743 if (fillbuffer()) 743 if (fillbuffer())
744 { 744 {
745 update(); 745 update();
746 } 746 }
747} 747}
748 748
@@ -761,38 +761,38 @@ void QTReader::dopageup()
761 if (delta % 2 != 0) delta++; 761 if (delta % 2 != 0) delta++;
762 if (target % 2 != 0) target++; 762 if (target % 2 != 0) target++;
763 do 763 do
764 { 764 {
765 delta <<= 1; 765 delta <<= 1;
766 if (delta >= target) 766 if (delta >= target)
767 { 767 {
768 delta = target; 768 delta = target;
769 jumpto(0); 769 jumpto(0);
770 for (int i = 0; i < numlines; i++) 770 for (int i = 0; i < numlines; i++)
771 { 771 {
772 loc[i] = locate(); 772 loc[i] = locate();
773 getline(buff[i]); 773 getline(buff[i]);
774 } 774 }
775 break; 775 break;
776 } 776 }
777 jumpto(target-delta); 777 jumpto(target-delta);
778 do 778 do
779 { 779 {
780 getline(buff[0]); 780 getline(buff[0]);
781#ifdef WS 781#ifdef WS
782 //printf("Trying:%s\n",buff[0]); 782 //printf("Trying:%s\n",buff[0]);
783#endif 783#endif
784 if (locate() > target) continue; 784 if (locate() > target) continue;
785 } 785 }
786 while (!buffdoc.iseol()); 786 while (!buffdoc.iseol());
787 for (int i = 0; i < numlines; i++) 787 for (int i = 0; i < numlines; i++)
788 { 788 {
789 loc[i] = locate(); 789 loc[i] = locate();
790 getline(buff[i]); 790 getline(buff[i]);
791#ifdef WS 791#ifdef WS
792 //printf("Filling:%s\n",buff[i]); 792 //printf("Filling:%s\n",buff[i]);
793#endif 793#endif
794 } 794 }
795 } 795 }
796 while (locate() >= target && delta < 4096); 796 while (locate() >= target && delta < 4096);
797#ifdef WS 797#ifdef WS
798 //printf("Delta:%u\n",delta); 798 //printf("Delta:%u\n",delta);
@@ -802,10 +802,10 @@ void QTReader::dopageup()
802 { 802 {
803 jumpto(0); 803 jumpto(0);
804 for (int i = 0; i < numlines; i++) 804 for (int i = 0; i < numlines; i++)
805 { 805 {
806 loc[i] = locate(); 806 loc[i] = locate();
807 getline(buff[i]); 807 getline(buff[i]);
808 } 808 }
809 } 809 }
810 cbptr = 0; 810 cbptr = 0;
811 while (locate() < target) 811 while (locate() < target)
@@ -862,18 +862,18 @@ void QTReader::lineDown()
862 CBuffer* buff = textarray[0]; 862 CBuffer* buff = textarray[0];
863 for (int i = 1; i < numlines; i++) 863 for (int i = 1; i < numlines; i++)
864 { 864 {
865 textarray[i-1] = textarray[i]; 865 textarray[i-1] = textarray[i];
866 locnarray[i-1] = locnarray[i]; 866 locnarray[i-1] = locnarray[i];
867 } 867 }
868 locnarray[numlines-1] = locate(); 868 locnarray[numlines-1] = locate();
869 if (getline(buff)) 869 if (getline(buff))
870 { 870 {
871 textarray[numlines-1] = buff; 871 textarray[numlines-1] = buff;
872 mylastpos = locate(); 872 mylastpos = locate();
873 } 873 }
874 else 874 else
875 { 875 {
876 textarray[numlines-1] = buff; 876 textarray[numlines-1] = buff;
877 } 877 }
878 update(); 878 update();
879} 879}
@@ -890,38 +890,38 @@ void QTReader::lineUp()
890 unsigned int delta = locate()-pagelocate(); 890 unsigned int delta = locate()-pagelocate();
891 if (delta < 64) delta = 64; 891 if (delta < 64) delta = 64;
892 do 892 do
893 { 893 {
894 delta <<= 1; 894 delta <<= 1;
895 if (delta >= target) 895 if (delta >= target)
896 { 896 {
897 delta = target; 897 delta = target;
898 jumpto(0); 898 jumpto(0);
899 for (int i = 0; i < numlines; i++) 899 for (int i = 0; i < numlines; i++)
900 { 900 {
901 loc[i] = locate(); 901 loc[i] = locate();
902 getline(buff[i]); 902 getline(buff[i]);
903 } 903 }
904 break; 904 break;
905 } 905 }
906 jumpto(target-delta); 906 jumpto(target-delta);
907 do 907 do
908 { 908 {
909 buffdoc.getline(buff[0],width()); 909 buffdoc.getline(buff[0],width());
910#ifdef WS 910#ifdef WS
911 //printf("Trying:%s\n",buff[0]); 911 //printf("Trying:%s\n",buff[0]);
912#endif 912#endif
913 if (locate() > target) continue; 913 if (locate() > target) continue;
914 } 914 }
915 while (!buffdoc.iseol()); 915 while (!buffdoc.iseol());
916 for (int i = 0; i < numlines; i++) 916 for (int i = 0; i < numlines; i++)
917 { 917 {
918 loc[i] = locate(); 918 loc[i] = locate();
919 buffdoc.getline(buff[i],width()); 919 buffdoc.getline(buff[i],width());
920#ifdef WS 920#ifdef WS
921 //printf("Filling:%s\n",buff[i]); 921 //printf("Filling:%s\n",buff[i]);
922#endif 922#endif
923 } 923 }
924 } 924 }
925 while (locate() >= target && delta < 4096); 925 while (locate() >= target && delta < 4096);
926#ifdef WS 926#ifdef WS
927 //printf("Delta:%u\n",delta); 927 //printf("Delta:%u\n",delta);
@@ -931,10 +931,10 @@ void QTReader::lineUp()
931 { 931 {
932 jumpto(0); 932 jumpto(0);
933 for (int i = 0; i < numlines; i++) 933 for (int i = 0; i < numlines; i++)
934 { 934 {
935 loc[i] = locate(); 935 loc[i] = locate();
936 buffdoc.getline(buff[i],width()); 936 buffdoc.getline(buff[i],width());
937 } 937 }
938 } 938 }
939 cbptr = 0; 939 cbptr = 0;
940 while (locate() < target) 940 while (locate() < target)
@@ -973,32 +973,32 @@ void QTReader::lineUp()
973 unsigned int delta = locate()-pagelocate(); 973 unsigned int delta = locate()-pagelocate();
974 if (delta < 64) delta = 64; 974 if (delta < 64) delta = 64;
975 do 975 do
976 { 976 {
977 delta <<= 1; 977 delta <<= 1;
978 if (delta >= target) 978 if (delta >= target)
979 { 979 {
980 delta = target; 980 delta = target;
981 jumpto(0); 981 jumpto(0);
982 for (int i = 0; i < numlines; i++) 982 for (int i = 0; i < numlines; i++)
983 { 983 {
984 loc = locate(); 984 loc = locate();
985 getline(buff); 985 getline(buff);
986 } 986 }
987 break; 987 break;
988 } 988 }
989 jumpto(target-delta); 989 jumpto(target-delta);
990 do 990 do
991 { 991 {
992 getline(buff); 992 getline(buff);
993#ifdef WS 993#ifdef WS
994 //printf("Trying:%s\n",buff[0]); 994 //printf("Trying:%s\n",buff[0]);
995#endif 995#endif
996 if (locate() > target) continue; 996 if (locate() > target) continue;
997 } 997 }
998 while (!buffdoc.iseol()); 998 while (!buffdoc.iseol());
999 loc = locate(); 999 loc = locate();
1000 getline(buff); 1000 getline(buff);
1001 } 1001 }
1002 while (locate() >= target && delta < 4096); 1002 while (locate() >= target && delta < 4096);
1003 } 1003 }
1004 else 1004 else
diff --git a/noncore/apps/opie-reader/opie-reader.control b/noncore/apps/opie-reader/opie-reader.control
index e8c98bb..1c28648 100644
--- a/noncore/apps/opie-reader/opie-reader.control
+++ b/noncore/apps/opie-reader/opie-reader.control
@@ -3,7 +3,7 @@ Priority: optional
3Section: applications 3Section: applications
4Maintainer: Tim Wentford <timwentford@hotmail.com> 4Maintainer: Tim Wentford <timwentford@hotmail.com>
5Architecture: arm 5Architecture: arm
6Version: 0_3r_beta_UTF8 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: 7Depends: zlib
8License: GPL 8License: GPL
9Description: E-Book reader 9Description: E-Book reader