[elvystrac] r1750 - page scrolling definitely OK now..

  • From: elvys@xxxxxxxxxxxxxxxxxxxxxx
  • To: elvystrac@xxxxxxxxxxxxx
  • Date: Wed, 17 Feb 2010 12:04:51 +0100

Author: JirkaH
Date: 2010-02-17 12:04:51 +0100 (Wed, 17 Feb 2010)
New Revision: 1750

Modified:
   branches/client/pdf-presentation-branch/elvys-client/src/Makefile
   branches/client/pdf-presentation-branch/elvys-client/src/pdfdocument.cpp
   branches/client/pdf-presentation-branch/elvys-client/src/pdfdocument.h
   branches/client/pdf-presentation-branch/elvys-client/src/pdffiller.cpp
   branches/client/pdf-presentation-branch/elvys-client/src/pdffiller.h
   branches/client/pdf-presentation-branch/elvys-client/src/pdfviewer.cpp
   branches/client/pdf-presentation-branch/elvys-client/src/pdfviewer.h
   branches/client/pdf-presentation-branch/elvys-client/src/pdfzoomed.cpp
   branches/client/pdf-presentation-branch/elvys-client/src/pdfzoomed.h
Log:
page scrolling definitely OK now..


Modified: branches/client/pdf-presentation-branch/elvys-client/src/Makefile
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/Makefile   
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/Makefile   
2010-02-17 11:04:51 UTC (rev 1750)
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building: ../bin/elvys-client
-# Generated by qmake (2.01a) (Qt 4.5.3) on: Tue Feb 16 17:09:36 2010
+# Generated by qmake (2.01a) (Qt 4.5.3) on: Wed Feb 17 09:52:32 2010
 # Project:  src.pro
 # Template: app
 # Command: /usr/bin/qmake -spec /usr/share/qt4/mkspecs/linux-g++ -unix 
CONFIG+=debug_and_release -o Makefile src.pro

Modified: 
branches/client/pdf-presentation-branch/elvys-client/src/pdfdocument.cpp
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/pdfdocument.cpp    
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/pdfdocument.cpp    
2010-02-17 11:04:51 UTC (rev 1750)
@@ -29,6 +29,7 @@
 
        docId = _docId;
        mainPage = 0;
+       _scaleFactor = 1;
        qRegisterMetaType<PageSelector>( "PageSelector" );
 
        pdfFiller = new PDFFiller(doc->width(), doc->height());
@@ -37,12 +38,14 @@
 
        //connect(pdfFiller, SIGNAL(changeReady(bool)), pdfViewer, 
SLOT(setReady(bool )));
        connect(pdfFiller, SIGNAL(requestPages()), this, SLOT(setPages()));
-       connect(pdfFiller, SIGNAL(zoomedSize(int, int)), pdfZoomed, 
SLOT(setZoomedSize(int, int)));
+       connect(pdfFiller, SIGNAL(zoomedSize(int, int)), pdfZoomed, 
SLOT(setPagesRect(int,int)));
        connect(pdfFiller, SIGNAL(zoomedSize(int, int)), pdfViewer, 
SLOT(setZoomedSize(int, int)));
        connect(pdfFiller, SIGNAL(pageLoaded(PageSelector  , PDFPage *)), 
pdfViewer, SLOT(pageReady(PageSelector , PDFPage *)));
        //connect(pdfFiller, SIGNAL(zoomChanged(bool)), pdfViewer, 
SLOT(allowZoom(bool)));
 
        connect(pdfViewer, SIGNAL(scale(double)), pdfZoomed, 
SLOT(scale(double)));      
+       connect(pdfViewer, SIGNAL(scale(double)), this, SLOT(scale(double)));
+
        connect(pdfViewer, SIGNAL(getPage(int, QSize, QString)), pdfFiller, 
SLOT(loadPage(int, QSize, QString)));
        connect(pdfZoomed, SIGNAL(getPage(int, QSize, QString)), pdfFiller, 
SLOT(loadPage(int, QSize, QString)));       
        connect(pdfFiller, SIGNAL(pageLoaded(PageSelector , PDFPage *)), 
pdfZoomed, SLOT(pageReady(PageSelector , PDFPage *)));
@@ -53,6 +56,7 @@
        connect(pdfViewer, SIGNAL(zoomEvent()), this, SLOT(zoomEventHandler()));
        connect(pdfViewer, SIGNAL(unZoomEvent()), this, 
SLOT(unZoomEventHandler()));
 
