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

List:       kde-commits
Subject:    KDE/kdegraphics/kviewshell/shell
From:       Stefan Kebekus <kebekus () kde ! org>
Date:       2006-08-27 8:03:37
Message-ID: 1156665817.032216.25394.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 577623 by kebekus:

added framework so plugins can specify that they mark hyperlins themselves


 M  +20 -21    documentWidget.cpp  
 M  +9 -14     optionDialogGUIWidget.ui  
 M  +2 -1      renderedDocumentPage.cpp  
 M  +12 -2     renderedDocumentPage.h  


--- trunk/KDE/kdegraphics/kviewshell/shell/documentWidget.cpp #577622:577623
@@ -331,33 +331,32 @@
   p.setMatrix(transform());
 
   // Underline hyperlinks
-  if (dataModel->preferences()->underlineLinks() == \
                KVSPrefs::EnumUnderlineLinks::Enabled ||
-      dataModel->preferences()->underlineLinks() == \
                KVSPrefs::EnumUnderlineLinks::OnlyOnHover)
-  {
-    int h = 2; // Height of line.
-    for(int i = 0; i < (int)pageData->hyperLinkList.size(); i++)
-    {
-      if (dataModel->preferences()->underlineLinks() == \
                KVSPrefs::EnumUnderlineLinks::OnlyOnHover &&
-          i != indexOfUnderlinedLink)
-        continue;
-      int x = pageData->hyperLinkList[i].box.left();
-      int w = pageData->hyperLinkList[i].box.width();
-      int y = pageData->hyperLinkList[i].baseline;
-
-      QRect hyperLinkRect(x, y, w, h);
-      //if (hyperLinkRect.intersects(inverseMap(e->rect()))) //FIXME: need to \
                transform events
-      {
+  if (pageData->hyperlinks_are_marked == false) // If hyperlinks are marked already, \
we don't underline them +    if (dataModel->preferences()->underlineLinks() == \
KVSPrefs::EnumUnderlineLinks::Enabled || +        \
dataModel->preferences()->underlineLinks() == \
KVSPrefs::EnumUnderlineLinks::OnlyOnHover) { +      int h = 2; // Height of line.
+      for(int i = 0; i < (int)pageData->hyperLinkList.size(); i++) {
+        if (dataModel->preferences()->underlineLinks() == \
KVSPrefs::EnumUnderlineLinks::OnlyOnHover && +            i != indexOfUnderlinedLink)
+          continue;
+        int x = pageData->hyperLinkList[i].box.left();
+        int w = pageData->hyperLinkList[i].box.width();
+        int y = pageData->hyperLinkList[i].baseline;
+        
+        QRect hyperLinkRect(x, y, w, h);
+        //if (hyperLinkRect.intersects(inverseMap(e->rect()))) //FIXME: need to \
transform events +        {
 #ifdef DEBUG_DOCUMENTWIDGET
-        kDebug(kvs::shell) << "Underline hyperlink \"" << \
pageData->hyperLinkList[i].linkText << "\"" << endl; +          kDebug(kvs::shell) << \
"Underline hyperlink \"" << pageData->hyperLinkList[i].linkText << "\"" << endl;  \
                #endif
-        p.fillRect(x, y, w, h, KGlobalSettings::linkColor());
+          p.fillRect(x, y, w, h, KGlobalSettings::linkColor());
+        }
       }
     }
-  }
-
+  
   // Paint flashing frame, if appropriate
   if (animationCounter > 0 && animationCounter < 10)
-  {
+    {
     int gbChannel = 255 - (9-animationCounter)*28;
     p.setPen(QPen(QColor(255, gbChannel, gbChannel), 3));
     p.drawRect(linkFlashRect());
--- trunk/KDE/kdegraphics/kviewshell/shell/optionDialogGUIWidget.ui #577622:577623
@@ -1,15 +1,12 @@
 <ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
  <class>optionDialogGUIWidget</class>
  <widget class="QWidget" name="optionDialogGUIWidget" >
   <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>506</width>
-    <height>398</height>
+    <width>400</width>
+    <height>300</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -33,7 +30,7 @@
       </sizepolicy>
      </property>
      <property name="text" >
-      <string>Underline links:</string>
+      <string>Mark Hyperlinks:</string>
      </property>
     </widget>
    </item>
@@ -90,27 +87,26 @@
    </item>
    <item row="0" column="1" >
     <widget class="QComboBox" name="kcfg_UnderlineLinks" >
-     <property name="whatsThis" >
-      <string>&lt;qt>Controls how hyperlinks are underlined:
+     <property name="toolTip" >
+      <string>&lt;qt>Some documents specify how hyperlinks are marked on screen. For \
other documents, this field controls how hyperlinks are underlined.  &lt;ul>
 &lt;li>&lt;b>Enabled&lt;/b>: Always underline links&lt;/li>
 &lt;li>&lt;b>Disabled&lt;/b>: Never underline links&lt;/li>
-&lt;li>&lt;b>Only on Hover&lt;/b>: Underline when the mouse is moved over the \
                link&lt;/li>
-&lt;/ul>&lt;/qt></string>
+&lt;li>&lt;b>Only on Hover&lt;/b>: Underline when the mouse is moved over the \
link&lt;/li>&lt;/ul>&lt;/qt></string>  </property>
      <item>
       <property name="text" >
-       <string>Enabled</string>
+       <string>Underline hyperlinks</string>
       </property>
      </item>
      <item>
       <property name="text" >
-       <string>Disabled</string>
+       <string>Do not mark hyperlinks</string>
       </property>
      </item>
      <item>
       <property name="text" >
-       <string>Only on Hover</string>
+       <string>Underline hyperlinks only on hover</string>
       </property>
      </item>
     </widget>
@@ -213,7 +209,6 @@
    <extends>QGroupBox</extends>
    <header>Qt3Support/Q3GroupBox</header>
    <container>1</container>
-   <pixmap></pixmap>
   </customwidget>
  </customwidgets>
  <tabstops>
--- trunk/KDE/kdegraphics/kviewshell/shell/renderedDocumentPage.cpp #577622:577623
@@ -5,7 +5,7 @@
 // Widget for displaying TeX DVI files.
 // Part of KDVI- A previewer for TeX DVI files.
 //
-// (C) 2004 Stefan Kebekus.
+// (C) 2004-2006 Stefan Kebekus.
 // (C) 2005-2006 Wilfried Huss.
 //
 // Distributed under the GPL.
@@ -29,6 +29,7 @@
   pageNr = 0;
   isEmpty = true;
   pageText = QString::null;
+  hyperlinks_are_marked = false;
 }
 
 
--- trunk/KDE/kdegraphics/kviewshell/shell/renderedDocumentPage.h #577622:577623
@@ -5,7 +5,7 @@
 // Widget for displaying TeX DVI files.
 // Part of KDVI- A previewer for TeX DVI files.
 //
-// (C) 2004-2005 Stefan Kebekus. 
+// (C) 2004-2006 Stefan Kebekus. 
 // (C) 2005-2006 Wilfried Huss
 //
 // Distributed under the GPL.
@@ -70,7 +70,6 @@
     documentRenderer.drawPage() is used again.
 
     @author Stefan Kebekus <kebekus@kde.org>
-    @version 1.0.0
 */
 
 class KVIEWSHELL_EXPORT RenderedDocumentPage : public QObject
@@ -204,6 +203,17 @@
 
   void setTransition(KPDFPageTransition* pageTransition);
 
+  /** Indicates if hyperlinks are drawn
+      
+  Some document formats, e.g. PDF, specify how hyperlinks appear on
+  screen, and the hyperlink is drawn by the documentRenderer. In that
+  case, the documentRenderer sets this member to 'true'. KViewShell
+  will then not attempt to mark the hyperlink itself.
+  
+  This member is set to 'false' in the constructor.
+  */
+  bool hyperlinks_are_marked;
+
  private:
   /** \brief Page number
 


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

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