| Summary: | No scrolling when selection reaches border | ||
|---|---|---|---|
| Product: | [Unmaintained] kpdf | Reporter: | Kyryll A Mirnenko aka Mirya <mirya> |
| Component: | general | Assignee: | Albert Astals Cid <aacid> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | CC: | philipp.sternberg |
| Priority: | NOR | ||
| Version First Reported In: | 0.4 | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | FreeBSD | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Kyryll A Mirnenko aka Mirya
2005-06-20 21:35:17 UTC
I don't know about the other two problems, but I was just going to post something about scrolling myself. I noticed the same problem. You start selecting down a page, reach the end of the screen, and it doesn't scroll naturally to keep selecting, as one would expect. I think that's a very important feature to have. Thanks. SVN commit 606296 by aacid:
Fix "No scrolling when selection reaches border"
BUGS: 107803
M +29 -0 pageview.cpp
M +3 -1 pageview.h
--- branches/KDE/3.5/kdegraphics/kpdf/ui/pageview.cpp #606295:606296
@@ -97,6 +97,10 @@
bool blockPixmapsRequest; // prevent pixmap requests
PageViewMessage * messageWindow; // in pageviewutils.h
+ // drag scroll
+ QPoint dragScrollVector;
+ QTimer dragScrollTimer;
+
// actions
KToggleAction * aMouseNormal;
KToggleAction * aMouseSelect;
@@ -158,6 +162,7 @@
// conntect the padding of the viewport to pixmaps requests
connect( this, SIGNAL(contentsMoving(int, int)), this, SLOT(slotRequestVisiblePixmaps(int, int)) );
+ connect( &d->dragScrollTimer, SIGNAL(timeout()), this, SLOT(slotDragScroll()) );
// set a corner button to resize the view to the page size
// QPushButton * resizeButton = new QPushButton( viewport() );
@@ -897,6 +902,9 @@
void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
{
+ // stop the drag scrolling
+ d->dragScrollTimer.stop();
+
// don't perform any mouse action when no document is shown
if ( d->items.isEmpty() )
{
@@ -1377,6 +1385,20 @@
void PageView::selectionEndPoint( int x, int y )
{
+ if (x < contentsX()) d->dragScrollVector.setX(x - contentsX());
+ else if (contentsX() + viewport()->width() < x) d->dragScrollVector.setX(x - contentsX() - viewport()->width());
+ else d->dragScrollVector.setX(0);
+
+ if (y < contentsY()) d->dragScrollVector.setY(y - contentsY());
+ else if (contentsY() + viewport()->height() < y) d->dragScrollVector.setY(y - contentsY() - viewport()->height());
+ else d->dragScrollVector.setY(0);
+
+ if (d->dragScrollVector != QPoint(0, 0))
+ {
+ if (!d->dragScrollTimer.isActive()) d->dragScrollTimer.start(100);
+ }
+ else d->dragScrollTimer.stop();
+
// clip selection to the viewport
QRect viewportRect( contentsX(), contentsY(), visibleWidth(), visibleHeight() );
x = QMAX( QMIN( x, viewportRect.right() ), viewportRect.left() );
@@ -1910,6 +1932,13 @@
scrollBy( 0, d->scrollIncrement > 0 ? scrollOffset[ index ] : -scrollOffset[ index ] );
}
+void PageView::slotDragScroll()
+{
+ scrollBy(d->dragScrollVector.x(), d->dragScrollVector.y());
+ QPoint p = viewportToContents( mapFromGlobal( QCursor::pos() ) );
+ selectionEndPoint( p.x(), p.y() );
+}
+
void PageView::findAheadStop()
{
d->typeAheadActive = false;
--- branches/KDE/3.5/kdegraphics/kpdf/ui/pageview.h #606295:606296
@@ -118,9 +118,11 @@
void slotMoveViewport();
// activated by the autoscroll timer (Shift+Up/Down keys)
void slotAutoScoll();
+ // activated by the dragScroll timer
+ void slotDragScroll();
// type-ahead find timeout
void findAheadStop();
- // sow the welcome message
+ // show the welcome message
void slotShowWelcome();
// connected to local actions (toolbar, menu, ..)
|