+       connect(pdfZoomed, SIGNAL(getAllPagesDimensions(int, int)), pdfFiller, 
SLOT(updatePageSizesZoomed(int,int)));
        connect(pdfFiller, SIGNAL(badPDF(QString )), this, 
SLOT(handleBadPDF(QString )));
 
        connect(pdfViewer, SIGNAL(imageGenerated(PageSelector)), pdfFiller, 
SLOT(cachePage(PageSelector)));
@@ -202,10 +206,20 @@
        int offset = 2 * area.frameWidth();
 
        pdfFiller->clear();
-       pdfFiller->updatePageSizes(width(), height(), 
AppConfig::getInstance()->getZoomWidth(parentWidget()),AppConfig::getInstance()->getZoomHeight(parentWidget())
 -offset);
+       pdfFiller->updatePageSizes(width(), height(), 
AppConfig::getInstance()->getZoomWidth(parentWidget()) * _scaleFactor,
+                                                          
AppConfig::getInstance()->getZoomHeight(parentWidget()) * _scaleFactor - 
offset);
        pdfViewer->setGeometry(geometry());
 }
 
+void PDFDocument::scale(double factor) {
+       QScrollArea area;
+       int offset = 2 * area.frameWidth();
+       _scaleFactor *= factor;
+
+       
pdfFiller->updatePageSizesZoomed(AppConfig::getInstance()->getZoomWidth(parentWidget())
 * _scaleFactor,
+                                                                        
AppConfig::getInstance()->getZoomHeight(parentWidget()) * _scaleFactor - 
offset);
+}
+
 void PDFDocument::hideEvent(QHideEvent * event) {
        Q_UNUSED(event);
 

Modified: branches/client/pdf-presentation-branch/elvys-client/src/pdfdocument.h
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/pdfdocument.h      
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/pdfdocument.h      
2010-02-17 11:04:51 UTC (rev 1750)
@@ -27,6 +27,7 @@
        public slots:
                virtual void load(QString name);
                void load(QString _name, int _docId);
+               void scale(double factor);
                void reLoad();
                void zoomEventHandler();
                void unZoomEventHandler();
@@ -64,6 +65,7 @@
                QList<int> pages;
                int mainPage;
                int docId;
+               double _scaleFactor;
                QMutex imgMtx;
                QMutex mtx;
 };

