[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kpdf/annotations/kdegraphics/kpdf
From: Piotr Szymanski <djurban () pld-dc ! org>
Date: 2005-07-15 15:31:04
Message-ID: 1121441464.023340.10730.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 434832 by djurban:
- backporting:
http://robotics.dei.unipd.it/~koral/KPDF_HEAD 2005-02-16 to 2005-06-11 \
patches/TOAPPLY_OBJRECTS/
* patch_052.diff
* patch_094.diff
* patch_109_110.diff
also
SVN commit 431642 by aacid:
"this generates more bad than good"
this fixes bugs:
101648,106767,105454 on annotation branch
M +2 -2 core/page.cpp
M +1 -1 core/page.h
M +29 -17 ui/pageview.cpp
--- branches/kpdf/annotations/kdegraphics/kpdf/core/page.cpp #434831:434832
@@ -179,12 +179,12 @@
return result;
}
-const ObjectRect * KPDFPage::getObjectRect( double x, double y ) const
+const ObjectRect * KPDFPage::getObjectRect( ObjectRect::ObjectType type, double x, \
double y ) const {
QValueList< ObjectRect * >::const_iterator it = m_rects.begin(), end = \
m_rects.end(); for ( ; it != end; ++it )
if ( (*it)->contains( x, y ) )
- return *it;
+ if ((*it)->objectType() == type) return *it;
return 0;
}
--- branches/kpdf/annotations/kdegraphics/kpdf/core/page.h #434831:434832
@@ -58,7 +58,7 @@
NormalizedRect * findText( const QString & text, bool keepCase, \
NormalizedRect * last = 0 ) const; const QString getText( const NormalizedRect & \
rect ) const;
- const ObjectRect * getObjectRect( double x, double y ) const;
+ const ObjectRect * getObjectRect( ObjectRect::ObjectType type, double x, \
double y ) const; //const Annotation * getAnnotation( double x, double y ) const;
const KPDFPageTransition * getTransition() const;
//FIXME TEMP:
--- branches/kpdf/annotations/kdegraphics/kpdf/ui/pageview.cpp #434831:434832
@@ -302,7 +302,12 @@
// invalidate layout so relayout/repaint will happen on next viewport change
if ( pageSet.count() > 0 )
- d->dirtyLayout = true;
+ // TODO for Enrico: Check if doing always the slotRelayoutPages() is not
+ // suboptimal in some cases, i'd say it is not but a recheck will not hurt
+ // Need slotRelayoutPages() here instead of d->dirtyLayout = true
+ // because opening a pdf from another pdf will not trigger a viewportchange
+ // so pages are never relayouted
+ slotRelayoutPages();
else
resizeContents( 0, 0 );
@@ -997,25 +1002,31 @@
{
double nX = (double)(e->x() - pageItem->geometry().left()) / \
(double)pageItem->width(),
nY = (double)(e->y() - pageItem->geometry().top()) / \
(double)pageItem->height();
- const ObjectRect * rect = pageItem->page()->getObjectRect( nX, nY );
+ const ObjectRect * rect;
+ rect = pageItem->page()->getObjectRect( ObjectRect::Link, nX, nY );
if ( rect )
{
- // handle click over a link/image
- switch ( rect->objectType() )
+ // handle click over a link
+ const KPDFLink * link = static_cast< const KPDFLink * >( \
rect->pointer() ); + d->document->processLink( link );
+ }
+ else
+ {
+ // a link can move us to another page or even to another \
document, there's no point in trying to + // process the click on \
the image once we have processes the click on the link + rect = \
pageItem->page()->getObjectRect( ObjectRect::Image, nX, nY ); + if \
( rect ) {
- case ObjectRect::Link:{
- const KPDFLink * link = static_cast< const KPDFLink * >( \
rect->pointer() );
- d->document->processLink( link );
- }break;
- case ObjectRect::Image:
- break;
+ // handle click over a image
}
+/* Enrico and me have decided this is not worth the trouble it generates
+ else
+ {
+ // if not on a rect, the click selects the page
+ // if ( pageItem->pageNumber() != \
(int)d->document->currentPage() ) + \
d->document->setViewportPage( pageItem->pageNumber(), PAGEVIEW_ID ); + \
}*/ }
- else if ( pageItem->pageNumber() != (int)d->document->currentPage() \
)
- {
- // click to select different pages
- d->document->setViewportPage( pageItem->pageNumber(), \
PAGEVIEW_ID );
- }
}
else if ( rightButton )
{
@@ -1382,6 +1393,7 @@
{
height = kpdfPage->ratio() * colWidth;
item->setWHZ( colWidth, (int)height, (double)colWidth / width );
+ d->zoomFactor = (double)colWidth / width;
}
else if ( d->zoomMode == ZoomFitPage )
{
@@ -1389,6 +1401,7 @@
double scaleH = (double)rowHeight / (double)height;
zoom = QMIN( scaleW, scaleH );
item->setWHZ( (int)(zoom * width), (int)(zoom * height), zoom );
+ d->zoomFactor = zoom;
}
#ifndef NDEBUG
else
@@ -1589,8 +1602,7 @@
nY = (double)(p.y() - pageItem->geometry().top()) / \
(double)pageItem->height();
// if over a ObjectRect (of type Link) change cursor to hand
- const ObjectRect * r = pageItem->page()->getObjectRect( nX, nY );
- d->mouseOnRect = r && r->objectType() == ObjectRect::Link;
+ d->mouseOnRect = pageItem->page()->getObjectRect( ObjectRect::Link, nX, nY \
); if ( d->mouseOnRect )
setCursor( pointingHandCursor );
else
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic