-rw-r--r-- | noncore/apps/opie-reader/QTReader.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp index fc9cffb..6335ea2 100644 --- a/noncore/apps/opie-reader/QTReader.cpp +++ b/noncore/apps/opie-reader/QTReader.cpp | |||
@@ -484,384 +484,385 @@ void QTReader::drawFonts( QPainter *p ) | |||
484 | m_scrolldy = 0; | 484 | m_scrolldy = 0; |
485 | } | 485 | } |
486 | 486 | ||
487 | QString QTReader::firstword() | 487 | 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 | ||
515 | // | 515 | // |
516 | // Construct the QTReader with buttons. | 516 | // Construct the QTReader with buttons. |
517 | // | 517 | // |
518 | 518 | ||
519 | void QTReader::ChangeFont(int tgt) | 519 | void QTReader::ChangeFont(int tgt) |
520 | { | 520 | { |
521 | 521 | ||
522 | QValueList<int>::Iterator it; | 522 | QValueList<int>::Iterator it; |
523 | 523 | ||
524 | // QValueList<int> sizes = QFontDatabase::pointSizes(m_fontname, (m_bBold) ? QFont::Bold : QFont::Normal); | 524 | // QValueList<int> sizes = QFontDatabase::pointSizes(m_fontname, (m_bBold) ? QFont::Bold : QFont::Normal); |
525 | QFontDatabase fdb; | 525 | QFontDatabase fdb; |
526 | /* | 526 | /* |
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); |
534 | uint n = sizes.count(); | 534 | uint n = sizes.count(); |
535 | if (fontsizes != NULL) delete [] fontsizes; | 535 | if (fontsizes != NULL) delete [] fontsizes; |
536 | fontsizes = new unsigned int[n+1]; | 536 | fontsizes = new unsigned int[n+1]; |
537 | uint i = 0; | 537 | uint i = 0; |
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; |
550 | setfont(NULL); | 550 | setfont(NULL); |
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 | ||
559 | void QTReader::init() | 559 | void QTReader::init() |
560 | { | 560 | { |
561 | // setCaption( "Qt Draw Demo Application" ); | 561 | // setCaption( "Qt Draw Demo Application" ); |
562 | 562 | ||
563 | setBackgroundColor( white ); | 563 | setBackgroundColor( white ); |
564 | // QPainter p(this); | 564 | // QPainter p(this); |
565 | // p.setBackgroundMode( Qt::OpaqueMode ); | 565 | // p.setBackgroundMode( Qt::OpaqueMode ); |
566 | buffdoc.setfilter(getfilter()); | 566 | buffdoc.setfilter(getfilter()); |
567 | ChangeFont(m_textsize); | 567 | ChangeFont(m_textsize); |
568 | // setFocusPolicy(QWidget::StrongFocus); | 568 | // setFocusPolicy(QWidget::StrongFocus); |
569 | // resize( 240, 320 ); | 569 | // resize( 240, 320 ); |
570 | //setFocus(); | 570 | //setFocus(); |
571 | timer = new QTimer(this); | 571 | timer = new QTimer(this); |
572 | connect(timer, SIGNAL(timeout()), this, SLOT(doscroll())); | 572 | connect(timer, SIGNAL(timeout()), this, SLOT(doscroll())); |
573 | // QMessageBox::information(this, "init", m_lastfile, 1); | 573 | // QMessageBox::information(this, "init", m_lastfile, 1); |
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 | ||
582 | // | 582 | // |
583 | // Clean up | 583 | // Clean up |
584 | // | 584 | // |
585 | QTReader::~QTReader() | 585 | QTReader::~QTReader() |
586 | { | 586 | { |
587 | if (fontsizes != NULL) delete [] fontsizes; | 587 | if (fontsizes != NULL) delete [] fontsizes; |
588 | #ifndef QT_NO_PRINTER | 588 | #ifndef QT_NO_PRINTER |
589 | // delete printer; | 589 | // delete printer; |
590 | #endif | 590 | #endif |
591 | } | 591 | } |
592 | 592 | ||
593 | // | 593 | // |
594 | // Calls the drawing function as specified by the radio buttons. | 594 | // Calls the drawing function as specified by the radio buttons. |
595 | // | 595 | // |
596 | 596 | ||
597 | void QTReader::drawIt( QPainter *p ) | 597 | void QTReader::drawIt( QPainter *p ) |
598 | { | 598 | { |
599 | drawFonts(p); | 599 | drawFonts(p); |
600 | } | 600 | } |
601 | 601 | ||
602 | // | 602 | // |
603 | // Called when the print button is clicked. | 603 | // Called when the print button is clicked. |
604 | // | 604 | // |
605 | /* | 605 | /* |
606 | void QTReader::printIt() | 606 | void QTReader::printIt() |
607 | { | 607 | { |
608 | #ifndef QT_NO_PRINTER | 608 | #ifndef QT_NO_PRINTER |
609 | if ( printer->setup( this ) ) { | 609 | if ( printer->setup( this ) ) { |
610 | QPainter paint; | 610 | QPainter paint; |
611 | if ( !paint.begin( printer ) ) | 611 | if ( !paint.begin( printer ) ) |
612 | return; | 612 | return; |
613 | drawIt( &paint ); | 613 | drawIt( &paint ); |
614 | } | 614 | } |
615 | #endif | 615 | #endif |
616 | } | 616 | } |
617 | */ | 617 | */ |
618 | // | 618 | // |
619 | // Called when the widget needs to be updated. | 619 | // Called when the widget needs to be updated. |
620 | // | 620 | // |
621 | 621 | ||
622 | void QTReader::paintEvent( QPaintEvent * ) | 622 | void QTReader::paintEvent( QPaintEvent * ) |
623 | { | 623 | { |
624 | QPainter paint( this ); | 624 | QPainter paint( this ); |
625 | drawIt( &paint ); | 625 | drawIt( &paint ); |
626 | } | 626 | } |
627 | 627 | ||
628 | // | 628 | // |
629 | // Called when the widget has been resized. | 629 | // Called when the widget has been resized. |
630 | // Moves the button group to the upper right corner | 630 | // Moves the button group to the upper right corner |
631 | // of the widget. | 631 | // of the widget. |
632 | 632 | ||
633 | /* | 633 | /* |
634 | void QTReader::resizeEvent( QResizeEvent * ) | 634 | void QTReader::resizeEvent( QResizeEvent * ) |
635 | { | 635 | { |
636 | // qDebug("resize:(%u,%u)", width(), height()); | 636 | // qDebug("resize:(%u,%u)", width(), height()); |
637 | // bgroup->move( width()-bgroup->width(), 0 ); | 637 | // bgroup->move( width()-bgroup->width(), 0 ); |
638 | } | 638 | } |
639 | */ | 639 | */ |
640 | 640 | ||
641 | // | 641 | // |
642 | // Create and display our widget. | 642 | // Create and display our widget. |
643 | // | 643 | // |
644 | /* | 644 | /* |
645 | int main( int argc, tchar **argv ) | 645 | int main( int argc, tchar **argv ) |
646 | { | 646 | { |
647 | QApplication app( argc, argv ); | 647 | QApplication app( argc, argv ); |
648 | QTReader draw; | 648 | QTReader draw; |
649 | app.setMainWidget( &draw ); | 649 | app.setMainWidget( &draw ); |
650 | draw.setCaption("Qt Example - Drawdemo"); | 650 | draw.setCaption("Qt Example - Drawdemo"); |
651 | draw.show(); | 651 | draw.show(); |
652 | return app.exec(); | 652 | return app.exec(); |
653 | } | 653 | } |
654 | */ | 654 | */ |
655 | 655 | ||
656 | 656 | ||
657 | bool QTReader::locate(unsigned long n) { | 657 | bool QTReader::locate(unsigned long n) { |
658 | //printf("Locate\n"); | 658 | //printf("Locate\n"); |
659 | buffdoc.locate(n); | 659 | buffdoc.locate(n); |
660 | // qDebug("&buffdoc.located"); | 660 | // qDebug("&buffdoc.located"); |
661 | fillbuffer(); | 661 | fillbuffer(); |
662 | // qDebug("&Buffer filled"); | 662 | // qDebug("&Buffer filled"); |
663 | update(); | 663 | update(); |
664 | // qDebug("&Located"); | 664 | // qDebug("&Located"); |
665 | return true; | 665 | return true; |
666 | } | 666 | } |
667 | 667 | ||
668 | unsigned int QTReader::screenlines() | 668 | unsigned int QTReader::screenlines() |
669 | { | 669 | { |
670 | // int linespacing = (tight) ? m_ascent : m_ascent+m_descent; | 670 | // int linespacing = (tight) ? m_ascent : m_ascent+m_descent; |
671 | // return (height()-m_descent)/(m_linespacing); | 671 | // return (height()-m_descent)/(m_linespacing); |
672 | return (height()-2)/(m_linespacing); | 672 | return (height()-2)/(m_linespacing); |
673 | }; | 673 | }; |
674 | 674 | ||
675 | bool QTReader::fillbuffer() { | 675 | bool QTReader::fillbuffer() { |
676 | if (buffdoc.empty()) return false; | ||
676 | //printf("Fillbuffer\n"); | 677 | //printf("Fillbuffer\n"); |
677 | m_scrolldy = 0; | 678 | m_scrolldy = 0; |
678 | int ch; | 679 | int ch; |
679 | bool ret = false; | 680 | bool ret = false; |
680 | int delta = screenlines(); | 681 | int delta = screenlines(); |
681 | // qDebug("fillbuffer:%u-%u",delta,numlines); | 682 | // qDebug("fillbuffer:%u-%u",delta,numlines); |
682 | if (delta != numlines) | 683 | if (delta != numlines) |
683 | { | 684 | { |
684 | if (textarray != NULL) | 685 | if (textarray != NULL) |
685 | { | 686 | { |
686 | for (int i = 0; i < numlines; i++) delete textarray[i]; | 687 | for (int i = 0; i < numlines; i++) delete textarray[i]; |
687 | delete [] textarray; | 688 | delete [] textarray; |
688 | delete [] locnarray; | 689 | delete [] locnarray; |
689 | } | 690 | } |
690 | numlines = delta; | 691 | numlines = delta; |
691 | textarray = new CBuffer*[numlines]; | 692 | textarray = new CBuffer*[numlines]; |
692 | locnarray = new size_t[numlines]; | 693 | locnarray = new size_t[numlines]; |
693 | for (int i = 0; i < numlines; i++) textarray[i] = new CBuffer; | 694 | for (int i = 0; i < numlines; i++) textarray[i] = new CBuffer; |
694 | } | 695 | } |
695 | // qDebug("fillbuffer:pagepos:%u",pagepos); | 696 | // qDebug("fillbuffer:pagepos:%u",pagepos); |
696 | unsigned int oldpagepos = pagepos; | 697 | unsigned int oldpagepos = pagepos; |
697 | // if (textarray != NULL) | 698 | // if (textarray != NULL) |
698 | // pagepos = locnarray[0]; | 699 | // pagepos = locnarray[0]; |
699 | // else | 700 | // else |
700 | pagepos = locate(); | 701 | pagepos = locate(); |
701 | for (int i = 0; i < delta; i++) | 702 | for (int i = 0; i < delta; i++) |
702 | { | 703 | { |
703 | locnarray[i] = locate(); | 704 | locnarray[i] = locate(); |
704 | ch = getline(textarray[i]); | 705 | ch = getline(textarray[i]); |
705 | // if (ch == EOF) { | 706 | // if (ch == EOF) { |
706 | if (!ch) | 707 | if (!ch) |
707 | { | 708 | { |
708 | if (i == 0) | 709 | if (i == 0) |
709 | { | 710 | { |
710 | locate(oldpagepos); | 711 | locate(oldpagepos); |
711 | return false; | 712 | return false; |
712 | } | 713 | } |
713 | else | 714 | else |
714 | { | 715 | { |
715 | ret = true; | 716 | ret = true; |
716 | for (int j = i+1; j < delta; j++) | 717 | for (int j = i+1; j < delta; j++) |
717 | { | 718 | { |
718 | locnarray[j] = locnarray[j-1]; | 719 | locnarray[j] = locnarray[j-1]; |
719 | (*(textarray[j]))[0] = '\0'; | 720 | (*(textarray[j]))[0] = '\0'; |
720 | } | 721 | } |
721 | break; | 722 | break; |
722 | } | 723 | } |
723 | } | 724 | } |
724 | if (ch == '\012') ret = true; | 725 | if (ch == '\012') ret = true; |
725 | } | 726 | } |
726 | mylastpos = locate(); | 727 | mylastpos = locate(); |
727 | // qDebug("fillbuffer:lastpos:%u",mylastpos); | 728 | // qDebug("fillbuffer:lastpos:%u",mylastpos); |
728 | return true; | 729 | return true; |
729 | } | 730 | } |
730 | 731 | ||
731 | 732 | ||
732 | void QTReader::dopagedn() | 733 | void QTReader::dopagedn() |
733 | { | 734 | { |
734 | if (m_overlap == 0) | 735 | if (m_overlap == 0) |
735 | { | 736 | { |
736 | if (locate() != mylastpos) jumpto(mylastpos); | 737 | if (locate() != mylastpos) jumpto(mylastpos); |
737 | } | 738 | } |
738 | else | 739 | else |
739 | { | 740 | { |
740 | if (m_overlap >= screenlines()) m_overlap = screenlines()/2; | 741 | if (m_overlap >= screenlines()) m_overlap = screenlines()/2; |
741 | jumpto(locnarray[screenlines()-m_overlap]); | 742 | jumpto(locnarray[screenlines()-m_overlap]); |
742 | } | 743 | } |
743 | if (fillbuffer()) | 744 | if (fillbuffer()) |
744 | { | 745 | { |
745 | update(); | 746 | update(); |
746 | } | 747 | } |
747 | } | 748 | } |
748 | 749 | ||
749 | void QTReader::dopageup() | 750 | void QTReader::dopageup() |
750 | { | 751 | { |
751 | CBuffer** buff = textarray; | 752 | CBuffer** buff = textarray; |
752 | unsigned int *loc = new unsigned int[numlines]; | 753 | unsigned int *loc = new unsigned int[numlines]; |
753 | int cbptr = 0; | 754 | int cbptr = 0; |
754 | if (locate() != mylastpos) jumpto(mylastpos); | 755 | if (locate() != mylastpos) jumpto(mylastpos); |
755 | if (m_overlap >= screenlines()) m_overlap = screenlines()/2; | 756 | if (m_overlap >= screenlines()) m_overlap = screenlines()/2; |
756 | unsigned int target = locnarray[m_overlap]; | 757 | unsigned int target = locnarray[m_overlap]; |
757 | if (buffdoc.hasrandomaccess()) | 758 | if (buffdoc.hasrandomaccess()) |
758 | { | 759 | { |
759 | unsigned int delta = locate()-pagelocate(); | 760 | unsigned int delta = locate()-pagelocate(); |
760 | if (delta < 64) delta = 64; | 761 | if (delta < 64) delta = 64; |
761 | if (delta % 2 != 0) delta++; | 762 | if (delta % 2 != 0) delta++; |
762 | if (target % 2 != 0) target++; | 763 | if (target % 2 != 0) target++; |
763 | do | 764 | do |
764 | { | 765 | { |
765 | delta <<= 1; | 766 | delta <<= 1; |
766 | if (delta >= target) | 767 | if (delta >= target) |
767 | { | 768 | { |
768 | delta = target; | 769 | delta = target; |
769 | jumpto(0); | 770 | jumpto(0); |
770 | for (int i = 0; i < numlines; i++) | 771 | for (int i = 0; i < numlines; i++) |
771 | { | 772 | { |
772 | loc[i] = locate(); | 773 | loc[i] = locate(); |
773 | getline(buff[i]); | 774 | getline(buff[i]); |
774 | } | 775 | } |
775 | break; | 776 | break; |
776 | } | 777 | } |
777 | jumpto(target-delta); | 778 | jumpto(target-delta); |
778 | do | 779 | do |
779 | { | 780 | { |
780 | getline(buff[0]); | 781 | getline(buff[0]); |
781 | #ifdef WS | 782 | #ifdef WS |
782 | //printf("Trying:%s\n",buff[0]); | 783 | //printf("Trying:%s\n",buff[0]); |
783 | #endif | 784 | #endif |
784 | if (locate() > target) continue; | 785 | if (locate() > target) continue; |
785 | } | 786 | } |
786 | while (!buffdoc.iseol()); | 787 | while (!buffdoc.iseol()); |
787 | for (int i = 0; i < numlines; i++) | 788 | for (int i = 0; i < numlines; i++) |
788 | { | 789 | { |
789 | loc[i] = locate(); | 790 | loc[i] = locate(); |
790 | getline(buff[i]); | 791 | getline(buff[i]); |
791 | #ifdef WS | 792 | #ifdef WS |
792 | //printf("Filling:%s\n",buff[i]); | 793 | //printf("Filling:%s\n",buff[i]); |
793 | #endif | 794 | #endif |
794 | } | 795 | } |
795 | } | 796 | } |
796 | while (locate() >= target && delta < 4096); | 797 | while (locate() >= target && delta < 4096); |
797 | #ifdef WS | 798 | #ifdef WS |
798 | //printf("Delta:%u\n",delta); | 799 | //printf("Delta:%u\n",delta); |
799 | #endif | 800 | #endif |
800 | } | 801 | } |
801 | else | 802 | else |
802 | { | 803 | { |
803 | jumpto(0); | 804 | jumpto(0); |
804 | for (int i = 0; i < numlines; i++) | 805 | for (int i = 0; i < numlines; i++) |
805 | { | 806 | { |
806 | loc[i] = locate(); | 807 | loc[i] = locate(); |
807 | getline(buff[i]); | 808 | getline(buff[i]); |
808 | } | 809 | } |
809 | } | 810 | } |
810 | cbptr = 0; | 811 | cbptr = 0; |
811 | while (locate() < target) | 812 | while (locate() < target) |
812 | { | 813 | { |
813 | loc[cbptr] = locate(); | 814 | loc[cbptr] = locate(); |
814 | getline(buff[cbptr]); | 815 | getline(buff[cbptr]); |
815 | #ifdef WS | 816 | #ifdef WS |
816 | //printf("Adding:%s\n",buff[cbptr]->data()); | 817 | //printf("Adding:%s\n",buff[cbptr]->data()); |
817 | #endif | 818 | #endif |
818 | cbptr = (cbptr+1) % numlines; | 819 | cbptr = (cbptr+1) % numlines; |
819 | } | 820 | } |
820 | pagepos = loc[cbptr]; | 821 | pagepos = loc[cbptr]; |
821 | textarray = new CBuffer*[numlines]; | 822 | textarray = new CBuffer*[numlines]; |
822 | for (int i = 0; i < numlines; i++) | 823 | for (int i = 0; i < numlines; i++) |
823 | { | 824 | { |
824 | int j = (cbptr+i)%numlines; | 825 | int j = (cbptr+i)%numlines; |
825 | textarray[i] = buff[j]; | 826 | textarray[i] = buff[j]; |
826 | locnarray[i] = loc[j]; | 827 | locnarray[i] = loc[j]; |
827 | } | 828 | } |
828 | delete [] buff; | 829 | delete [] buff; |
829 | delete [] loc; | 830 | delete [] loc; |
830 | mylastpos = locate(); | 831 | mylastpos = locate(); |
831 | update(); | 832 | update(); |
832 | } | 833 | } |
833 | 834 | ||
834 | bool QTReader::load_file(const char *newfile, unsigned int _lcn) | 835 | bool QTReader::load_file(const char *newfile, unsigned int _lcn) |
835 | { | 836 | { |
836 | // QMessageBox::information(this, "Name", name, 1); | 837 | // QMessageBox::information(this, "Name", name, 1); |
837 | // QMessageBox::information(this, "load_file", newfile, 1); | 838 | // QMessageBox::information(this, "load_file", newfile, 1); |
838 | 839 | ||
839 | bool bRC = false; | 840 | bool bRC = false; |
840 | unsigned int lcn = _lcn; | 841 | unsigned int lcn = _lcn; |
841 | if (m_lastfile == newfile) | 842 | if (m_lastfile == newfile) |
842 | { | 843 | { |
843 | lcn = m_lastposn; | 844 | lcn = m_lastposn; |
844 | } | 845 | } |
845 | m_lastfile = newfile; | 846 | m_lastfile = newfile; |
846 | // QMessageBox::information(0, "Opening...", newfile); | 847 | // QMessageBox::information(0, "Opening...", newfile); |
847 | if (buffdoc.openfile(this,newfile) == 0) | 848 | if (buffdoc.openfile(this,newfile) == 0) |
848 | { | 849 | { |
849 | bRC = true; | 850 | bRC = true; |
850 | // qDebug("buffdoc.openfile done"); | 851 | // qDebug("buffdoc.openfile done"); |
851 | locate(lcn); | 852 | locate(lcn); |
852 | // qDebug("buffdoc.locate done"); | 853 | // qDebug("buffdoc.locate done"); |
853 | } | 854 | } |
854 | update(); | 855 | update(); |
855 | // qDebug("Updated"); | 856 | // qDebug("Updated"); |
856 | return bRC; | 857 | return bRC; |
857 | } | 858 | } |
858 | 859 | ||
859 | void QTReader::lineDown() | 860 | void QTReader::lineDown() |
860 | { | 861 | { |
861 | pagepos = locnarray[1]; | 862 | pagepos = locnarray[1]; |
862 | CBuffer* buff = textarray[0]; | 863 | CBuffer* buff = textarray[0]; |
863 | for (int i = 1; i < numlines; i++) | 864 | for (int i = 1; i < numlines; i++) |
864 | { | 865 | { |
865 | textarray[i-1] = textarray[i]; | 866 | textarray[i-1] = textarray[i]; |
866 | locnarray[i-1] = locnarray[i]; | 867 | locnarray[i-1] = locnarray[i]; |
867 | } | 868 | } |