Modified: branches/client/pdf-presentation-branch/elvys-client/src/pdffiller.cpp
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/pdffiller.cpp      
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/pdffiller.cpp      
2010-02-17 11:04:51 UTC (rev 1750)
@@ -515,13 +515,49 @@
   * pages in document
   */
 void PDFFiller::updatePageSizes(int w, int h, int zoomedW, int zoomedH) {
-       int sumZoomedHeight = 0;
+       updatePageSizesNormal(w, h);
+       updatePageSizesZoomed(zoomedW, zoomedH);
+}
+
+void PDFFiller::updatePageSizesNormal(int w, int h) {
        int maxWidth = 0;
        int maxHeight = 0;
+       int docW;
+       int docH;
+       double docW72, docH72;
+       double dpi;
+
+       while (restart ||  pdf == NULL ) { //wait for initialization
+               if ( ! ready ) {
+                       return;
+               }
+       }
+
+       mutexPDF.lock();
+
+       for (int i = 0; i < pages.size(); ++i) {
+               docW72 = pdfGetPageWidth(pdf, pages[i]);
+               docH72 = pdfGetPageHeight(pdf, pages[i]);               
+               normalizeDimensions(docW72, docH72, w, h, docW, docH, dpi);
+
+               if (docW > maxWidth) {
+                       maxWidth = docW;
+               }
+               if (docH > maxHeight) {
+                       maxHeight = docH;
+               }
+       }
+       mutexPDF.unlock();
+
+       emit sizeRect(maxWidth, maxHeight);
+}
+
+void PDFFiller::updatePageSizesZoomed(int zoomedW, int zoomedH) {
+       int sumZoomedHeight = 0;
        int maxZoomedWidth = 0;
        int maxZoomedHeight = 0;
-       int docZoomedW, docW;
-       int docZoomedH, docH;
+       int docZoomedW;
+       int docZoomedH;
        double docW72, docH72;
        double dpi;
 
@@ -536,32 +572,23 @@
        for (int i = 0; i < pages.size(); ++i) {
                docW72 = pdfGetPageWidth(pdf, pages[i]);
                docH72 = pdfGetPageHeight(pdf, pages[i]);
-               normalizeDimensions(docW72, docH72, zoomedW, zoomedH, 
docZoomedW, docZoomedH, dpi);
-               normalizeDimensions(docW72, docH72, w, h, docW, docH, dpi);
+               normalizeDimensions(docW72, docH72, zoomedW, zoomedH, 
docZoomedW, docZoomedH, dpi);             
                sumZoomedHeight += docZoomedH;
                if (docZoomedW > maxZoomedWidth) {
                        maxZoomedWidth = docZoomedW;
                }
-               if (docW > maxWidth) {
-                       maxWidth = docW;
-               }
                if (docZoomedH > maxZoomedHeight) {
                        maxZoomedHeight = docZoomedH;
                }
-               if (docH > maxHeight) {
-                       maxHeight = docH;
-               }
                ////qDebug() << "Page dimension " << i << docW << docH;
                emit pageDimension(i, docZoomedW, docZoomedH);
        }
        mutexPDF.unlock();
 
-       emit zoomedSize(maxZoomedWidth, sumZoomedHeight + 
SEP_HEIGHT*(pages.size()-1));
+       emit zoomedSize(maxZoomedWidth, sumZoomedHeight);
        emit zoomedSizeRect(maxZoomedWidth, maxZoomedHeight);
-       emit sizeRect(maxWidth, maxHeight);
 }
 
-
 /**
  * Closes current document and clears cache.
  */

Modified: branches/client/pdf-presentation-branch/elvys-client/src/pdffiller.h
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/pdffiller.h        
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/pdffiller.h        
2010-02-17 11:04:51 UTC (rev 1750)
@@ -55,8 +55,11 @@
                void requestPages();
 
        public slots:
-               void loadPage(int pageNum, QSize size, QString desc);
+               void loadPage(int pageNum, QSize size, QString desc);           
                void cachePage(PageSelector  selector);
+               void updatePageSizes(int w, int h, int zoomedW, int zoomedH);
+               void updatePageSizesNormal(int w, int h);
+               void updatePageSizesZoomed(int zoomedW, int zoomedH);
        public:
 
 
@@ -65,7 +68,6 @@
                ~PDFFiller();
                void load(QString name);
                bool setPages(QList <int> & _pages, int _mainPage);
-               void updatePageSizes(int w, int h, int zoomedW, int zoomedH);
                bool makeInit();
                void clear();
                void close();

Modified: branches/client/pdf-presentation-branch/elvys-client/src/pdfviewer.cpp
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/pdfviewer.cpp      
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/pdfviewer.cpp      
2010-02-17 11:04:51 UTC (rev 1750)
@@ -249,6 +249,7 @@
 
 void PDFViewer::scrollByOnePage(ElvysNs::Direction direction) {
        int curY;
+       int nextY;
        int curPage;
        bool aligned;
 
@@ -257,18 +258,21 @@
        }
 
        curY = scroll->verticalScrollBar()->value();
+
        curPage = pdfZoomed->whichPage(curY, aligned);
 
        mtx.lock();
 
        if ( lengths.size() == curPage + 1 && direction == ElvysNs::Down) { // 
I am already at the last page
-               scroll->verticalScrollBar()->setValue(lengths[curPage] - 
pages[curPage].h);
+               nextY = pdfZoomed->pageTop(curPage) - 
pdfZoomed->pageHeight(curPage);
+               scroll->verticalScrollBar()->setValue(nextY);
                mtx.unlock();
                return;
        }
 
        if ( curPage == 0 && direction == ElvysNs::Up) { // I am on already at 
the first page
-               scroll->verticalScrollBar()->setValue(lengths[curPage] - 
pages[curPage].h);
+               nextY = pdfZoomed->pageTop(curPage) - 
pdfZoomed->pageHeight(curPage);
+               scroll->verticalScrollBar()->setValue(nextY);
                mtx.unlock();
                return;
        }
