CPDFLandscapeView Class Reference

#include <PDFLandscapeView.h>

Collaboration diagram for CPDFLandscapeView:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CPDFLandscapeView (void)
 ~CPDFLandscapeView (void)
void setView (CPDFView *p)
void init ()
void clear ()
void displayPage (const int pageNumber, const ContinousModeScroll mode=ScrollToPage)
void ipcCbk (gint *fd, GdkInputCondition id)
int hitTest (const int x, const int y, int &ox, int &oy)
GBool isReady () const
gboolean buttonPressCbk (GdkEventButton *)
gboolean buttonReleaseCbk (GdkEventButton *)
gboolean motionNotifyCbk (GdkEventMotion *)
gboolean keyPressCbk (GdkEventKey *)
gboolean deleteCbk (GdkEvent *)

Private Member Functions

void onPageRendered (const int pageNumber)
void updateToolbar (CPageInfo *page)
void updatePagebar ()
void zoomFromRect (int left, int top, int right, int bottom)
void zoomToRect (int left, int top, int right, int bottom)
void switchMode ()
void drawScribble (const int x, const int y, CPageInfo *page)
void getPagesRange (int &start, int &end, const int pageNumber, const ContinousModeScroll scroll)
void validatePosition ()
void setReady (const GBool b=gTrue)
void getPageScreenPosition (const int pn, int &x, int &y)
void zoomBack ()
void backward ()
void forward ()
void zoomFromRectPageMode (rectangle &rect)
void adjustPositionPageMode (const rectangle &oldRect, double ratio)
void zoomFitPageMode ()
GBool doLinkPageMode (const int x, const int y)
void zoomFromRectContinousMode (rectangle &rect)
void adjustPositionContinousMode (const rectangle &oldRect, double ratio)
void zoomFitContinousMode ()
GBool doLinkContinousMode (const int x, const int y)
void displayPages (const int start, const int end)
void drawPages (const int start, const int end)
void drawPageImage (CPageInfo *page)

Private Attributes

CPDFViewview
CLayoutMgr layout
CDisplayList list
int nStart
int nEnd
int nOffset
GBool bReady


Detailed Description

Definition at line 35 of file PDFLandscapeView.h.


Constructor & Destructor Documentation

CPDFLandscapeView::CPDFLandscapeView ( void   ) 

Definition at line 33 of file PDFLandscapeView.cpp.

00034 : view(NULL)
00035 , nStart(-1)
00036 , nEnd(-1)
00037 , nOffset(100)
00038 , bReady(gFalse)
00039 {
00040 }

CPDFLandscapeView::~CPDFLandscapeView ( void   ) 

Definition at line 42 of file PDFLandscapeView.cpp.

00043 {
00044 }


Member Function Documentation

void CPDFLandscapeView::onPageRendered ( const int  pageNumber  )  [private]

Definition at line 342 of file PDFLandscapeView.cpp.

00343 {
00344     // compare and draw, checkpoint
00345     if (list.remove(pageNumber))
00346     {
00347         if (list.isEmpty())
00348         {
00349             drawPages(nStart, nEnd);
00350         }
00351     }
00352 }

Here is the call graph for this function:

void CPDFLandscapeView::updateToolbar ( CPageInfo page  )  [private]

Definition at line 817 of file PDFLandscapeView.cpp.

00818 {
00819     GBool bDirty = gFalse;
00820     
00821     // pan
00822     int w = page->bitmap->getWidth();
00823     int h = page->bitmap->getHeight();
00824     rectangle rect;
00825     layout.getVirtualScreen(rect);
00826     if ((view->isPageMode() &&
00827         w <= view->ctrl->settings.getScreenWidth() &&
00828         h <= view->ctrl->settings.getScreenHeight() &&
00829         view->ctrl->settings.getScreenX() >= 0 &&
00830         view->ctrl->settings.getScreenY() >= 0 &&
00831         view->ctrl->settings.getScreenY() + h <= view->ctrl->settings.getScreenHeight() && 
00832         view->ctrl->settings.getScreenX() + w <= view->ctrl->settings.getScreenWidth()))
00833     {
00834         if (view->ctrl->channels.getPanState() != iconState_grey)
00835         {
00836             bDirty = gTrue;
00837             view->ctrl->channels.setPanState(iconState_grey);
00838         }
00839     }
00840     else if (view->isContinousMode() &&
00841             rect.right - rect.left <= view->ctrl->settings.getScreenHeight() &&
00842             rect.bottom - rect.top <= view->ctrl->settings.getScreenWidth() &&
00843             view->ctrl->channels.getPanState() != iconState_grey)
00844     {
00845         bDirty = gTrue;
00846         view->ctrl->channels.setPanState(iconState_grey);
00847     }
00848     else
00849     {
00850         if (view->ctrl->channels.getPanState() == iconState_grey)
00851         {
00852             bDirty = gTrue;
00853             view->ctrl->channels.setPanState(iconState_normal);        
00854         }
00855     }
00856 
00857     // zoom
00858     double z  = page->calZoom();
00859     if (z >= view->ctrl->core->getZoomMax(page->pageNumber))
00860     {
00861         if (view->ctrl->channels.getZoomInState() != iconState_grey)
00862         {
00863             bDirty = gTrue;
00864             view->ctrl->channels.setZoomIn(iconState_grey);            
00865         }
00866     }    
00867     else
00868     {  
00869         if (view->ctrl->channels.getZoomInState() == iconState_grey ||
00870             view->ctrl->channels.getZoomInState() == iconState_selected)
00871         {
00872             bDirty = gTrue;
00873             view->ctrl->channels.setZoomIn(iconState_normal);
00874         }
00875         else if (view->ctrl->channels.getZoomInState() == 3)
00876         {
00877             view->ctrl->channels.setZoomIn(iconState_selected);
00878         }
00879     }
00880     
00881     // zoom back
00882     if (view->ctrl->channels.getZoombackState() != view->ctrl->settings.getZoomBackState())
00883     {
00884         bDirty = gTrue;
00885         view->ctrl->channels.setZoombackState(view->ctrl->settings.getZoomBackState());
00886     }
00887 
00888     /*
00889     if (z <= ZoomMin)
00890     {
00891         if (view->ctrl->channels.getZoomOutState() != iconState_grey)
00892         {
00893             bDirty = gTrue;
00894             view->ctrl->channels.setZoomOut(iconState_grey);        
00895         }
00896     }
00897     else
00898     {
00899         if (view->ctrl->channels.getZoomOutState() == iconState_grey ||
00900             view->ctrl->channels.getZoomOutState() == iconState_selected)
00901         {
00902             bDirty = gTrue;
00903             view->ctrl->channels.setZoomOut(iconState_normal);
00904         }
00905     }
00906     */
00907     
00908     // rotate
00909     if (view->ctrl->channels.getRotateState() != LandscapeToPortrait)
00910     {
00911         bDirty = gTrue;
00912         view->ctrl->channels.setRotateState(LandscapeToPortrait);
00913     }            
00914     
00915     // mode
00916     if (view->ctrl->channels.getContinousState() == iconState_normal &&
00917         view->isContinousMode())
00918     {
00919         bDirty = gTrue;
00920         view->ctrl->channels.setContinousState(3);
00921     }        
00922     else if (view->ctrl->channels.getContinousState() == 3 &&
00923              view->isPageMode())
00924     {
00925         bDirty = gTrue;
00926         view->ctrl->channels.setContinousState(iconState_normal);
00927     }
00928 
00929     // backward
00930     if (view->ctrl->channels.getBackwardState() == iconState_grey &&
00931         view->ctrl->settings.canGoBack())
00932     {
00933         bDirty = gTrue;
00934         view->ctrl->channels.setBackwardState(iconState_normal);
00935     }        
00936     else if (view->ctrl->channels.getBackwardState() == iconState_normal &&
00937         !view->ctrl->settings.canGoBack())
00938     {
00939         bDirty = gTrue;
00940         view->ctrl->channels.setBackwardState(iconState_grey);
00941     }
00942 
00943     // forward
00944     if (view->ctrl->channels.getForwardState() == iconState_grey &&
00945         view->ctrl->settings.canGoForward())
00946     {
00947         bDirty = gTrue;
00948         view->ctrl->channels.setForwardState(iconState_normal);
00949     }        
00950     else if (view->ctrl->channels.getForwardState() == iconState_normal &&
00951         !view->ctrl->settings.canGoForward())
00952     {
00953         bDirty = gTrue;
00954         view->ctrl->channels.setForwardState(iconState_grey);
00955     }
00956 
00957     // update
00958     if (bDirty)
00959     {
00960         view->ctrl->channels.setToolbarDirty();
00961         view->ctrl->channels.setToolbarUpdateType(dmQFull);
00962         view->ctrl->updateReq++;
00963         PV_LOGPRINTF("updateReq %d", view->ctrl->updateReq);        
00964         view->ctrl->channels.redrawToolbar();
00965     }
00966     else
00967     {
00968         view->ctrl->channels.setToolbarDirty(gFalse);
00969         view->ctrl->channels.setToolbarUpdateType(dmQUndefined);
00970     }
00971 }

