[Okular-devel] [Bug 205084] dvi source references don't work properly when --unique is used (not a backend problem)

Jochen Trumpf Jochen.Trumpf at anu.edu.au
Fri Jan 8 04:16:07 CET 2010


https://bugs.kde.org/show_bug.cgi?id=205084





--- Comment #16 from Jochen Trumpf <Jochen Trumpf anu edu au>  2010-01-08 04:16:03 ---
Yes, indeed, that fixes the dvi case. And even better, it led me to improve the
pdf case a bit as well:

--- generator_pdf.cpp.orig      2010-01-08 12:29:07.000000000 +1100
+++ generator_pdf.cpp   2010-01-08 14:05:21.000000000 +1100
@@ -1541,11 +1541,12 @@

             if ( !viewport.isValid() ) return;

-            // TeX small points ...
-            viewport.rePos.normalizedX = (synctex_node_h( node ) * dpiX) /
(72.27 * 65536.0 * document()->page(viewport.pageNumber)->width());
-            viewport.rePos.normalizedY = (synctex_node_v( node ) * dpiY) /
(72.27 * 65536.0 * document()->page(viewport.pageNumber)->height());
-            viewport.rePos.enabled = true;
-            viewport.rePos.pos = Okular::DocumentViewport::TopLeft;
+           double px = (synctex_node_visible_h( node ) * dpiX) / 72.27;
+            double py = (synctex_node_visible_v( node ) * dpiY) / 72.27;
+            viewport.rePos.normalizedX = px /
document()->page(viewport.pageNumber)->width();
+            viewport.rePos.normalizedY = ( py + 0.5 ) /
document()->page(viewport.pageNumber)->height();
+           viewport.rePos.enabled = true;
+            viewport.rePos.pos = Okular::DocumentViewport::Center;

             return;
         }

With this change the target gets positioned more accurately within the center
of the current view which makes finding it easier in cluttered pages. The trick
is the "+ 0.5" in the correct units. Don't ask me why but the dvi case does
this as well ...

So, with the changes from comment #13, comment #15 and this comment committed
the bug can be finally closed as fixed IMHO.

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Okular-devel mailing list