Diffstat (limited to 'noncore/apps/opie-reader/QTReader.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReader.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp index d64abb4..b356ba5 100644 --- a/noncore/apps/opie-reader/QTReader.cpp +++ b/noncore/apps/opie-reader/QTReader.cpp | |||
@@ -71,49 +71,49 @@ QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *nam | |||
71 | m_textsize(1), | 71 | m_textsize(1), |
72 | textarray(NULL), | 72 | textarray(NULL), |
73 | numlines(0), | 73 | numlines(0), |
74 | bstripcr(true), | 74 | bstripcr(true), |
75 | bunindent(false), | 75 | bunindent(false), |
76 | brepara(false), | 76 | brepara(false), |
77 | bdblspce(false), | 77 | bdblspce(false), |
78 | btight(false), | 78 | btight(false), |
79 | bindenter(0), | 79 | bindenter(0), |
80 | m_fm(NULL) | 80 | m_fm(NULL) |
81 | { | 81 | { |
82 | init(); | 82 | init(); |
83 | // // qDebug("Load_file(1)"); | 83 | // // odebug << "Load_file(1)" << oendl; |
84 | load_file((const tchar*)filename); | 84 | load_file((const tchar*)filename); |
85 | } | 85 | } |
86 | */ | 86 | */ |
87 | 87 | ||
88 | /* | 88 | /* |
89 | void QTReader::mouseMoveEvent(QMouseEvent* _e) | 89 | void QTReader::mouseMoveEvent(QMouseEvent* _e) |
90 | { | 90 | { |
91 | 91 | ||
92 | mouseUpOn = !(_e->pos().x() == -1); | 92 | mouseUpOn = !(_e->pos().x() == -1); |
93 | 93 | ||
94 | qDebug("MouseMove:[%d, %d]", _e->pos().x(), _e->pos().y()); | 94 | odebug << "MouseMove:[" << _e->pos().x() << ", " << _e->pos().y() << "]" << oendl; |
95 | } | 95 | } |
96 | */ | 96 | */ |
97 | long QTReader::real_delay() | 97 | long QTReader::real_delay() |
98 | { | 98 | { |
99 | return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing ); | 99 | return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing ); |
100 | } | 100 | } |
101 | 101 | ||
102 | void QTReader::mousePressEvent( QMouseEvent* _e ) | 102 | void QTReader::mousePressEvent( QMouseEvent* _e ) |
103 | { | 103 | { |
104 | buffdoc.unsuspend(); | 104 | buffdoc.unsuspend(); |
105 | if (_e->button() == RightButton) | 105 | if (_e->button() == RightButton) |
106 | { | 106 | { |
107 | //qDebug("MousePress"); | 107 | //odebug << "MousePress" << oendl; |
108 | mouseUpOn = false; | 108 | mouseUpOn = false; |
109 | if (m_swapmouse) | 109 | if (m_swapmouse) |
110 | { | 110 | { |
111 | int lineno = 0; | 111 | int lineno = 0; |
112 | int ht = textarray[0]->lineSpacing(); | 112 | int ht = textarray[0]->lineSpacing(); |
113 | while ((ht < _e->y()) && (lineno < numlines)) | 113 | while ((ht < _e->y()) && (lineno < numlines)) |
114 | { | 114 | { |
115 | ht += textarray[++lineno]->lineSpacing(); | 115 | ht += textarray[++lineno]->lineSpacing(); |
116 | } | 116 | } |
117 | size_t startpos, startoffset, tgt; | 117 | size_t startpos, startoffset, tgt; |
118 | getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt); | 118 | getcurrentpos(_e->x(), _e->y(), startpos, startoffset, tgt); |
119 | processmousewordevent(startpos, startoffset, _e, lineno); | 119 | processmousewordevent(startpos, startoffset, _e, lineno); |
@@ -308,47 +308,47 @@ void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouse | |||
308 | else | 308 | else |
309 | { | 309 | { |
310 | CDrawBuffer* t = textarray[lineno]; | 310 | CDrawBuffer* t = textarray[lineno]; |
311 | int first = 0; | 311 | int first = 0; |
312 | int tgt = _e->x() - t->offset(width(), m_border); | 312 | int tgt = _e->x() - t->offset(width(), m_border); |
313 | while (1) | 313 | while (1) |
314 | { | 314 | { |
315 | int i = first+1; | 315 | int i = first+1; |
316 | while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; | 316 | while (QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; |
317 | if (t->width(i, true, width(), m_border) > tgt) | 317 | if (t->width(i, true, width(), m_border) > tgt) |
318 | { | 318 | { |
319 | wrd = toQString(t->data()+first, i - first); | 319 | wrd = toQString(t->data()+first, i - first); |
320 | // qDebug("Got %s", (const char *)wrd); | 320 | // odebug << "Got " << (const char *)wrd << "" << oendl; |
321 | break; | 321 | break; |
322 | } | 322 | } |
323 | while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; | 323 | while (!QChar((*t)[i]).isLetter() && (*t)[i] != 0) i++; |
324 | if ((*t)[i] == 0) break; | 324 | if ((*t)[i] == 0) break; |
325 | first = i; | 325 | first = i; |
326 | } | 326 | } |
327 | } | 327 | } |
328 | if (!wrd.isEmpty()) | 328 | if (!wrd.isEmpty()) |
329 | { | 329 | { |
330 | //qDebug("Selected:%s", (const char*)wrd); | 330 | //odebug << "Selected:" << wrd << "" << oendl; |
331 | emit OnWordSelected(wrd, locnarray[lineno], (m_twotouch) ? wrd : toQString(textarray[lineno]->data())); | 331 | emit OnWordSelected(wrd, locnarray[lineno], (m_twotouch) ? wrd : toQString(textarray[lineno]->data())); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | void QTReader::mouseReleaseEvent( QMouseEvent* _e ) | 335 | void QTReader::mouseReleaseEvent( QMouseEvent* _e ) |
336 | { | 336 | { |
337 | buffdoc.unsuspend(); | 337 | buffdoc.unsuspend(); |
338 | if (_e->button() == LeftButton) | 338 | if (_e->button() == LeftButton) |
339 | { | 339 | { |
340 | if (mouseUpOn) | 340 | if (mouseUpOn) |
341 | { | 341 | { |
342 | // qDebug("MouseRelease"); | 342 | // odebug << "MouseRelease" << oendl; |
343 | if (_e->x() > width() - m_border) | 343 | if (_e->x() > width() - m_border) |
344 | { | 344 | { |
345 | locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*_e->y()+height()/2)/height()); | 345 | locate(buffdoc.startSection()+((buffdoc.endSection()-buffdoc.startSection())*_e->y()+height()/2)/height()); |
346 | return; | 346 | return; |
347 | } | 347 | } |
348 | if (textarray[0] != NULL) | 348 | if (textarray[0] != NULL) |
349 | { | 349 | { |
350 | QString line; | 350 | QString line; |
351 | // int lineno = _e->y()/m_linespacing; | 351 | // int lineno = _e->y()/m_linespacing; |
352 | int lineno = 0; | 352 | int lineno = 0; |
353 | int ht = textarray[0]->lineSpacing(); | 353 | int ht = textarray[0]->lineSpacing(); |
354 | while ((ht < _e->y()) && (lineno < numlines)) | 354 | while ((ht < _e->y()) && (lineno < numlines)) |
@@ -385,41 +385,41 @@ void QTReader::mouseReleaseEvent( QMouseEvent* _e ) | |||
385 | // QString anchortext = textarray[lineno]->getanchortext(startoffset); | 385 | // QString anchortext = textarray[lineno]->getanchortext(startoffset); |
386 | if (!href.isEmpty()) | 386 | if (!href.isEmpty()) |
387 | { | 387 | { |
388 | emit OnURLSelected(href); | 388 | emit OnURLSelected(href); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | locate(pagelocate()); | 391 | locate(pagelocate()); |
392 | } | 392 | } |
393 | return; | 393 | return; |
394 | } | 394 | } |
395 | case ePicture: | 395 | case ePicture: |
396 | { | 396 | { |
397 | // qDebug("Picture:%x", tgt); | 397 | // odebug << "Picture:" << tgt << "" << oendl; |
398 | QImage* pm = buffdoc.getPicture(tgt); | 398 | QImage* pm = buffdoc.getPicture(tgt); |
399 | if (pm != NULL) | 399 | if (pm != NULL) |
400 | { | 400 | { |
401 | emit OnShowPicture(*pm); | 401 | emit OnShowPicture(*pm); |
402 | delete pm; | 402 | delete pm; |
403 | } | 403 | } |
404 | else | 404 | else |
405 | { | 405 | { |
406 | locate(pagelocate()); | 406 | locate(pagelocate()); |
407 | } | 407 | } |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | case eNone: | 410 | case eNone: |
411 | break; | 411 | break; |
412 | default: | 412 | default: |
413 | // qDebug("Unknown linktype"); | 413 | // odebug << "Unknown linktype" << oendl; |
414 | return; | 414 | return; |
415 | } | 415 | } |
416 | if (m_swapmouse) | 416 | if (m_swapmouse) |
417 | processmousepositionevent(_e); | 417 | processmousepositionevent(_e); |
418 | else | 418 | else |
419 | processmousewordevent(startpos, startoffset, _e, lineno); | 419 | processmousewordevent(startpos, startoffset, _e, lineno); |
420 | } | 420 | } |
421 | } | 421 | } |
422 | else | 422 | else |
423 | { | 423 | { |
424 | mouseUpOn = true; | 424 | mouseUpOn = true; |
425 | } | 425 | } |
@@ -687,25 +687,25 @@ void QTReader::setautoscroll(bool _sc) | |||
687 | m_pipeout = NULL; | 687 | m_pipeout = NULL; |
688 | } | 688 | } |
689 | #endif | 689 | #endif |
690 | } | 690 | } |
691 | else | 691 | else |
692 | { | 692 | { |
693 | CDrawBuffer* reusebuffer = textarray[numlines]; | 693 | CDrawBuffer* reusebuffer = textarray[numlines]; |
694 | if (reusebuffer == NULL || reusebuffer->eof()) return; | 694 | if (reusebuffer == NULL || reusebuffer->eof()) return; |
695 | m_autoScroll = true; | 695 | m_autoScroll = true; |
696 | #ifdef _SCROLLPIPE | 696 | #ifdef _SCROLLPIPE |
697 | if (!m_pipetarget.isEmpty()) | 697 | if (!m_pipetarget.isEmpty()) |
698 | { | 698 | { |
699 | // qDebug("Opening pipe to %s", (const char*)m_pipetarget); | 699 | // odebug << "Opening pipe to " << m_pipetarget << "" << oendl; |
700 | m_pipeout = popen((const char*)m_pipetarget, "w"); | 700 | m_pipeout = popen((const char*)m_pipetarget, "w"); |
701 | m_isPaused = false; | 701 | m_isPaused = false; |
702 | } | 702 | } |
703 | #endif | 703 | #endif |
704 | autoscroll(); | 704 | autoscroll(); |
705 | #ifdef USEQPE | 705 | #ifdef USEQPE |
706 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; // light is even not dimmed | 706 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; // light is even not dimmed |
707 | #endif | 707 | #endif |
708 | } | 708 | } |
709 | } | 709 | } |
710 | 710 | ||
711 | bool QTReader::getline(CDrawBuffer *buff) | 711 | bool QTReader::getline(CDrawBuffer *buff) |
@@ -814,65 +814,65 @@ void QTReader::setfont() | |||
814 | // m_fontControl.Change | 814 | // m_fontControl.Change |
815 | m_charWidth = (m_charpc*m_fontControl.currentsize())/100; | 815 | m_charWidth = (m_charpc*m_fontControl.currentsize())/100; |
816 | if (m_charWidth <= 0) m_charWidth = 1; | 816 | if (m_charWidth <= 0) m_charWidth = 1; |
817 | m_ascent = m_fontControl.ascent(); | 817 | m_ascent = m_fontControl.ascent(); |
818 | m_descent = m_fontControl.descent(); | 818 | m_descent = m_fontControl.descent(); |
819 | m_linespacing = m_fontControl.lineSpacing(); | 819 | m_linespacing = m_fontControl.lineSpacing(); |
820 | } | 820 | } |
821 | 821 | ||
822 | void QTReader::drawFonts( QPainter *p ) | 822 | void QTReader::drawFonts( QPainter *p ) |
823 | { | 823 | { |
824 | if (bDoUpdates) | 824 | if (bDoUpdates) |
825 | { | 825 | { |
826 | //qDebug("How refreshing..."); | 826 | //odebug << "How refreshing..." << oendl; |
827 | if (buffdoc.empty()) return; | 827 | if (buffdoc.empty()) return; |
828 | setfont(); | 828 | setfont(); |
829 | if (m_lastwidth != width()) | 829 | if (m_lastwidth != width()) |
830 | { | 830 | { |
831 | // qDebug("Not Optimised %d", m_lastwidth); | 831 | // odebug << "Not Optimised " << m_lastwidth << "" << oendl; |
832 | m_lastwidth = width(); | 832 | m_lastwidth = width(); |
833 | m_lastheight = height(); | 833 | m_lastheight = height(); |
834 | buffdoc.setwidth(m_lastwidth-2*m_border); | 834 | buffdoc.setwidth(m_lastwidth-2*m_border); |
835 | locate(pagelocate()); | 835 | locate(pagelocate()); |
836 | // qDebug("Not Optimised %d", m_lastwidth); | 836 | // odebug << "Not Optimised " << m_lastwidth << "" << oendl; |
837 | } | 837 | } |
838 | else | 838 | else |
839 | { | 839 | { |
840 | int newht = height(); | 840 | int newht = height(); |
841 | if (m_lastheight > newht) | 841 | if (m_lastheight > newht) |
842 | { | 842 | { |
843 | // qDebug("Optimised < %d %d %d", numlines, m_lastheight, newht); | 843 | // odebug << "Optimised < " << numlines << " " << m_lastheight << " " << newht << "" << oendl; |
844 | int ypos = 0; | 844 | int ypos = 0; |
845 | for (int i = 0; i < numlines; i++) | 845 | for (int i = 0; i < numlines; i++) |
846 | { | 846 | { |
847 | if ((ypos += textarray[i]->lineSpacing()) > newht) | 847 | if ((ypos += textarray[i]->lineSpacing()) > newht) |
848 | { | 848 | { |
849 | numlines = i; | 849 | numlines = i; |
850 | jumpto(mylastpos = locnarray[i+1]); | 850 | jumpto(mylastpos = locnarray[i+1]); |
851 | break; | 851 | break; |
852 | } | 852 | } |
853 | } | 853 | } |
854 | // qDebug("Optimised < %d", numlines); | 854 | // odebug << "Optimised < " << numlines << "" << oendl; |
855 | m_lastheight = newht; | 855 | m_lastheight = newht; |
856 | } | 856 | } |
857 | else if (m_lastheight < newht) | 857 | else if (m_lastheight < newht) |
858 | { | 858 | { |
859 | // qDebug("Optimised > %d", numlines); | 859 | // odebug << "Optimised > " << numlines << "" << oendl; |
860 | int ypos = 0; | 860 | int ypos = 0; |
861 | for (int i = 0; i <= numlines; i++) | 861 | for (int i = 0; i <= numlines; i++) |
862 | { | 862 | { |
863 | ypos += textarray[i]->lineSpacing(); | 863 | ypos += textarray[i]->lineSpacing(); |
864 | } | 864 | } |
865 | fillbuffer(numlines+1, ypos, newht); | 865 | fillbuffer(numlines+1, ypos, newht); |
866 | // qDebug("Optimised > %d", numlines); | 866 | // odebug << "Optimised > " << numlines << "" << oendl; |
867 | } | 867 | } |
868 | if (numlines > 0) | 868 | if (numlines > 0) |
869 | { | 869 | { |
870 | int ypos = textarray[0]->ascent(); | 870 | int ypos = textarray[0]->ascent(); |
871 | textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border); | 871 | textarray[0]->render( p, ypos, m_bMonoSpaced, m_charWidth, width(), m_border); |
872 | // int last = (m_showlast) ? numlines : numlines-1; | 872 | // int last = (m_showlast) ? numlines : numlines-1; |
873 | // for (int i = 1; i <= last; i++) | 873 | // for (int i = 1; i <= last; i++) |
874 | for (int i = 1; i < numlines; i++) | 874 | for (int i = 1; i < numlines; i++) |
875 | { | 875 | { |
876 | // ypos += (textarray[i-1]->lineSpacing() + textarray[i]->lineSpacing())/2; | 876 | // ypos += (textarray[i-1]->lineSpacing() + textarray[i]->lineSpacing())/2; |
877 | ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ | 877 | ypos += (textarray[i-1]->descent() + textarray[i]->ascent())+ |
878 | (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; | 878 | (textarray[i-1]->lineExtraSpacing() + textarray[i]->lineExtraSpacing())/2; |
@@ -888,25 +888,25 @@ void QTReader::drawFonts( QPainter *p ) | |||
888 | p->fillRect(width()-2, 0, 2, height(), cyan); | 888 | p->fillRect(width()-2, 0, 2, height(), cyan); |
889 | int sectionsize = (buffdoc.endSection()-buffdoc.startSection()); | 889 | int sectionsize = (buffdoc.endSection()-buffdoc.startSection()); |
890 | int mid = (height()*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize); | 890 | int mid = (height()*(locnarray[numlines]+locnarray[0]-2*buffdoc.startSection())+sectionsize)/(2*sectionsize); |
891 | p->fillRect(width()-2, mid-5, 2, 10, yellow); | 891 | p->fillRect(width()-2, mid-5, 2, 10, yellow); |
892 | p->fillRect(width()-2, (height()*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize, 2, ((locnarray[numlines]-locnarray[0])*height()+sectionsize/2)/sectionsize, magenta); | 892 | p->fillRect(width()-2, (height()*(locnarray[0]-buffdoc.startSection())+sectionsize/2)/sectionsize, 2, ((locnarray[numlines]-locnarray[0])*height()+sectionsize/2)/sectionsize, magenta); |
893 | } | 893 | } |
894 | 894 | ||
895 | emit OnRedraw(); | 895 | emit OnRedraw(); |
896 | } | 896 | } |
897 | /* | 897 | /* |
898 | else | 898 | else |
899 | { | 899 | { |
900 | qDebug("Not so refreshing..."); | 900 | odebug << "Not so refreshing..." << oendl; |
901 | } | 901 | } |
902 | */ | 902 | */ |
903 | } | 903 | } |
904 | 904 | ||
905 | QString QTReader::firstword() | 905 | QString QTReader::firstword() |
906 | { | 906 | { |
907 | if (m_bMonoSpaced) | 907 | if (m_bMonoSpaced) |
908 | { | 908 | { |
909 | return toQString(textarray[0]->data()); | 909 | return toQString(textarray[0]->data()); |
910 | } | 910 | } |
911 | else | 911 | else |
912 | { | 912 | { |
@@ -1019,54 +1019,54 @@ void QTReader::paintEvent( QPaintEvent * ) | |||
1019 | QPainter paint( this ); | 1019 | QPainter paint( this ); |
1020 | drawIt( &paint ); | 1020 | drawIt( &paint ); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | // | 1023 | // |
1024 | // Called when the widget has been resized. | 1024 | // Called when the widget has been resized. |
1025 | // Moves the button group to the upper right corner | 1025 | // Moves the button group to the upper right corner |
1026 | // of the widget. | 1026 | // of the widget. |
1027 | 1027 | ||
1028 | /* | 1028 | /* |
1029 | void QTReader::resizeEvent( QResizeEvent * ) | 1029 | void QTReader::resizeEvent( QResizeEvent * ) |
1030 | { | 1030 | { |
1031 | // // qDebug("resize:(%u,%u)", width(), height()); | 1031 | // // odebug << "resize:(" << width() << "," << height() << ")" << oendl; |
1032 | // bgroup->move( width()-bgroup->width(), 0 ); | 1032 | // bgroup->move( width()-bgroup->width(), 0 ); |
1033 | } | 1033 | } |
1034 | */ | 1034 | */ |
1035 | 1035 | ||
1036 | // | 1036 | // |
1037 | // Create and display our widget. | 1037 | // Create and display our widget. |
1038 | // | 1038 | // |
1039 | /* | 1039 | /* |
1040 | int main( int argc, tchar **argv ) | 1040 | int main( int argc, tchar **argv ) |
1041 | { | 1041 | { |
1042 | QApplication app( argc, argv ); | 1042 | QApplication app( argc, argv ); |
1043 | QTReader draw; | 1043 | QTReader draw; |
1044 | app.setMainWidget( &draw ); | 1044 | app.setMainWidget( &draw ); |
1045 | draw.setCaption("Qt Example - Drawdemo"); | 1045 | draw.setCaption("Qt Example - Drawdemo"); |
1046 | draw.show(); | 1046 | draw.show(); |
1047 | return app.exec(); | 1047 | return app.exec(); |
1048 | } | 1048 | } |
1049 | */ | 1049 | */ |
1050 | 1050 | ||
1051 | 1051 | ||
1052 | bool QTReader::locate(unsigned long n) { | 1052 | bool QTReader::locate(unsigned long n) { |
1053 | //printf("Locate\n"); | 1053 | //printf("Locate\n"); |
1054 | buffdoc.unsuspend(); | 1054 | buffdoc.unsuspend(); |
1055 | buffdoc.locate(n); | 1055 | buffdoc.locate(n); |
1056 | // // qDebug("&buffdoc.located"); | 1056 | // // odebug << "&buffdoc.located" << oendl; |
1057 | fillbuffer(); | 1057 | fillbuffer(); |
1058 | // // qDebug("&Buffer filled"); | 1058 | // // odebug << "&Buffer filled" << oendl; |
1059 | update(); | 1059 | update(); |
1060 | // // qDebug("&Located"); | 1060 | // // odebug << "&Located" << oendl; |
1061 | return true; | 1061 | return true; |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | unsigned int QTReader::screenlines() | 1064 | unsigned int QTReader::screenlines() |
1065 | { | 1065 | { |
1066 | // int linespacing = (tight) ? m_ascent : m_ascent+m_descent; | 1066 | // int linespacing = (tight) ? m_ascent : m_ascent+m_descent; |
1067 | // return (height()-m_descent)/(m_linespacing); | 1067 | // return (height()-m_descent)/(m_linespacing); |
1068 | return (height()-2)/(m_linespacing); | 1068 | return (height()-2)/(m_linespacing); |
1069 | }; | 1069 | }; |
1070 | 1070 | ||
1071 | bool QTReader::fillbuffer(int reuse, int ht, int newht) | 1071 | bool QTReader::fillbuffer(int reuse, int ht, int newht) |
1072 | { | 1072 | { |
@@ -1108,30 +1108,30 @@ bool QTReader::fillbuffer(int reuse, int ht, int newht) | |||
1108 | } | 1108 | } |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | --numlines; | 1111 | --numlines; |
1112 | mylastpos = locate(); | 1112 | mylastpos = locate(); |
1113 | m_scrolldy1 = m_scrolldy2 = m_scrollpart = m_lastheight - lastypos; | 1113 | m_scrolldy1 = m_scrolldy2 = m_scrollpart = m_lastheight - lastypos; |
1114 | 1114 | ||
1115 | return true; | 1115 | return true; |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | void QTReader::dopagedn() | 1118 | void QTReader::dopagedn() |
1119 | { | 1119 | { |
1120 | // qDebug("HEIGHT(2):%d", m_lastheight); | 1120 | // odebug << "HEIGHT(2):" << m_lastheight << "" << oendl; |
1121 | buffdoc.unsuspend(); | 1121 | buffdoc.unsuspend(); |
1122 | int skip = 0, ypos = 0; | 1122 | int skip = 0, ypos = 0; |
1123 | if (locate() != mylastpos) | 1123 | if (locate() != mylastpos) |
1124 | { | 1124 | { |
1125 | ////qDebug("Jumping to %u", mylastpos); | 1125 | ////odebug << "Jumping to " << mylastpos << "" << oendl; |
1126 | jumpto(mylastpos); | 1126 | jumpto(mylastpos); |
1127 | } | 1127 | } |
1128 | CDrawBuffer* reusebuffer = textarray[numlines]; | 1128 | CDrawBuffer* reusebuffer = textarray[numlines]; |
1129 | if (reusebuffer != NULL && reusebuffer->eof()) return; | 1129 | if (reusebuffer != NULL && reusebuffer->eof()) return; |
1130 | if (reusebuffer != NULL) | 1130 | if (reusebuffer != NULL) |
1131 | { | 1131 | { |
1132 | for (int i = 0; i <= m_overlap; i++) | 1132 | for (int i = 0; i <= m_overlap; i++) |
1133 | { | 1133 | { |
1134 | int offset = numlines - m_overlap + i; | 1134 | int offset = numlines - m_overlap + i; |
1135 | reusebuffer = textarray[offset]; | 1135 | reusebuffer = textarray[offset]; |
1136 | size_t reuselocn = locnarray[offset]; | 1136 | size_t reuselocn = locnarray[offset]; |
1137 | textarray[offset] = textarray[i]; | 1137 | textarray[offset] = textarray[i]; |
@@ -1304,31 +1304,31 @@ bool QTReader::load_file(const char *newfile, unsigned int _lcn) | |||
1304 | { | 1304 | { |
1305 | lcn = m_lastposn; | 1305 | lcn = m_lastposn; |
1306 | } | 1306 | } |
1307 | // QMessageBox::information(0, "Opening...", newfile); | 1307 | // QMessageBox::information(0, "Opening...", newfile); |
1308 | m_lastwidth = width(); | 1308 | m_lastwidth = width(); |
1309 | m_lastheight = height(); | 1309 | m_lastheight = height(); |
1310 | if (buffdoc.openfile(this,newfile) == 0) | 1310 | if (buffdoc.openfile(this,newfile) == 0) |
1311 | { | 1311 | { |
1312 | m_lastfile = newfile; | 1312 | m_lastfile = newfile; |
1313 | buffdoc.setwidth(m_lastwidth-2*m_border); | 1313 | buffdoc.setwidth(m_lastwidth-2*m_border); |
1314 | bRC = true; | 1314 | bRC = true; |
1315 | buffdoc.setContinuous(m_continuousDocument); | 1315 | buffdoc.setContinuous(m_continuousDocument); |
1316 | // // qDebug("buffdoc.openfile done"); | 1316 | // // odebug << "buffdoc.openfile done" << oendl; |
1317 | locate(lcn); | 1317 | locate(lcn); |
1318 | // // qDebug("buffdoc.locate done"); | 1318 | // // odebug << "buffdoc.locate done" << oendl; |
1319 | } | 1319 | } |
1320 | setfilter(getfilter()); | 1320 | setfilter(getfilter()); |
1321 | update(); | 1321 | update(); |
1322 | // // qDebug("Updated"); | 1322 | // // odebug << "Updated" << oendl; |
1323 | return bRC; | 1323 | return bRC; |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | void QTReader::lineDown() | 1326 | void QTReader::lineDown() |
1327 | { | 1327 | { |
1328 | int ypos = 0; | 1328 | int ypos = 0; |
1329 | int offset = numlines; | 1329 | int offset = numlines; |
1330 | 1330 | ||
1331 | for (int i = 0; i <= numlines; i++) | 1331 | for (int i = 0; i <= numlines; i++) |
1332 | { | 1332 | { |
1333 | if ((ypos += textarray[numlines-i]->lineSpacing()) > height()) | 1333 | if ((ypos += textarray[numlines-i]->lineSpacing()) > height()) |
1334 | { | 1334 | { |