Here is the call graph for this function:

void CPDFLandscapeView::updatePagebar (  )  [private]

Definition at line 973 of file PDFLandscapeView.cpp.

00974 {
00975     // increase reference count
00976     view->ctrl->updateReq++;
00977     PV_LOGPRINTF("updateReq %d", view->ctrl->updateReq);
00978     view->ctrl->channels.pagebar_set_current_page(view->ctrl->settings.getCurrentPage());
00979     // offset. todo
00980 }

Here is the call graph for this function:

void CPDFLandscapeView::zoomFromRect ( int  left,
int  top,
int  right,
int  bottom 
) [private]

Definition at line 989 of file PDFLandscapeView.cpp.

00990 {
00991     rectangle rect; 
00992     rect.left = left; rect.top = top; rect.right = right; rect.bottom = bottom;
00993     rect.normalize();
00994     if (view->isPageMode())
00995     {
00996         zoomFromRectPageMode(rect);
00997     }
00998     else if (view->isContinousMode())
00999     {
01000         zoomFromRectContinousMode(rect);
01001     }
01002 }

Here is the call graph for this function:

void CPDFLandscapeView::zoomToRect ( int  left,
int  top,
int  right,
int  bottom 
) [private]

Definition at line 1099 of file PDFLandscapeView.cpp.

01100 {
01101     /*
01102     // check rectangle and normalize rectangle
01103     if (left > right) { int tmp = left; left = right; right = tmp; }
01104     if (top > bottom) { int tmp = top; top = bottom; bottom = tmp; }
01105     PV_LOGPRINTF("Zoom To rectangle (%d %d)-(%d %d)", left, top, right, bottom);
01106 
01107     double ratio = 1.0;
01108     CPageInfo * page = view->ctrl->pageList.getPage(view->ctrl->settings.getCurrentPage());
01109     rectangle rect;
01110     rect.left = left; rect.top = top; rect.right = right; rect.bottom = bottom;
01111 
01112     if (left == right || top == bottom) 
01113     {
01114         PV_LOGPRINTF("Rectangle is empty!");
01115         ratio = ZoomMin / page->calZoom();
01116         view->ctrl->settings.setNewZoom(ZoomMin);
01117         adjustPosition(rect, ratio);
01118     }
01119     else
01120     {        
01121         // calcuate zoom factor from dpi: dpi = 0.01 * zoomA * 72
01122         // zoom and then calcuate the new position
01123         ratio = view->calRatio(rect, gFalse);
01124         view->ctrl->settings.setZoom(page->calZoom() * ratio);
01125         if (view->ctrl->settings.getZoom() >= view->ctrl->core->getZoomMax(page->pageNumber))
01126         {
01127             view->ctrl->settings.setNewZoom(view->ctrl->core->getZoomMax(page->pageNumber));
01128             ratio = view->ctrl->core->getZoomMax(page->pageNumber) / page->calZoom();
01129         }
01130         else if (view->ctrl->settings.getZoom() <= ZoomMin)
01131         {
01132             view->ctrl->settings.setNewZoom(ZoomMin);
01133             ratio = ZoomMin / page->calZoom();
01134         }
01135         else
01136         {
01137             view->ctrl->settings.setNewZoom(view->ctrl->settings.getZoom());
01138         }
01139         adjustPosition( rect, ratio);
01140     }
01141     displayPage(view->ctrl->settings.getCurrentPage());
01142     */
01143 }

void CPDFLandscapeView::switchMode (  )  [private]

Definition at line 1288 of file PDFLandscapeView.cpp.

01289 {
01290     // we should redraw when mode is changed
01291     if (view->isPageMode())
01292     {
01293         // from page mode to continous mode
01294         view->setContinousMode();
01295 
01296         // reset page position
01297         init();        
01298         // adjust position
01299         rectangle rect;
01300         layout.getPageRect(view->ctrl->settings.getCurrentPage(), rect);        
01301         int y = view->ctrl->settings.getScreenY();
01302         view->ctrl->settings.setScreenY(rect.left - y);
01303     }
01304     else if (view->isContinousMode())
01305     {
01306         // from continous mode to page mode
01307         view->setPageMode();
01308         
01309         // adjust position, in page mode, display page from top or from offset?
01310         rectangle rect;
01311         layout.getPageRect(view->ctrl->settings.getCurrentPage(), rect);
01312         view->ctrl->settings.setScreenX(0);
01313         int y = view->ctrl->settings.getScreenY();
01314         view->ctrl->settings.setScreenY(rect.left - y);        
01315     }
01316 
01317     // disable zoomback
01318     view->ctrl->settings.disableZoomBack();
01319     
01320     displayPage(view->ctrl->settings.getCurrentPage());
01321 }

Here is the call graph for this function:

void CPDFLandscapeView::drawScribble ( const int  x,
const int  y,
CPageInfo page 
) [private]

Definition at line 1426 of file PDFLandscapeView.cpp.

01427 {
01428     view->ctrl->scbMgr.drawScribblePage(page->pageNumber, 
01429         view->ctrl, x, y);
01430 }

