Changeset View
Changeset View
Standalone View
Standalone View
ui/pageview.cpp
Show First 20 Lines • Show All 1467 Lines • ▼ Show 20 Line(s) | 1467 | { | |||
---|---|---|---|---|---|
1468 | if ( previous != -1 ) | 1468 | if ( previous != -1 ) | ||
1469 | { | 1469 | { | ||
1470 | PageViewItem * item = d->items.at( previous ); | 1470 | PageViewItem * item = d->items.at( previous ); | ||
1471 | if ( item ) | 1471 | if ( item ) | ||
1472 | { | 1472 | { | ||
1473 | Q_FOREACH ( VideoWidget *videoWidget, item->videoWidgets() ) | 1473 | Q_FOREACH ( VideoWidget *videoWidget, item->videoWidgets() ) | ||
1474 | videoWidget->pageLeft(); | 1474 | videoWidget->pageLeft(); | ||
1475 | } | 1475 | } | ||
1476 | | ||||
1477 | // On close, run the widget scripts, needed for running animated PDF | ||||
1478 | const Okular::Page *page = d->document->page( previous ); | ||||
1479 | foreach( Okular::Annotation *annotation, page->annotations() ) | ||||
1480 | { | ||||
1481 | if ( annotation->subType() == Okular::Annotation::AWidget ) | ||||
1482 | { | ||||
1483 | Okular::WidgetAnnotation *widgetAnnotation = static_cast<Okular::WidgetAnnotation*>( annotation ); | ||||
1484 | d->document->processAction( widgetAnnotation->additionalAction( Okular::Annotation::PageClosing ) ); | ||||
1485 | } | ||||
1486 | } | ||||
1487 | | ||||
1476 | } | 1488 | } | ||
1477 | 1489 | | |||
1478 | if ( current != -1 ) | 1490 | if ( current != -1 ) | ||
1479 | { | 1491 | { | ||
1480 | PageViewItem * item = d->items.at( current ); | 1492 | PageViewItem * item = d->items.at( current ); | ||
1481 | if ( item ) | 1493 | if ( item ) | ||
1482 | { | 1494 | { | ||
1483 | Q_FOREACH ( VideoWidget *videoWidget, item->videoWidgets() ) | 1495 | Q_FOREACH ( VideoWidget *videoWidget, item->videoWidgets() ) | ||
1484 | videoWidget->pageEntered(); | 1496 | videoWidget->pageEntered(); | ||
1485 | } | 1497 | } | ||
1486 | 1498 | | |||
1487 | // update zoom text and factor if in a ZoomFit/* zoom mode | 1499 | // update zoom text and factor if in a ZoomFit/* zoom mode | ||
1488 | if ( d->zoomMode != ZoomFixed ) | 1500 | if ( d->zoomMode != ZoomFixed ) | ||
1489 | updateZoomText(); | 1501 | updateZoomText(); | ||
1502 | | ||||
1503 | // Opening any widget scripts, needed for running animated PDF | ||||
1504 | const Okular::Page *page = d->document->page( current ); | ||||
1505 | foreach( Okular::Annotation *annotation, page->annotations() ) | ||||
1506 | { | ||||
1507 | if ( annotation->subType() == Okular::Annotation::AWidget ) | ||||
1508 | { | ||||
1509 | Okular::WidgetAnnotation *widgetAnnotation = static_cast<Okular::WidgetAnnotation*>( annotation ); | ||||
1510 | d->document->processAction( widgetAnnotation->additionalAction( Okular::Annotation::PageOpening ) ); | ||||
1511 | } | ||||
1512 | } | ||||
1490 | } | 1513 | } | ||
1491 | } | 1514 | } | ||
1492 | 1515 | | |||
1493 | //END DocumentObserver inherited methods | 1516 | //END DocumentObserver inherited methods | ||
1494 | 1517 | | |||
1495 | //BEGIN View inherited methods | 1518 | //BEGIN View inherited methods | ||
1496 | bool PageView::supportsCapability( ViewCapability capability ) const | 1519 | bool PageView::supportsCapability( ViewCapability capability ) const | ||
1497 | { | 1520 | { | ||
▲ Show 20 Lines • Show All 1068 Lines • ▼ Show 20 Line(s) | 2587 | #if 0 | |||
2566 | { | 2589 | { | ||
2567 | // a link can move us to another page or even to another document, there's no point in trying to | 2590 | // a link can move us to another page or even to another document, there's no point in trying to | ||
2568 | // process the click on the image once we have processes the click on the link | 2591 | // process the click on the image once we have processes the click on the link | ||
2569 | rect = pageItem->page()->objectRect( Okular::ObjectRect::Image, nX, nY, pageItem->width(), pageItem->height() ); | 2592 | rect = pageItem->page()->objectRect( Okular::ObjectRect::Image, nX, nY, pageItem->width(), pageItem->height() ); | ||
2570 | if ( rect ) | 2593 | if ( rect ) | ||
2571 | { | 2594 | { | ||
2572 | // handle click over a image | 2595 | // handle click over a image | ||
2573 | } | 2596 | } | ||
2574 | /* Enrico and me have decided this is not worth the trouble it generates | 2597 | /* Enrico and me have decided this is not worth the trouble it generates | ||
2575 | else | 2598 | else | ||
2576 | { | 2599 | { | ||
2577 | // if not on a rect, the click selects the page | 2600 | // if not on a rect, the click selects the page | ||
2578 | // if ( pageItem->pageNumber() != (int)d->document->currentPage() ) | 2601 | // if ( pageItem->pageNumber() != (int)d->document->currentPage() ) | ||
2579 | d->document->setViewportPage( pageItem->pageNumber(), this ); | 2602 | d->document->setViewportPage( pageItem->pageNumber(), this ); | ||
2580 | }*/ | 2603 | }*/ | ||
2581 | } | 2604 | } | ||
2582 | #endif | 2605 | #endif | ||
▲ Show 20 Lines • Show All 1166 Lines • ▼ Show 20 Line(s) | 3765 | { | |||
3749 | { | 3772 | { | ||
3750 | d->scrollIncrement = 0; | 3773 | d->scrollIncrement = 0; | ||
3751 | d->autoScrollTimer->stop(); | 3774 | d->autoScrollTimer->stop(); | ||
3752 | } | 3775 | } | ||
3753 | } | 3776 | } | ||
3754 | 3777 | | |||
3755 | void PageView::scrollPosIntoView( const QPoint & pos ) | 3778 | void PageView::scrollPosIntoView( const QPoint & pos ) | ||
3756 | { | 3779 | { | ||
3757 | // this number slows the speed of the page by its value, chosen not to be too fast or too slow, the actual speed is determined from the mouse position, not critical | 3780 | if (pos.x() < horizontalScrollBar()->value()) d->dragScrollVector.setX(pos.x() - horizontalScrollBar()->value()); | ||
3758 | const int damping=6; | 3781 | else if (horizontalScrollBar()->value() + viewport()->width() < pos.x()) d->dragScrollVector.setX(pos.x() - horizontalScrollBar()->value() - viewport()->width()); | ||
3759 | | ||||
3760 | if (pos.x() < horizontalScrollBar()->value()) d->dragScrollVector.setX((pos.x() - horizontalScrollBar()->value())/damping); | | |||
3761 | else if (horizontalScrollBar()->value() + viewport()->width() < pos.x()) d->dragScrollVector.setX((pos.x() - horizontalScrollBar()->value() - viewport()->width())/damping); | | |||
3762 | else d->dragScrollVector.setX(0); | 3782 | else d->dragScrollVector.setX(0); | ||
3763 | 3783 | | |||
3764 | if (pos.y() < verticalScrollBar()->value()) d->dragScrollVector.setY((pos.y() - verticalScrollBar()->value())/damping); | 3784 | if (pos.y() < verticalScrollBar()->value()) d->dragScrollVector.setY(pos.y() - verticalScrollBar()->value()); | ||
3765 | else if (verticalScrollBar()->value() + viewport()->height() < pos.y()) d->dragScrollVector.setY((pos.y() - verticalScrollBar()->value() - viewport()->height())/damping); | 3785 | else if (verticalScrollBar()->value() + viewport()->height() < pos.y()) d->dragScrollVector.setY(pos.y() - verticalScrollBar()->value() - viewport()->height()); | ||
3766 | else d->dragScrollVector.setY(0); | 3786 | else d->dragScrollVector.setY(0); | ||
3767 | 3787 | | |||
3768 | if (d->dragScrollVector != QPoint(0, 0)) | 3788 | if (d->dragScrollVector != QPoint(0, 0)) | ||
3769 | { | 3789 | { | ||
3770 | if (!d->dragScrollTimer.isActive()) d->dragScrollTimer.start(1000/60); //60 fps | 3790 | if (!d->dragScrollTimer.isActive()) d->dragScrollTimer.start(100); | ||
3771 | } | 3791 | } | ||
3772 | else d->dragScrollTimer.stop(); | 3792 | else d->dragScrollTimer.stop(); | ||
3773 | } | 3793 | } | ||
3774 | 3794 | | |||
3775 | QPoint PageView::viewportToContentArea( const Okular::DocumentViewport & vp ) const { | 3795 | QPoint PageView::viewportToContentArea( const Okular::DocumentViewport & vp ) const { | ||
3776 | Q_ASSERT( vp.pageNumber >= 0 ); | 3796 | Q_ASSERT( vp.pageNumber >= 0 ); | ||
3777 | 3797 | | |||
3778 | const QRect & r = d->items[ vp.pageNumber ]->croppedGeometry(); | 3798 | const QRect & r = d->items[ vp.pageNumber ]->croppedGeometry(); | ||
▲ Show 20 Lines • Show All 1806 Lines • Show Last 20 Lines |