[Okular-devel] Review Request: Implement the handling of page rotations for source references

Albert Astals Cid aacid at kde.org
Thu Nov 10 00:46:11 UTC 2011


A Dimecres, 9 de novembre de 2011, Michel Ludwig vàreu escriure:
> Hi Albert,
> 
> On Wed 09 Nov 2011 17:53:38 you wrote:
> > Ok, here comes my suggestion. It is basically veeeeery similar to your
> > patch but touches [almost] no generator code.
> > 
> > What do you think?
> > 
> > Albert
> > 
> > P.S: It seems there is a kind of "refresh" problem after the rotation is
> > switched but that should be hopefully easy to fix for you?
> 
> In my patch I assumed that *every* viewport is relative to Rotation0. I
> should have maybe made this more explicit. This seems to be important for
> the viewport history, for example. Without this, the viewports stored in
> the history will point to the wrong location after switching the rotation,
> I think. At least I couldn't find a mechanism that would correct this.

That every viewport is relative to Rotation0, would be awesome.

The problem is that it is not true. For example 
PageView::slotRequestVisiblePixmaps calls 
d->document->setViewport() with 
        newViewport.rePos.normalizedX = focusedX;
        newViewport.rePos.normalizedY = focusedY;
where focusedX come from the view (thus i guess they are "wrong" in rotated 
pages)
Also there is 
            newViewport.pageNumber = d->items.count() - 1;
            newViewport.rePos.enabled = true;
            newViewport.rePos.normalizedY = 0.0;
            d->document->setViewport( newViewport );
to go to the next page, where here it does not mean we want to go to the left 
of the page if we are in rotate270, it means we want to go to the top of the 
viewing area.

Unfortunately we are mixing viewports that are Rotate0 based with some others 
that are based in the current rotation. If you want to go thourgh all 
setViewport & friends and check that the normalized positions are Rotate0, i 
fully support that, since it really makes a lot of sense (and what we have now 
is simply wrong).

Albert


> 
> Also, the last source location was previously stored relative to Rotation 0
> as well (as it was asking for 'm_document->viewport()' in
> 'Part::showSourceLocation'). Now, it is stored relative to the current
> rotation, and once that changes it will point to the wrong location again,
> which can be seen by the refresh problem you noticed.
> 
> Do you maybe have an idea how this could be added back?
> 
> 
> Thanks,
> 
> Michel


More information about the Okular-devel mailing list