Here is the call graph for this function:

void CPDFLandscapeView::getPagesRange ( int &  start,
int &  end,
const int  pageNumber,
const ContinousModeScroll  scroll 
) [private]

Definition at line 702 of file PDFLandscapeView.cpp.

00703 {
00704     rectangle rect;
00705     if (scroll == ScrollToPage)
00706     {
00707         layout.getPageRect(pageNumber,rect);
00708         rect.bottom = rect.top + view->ctrl->settings.getScreenWidth();
00709         view->ctrl->settings.setScreenX(rect.top);
00710         view->ctrl->settings.setCurrentPage(layout.getPagesVisible(start, end, rect));
00711         return;
00712     }
00713 
00714     if (scroll == ScrollToNextPage)
00715     {
00716         view->ctrl->settings.moveScreenX(view->ctrl->settings.getScreenWidth() - PageRepeat);
00717         validatePosition();     
00718         view->ctrl->settings.getScreenRect(rect);
00719         view->ctrl->settings.setCurrentPage(layout.getPagesVisible(start, end, rect)); 
00720         return;
00721     }
00722 
00723     if (scroll == ScrollToPrevPage)
00724     {
00725         view->ctrl->settings.moveScreenX(PageRepeat - view->ctrl->settings.getScreenWidth());
00726         validatePosition();     
00727         view->ctrl->settings.getScreenRect(rect);
00728         view->ctrl->settings.setCurrentPage(layout.getPagesVisible(start, end, rect)); 
00729         return;
00730     }
00731 
00732     if (scroll == ScrollToPosition)
00733     {
00734         // position is ready, need check
00735         validatePosition();
00736         view->ctrl->settings.getScreenRect(rect);
00737         
00738         // when scroll, should pay attention to render direction
00739         int n = layout.getPagesVisible(start, end, rect);
00740         if (n < view->ctrl->settings.getCurrentPage())
00741         {
00742             view->ctrl->settings.setRenderDir(RenderPrev);
00743         }
00744         else
00745         {
00746             view->ctrl->settings.setRenderDir(RenderNext);
00747         }
00748         view->ctrl->settings.setCurrentPage(n);
00749         return;                
00750     }
00751     
00752     if (scroll == ScrollToNextPages)
00753     {
00754         view->ctrl->settings.moveScreenX(view->ctrl->settings.getScreenWidth() * JumpWidth);
00755         validatePosition();     
00756         view->ctrl->settings.getScreenRect(rect);
00757         view->ctrl->settings.setCurrentPage(layout.getPagesVisible(start, end, rect)); 
00758         return;
00759     }
00760 
00761     if (scroll == ScrollToPrevPages)
00762     {
00763         view->ctrl->settings.moveScreenX(- JumpWidth * view->ctrl->settings.getScreenWidth());
00764         validatePosition();     
00765         view->ctrl->settings.getScreenRect(rect);
00766         view->ctrl->settings.setCurrentPage(layout.getPagesVisible(start, end, rect)); 
00767         return;
00768     }
00769     
00770     
00771     if (scroll == ScrollRedraw)
00772     {
00773         start = nStart; end = nEnd;
00774     }
00775 }

Here is the call graph for this function:

void CPDFLandscapeView::validatePosition (  )  [private]

Definition at line 1214 of file PDFLandscapeView.cpp.

01215 {
01216     rectangle rect; 
01217     int w = 0;
01218     layout.getVirtualScreen(rect);
01219     if (view->isContinousMode())
01220     {
01221         w = rect.right - rect.left;
01222         if (w > view->ctrl->settings.getScreenHeight())
01223         {
01224             if (view->ctrl->settings.getScreenY() < rect.left + Margin)
01225             {
01226                 view->ctrl->settings.setScreenY(rect.left + Margin);
01227             }
01228             else if (view->ctrl->settings.getScreenY() > 
01229             rect.right - view->ctrl->settings.getScreenHeight() - Margin)
01230             {
01231                 view->ctrl->settings.setScreenY(rect.right - view->ctrl->settings.getScreenHeight() - Margin);
01232             }
01233         }
01234         else
01235         {
01236             view->ctrl->settings.setScreenY((w - view->ctrl->settings.getScreenHeight()) / 2);
01237         }
01238 
01239         if (view->ctrl->settings.getScreenX() < rect.top + Margin)
01240         {
01241             view->ctrl->settings.setScreenX(rect.top + Margin);
01242         }
01243         else if (view->ctrl->settings.getScreenX() + view->ctrl->settings.getScreenWidth() > rect.bottom - Margin)
01244         {
01245             view->ctrl->settings.setScreenX(rect.bottom - view->ctrl->settings.getScreenWidth() - Margin);
01246         }
01247     }
01248     else if (view->isPageMode())
01249     {
01250         // here, rect is the page image rect
01251         w = rect.right - rect.left;
01252         int h = rect.bottom - rect.top;
01253         if ( h > view->ctrl->settings.getScreenHeight())
01254         {
01255             if (view->ctrl->settings.getScreenY() > -Margin)
01256             {
01257                 view->ctrl->settings.setScreenY(-Margin);
01258             }
01259             else if (view->ctrl->settings.getScreenY() < 
01260                 view->ctrl->settings.getScreenHeight() - h + Margin)
01261             {
01262                 view->ctrl->settings.setScreenY(view->ctrl->settings.getScreenHeight() - h + Margin);
01263             }
01264         }
01265         else
01266         {
01267             view->ctrl->settings.setScreenY((view->ctrl->settings.getScreenHeight() - h) /2 );
01268         }
01269                 
01270         if (w > view->ctrl->settings.getScreenWidth())
01271         {
01272             if (view->ctrl->settings.getScreenX() > -Margin)
01273             {
01274                 view->ctrl->settings.setScreenX(-Margin);
01275             }
01276             else if (view->ctrl->settings.getScreenX() < view->ctrl->settings.getScreenWidth() - w + Margin)
01277             {
01278                 view->ctrl->settings.setScreenX(view->ctrl->settings.getScreenWidth() - w + Margin);
01279             }
01280         }
01281         else
01282         {
01283             view->ctrl->settings.setScreenX((view->ctrl->settings.getScreenWidth() - w) / 2);
01284         }
01285     }
01286 }

Here is the call graph for this function:

void CPDFLandscapeView::setReady ( const GBool  b = gTrue  )  [inline, private]

Definition at line 59 of file PDFLandscapeView.h.

00059 { bReady = b; }

void CPDFLandscapeView::getPageScreenPosition ( const int  pn,
int &  x,
int &  y 
) [private]

Definition at line 324 of file PDFLandscapeView.cpp.

00325 {
00326     if (view->isPageMode())
00327     {
00328         x = layout.getVirtualScreen().left;
00329         y = layout.getVirtualScreen().bottom;
00330     }
00331     else
00332     {
00333         rectangle rect;
00334         layout.getPageRect(pn, rect);
00335         x = rect.top - view->ctrl->settings.getScreenX();
00336         y = rect.left - view->ctrl->settings.getScreenY();
00337         y += (rect.right - rect.left);
00338     }
00339 
00340 }

