[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/graphics/okular/generators/dvi
From:       Pino Toscano <toscano.pino () tiscali ! it>
Date:       2006-06-30 22:52:56
Message-ID: 1151707976.086062.12863.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 556625 by pino:

Make use of okularUtils, and use a Center viewport position for links.
(Luigi Toscano)


 M  +5 -35     generator_dvi.cpp  


--- trunk/playground/graphics/okular/generators/dvi/generator_dvi.cpp #556624:556625
@@ -10,6 +10,7 @@
 #include "generator_dvi.h"
 #include "core/page.h"
 #include "core/link.h"
+#include "core/utils.h"
 #include "dviFile.h"
 #include "dviPageInfo.h"
 #include "dviRenderer.h"
@@ -98,36 +99,6 @@
 
 }
 
-static QRect rotateQRect( QRect source, int pageWidth, int pageHeight, int orientation )
-{
-    QRect tr;
-
-    // adapt the coordinates of the boxes to the rotation 
-    switch ( orientation )
-    {
-     case 0:   /* no modifications */
-        tr = source;
-        break;
-     case 1:
-        tr = QRect( pageWidth-source.y()-source.height(),
-                    source.x(),
-                    source.height(), source.width() );
-        break;
-     case 2:
-        tr = QRect( pageWidth-source.x()-source.width(),
-                    pageHeight-source.y()-source.height(),
-                    source.width(), source.height() );
-        break;
-     case 3:
-        tr = QRect( source.y(),
-                    pageHeight-source.x()-source.width(),
-                    source.height(), source.width() );
-        break;
-    }
-
-    return tr;
-}
-
 void DviGenerator::fillViewportFromAnchor( DocumentViewport &vp,
                                            const Anchor &anch, int pW, int pH, 
                                            int orientation ) 
@@ -151,8 +122,7 @@
     vp.rePos.normalizedX = vp_x;
     vp.rePos.normalizedY = vp_y;
     vp.rePos.enabled = true;
-    vp.rePos.pos = DocumentViewport::TopLeft;
-
+    vp.rePos.pos = DocumentViewport::Center;
 }
 
 QLinkedList<ObjectRect*> DviGenerator::generateDviLinks( const dviPageInfo *pageInfo,   
@@ -167,8 +137,8 @@
 
     foreach( const Hyperlink dviLink, pageInfo->hyperLinkList )
     {
-        QRect boxArea = rotateQRect( dviLink.box, pageWidth, pageHeight, 
-                                     orientation );
+        QRect boxArea = okularUtils::rotateRect( dviLink.box, pageWidth, pageHeight, 
+                                                 orientation );
         double nl = (double)boxArea.left() / pageWidth,
                nt = (double)boxArea.top() / pageHeight,
                nr = (double)boxArea.right() / pageWidth,
@@ -311,7 +281,7 @@
     {
         TextBox curTB = *it;
  
-        tmpRect = rotateQRect( curTB.box, pageWidth, pageHeight, orientation );
+        tmpRect = okularUtils::rotateRect( curTB.box, pageWidth, pageHeight, orientation );
 
 #if 0
         kDebug() << "orientation: " << orientation
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic