diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/prerex/patches/kpdf-3.5.10.patch')
-rw-r--r-- | Master/texmf-dist/doc/latex/prerex/patches/kpdf-3.5.10.patch | 291 |
1 files changed, 291 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/prerex/patches/kpdf-3.5.10.patch b/Master/texmf-dist/doc/latex/prerex/patches/kpdf-3.5.10.patch new file mode 100644 index 00000000000..aa2eff80e73 --- /dev/null +++ b/Master/texmf-dist/doc/latex/prerex/patches/kpdf-3.5.10.patch @@ -0,0 +1,291 @@ +diff -cr kpdf.orig/core/document.cpp kpdf/core/document.cpp +*** kpdf.orig/core/document.cpp 2007-10-08 05:48:37.000000000 -0400 +--- kpdf/core/document.cpp 2009-09-29 16:56:48.000000000 -0400 +*************** +*** 26,31 **** +--- 26,32 ---- + #include <kuserprofile.h> + #include <krun.h> + #include <kstandarddirs.h> ++ #include <qclipboard.h> + + // local includes + #include "document.h" +*************** +*** 1066,1071 **** +--- 1067,1082 ---- + + case KPDFLink::Browse: { + const KPDFLinkBrowse * browse = static_cast< const KPDFLinkBrowse * >( link ); ++ if ( browse->url().startsWith( "coord:", false ) ) ++ { // for prerex: load coordinates of clicked box into the clipboard ++ QString message = browse->url(); ++ QClipboard *cb = QApplication::clipboard(); ++ message.remove("coord: "); ++ cb->setText(message, QClipboard::Selection ); ++ } ++ else if ( browse->url().startsWith( "anchor:", false ) ) // ignore it ++ { } ++ else + // if the url is a mailto one, invoke mailer + if ( browse->url().startsWith( "mailto:", false ) ) + kapp->invokeMailer( browse->url() ); +diff -cr kpdf.orig/core/page.cpp kpdf/core/page.cpp +*** kpdf.orig/core/page.cpp 2005-09-10 04:18:42.000000000 -0400 +--- kpdf/core/page.cpp 2009-09-29 16:56:48.000000000 -0400 +*************** +*** 13,24 **** +--- 13,27 ---- + #include <qmap.h> + #include <kdebug.h> + ++ #include <kmessagebox.h> ++ + // local includes + #include "page.h" + #include "pagetransition.h" + #include "link.h" + #include "conf/settings.h" + #include "xpdf/TextOutputDev.h" ++ #include <stdlib.h> + + + /** class KPDFPage **/ +*************** +*** 172,177 **** +--- 175,269 ---- + return 0; + } + ++ // computes the factor that scales from pixel coordinates to chart coordinates ++ const QPoint KPDFPage::scaleToChart (int xclick, int yclick, int widthPage, int heightPage) const ++ { ++ // Copyright (c) 2006 R. D. Tennent ++ // School of Computing, Queen's University, rdt@cs.queensu.ca ++ // ++ // There are *three* coordinate systems involved here: ++ // ++ // + chart coordinates, to which kpdf has no direct access ++ // ++ // + pixel coordinates, for example, as registered by a mouse click ++ // ++ // + normalized page coordinates in [0,1] range used internally ++ // by kpdf ++ // ++ // Implementation: ++ // ++ // Find the two "anchor: xci,yci" links, determine their ++ // "normalized" locations on the page, unnormalize to get the pixel ++ // coordinates (x1, y1) and (x2, y2) of their centre points, and ++ // then scale the mouse-click coordinates accordingly to get the ++ // corresponding chart coordinates (xc, yc). ++ // ++ QPoint clickChart = QPoint(); ++ bool first = false, second = false; ++ int x1=0, y1=0, x2=0, y2=0; // pixel coordinates of centre points of two anchor links ++ int xc1=0, yc1=0, xc2=0, yc2=0; // chart coordinates of anchors, as determined by their URIs ++ int xc=0, yc=0; // rounded chart coordinates of mouse-click location ++ ++ QValueList< ObjectRect * >::const_iterator it = m_rects.begin(), end = m_rects.end(); ++ for ( ; it != end; ++it ) ++ if ((*it)->objectType() == ObjectRect::Link) ++ { ++ const KPDFLink * link = static_cast< const KPDFLink * >( (*it)->pointer() ); ++ if (link) ++ { ++ const KPDFLinkBrowse * browse = dynamic_cast< const KPDFLinkBrowse * >( link ); ++ if (browse) ++ { ++ QString thisURL = browse->url(); ++ if (thisURL.startsWith( "anchor:", false) ) ++ { ++ int comma; ++ QString xs; ++ NormalizedRect * r = (*it); ++ QRect unnormalized; ++ thisURL.remove(0,7); // remove "anchor:" ++ comma = thisURL.find(','); ++ xs = thisURL.left(comma); // x coordinate as a string ++ thisURL.remove(0, comma+1); // y coordinate as a string ++ unnormalized = r->geometry(widthPage, heightPage); ++ if (!first) ++ { ++ QPoint p1; // centre of first anchor ++ xc1 = xs.toInt(); ++ yc1 = thisURL.toInt(); ++ p1 = unnormalized.center(); ++ x1 = p1.x(); y1 = p1.y(); ++ first = true; ++ } ++ else ++ { ++ QPoint p2; // centre of second anchor ++ xc2 = xs.toInt(); ++ yc2 = thisURL.toInt(); ++ p2 = unnormalized.center(); ++ x2 = p2.x(); y2 = p2.y(); ++ second = true; ++ break; ++ } ++ } ++ } ++ } ++ } ++ if (!second) return QPoint(QCOORD_MIN, QCOORD_MIN); ++ // KMessageBox::information(0, QString() ++ // + " x1= " + QString::number(x1) ++ // + " y1= " + QString::number(y1) ++ // + " x2= " + QString::number(x2) ++ // + " y2= " + QString::number(y1) ++ // + " xclick= " + QString::number(xclick) ++ // + " yclick= " + QString::number(yclick) ++ // ); ++ xc = (int)( 0.25L + (xc1 + xc2)/2.0L - ((x1 + x2)/2.0L - xclick) * (xc2 - xc1) / (x2 - x1) ) ; ++ yc = (int)( 0.75L + (yc1 + yc2)/2.0L - ((y1 + y2)/2.0L - yclick) * (yc2 - yc1) / (y2 - y1) ); ++ clickChart = QPoint(xc, yc); ++ return clickChart; ++ } ++ + const KPDFPageTransition * KPDFPage::getTransition() const + { + return m_transition; +diff -cr kpdf.orig/core/page.h kpdf/core/page.h +*** kpdf.orig/core/page.h 2005-09-10 04:18:42.000000000 -0400 +--- kpdf/core/page.h 2009-09-29 16:56:48.000000000 -0400 +*************** +*** 120,125 **** +--- 120,128 ---- + void deletePixmapsAndRects(); + void deleteHighlights( int s_id = -1 ); + ++ // computes the factor that scales from pixel coordinates to chart coordinates: ++ const QPoint scaleToChart(int xclick, int yclick, int widthPage, int heightPage) const; ++ + private: + friend class PagePainter; + int m_number, m_rotation; +diff -cr kpdf.orig/shell/main.cpp kpdf/shell/main.cpp +*** kpdf.orig/shell/main.cpp 2008-08-19 14:12:37.000000000 -0400 +--- kpdf/shell/main.cpp 2009-09-29 16:56:48.000000000 -0400 +*************** +*** 19,25 **** + #include <klocale.h> + + static const char description[] = +! I18N_NOOP("kpdf, a kde pdf viewer based on xpdf"); + + static const char version[] = "0.5.10"; + +--- 19,25 ---- + #include <klocale.h> + + static const char description[] = +! I18N_NOOP("prerex-enabled kpdf, a kde pdf viewer based on xpdf for use with the prerex editor"); + + static const char version[] = "0.5.10"; + +Only in kpdf/shell: main.cpp.orig +diff -cr kpdf.orig/shell/shell.cpp kpdf/shell/shell.cpp +*** kpdf.orig/shell/shell.cpp 2007-05-14 03:39:31.000000000 -0400 +--- kpdf/shell/shell.cpp 2009-09-29 16:56:48.000000000 -0400 +*************** +*** 34,39 **** +--- 34,40 ---- + #include <kparts/componentfactory.h> + #include <kio/netaccess.h> + #include <kmainwindowiface.h> ++ #include <kstatusbar.h> + + // local includes + #include "shell.h" +*************** +*** 75,81 **** +--- 76,86 ---- + setCentralWidget(m_part->widget()); + // and integrate the part's GUI with the shell's + setupGUI(Keys | Save); ++ createStandardStatusBarAction(); ++ setupGUI(ToolBar | Keys | Save | StatusBar ); + createGUI(m_part); ++ m_statusBar = statusBar(); ++ m_statusBar->message("This is prerex-enabled kpdf.", 8000); + m_showToolBarAction = static_cast<KToggleAction*>(toolBarMenuAction()); + } + } +diff -cr kpdf.orig/shell/shell.h kpdf/shell/shell.h +*** kpdf.orig/shell/shell.h 2006-10-01 13:25:15.000000000 -0400 +--- kpdf/shell/shell.h 2009-09-29 16:56:48.000000000 -0400 +*************** +*** 103,108 **** +--- 103,109 ---- + KToggleAction* m_showToolBarAction; + bool m_menuBarWasShown, m_toolBarWasShown; + KURL m_openUrl; ++ KStatusBar *m_statusBar; + }; + + } +diff -cr kpdf.orig/ui/pageview.cpp kpdf/ui/pageview.cpp +*** kpdf.orig/ui/pageview.cpp 2007-10-08 05:48:37.000000000 -0400 +--- kpdf/ui/pageview.cpp 2009-09-29 16:56:48.000000000 -0400 +*************** +*** 930,936 **** + { + d->mouseGrabPos = d->mouseOnRect ? QPoint() : d->mousePressPos; + if ( !d->mouseOnRect ) +! setCursor( KCursor::sizeAllCursor() ); + } + break; + +--- 930,965 ---- + { + d->mouseGrabPos = d->mouseOnRect ? QPoint() : d->mousePressPos; + if ( !d->mouseOnRect ) +! { +! QPoint click = QPoint(e->x(), e->y()); +! // need to compute chart coordinates from pixel coordinates +! // first, find the relevant page: +! PageViewItem * pageItem = pickItemOnPoint( click.x(), click.y() ); +! if ( pageItem ) +! { // load chart coordinates of clicked point into clipboard +! QString message; +! QClipboard *cb = QApplication::clipboard(); +! QPoint clickChart = pageItem->page()-> +! scaleToChart( +! click.x() - pageItem->geometry().left(), +! click.y() - pageItem->geometry().top(), +! pageItem->width(), +! pageItem->height() +! ); +! if (clickChart.x() == QCOORD_MIN && clickChart.y() == QCOORD_MIN) +! { // no anchors +! setCursor( KCursor::sizeAllCursor() ); +! break; +! } +! setCursor( KCursor::crossCursor() ); +! message = ""; +! message.append(QString::number(clickChart.x())); +! message.append(','); +! message.append(QString::number(clickChart.y())); +! // message = QString::number(pageItem->width()); +! cb->setText(message, QClipboard::Selection ); +! } +! } + } + break; + +*************** +*** 1005,1010 **** +--- 1034,1045 ---- + // handle click over a link + const KPDFLink * link = static_cast< const KPDFLink * >( linkRect->pointer() ); + d->document->processLink( link ); ++ if ( link->linkType() == KPDFLink::Browse ) ++ { // for coord URIs with prerex, change cursor to cross to signal click success ++ const KPDFLinkBrowse * browse = static_cast< const KPDFLinkBrowse * >( link ); ++ if ( browse->url().startsWith( "coord:", false ) ) ++ setCursor( KCursor::crossCursor() ); ++ } + } + else + { |