Here is the call graph for this function:

void CPDFLandscapeView::zoomBack (  )  [private]

Definition at line 619 of file PDFLandscapeView.cpp.

00620 {
00621     if (!view->ctrl->settings.zoomBack())
00622     {
00623         return;
00624     }
00625     
00626     init();
00627     
00628     displayPage(view->ctrl->settings.getCurrentPage(), ScrollToPosition);
00629 }

Here is the call graph for this function:

void CPDFLandscapeView::backward (  )  [private]

Definition at line 631 of file PDFLandscapeView.cpp.

00632 {
00633     HistoryItemPtr ptr = view->ctrl->settings.goBackward();
00634     if (ptr)
00635     {
00636         displayPage(view->ctrl->settings.getCurrentPage(), ScrollToPage);
00637     }
00638 }

Here is the call graph for this function:

void CPDFLandscapeView::forward (  )  [private]

Definition at line 640 of file PDFLandscapeView.cpp.

00641 {
00642     HistoryItemPtr ptr = view->ctrl->settings.goForward();
00643     if (ptr)
00644     {
00645         displayPage(view->ctrl->settings.getCurrentPage(), ScrollToPage);
00646     }
00647 }

Here is the call graph for this function:

void CPDFLandscapeView::zoomFromRectPageMode ( rectangle rect  )  [private]

Definition at line 1004 of file PDFLandscapeView.cpp.

01005 {
01006     // tmp var
01007     double ratio = 1.0, max = 1.0, z = 1.0, tmp = 1.0;
01008 
01009     // get page info
01010     CPageInfo * page = view->ctrl->pageList.getPage(view->ctrl->settings.getCurrentPage());
01011     max = view->ctrl->core->getZoomMax(page->pageNumber);
01012     z   = page->calZoom();    
01013     ratio = view->calRatio(rect);
01014 
01015     // calcuate zoom factor from dpi: dpi = 0.01 * zoomA * 72
01016     // zoom and then calcuate the new position
01017     tmp = z * ratio;
01018     if (tmp >= max)
01019     {
01020         view->ctrl->settings.setNewZoom(max);
01021         ratio = max / z;
01022     }
01023     else if (tmp <= ZoomMin)
01024     {
01025         view->ctrl->settings.setNewZoom(ZoomMin);
01026         ratio = ZoomMin / z;
01027     }
01028     else
01029     {
01030         view->ctrl->settings.setNewZoom(tmp);
01031     }
01032 
01033     // center the rectangle
01034     adjustPositionPageMode(rect, ratio);
01035 
01036     // display it with new zoom factor
01037     displayPage(view->ctrl->settings.getCurrentPage());
01038 }

Here is the call graph for this function:

void CPDFLandscapeView::adjustPositionPageMode ( const rectangle oldRect,
double  ratio 
) [private]

Definition at line 1147 of file PDFLandscapeView.cpp.

01148 {
01149     // old offset
01150     int offsetX = 0, offsetY = 0;
01151     point oldCenter, newCenter;
01152     oldCenter.x = (oldRect.left + oldRect.right) / 2;
01153     oldCenter.y = (oldRect.top + oldRect.bottom) / 2;
01154     offsetX = oldCenter.x - view->ctrl->settings.getScreenX();
01155     offsetY = oldCenter.y - view->ctrl->settings.getScreenY();
01156 
01157     // calculate new rect
01158     rectangle newRect;   
01159     int width  = (int)((double)(oldRect.right - oldRect.left) * ratio);
01160     int height = (int)((double)(oldRect.bottom - oldRect.top) * ratio);
01161     newRect.top = (view->ctrl->settings.getScreenHeight() - height) / 2;
01162     newRect.bottom = newRect.top + height;
01163     newRect.left = (view->ctrl->settings.getScreenWidth() - width) /2;
01164     newRect.right = newRect.left + width;
01165     
01166     // offset   
01167     newCenter.y = (newRect.top + newRect.bottom) / 2;
01168     if (SmallNone != view->lessThreshold(oldRect))
01169     {
01170         newCenter.x =  oldCenter.x - (int)((double)offsetX * ratio);   
01171     }
01172     else
01173     {
01174         newCenter.x = (newRect.left + newRect.right) / 2;
01175         newCenter.x -= (int)((double)offsetX * ratio);
01176     }        
01177     
01178     view->ctrl->settings.setScreenX(newCenter.x );
01179     view->ctrl->settings.setScreenY(newCenter.y - (int)((double)offsetY * ratio));
01180 }

Here is the call graph for this function:

void CPDFLandscapeView::zoomFitPageMode (  )  [private]

Definition at line 1325 of file PDFLandscapeView.cpp.

01326 {
01327     // update settings, reset the screen position
01328     view->ctrl->settings.setNewZoom(ZoomPage);
01329     view->ctrl->settings.setScreenX(0);
01330     view->ctrl->settings.setScreenY(0);                
01331     displayPage(view->ctrl->settings.getCurrentPage());
01332 }

Here is the call graph for this function:

GBool CPDFLandscapeView::doLinkPageMode ( const int  x,
const int  y 
) [private]

Definition at line 1399 of file PDFLandscapeView.cpp.

01400 {
01401     return view->doLink(view->ctrl->settings.getCurrentPage(), 
01402         x - view->ctrl->settings.getScreenX(), 
01403         y - view->ctrl->settings.getScreenY());
01404 }

Here is the call graph for this function:

void CPDFLandscapeView::zoomFromRectContinousMode ( rectangle rect  )  [private]

Definition at line 1045 of file PDFLandscapeView.cpp.

01046 {
01047     // tmp var
01048     double ratio = 1.0, max = 1.0, min = 99999.0, z = 1.0, tmp = 1.0;
01049 
01050     // convert from screen to virtual screen
01051     layout.screenToVirtualScreen(view->ctrl, rect);
01052     
01053     // get max and min zoom factor for all visible pages
01054     int pn = nStart;
01055     CPageInfo * page = NULL;
01056     while (pn <= nEnd)
01057     {
01058         tmp = view->ctrl->core->getZoomMax(pn);
01059         if (max < tmp) max = tmp;
01060 
01061         // actually, should check which page is selected. todo
01062         page = view->ctrl->pageList.getPage(pn);
01063         tmp  = page->calZoom();  
01064         if (min > tmp) min = tmp;
01065         ++pn;
01066     }
01067     z = min;
01068     ratio = view->calRatio(rect);
01069 
01070     // calcuate zoom factor from dpi: dpi = 0.01 * zoomA * 72
01071     // zoom and then calcuate the new position
01072     tmp = z * ratio;
01073     if (tmp >= max)
01074     {
01075         view->ctrl->settings.setNewZoom(max);
01076         ratio = max / z;
01077     }
01078     else if (tmp <= ZoomMin)
01079     {
01080         view->ctrl->settings.setNewZoom(ZoomMin);
01081         ratio = ZoomMin / z;
01082     }
01083     else
01084     {
01085         view->ctrl->settings.setNewZoom(tmp);
01086     }
01087     
01088     // reset 
01089     init();
01090 
01091     // center the rectangle for continous mode
01092     swap(rect.left, rect.top); swap(rect.right, rect.bottom);
01093     adjustPositionContinousMode(rect, ratio);
01094 
01095     // display it with new zoom factor
01096     displayPage(view->ctrl->settings.getCurrentPage(), ScrollToPosition);
01097 }