@@ -288,27 +292,49 @@
 
        if (direction == ElvysNs::Up) {
                if (aligned) {
-                       scroll->verticalScrollBar()->setValue(lengths[curPage - 
1] - pages[curPage - 1].h);
+                       nextY = pdfZoomed->pageTop(curPage-1);
+                       scroll->verticalScrollBar()->setValue(nextY);
                } else {
-                       scroll->verticalScrollBar()->setValue(lengths[curPage] 
- pages[curPage].h);
+                       nextY = pdfZoomed->pageTop(curPage);
+                       scroll->verticalScrollBar()->setValue(nextY);
                }
        } else if ( direction == ElvysNs::Down) {
-               scroll->verticalScrollBar()->setValue(lengths[curPage + 1] - 
pages[curPage + 1].h);
+               nextY = pdfZoomed->pageTop(curPage+1);
+               scroll->verticalScrollBar()->setValue(nextY);
        }
 
        mtx.unlock();
 }
 
-void PDFViewer::adjustScrollBar(QScrollBar * scrollBar, double factor) {
-       scrollBar->setValue(int(factor * scrollBar->value() + ((factor - 1) * 
scrollBar->pageStep()/2)));
+/** Adjusts given @a scrollBar by @a factor. This is usefull when content of 
scroll area is zoomed. This function
+  makes sure that the same visible content will be displayed.
+  @arg scrollBar scrollBar to be adjusted
+  @arg factor by which is content zoomed
+  @return value that was set to scrollBar
+  */
+
+int PDFViewer::adjustScrollBar(QScrollBar * scrollBar, double factor) {
+       qDebug() << "-------------------";
+       qDebug() << "factor" << factor << "val" << scrollBar->value() << 
"pageStep" << scrollBar->pageStep();
+       qDebug() << "maximum" << scrollBar->maximum();
+
+       int value = int(factor * scrollBar->value() + ((factor - 1) * 
scrollBar->pageStep()/2));
+       qDebug() << "final val" << value;
+       scrollBar->setValue(value);
+       return value;
 }
 
 void PDFViewer::unzoom() {     
+       int val1, val2;
+
        if ( zoomed ) {
                if ( scaled != 0 ) {
+                       val1 = adjustScrollBar(scroll->verticalScrollBar(), 
1.0/SCALE_FACTOR);
+                       val2 = adjustScrollBar(scroll->horizontalScrollBar(), 
1.0/SCALE_FACTOR);
                        emit scale(1.0/SCALE_FACTOR);                   
-                       adjustScrollBar(scroll->verticalScrollBar(), 
1.0/SCALE_FACTOR);
-                       adjustScrollBar(scroll->horizontalScrollBar(), 
1.0/SCALE_FACTOR);
+                               //scaling could move the bars out, so make sure 
they are in correct position.
+                       scroll->verticalScrollBar()->setValue(val1);
+                       scroll->horizontalScrollBar()->setValue(val2);
                        scaled--;
                } else {
                        if (fadeEffect.isActive()) {
@@ -324,11 +350,17 @@
        }
 }
 
+void PDFViewer::debug(int aa) {
+       qDebug() << aa;
+}
+
 void PDFViewer::zoom() {
+       int val1, val2;
+
        if (pdfZoomed == NULL ) {
                //qDebug() << "Nemuzu zvetsovat, neni nastaveny widget 
PDFZoomed" ;
                return;
-       }
+       }       
 
        if ( ! zoomed ) {
                if ( ! zoomable ) {                     
@@ -339,16 +371,21 @@
                closeWatcher.start(1000);
                toBeZoomed = true;
                getFirstPageBig();
-       } else {
+       } else {                
                if ( scaled >= SCALE_MAX ) { // do not allow to zoom too much 
(SCALE_FACTOR^5)
                        return;
                }
+
                scaled++;
-               emit scale(SCALE_FACTOR);
-               //qDebug() << "vertical slider poss:" << 
scroll->verticalScrollBar()->sliderPosition();
+               qDebug() << scroll->verticalScrollBar()->value();
                //let's take care of image position - we will try to keep focus 
on the middle of an image
-               adjustScrollBar(scroll->verticalScrollBar(), SCALE_FACTOR);
-               adjustScrollBar(scroll->horizontalScrollBar(), SCALE_FACTOR);
+               val1 = adjustScrollBar(scroll->verticalScrollBar(), 
SCALE_FACTOR);
+               val2 = adjustScrollBar(scroll->horizontalScrollBar(), 
SCALE_FACTOR);
+               //connect(scroll->verticalScrollBar(), 
SIGNAL(valueChanged(int)), this, SLOT(debug(int)));
+               emit scale(SCALE_FACTOR);               
+               //scaling could move the bars out, so make sure they are in 
correct position.
+               scroll->verticalScrollBar()->setValue(val1);
+               scroll->horizontalScrollBar()->setValue(val2);
        }
 }
 

Modified: branches/client/pdf-presentation-branch/elvys-client/src/pdfviewer.h
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/pdfviewer.h        
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/pdfviewer.h        
2010-02-17 11:04:51 UTC (rev 1750)
@@ -30,6 +30,7 @@
        public slots:           
                virtual void pageReady(PageSelector selector, PDFPage * page);  
        
                void setPageDimension(int page, int w, int h);
+               void debug(int aa);
 
        public:
                PDFViewer(QWidget * parent, const QRect & rect); //inicializuju 
dedene promene
@@ -54,7 +55,7 @@
                virtual void zoom();
                virtual void unzoom();
                virtual void showPDF();
-               void adjustScrollBar(QScrollBar * scrollBar, double factor);
+               int adjustScrollBar(QScrollBar * scrollBar, double factor);
                void scrollByOnePage(ElvysNs::Direction);               
 
                int pageW; //velikost prvni zvetsene stranky

Modified: branches/client/pdf-presentation-branch/elvys-client/src/pdfzoomed.cpp
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/pdfzoomed.cpp      
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/pdfzoomed.cpp      
2010-02-17 11:04:51 UTC (rev 1750)
@@ -20,7 +20,8 @@
 /** Contructor.
   */
 
-PDFZoomed::PDFZoomed() {       
+PDFZoomed::PDFZoomed() {
+       sepHeight = SEP_HEIGHT;
        scaleI = 1000;
        scaleD = (double)scaleI/1000.0L;        
        keyBase = "PDFZOOMED";
@@ -55,11 +56,29 @@
 void PDFZoomed::scale(double scaleFactor) {
        scaleI = round(scaleI * scaleFactor);
        scaleD = (double)scaleI / 1000.0L;
+       int h, w;
 
-       setZoomedSize(round(width()*scaleFactor), round(height()*scaleFactor)); 
+       sepHeight *= scaleFactor;
+
+       h = round(height()*scaleFactor);
+       w = round(width()*scaleFactor);
+
+       setZoomedSize(h, w);
+
        update();
 }
 
+/** This slot is to be called when dimensions of pages changes. It set the 
right dimensions of whole widget
+  according to page separator height.
+
+@arg maxPageWidth maximum width of pages
+@arg sumPagesHeight sum of height of all pages
+ */
+
+void PDFZoomed::setPagesRect(int maxPageWidth, int sumPagesHeight) {
+       this->setGeometry(0,0, maxPageWidth, sumPagesHeight + sepHeight * 
(pages.size()-1));
+}
+
 /** Sets total base(scale == 1000) size of zoomed area.
   * @param width width of area
   * @param height height of area
@@ -70,6 +89,40 @@
        this->setGeometry(0,0, width, height);
 }
 
+
+/**
+  Returns y coordinate of top of the page @a page taking into account current 
scale.
+  @arg page page of which coordinates to return
+  @return y  y coordinate of top of the given page
+  */
+
+int PDFZoomed::pageTop(int page) {
+       if (page == 0) {
+               return 0;
+       }
+
+       if (page < lengths.size() ) {
+               return (lengths[page-1] + sepHeight);
+       } else {
+               return 0;
+       }
+}
+
+/** Returns height of the @a page taking into account current scale.
+  @arg page which page's height to return
+  @return height of the given page
+  */
+
+int PDFZoomed::pageHeight(int page) {  
+
+       if (page < pages.size() && page >= 0) {
+               return pages[page].h;
+       } else {
+               return 0;
+       }
+}
+
+
 /** Computes which page lay at point y.
   *
   * @param y point at which page should lay
@@ -77,19 +130,18 @@
   * @return page number or zero if conversion fails
   */
 
-int PDFZoomed::whichPage(int y, bool & aligned) {
-       int y2 = round((double)y / scaleD);
+int PDFZoomed::whichPage(int y, bool & aligned) {      
 
        for( int i = 0; i < lengths.size(); ++i ) {
-               if ( y2 <= lengths[i] ) {
+               if ( y <= lengths[i] ) {
                        if ( i != 0) {
-                               if (y2 == lengths[i-1] + SEP_HEIGHT ) {
+                               if (y == lengths[i-1] + sepHeight ) {
                                        aligned = true;
                                } else {
                                        aligned = false;
                                }
                        } else {
-                               if (y2 == 0) {
+                               if (y == 0) {
                                        aligned = true;
                                } else {
                                        aligned = false;
@@ -131,7 +183,7 @@
                        return false;
                }
        } else {
-               lengths[page] = (lengths[page-1] + SEP_HEIGHT + pages[page].h);
+               lengths[page] = (lengths[page-1] + sepHeight + pages[page].h);
                return true;
        }
        return true;
@@ -154,11 +206,11 @@
        if ( page == 0 ) {
                rect.setTop(0);
        } else {
-               rect.setTop(round( (lengths[page-1] + SEP_HEIGHT) * scaleD));
+               rect.setTop(round( (lengths[page-1] + sepHeight)));
        }
 
-       rect.setLeft( round( ((width()/scaleD - pages[page].w)/ 2) * scaleD));
-       rect.setWidth(round(pages[page].w * scaleD));
+       rect.setLeft( round( ((width() - pages[page].w)/ 2)));
+       rect.setWidth(round(pages[page].w));
 
        if (rect.left() < 0 ) {
                rect.setLeft(0);
@@ -170,7 +222,7 @@
                }
        }
 
-       rect.setHeight( round((lengths[page]*scaleD - rect.top()) *scaleD));
+       rect.setHeight( round((lengths[page] - rect.top())));
        return rect;
 }
 
@@ -249,7 +301,7 @@
                //draw page separator
                painter.setPen(Qt::transparent);
                painter.setBrush(Qt::transparent);                              
-               painter.drawRect(0, rect.bottom(), width(), SEP_HEIGHT*scaleD);
+               painter.drawRect(0, rect.bottom(), width(), sepHeight);
        }
        painter.end();
 }

Modified: branches/client/pdf-presentation-branch/elvys-client/src/pdfzoomed.h
===================================================================
--- branches/client/pdf-presentation-branch/elvys-client/src/pdfzoomed.h        
2010-02-17 08:47:02 UTC (rev 1749)
+++ branches/client/pdf-presentation-branch/elvys-client/src/pdfzoomed.h        
2010-02-17 11:04:51 UTC (rev 1750)
@@ -23,12 +23,15 @@
        public slots:
                void pageReady(PageSelector selector, PDFPage * page);
                void setZoomedSize(int width, int height);
+               void setPagesRect(int maxPageWidth, int sumPagesHeight);
                void setPageDimension(int page, int w, int h);
                void scale(double scaleFactor);
 //             void clearPages();
 
        signals:
-               void getPage(int pageNum, QSize size, QString desc);
+               ///< request dimensions of all pages. They must fit into 
width/height specified.
+               void getAllPagesDimensions(int width, int height);              
+               void getPage(int pageNum, QSize size, QString desc);            
                
 
        public:
                PDFZoomed();
@@ -36,6 +39,8 @@
                void setKeyBase(QString & _key);
                void setPages(QList <int> & _pageNumbers);
                int whichPage(int y, bool & aligned);
+               int pageTop(int page);
+               int pageHeight(int page);
 
        protected:                              
                void paintEvent(QPaintEvent * event);
@@ -52,6 +57,7 @@
                QString keyBase;
                int scaleI;
                double scaleD;
+               int sepHeight;
 
 };
 


Other related posts:

  • » [elvystrac] r1750 - page scrolling definitely OK now.. - elvys