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

List:       kde-commits
Subject:    KDE/kdegraphics/kviewshell
From:       Stefan Kebekus <kebekus () kde ! org>
Date:       2006-04-01 3:51:33
Message-ID: 1143863493.851762.20865.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 525172 by kebekus:

fixes problems with closing files, mouse scrolling and alpha-channel detection in the \
dvi plugin


 M  +13 -17    plugins/dvi/dviWidget.cpp  
 M  +3 -5      plugins/dvi/fontpool.cpp  
 M  +7 -15     plugins/dvi/psgs.cpp  
 M  +15 -0     shell/kviewpart.cpp  
 M  +1 -5      shell/pageView.cpp  


--- trunk/KDE/kdegraphics/kviewshell/plugins/dvi/dviWidget.cpp #525171:525172
@@ -30,31 +30,31 @@
 
 void DVIWidget::mousePressEvent(QMouseEvent* e)
 {
+  // Call implementation from parent
+  DocumentWidget::mousePressEvent(e);
+
   // Safety check
-  if (!pageNumber.isValid())
+  if (!pageNumber.isValid()) {
     return;
-
+  }
+  
   // Get a pointer to the page contents
   RenderedDviPagePixmap* pageData = \
                dynamic_cast<RenderedDviPagePixmap*>(documentCache->getPage(pageNumber));
                
-  if (pageData == 0)
-  {
+  if (pageData == 0) {
     kDebug(kvs::dvi) << "DVIWidget::mousePressEvent(...) pageData for page #" << \
pageNumber << " is empty" << endl;  return;
   }
-
+  
   // Check if the mouse is pressed on a source-hyperlink
   // source hyperlinks can be invoked with the Middle Mousebutton or alternatively
   // with Control+Left Mousebutton
   if ((e->button() == Qt::MidButton || (e->button() == Qt::LeftButton && (e->state() \
                & Qt::ControlButton)))
-      && (pageData->sourceHyperLinkList.size() > 0))
-  {
+      && (pageData->sourceHyperLinkList.size() > 0)) {
     int minIndex = 0;
     int minimum = 0;
-
-    for(int i=0; i<pageData->sourceHyperLinkList.size(); i++)
-    {
-      if (pageData->sourceHyperLinkList[i].box.contains(inverseMap(e->pos())))
-      {
+    
+    for(int i=0; i<pageData->sourceHyperLinkList.size(); i++) {
+      if (pageData->sourceHyperLinkList[i].box.contains(inverseMap(e->pos()))) {
         emit(SRCLink(pageData->sourceHyperLinkList[i].linkText, \
inverseMap(e->pos()), this));  e->accept();
         return;
@@ -63,8 +63,7 @@
       QPoint center = pageData->sourceHyperLinkList[i].box.center();
       int dx = center.x() - e->pos().x();
       int dy = center.y() - e->pos().y();
-      if (dx*dx + dy*dy < minimum || i == 0)
-      {
+      if (dx*dx + dy*dy < minimum || i == 0) {
         minIndex = i;
         minimum = dx*dx + dy*dy;
       }
@@ -73,9 +72,6 @@
     emit(SRCLink(pageData->sourceHyperLinkList[minIndex].linkText, \
inverseMap(e->pos()), this));  e->accept();
   }
-
-  // Call implementation from parent
-  DocumentWidget::mousePressEvent(e);
 }
 
 
--- trunk/KDE/kdegraphics/kviewshell/plugins/dvi/fontpool.cpp #525171:525172
@@ -70,12 +70,11 @@
   connect(&kpsewhich_, SIGNAL(readyReadStandardError()),
           this, SLOT(mf_output_receiver()));
 
-  /*
   // Check if the QT library supports the alpha channel of
-  // pixmaps. Experiments show that --depending of the configuration
+  // QImages. Experiments show that --depending of the configuration
   // of QT at compile and runtime or the availability of the XFt
   // extension, alpha channels are either supported, or silently
-  // converted to 1-bit masks.
+  // ignored.
   QImage start(1, 1, 32); // Generate a 1x1 image, black with alpha=0x10
   start.setAlphaBuffer(true);
   quint32 *destScanLine = (quint32 *)start.scanLine(0);
@@ -99,8 +98,7 @@
     kDebug(kvs::dvi) << "fontPool::fontPool(): QPixmap supports the alpha channel" \
<< endl;  #endif
     QPixmapSupportsAlpha = true;
-  }*/
-  QPixmapSupportsAlpha = true;
+  }
 }
 
 
--- trunk/KDE/kdegraphics/kviewshell/plugins/dvi/psgs.cpp #525171:525172
@@ -17,6 +17,7 @@
 
 #include <klocale.h>
 #include <kmessagebox.h>
+#include <kprocio.h>
 #include <kurl.h>
 
 #include <QDir>
@@ -240,8 +241,7 @@
   QProcess gs;
   gs.setReadChannelMode(QProcess::MergedChannels);
 
-  // FIXME Investigate why the QProcess can not be started in a Thread.
-  // This works in Qt3, and according the Qt4 Documentation should still work.
+#warning Investigate why the QProcess can not be started in a Thread. This works in \
Qt3, and according the Qt4 Documentation should still work.  return;
   gs.start(gs_exe, gs_args);
   
@@ -362,19 +362,11 @@
 
   // Otherwise, use kpsewhich to find the eps file.
   QString EPSfilename;
-
-  QProcess kpsewhich;
-  kpsewhich.setReadChannelMode(QProcess::MergedChannels);
-  kpsewhich.start("kpsewhich",
-                  QStringList() << filename,
-                  QIODevice::ReadOnly|QIODevice::Text);
-
-  if (kpsewhich.waitForStarted()) {
-    // We wait here while the external program runs concurrently.
-    kpsewhich.waitForFinished(-1);
-    EPSfilename = QString(kpsewhich.readAll()).trimmed();
-  }
-
+  KProcIO proc;
+  proc << "kpsewhich" << filename;
+  proc.start(KProcess::Block);
+  proc.readln(EPSfilename);
+  
   return EPSfilename;
 }
 
--- trunk/KDE/kdegraphics/kviewshell/shell/kviewpart.cpp #525171:525172
@@ -1120,6 +1120,21 @@
   if( watch && !m_file.isEmpty() )
     watch->removeFile( m_file );
 
+  // Clear navigation history.
+  document_history.clear();
+
+  // Delete Page Widgets.
+  pageView()->clear();
+  for (int i = 0; i < widgetList.size(); i++)
+    delete widgetList[i];
+  widgetList.clear();
+
+  // Clear Thumbnail List.
+  _markList->clear();
+
+  // Clear Table of Contents
+  tableOfContents->clear();
+
   multiPage->closeURL();
   m_url = KUrl();
   checkActions();
--- trunk/KDE/kdegraphics/kviewshell/shell/pageView.cpp #525171:525172
@@ -77,8 +77,8 @@
   widgetList.clear();
   layoutPages();
 }
+	
 
-
 bool PageView::atTop() const
 {
   return verticalScrollBar()->value() == verticalScrollBar()->minValue();
@@ -276,10 +276,6 @@
 
 void PageView::layoutPages(bool zoomChanged)
 {
-  // Paranoid safety check
-  if (widgetList.isEmpty())
-    return;
-
   // If there are no widgets, e.g. because the last widget has been
   // removed, the matter is easy: set the contents size to 0. If there
   // are no widgets because previously existing widgets were removed


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

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