Here is the call graph for this function:

void CPDFLandscapeView::adjustPositionContinousMode ( const rectangle oldRect,
double  ratio 
) [private]

Definition at line 1184 of file PDFLandscapeView.cpp.

01185 {
01186     // calculate the center point & offset
01187     int x = 0, y = 0, offset = 0;
01188     point oldCenter, newCenter;
01189     oldCenter.x = (oldRect.left + oldRect.right) / 2;
01190     oldCenter.y = (oldRect.top + oldRect.bottom) / 2;
01191     offset = oldCenter.y - view->ctrl->settings.getScreenX();
01192     x = (int)((double)oldCenter.x * ratio);
01193     y = (int)((double)oldCenter.y * ratio);
01194     
01195     // new center point
01196     newCenter.x = x - view->ctrl->settings.getScreenHeight() / 2;
01197     if (SmallNone == view->lessThreshold(oldRect))
01198     {
01199         newCenter.y = y - view->ctrl->settings.getScreenWidth() / 2;
01200     }
01201     else
01202     {
01203         newCenter.y = y - offset;   // do not change offset
01204     }        
01205         
01206     // update screen position
01207     view->ctrl->settings.setScreenX(newCenter.y);
01208     view->ctrl->settings.setScreenY(newCenter.x);
01209 }

Here is the call graph for this function:

void CPDFLandscapeView::zoomFitContinousMode (  )  [private]

Definition at line 1336 of file PDFLandscapeView.cpp.

01337 {
01338     // calculate ratio
01339     double oldZoom = view->ctrl->calZoom(view->ctrl->settings.getCurrentPage());
01340     view->ctrl->settings.setZoom(ZoomPage);     // maybe use ZoomWidth
01341     double newZoom = view->ctrl->calZoom(view->ctrl->settings.getCurrentPage());
01342     view->ctrl->settings.setZoom(oldZoom);    
01343     view->ctrl->settings.setNewZoom(newZoom);
01344     double ratio = newZoom / oldZoom;
01345    
01346     // get current virtual screen 
01347     rectangle rect;
01348     rect.left = 0; rect.right = view->ctrl->settings.getScreenHeight();
01349     rect.top = view->ctrl->settings.getScreenX(); 
01350     rect.bottom = view->ctrl->settings.getScreenX();
01351 
01352     // reset page position list
01353     init();
01354     
01355     // adjust
01356     adjustPositionContinousMode(rect, ratio);
01357 
01358     // display 
01359     displayPage(view->ctrl->settings.getCurrentPage(), ScrollToPosition);
01360 }

Here is the call graph for this function:

GBool CPDFLandscapeView::doLinkContinousMode ( const int  x,
const int  y 
) [private]

Definition at line 1407 of file PDFLandscapeView.cpp.

01408 {
01409     point pt; pt.x = x; pt.y = y;
01410     layout.screenToVirtualScreen(view->ctrl, pt);
01411     int pn = layout.hitTest(pt.y, pt.x, nStart, nEnd);
01412     if (pn < 0) 
01413     {
01414         return gFalse;
01415     }        
01416     rectangle rect;
01417     layout.getPageRect(pn, rect);
01418     // pt.x = rect.top - view->ctrl->settings.getScreenX(); pt.x = x - pt.x;
01419     // pt.y = rect.left - view->ctrl->settings.getScreenY(); pt.y = y - pt.y;
01420     return view->doLink(pn, pt.x - rect.top, pt.y - rect.left);
01421 }

Here is the call graph for this function:

void CPDFLandscapeView::displayPages ( const int  start,
const int  end 
) [private]

Definition at line 559 of file PDFLandscapeView.cpp.

00560 {
00561     // blink
00562     view->ctrl->channels.busy_blink();
00563 
00564     // record 
00565     nStart = start, nEnd = end;
00566 
00567     // check page number is valid or not
00568     GBool bRendering = gFalse;
00569     
00570     // clear all items
00571     list.clear();
00572 
00573     // check 
00574     for(int i = start; i <= end; ++i)
00575     {
00576         if (i >= 1 && i <= view->ctrl->core->getNumPages())
00577         {
00578             CPageInfo info; 
00579             info.pageNumber  = i;
00580             info.pageZoom    = view->ctrl->calZoom(i);
00581             info.rotate      = view->ctrl->settings.getRotate();
00582             CPageInfo * page = view->ctrl->pageList.checkPage(info);
00583             if (NULL == page)
00584             {
00585                 TodoItem * item = new TodoItem;
00586                 item->pageNumber = info.pageNumber;
00587                 item->rotate     = info.rotate;
00588                 item->zoom       = info.pageZoom;
00589                 item->timeStamp  = view->ctrl->getTimeStamp();
00590                 if (view->ctrl->thread.isInRendering(item))
00591                 {
00592                     bRendering = gTrue;
00593                     PV_LOGPRINTF("page %d is in rendering!\n", i);
00594                     item->timeStamp = 0;    // set a flag
00595                 }
00596                 list.add(item);
00597             }
00598         }
00599     }
00600 
00601     // draw now if available 
00602     if (list.isEmpty())
00603     {
00604         drawPages(start, end);
00605     }
00606     else
00607     {
00608         if (bRendering)
00609         {
00610             list.issueItems(view);    
00611         }
00612         else
00613         {
00614             list.renderItems(view);  // abort and issue
00615         }
00616     }
00617 }

Here is the call graph for this function:

void CPDFLandscapeView::drawPages ( const int  start,
const int  end 
) [private]

Definition at line 649 of file PDFLandscapeView.cpp.

00650 {   
00651     // update pagebar
00652     updatePagebar();
00653 
00654     // update toolbar
00655     CPageInfo * page = NULL;
00656     page = view->ctrl->pageList.getPage(view->ctrl->settings.getCurrentPage());
00657     updateToolbar(page);
00658 
00659 #if (PV_PROFILE_ON)
00660     int t1 = view->ctrl->getHighTimeStamp();
00661 #endif
00662     
00663     // clear background
00664     view->ctrl->gtkMgr.clearBkground();
00665 
00666     // draw page image
00667     for(int i = start; i <= end; ++i)
00668     {
00669         page = view->ctrl->pageList.getPage(i);
00670         if (page)
00671         {
00672             drawPageImage(page);
00673         }
00674     }
00675 
00676     // sync 
00677     XSync(view->ctrl->gtkMgr.display, gTrue);   
00678 
00679 #if (PV_PROFILE_ON)    
00680     int t2 = view->ctrl->getHighTimeStamp();
00681     PV_DUMP("\ndrawImage and XSync time %d\n", t2 - t1);
00682 #endif    
00683 
00684     // check reference count
00685     if (view->ctrl->updateReq <= 0)
00686     {
00687         view->refreshDeviceScreen(dmQFull);
00688         view->ctrl->updateReq = 0;
00689     }
00690 
00691     // set ready. Now enable handle mouse event
00692     setReady();
00693 
00694     // issue new requests now
00695     view->issueNewRequests();
00696 }

Here is the call graph for this function:

void CPDFLandscapeView::drawPageImage ( CPageInfo page  )  [private]

Definition at line 777 of file PDFLandscapeView.cpp.

00778 {
00779     // update page time stamp
00780     page->timestamp = view->ctrl->getTimeStamp();
00781 
00782     // page position 
00783     int x = view->ctrl->settings.getScreenX();
00784     int y = view->ctrl->settings.getScreenY();
00785 
00786     // should adjust page position
00787     if (view->isPageMode())
00788     {
00789         if (page->bitmap->getHeight() <= view->ctrl->settings.getScreenHeight() ||
00790             view->ctrl->settings.getZoom() == ZoomPage)
00791         {
00792             y = ((view->ctrl->settings.getScreenHeight() - page->bitmap->getHeight()) >> 1);
00793             view->ctrl->settings.setScreenY(y);
00794         }
00795         layout.updatePageRect(x, y, page->bitmap->getWidth(), page->bitmap->getHeight());
00796     }
00797     else if (view->isContinousMode())
00798     {
00799         rectangle rect;
00800         layout.getPageRect(page->pageNumber, rect);
00801         x = rect.top - view->ctrl->settings.getScreenX();
00802         y = rect.left - view->ctrl->settings.getScreenY();        
00803     }
00804 
00805     // display image. draws border only in continous mode
00806     view->ctrl->gtkMgr.drawImage(page->bitmap,
00807         0, 0, 
00808         x, y,
00809         page->bitmap->getWidth(), page->bitmap->getHeight(),
00810         view->isContinousMode());
00811 
00812     // when drawing scribble, should use another y position
00813     y += page->bitmap->getHeight();
00814     drawScribble(x, y, page);
00815 }

Here is the call graph for this function:

void CPDFLandscapeView::setView ( CPDFView p  )  [inline]

Definition at line 84 of file PDFLandscapeView.h.

00084 { view = p; }

void CPDFLandscapeView::init (  ) 

Definition at line 49 of file PDFLandscapeView.cpp.

00050 {
00051     list.clear();
00052     if (view->isPageMode())
00053     {
00054         // validatePosition();
00055     }
00056     else if (view->isContinousMode())
00057     {
00058         // update zoom, otherwise zoomPage and zoomWidth will cause
00059         // some page problems. 
00060         double z = layout.initPagesPosition(view->ctrl);
00061         view->ctrl->settings.setZoom(z);
00062     }
00063     setReady(gFalse);
00064 }

Here is the call graph for this function:

void CPDFLandscapeView::clear (  ) 

Definition at line 66 of file PDFLandscapeView.cpp.

00067 {
00068     list.clear();
00069     layout.clear();
00070 }

Here is the call graph for this function:

void CPDFLandscapeView::displayPage ( const int  pageNumber,
const ContinousModeScroll  mode = ScrollToPage 
)

Definition at line 519 of file PDFLandscapeView.cpp.

00520 {
00521     // check page number is valid or not
00522     if (pageNumber <= 0 ||
00523         pageNumber > view->ctrl->core->getNumPages())
00524     {
00525         PV_ERRORPRINTF("Invalid page number %d!", pageNumber);
00526         view->ctrl->channels.busy_off();
00527         return;
00528     }
00529 
00530     // set busy, not allow mouse input
00531     setReady(gFalse);
00532 
00533     if (view->isPageMode())
00534     {
00535         // change current page
00536         view->ctrl->settings.setCurrentPage(pageNumber);
00537         
00538         // display it
00539         displayPages(pageNumber, pageNumber);
00540     }
00541     else if (view->isContinousMode())
00542     {
00543         // calcuate pages should be displayed from pagenumber and scroll mode
00544         int start = pageNumber, end = pageNumber;
00545         getPagesRange(start, end, pageNumber, scroll);
00546 
00547         // debug
00548         PV_LOGPRINTF("Visible page range [%d, %d] current page %d", start, end, 
00549             view->ctrl->settings.getCurrentPage());
00550 
00551         // display them
00552         displayPages(start, end);
00553     }
00554 }

Here is the call graph for this function:

void CPDFLandscapeView::ipcCbk ( gint *  fd,
GdkInputCondition  id 
)

Definition at line 354 of file PDFLandscapeView.cpp.

00355 {
00356     char szBuffer[IPC_BUF_MAX]; 
00357     int nBuf = IPC_BUF_MAX;
00358     erIpcCmd_t command;
00359     erServerChannel_t channel = view->ctrl->channels.erIpcChannel;
00360     erIpcGetMessage(channel, szBuffer, &nBuf);
00361     if (vwrParseCommand(szBuffer, &command) >= 0) 
00362     {
00363         switch (command.cc) 
00364         {
00365         case ccVwrJumpToPage:
00366         {
00367             int pg = atoi(command.arg[1]);
00368             
00369             // should change render direction
00370             if (pg < view->ctrl->settings.getCurrentPage())
00371             {
00372                 if (pg <= 1)
00373                 {
00374                     view->ctrl->settings.setRenderDir(RenderNext);
00375                 }
00376                 else
00377                 {
00378                     view->ctrl->settings.setRenderDir(RenderPrev);
00379                 }
00380             }
00381             else if (pg > view->ctrl->settings.getCurrentPage())
00382             {
00383                 if (pg >= view->ctrl->core->getNumPages())
00384                 {
00385                     view->ctrl->settings.setRenderDir(RenderPrev);
00386                 }
00387                 else
00388                 {
00389                     view->ctrl->settings.setRenderDir(RenderNext);
00390                 }
00391             }
00392             
00393             displayPage(pg);
00394             break;
00395         }                
00396         case ccVwrToolbar:
00397         {
00398             // protect toolbar
00399             if (!isReady()) 
00400             {
00401                 PV_TBPRINTF("Not allow to handle it during rendering!");
00402                 return;
00403             }
00404             PV_TBPRINTF("Received toolbar message!");
00405             
00406             int iconID = atoi(command.arg[0]);
00407             int state  = atoi(command.arg[1]);
00408             if (view->ctrl->channels.onReceiveToolbarMsg(iconID, state))
00409             {
00410                 view->ctrl->channels.setToolbarUpdateType();
00411                 view->ctrl->channels.redrawToolbar();            
00412             }
00413             if (iconID == iconID_zoomfit)
00414             {
00415                 if (view->isPageMode())
00416                 {
00417                     zoomFitPageMode();
00418                 }
00419                 else if (view->isContinousMode())
00420                 {
00421                     zoomFitContinousMode();
00422                 }
00423             }
00424             else if (iconID == iconID_portrait_landscape ||
00425                      iconID == iconID_landscape_portrait )
00426             {
00427                 view->ctrl->channels.setRotateState(RotateDirty);
00428                 if (view->isPageMode())
00429                 {                  
00430                     view->rotatePageMode(90);
00431                 }
00432                 else
00433                 {
00434                     view->rotateContinousMode(90);
00435                 }                    
00436             }
00437             else if (iconID == iconID_page_mode ||
00438                      iconID == iconID_continuous_mode)
00439             {
00440                 switchMode();
00441             }
00442             else if (iconID == iconID_zoomback)
00443             {
00444                 zoomBack();
00445             }
00446             else if (iconID == iconID_back)
00447             {
00448                 backward();   
00449             }
00450             else if (iconID == iconID_forward)
00451             {
00452                 forward();
00453             }
00454             else if (view->ctrl->scbMgr.isEraseDirty())
00455             {
00456                 if (view->ctrl->channels.isScribbleIcon(iconID) ||
00457                     iconID == iconID_pan ||
00458                     iconID == iconID_zoomin)
00459                 {
00460                     // need to redraw the page now
00461                     view->ctrl->scbMgr.setEraseDirty(gFalse);                    
00462                     view->ctrl->channels.setToolbarUpdateType(dmQFull);
00463                     if (iconID == iconID_zoomin)
00464                     {
00465                         // for zoom in, need to do something more
00466                         view->ctrl->channels.setZoomIn(3);                        
00467                     }
00468                     view->displayPage(view->ctrl->settings.getCurrentPage(), ScrollRedraw);
00469                 }
00470             }
00471             break;
00472         }
00473         case ccVwrToolbarSync:
00474         {
00475             PV_TBPRINTF("Receive toolbar sync!");
00476             if (view->ctrl->channels.getToolbarUpdateType() == dmQTyping)
00477             {
00478                 PV_TBPRINTF("Toolbar sync typing!");
00479                 view->refreshDeviceScreen(dmQTyping, gFalse);
00480                 view->ctrl->channels.setToolbarDirty(gFalse);
00481                 view->ctrl->channels.setToolbarUpdateType(dmQUndefined);
00482             }
00483             // happens when a new page is displayed. 
00484             else if (view->ctrl->channels.getToolbarUpdateType() == dmQFull)
00485             {
00486                 PV_TBPRINTF("Toolbar sync full update!");
00487                 --view->ctrl->updateReq;
00488                 if (view->ctrl->updateReq <= 0)
00489                 {
00490                     view->refreshDeviceScreen(dmQFull);
00491                     view->ctrl->updateReq = 0;
00492                 }
00493                 view->ctrl->channels.setToolbarDirty(gFalse);
00494                 view->ctrl->channels.setToolbarUpdateType(dmQUndefined);
00495             }
00496             break;
00497         }      
00498         case ccVwrPagebarSync:
00499         {
00500             --view->ctrl->updateReq;
00501             if (view->ctrl->updateReq <= 0)
00502             {
00503                 view->refreshDeviceScreen(dmQFull);
00504                 view->ctrl->updateReq = 0;
00505             }
00506             PV_TBPRINTF("Received pageBar sync!");
00507             break;
00508         }            
00509         default:
00510             break;
00511         }
00512     }
00513 }

Here is the call graph for this function:

int CPDFLandscapeView::hitTest ( const int  x,
const int  y,
int &  ox,
int &  oy 
)

Definition at line 1365 of file PDFLandscapeView.cpp.

01366 {
01367     if (view->isPageMode())
01368     {
01369         if (layout.hitTest(x, y))
01370         {
01371             // convert to page offset
01372             oy = x - view->ctrl->settings.getScreenX();
01373             ox = layout.getVirtualScreen().bottom - y;
01374             return view->ctrl->settings.getCurrentPage();
01375         }
01376     }
01377     else
01378     {
01379         if (nStart > 0 && nEnd > 0 && list.isEmpty())
01380         {
01381             // from screen to virtual screen
01382             oy = x + view->ctrl->settings.getScreenX();
01383             ox = y + view->ctrl->settings.getScreenY();
01384             int pn = layout.hitTest(ox, oy, nStart, nEnd);
01385             if (pn > 0)
01386             {
01387                 rectangle rect;
01388                 layout.getPageRect(pn, rect);
01389                 oy -= rect.top; 
01390                 ox = rect.right - ox;
01391                 return pn;
01392             }
01393             return -1;
01394         }
01395     }
01396     return -1;
01397 }

Here is the call graph for this function:

GBool CPDFLandscapeView::isReady (  )  const [inline]

Definition at line 90 of file PDFLandscapeView.h.

00090 { return bReady; }

gboolean CPDFLandscapeView::buttonPressCbk ( GdkEventButton *  event  ) 

Definition at line 74 of file PDFLandscapeView.cpp.

00075 {
00076     if (!isReady())
00077     {
00078         PV_LOGPRINTF("Not allow to handle mouse event now!");
00079         return FALSE;
00080     }
00081     int x = (int)event->x;
00082     int y = (int)event->y;
00083     if (y >= view->ctrl->settings.getScreenHeight())
00084     {
00085         return FALSE;
00086     }
00087     if (view->isPanEnable())
00088     {
00089         // enable panning, record the position
00090         view->initPan(x, y);
00091     }
00092     else if (view->isZoomInEnable() ||
00093         view->isZoomOutEnable())
00094     {
00095         view->initZoomRect(x, y);
00096     }
00097     else if (view->isScribbleEnable())
00098     {
00099         int ox, oy;
00100         int px, py;
00101         int pn = hitTest(x, y, ox, oy);
00102 
00103         // get page x & y
00104         getPageScreenPosition(pn, px, py);
00105         view->ctrl->scbMgr.onScribblePress(pn, view->ctrl, px, py, 
00106             x, y, ox, oy);
00107         return FALSE;
00108     }
00109     else if (view->isEraseEnable())
00110     {
00111         int ox, oy; 
00112         int pn = hitTest(x, y, ox, oy);
00113         getPageScreenPosition(pn, x, y);
00114         view->ctrl->scbMgr.onErasePress(pn, view->ctrl, 
00115             x, y, ox, oy);
00116     }
00117     return FALSE;
00118 }          

Here is the call graph for this function:

gboolean CPDFLandscapeView::buttonReleaseCbk ( GdkEventButton *  event  ) 

Definition at line 121 of file PDFLandscapeView.cpp.

00122 {
00123     if (!isReady())
00124     {
00125         PV_LOGPRINTF("Not allow to handle mouse event now!");
00126         return FALSE;
00127     }
00128     
00129     int x = (int)event->x;
00130     int y = (int)event->y;
00131     if (y >= view->ctrl->settings.getScreenHeight()) return FALSE;
00132 
00133     if (view->isScribbleEnable())
00134     {
00135         int ox, oy;
00136         int px, py;                
00137         int pn = hitTest(x, y, ox, oy);
00138         // get page x & y
00139         getPageScreenPosition(pn, px, py);     
00140         view->ctrl->scbMgr.onScribbleRelease(pn, view->ctrl, px, py, 
00141             x, y, ox, oy);
00142         return FALSE;                    
00143     }
00144     else if (view->isEraseEnable())
00145     {
00146         int ox, oy; 
00147         int pn = hitTest(x, y, ox, oy);
00148         getPageScreenPosition(pn, x, y);
00149         view->ctrl->scbMgr.onEraseRelease(pn, view->ctrl, 
00150             x, y, ox, oy);
00151         return FALSE;
00152     }
00153     // try to do hyper link at first. if not in scribble
00154     if (view->isSmallOffset(x, y))
00155     {
00156         PV_LOGPRINTF("Small Offset!");
00157         if (view->isPageMode())
00158         {
00159             if (doLinkPageMode(x, y))
00160                 return FALSE;
00161         }
00162         else 
00163         {
00164             if (doLinkContinousMode(x, y))
00165                 return FALSE;
00166         }
00167         PV_LOGPRINTF("Seems no link!");                                    
00168     }
00169     if (view->isPanEnable())
00170     {
00171         // pan should never out of range of current document
00172         int deltaX = view->panPt.x - x;
00173         int deltaY = view->panPt.y - y;
00174 
00175         if (view->isPageMode())
00176         {
00177             view->ctrl->settings.moveScreenX(-deltaX);
00178             view->ctrl->settings.moveScreenY(-deltaY);                    
00179         }
00180         else
00181         {                    
00182             view->ctrl->settings.moveScreenX(deltaX);
00183             view->ctrl->settings.moveScreenY(deltaY);                    
00184         }
00185         validatePosition();
00186         displayPage(view->ctrl->settings.getCurrentPage(), ScrollToPosition);
00187         return FALSE;
00188     }  
00189     else if (view->isZoomInEnable())
00190     {
00191         view->adjustZoomRect(x, y);
00192         zoomFromRect(view->zoomRect.left, 
00193             view->zoomRect.top,
00194             view->zoomRect.right,
00195             view->zoomRect.bottom);
00196 
00197     }               
00198     else if (view->isZoomOutEnable())                    
00199     {
00200         view->adjustZoomRect(x, y);
00201         zoomToRect(view->zoomRect.left, 
00202             view->zoomRect.top,
00203             view->zoomRect.right,
00204             view->zoomRect.bottom);
00205     }
00206     return FALSE;
00207 }

Here is the call graph for this function:

gboolean CPDFLandscapeView::motionNotifyCbk ( GdkEventMotion *  event  ) 

Definition at line 209 of file PDFLandscapeView.cpp.

00210 {
00211     if (!isReady())
00212     {
00213         PV_LOGPRINTF("Not allow to handle mouse event now!");
00214         return FALSE;
00215     }
00216     int x = (int)event->x;
00217     int y = (int)event->y;
00218     if (y >= view->ctrl->settings.getScreenHeight())
00219     {
00220         PV_LOGPRINTF("Not allow to handle mouse event now!");
00221         return FALSE;
00222     }
00223     if (view->isZoomInEnable() || 
00224         view->isZoomOutEnable())
00225     {
00226         view->adjustZoomRect(x, y);        
00227     }   
00228     else if (view->isScribbleEnable())
00229     {
00230         int ox, oy; 
00231         int px, py;
00232         int pn = hitTest(x, y, ox, oy);
00233         
00234         // get page x & y
00235         getPageScreenPosition(pn, px, py);
00236         view->ctrl->scbMgr.onScribbleMove(pn, view->ctrl, px, py,
00237             x, y, ox, oy);
00238     }         
00239     else if (view->isEraseEnable())
00240     {
00241         int ox, oy; 
00242         int pn = hitTest(x, y, ox, oy);
00243         getPageScreenPosition(pn, x, y);
00244         view->ctrl->scbMgr.onEraseMove(pn, view->ctrl, 
00245             x, y, ox, oy);
00246     }
00247     return FALSE;
00248 }

Here is the call graph for this function:

gboolean CPDFLandscapeView::keyPressCbk ( GdkEventKey *  event  ) 

Definition at line 250 of file PDFLandscapeView.cpp.

00251 {
00252     if (event->time == 0)
00253     {
00254         onPageRendered(event->state);
00255         return FALSE;
00256     }
00257 
00258     switch (event->keyval)
00259     {
00260     case GDK_Home:
00261         displayPage(1);
00262         break;
00263     case GDK_F5:
00264         view->quit();
00265         break;  
00266     case GDK_Page_Up:
00267         view->ctrl->settings.setRenderDir(RenderPrev);
00268         if (view->ctrl->settings.getCurrentPage() <= 1)
00269         {
00270             displayPage(1, ScrollToPrevPage);    
00271         }
00272         else
00273         {
00274             displayPage(view->ctrl->settings.getCurrentPage() - 1, ScrollToPrevPage);
00275         }   
00276         break;
00277     case GDK_Page_Down:
00278         view->ctrl->settings.setRenderDir(RenderNext);
00279         if (view->ctrl->settings.getCurrentPage() >= view->ctrl->core->getNumPages())
00280         {
00281             displayPage(view->ctrl->settings.getCurrentPage(), ScrollToNextPage);    
00282         }
00283         else
00284         {
00285             displayPage(view->ctrl->settings.getCurrentPage() + 1, ScrollToNextPage);
00286         }   
00287         break;
00288     case GDK_F1: // iRex: long pageflip forward 
00289         view->ctrl->settings.setRenderDir(RenderNext);
00290         if (view->ctrl->settings.getCurrentPage() + JumpWidth > view->ctrl->core->getNumPages())
00291         {
00292             displayPage(view->ctrl->core->getNumPages());
00293         }
00294         else
00295         {
00296             displayPage(view->ctrl->settings.getCurrentPage() + JumpWidth, ScrollToNextPages);
00297         }            
00298         break;
00299     case GDK_F2: // iRex: long pageflip backward 
00300         view->ctrl->settings.setRenderDir(RenderPrev);
00301         if ((view->ctrl->settings.getCurrentPage() - JumpWidth) < 1)
00302         {
00303             displayPage(1);
00304         }
00305         else
00306         {
00307             displayPage(view->ctrl->settings.getCurrentPage() - JumpWidth, ScrollToPrevPages);
00308         }            
00309         break;
00310     default:
00311         view->ctrl->channels.busy_off();
00312         break; // no return: do not bypass keyPressCbk
00313     }
00314     return FALSE;
00315 }

Here is the call graph for this function:

gboolean CPDFLandscapeView::deleteCbk ( GdkEvent *  event  ) 

Definition at line 317 of file PDFLandscapeView.cpp.

00318 {
00319     return TRUE;
00320 }


Member Data Documentation

Definition at line 38 of file PDFLandscapeView.h.

Definition at line 39 of file PDFLandscapeView.h.

Definition at line 40 of file PDFLandscapeView.h.

Definition at line 41 of file PDFLandscapeView.h.

int CPDFLandscapeView::nEnd [private]

Definition at line 41 of file PDFLandscapeView.h.

Definition at line 42 of file PDFLandscapeView.h.

GBool CPDFLandscapeView::bReady [private]

Definition at line 43 of file PDFLandscapeView.h.


The documentation for this class was generated from the following files:

Generated on Wed Feb 4 18:26:18 2009 by  doxygen 1.5.6