2004-09-26 23:39:39 +00:00
|
|
|
/***************************************************************************
|
2005-02-18 18:24:45 +00:00
|
|
|
* Copyright (C) 2004-2005 by Enrico Ros <eros.kde@email.it> *
|
2006-02-18 12:06:52 +00:00
|
|
|
* Copyright (C) 2004-2006 by Albert Astals Cid <tsdgeos@terra.es> *
|
2004-09-27 21:36:25 +00:00
|
|
|
* *
|
2005-01-02 14:29:37 +00:00
|
|
|
* With portions of code from kpdf/kpdf_pagewidget.cc by: *
|
2004-09-27 21:36:25 +00:00
|
|
|
* Copyright (C) 2002 by Wilco Greven <greven@kde.org> *
|
|
|
|
* Copyright (C) 2003 by Christophe Devriese *
|
|
|
|
* <Christophe.Devriese@student.kuleuven.ac.be> *
|
|
|
|
* Copyright (C) 2003 by Laurent Montel <montel@kde.org> *
|
|
|
|
* Copyright (C) 2003 by Dirk Mueller <mueller@kde.org> *
|
|
|
|
* Copyright (C) 2004 by James Ots <kde@jamesots.com> *
|
2004-09-26 23:39:39 +00:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
#include <fixx11h.h>
|
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
// qt/kde includes
|
2005-01-01 21:50:34 +00:00
|
|
|
#include <qcursor.h>
|
2006-03-24 20:40:02 +00:00
|
|
|
#include <qevent.h>
|
2004-09-26 23:39:39 +00:00
|
|
|
#include <qpainter.h>
|
|
|
|
#include <qtimer.h>
|
2005-02-01 18:24:16 +00:00
|
|
|
#include <qdatetime.h>
|
2004-09-26 23:39:39 +00:00
|
|
|
#include <qpushbutton.h>
|
2004-10-14 20:21:59 +00:00
|
|
|
#include <qapplication.h>
|
|
|
|
#include <qclipboard.h>
|
2006-03-30 15:27:27 +00:00
|
|
|
#include <QX11Info>
|
2004-09-26 23:39:39 +00:00
|
|
|
#include <kiconloader.h>
|
|
|
|
#include <kaction.h>
|
2005-01-14 23:19:04 +00:00
|
|
|
#include <kstdaccel.h>
|
2006-05-08 19:00:23 +00:00
|
|
|
#include <kstdaction.h>
|
2004-09-26 23:39:39 +00:00
|
|
|
#include <kactioncollection.h>
|
2006-03-24 20:40:02 +00:00
|
|
|
#include <kmenu.h>
|
2004-09-26 23:39:39 +00:00
|
|
|
#include <klocale.h>
|
2004-11-03 17:35:48 +00:00
|
|
|
#include <kfiledialog.h>
|
2004-10-31 17:04:04 +00:00
|
|
|
#include <kimageeffect.h>
|
2006-05-08 19:00:23 +00:00
|
|
|
#include <kselectaction.h>
|
|
|
|
#include <ktoggleaction.h>
|
2006-03-24 20:40:02 +00:00
|
|
|
#include <ktoolinvocation.h>
|
2004-11-08 13:13:46 +00:00
|
|
|
#include <kdebug.h>
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
#include <kmessagebox.h>
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2006-07-03 10:15:55 +00:00
|
|
|
#include <QtDBus/QtDBus>
|
2006-06-05 15:47:35 +00:00
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
// system includes
|
2004-09-26 23:39:39 +00:00
|
|
|
#include <math.h>
|
2004-10-06 00:05:49 +00:00
|
|
|
#include <stdlib.h>
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
// local includes
|
2004-09-26 23:39:39 +00:00
|
|
|
#include "pageview.h"
|
2004-10-20 16:41:13 +00:00
|
|
|
#include "pageviewutils.h"
|
2005-01-27 17:31:07 +00:00
|
|
|
#include "pagepainter.h"
|
2005-03-04 23:06:24 +00:00
|
|
|
#include "pageviewannotator.h"
|
2005-01-02 14:55:14 +00:00
|
|
|
#include "core/document.h"
|
2005-01-02 14:37:49 +00:00
|
|
|
#include "core/page.h"
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#include "core/misc.h"
|
2005-01-02 14:37:49 +00:00
|
|
|
#include "core/link.h"
|
|
|
|
#include "core/generator.h"
|
2006-03-28 22:22:10 +00:00
|
|
|
#include "settings.h"
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2004-11-25 19:42:04 +00:00
|
|
|
#define ROUND(x) (int(x + 0.5))
|
|
|
|
|
2006-07-09 11:10:24 +00:00
|
|
|
static int pageflags = PagePainter::Accessibility | PagePainter::EnhanceLinks |
|
|
|
|
PagePainter::EnhanceImages | PagePainter::Highlights |
|
|
|
|
PagePainter::Annotations;
|
|
|
|
|
2004-09-26 23:39:39 +00:00
|
|
|
// structure used internally by PageView for data storage
|
|
|
|
class PageViewPrivate
|
|
|
|
{
|
|
|
|
public:
|
2005-01-09 23:37:07 +00:00
|
|
|
// the document, pageviewItems and the 'visible cache'
|
2004-09-26 23:39:39 +00:00
|
|
|
KPDFDocument * document;
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector< PageViewItem * > items;
|
|
|
|
QLinkedList< PageViewItem * > visibleItems;
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2005-03-05 15:59:15 +00:00
|
|
|
// view layout (columns and continuous in Settings), zoom and mouse
|
2004-09-26 23:39:39 +00:00
|
|
|
PageView::ZoomMode zoomMode;
|
|
|
|
float zoomFactor;
|
|
|
|
PageView::MouseMode mouseMode;
|
|
|
|
QPoint mouseGrabPos;
|
2005-01-29 12:32:59 +00:00
|
|
|
QPoint mousePressPos;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
QPoint mouseSelectPos;
|
2005-03-24 19:10:41 +00:00
|
|
|
bool mouseMidZooming;
|
|
|
|
int mouseMidLastY;
|
2005-06-24 16:41:55 +00:00
|
|
|
bool mouseSelecting;
|
2004-10-30 20:54:48 +00:00
|
|
|
QRect mouseSelectionRect;
|
2005-06-24 16:41:55 +00:00
|
|
|
QColor mouseSelectionColor;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
bool mouseTextSelecting;
|
|
|
|
bool mouseTextSelectionPainted;
|
2006-03-24 20:40:02 +00:00
|
|
|
QList<QRect>* mouseTextSelectionRect;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
QColor mouseTextSelectionColor;
|
|
|
|
TextSelection * mouseTextSelectionInfo;
|
2005-06-24 16:41:55 +00:00
|
|
|
bool mouseOnRect;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
// type ahead find
|
|
|
|
bool typeAheadActive;
|
|
|
|
QString typeAheadString;
|
|
|
|
QTimer * findTimeoutTimer;
|
|
|
|
// viewport move
|
|
|
|
bool viewportMoveActive;
|
|
|
|
QTime viewportMoveTime;
|
|
|
|
QPoint viewportMoveDest;
|
|
|
|
QTimer * viewportMoveTimer;
|
|
|
|
// auto scroll
|
2004-10-06 00:05:49 +00:00
|
|
|
int scrollIncrement;
|
2005-02-01 18:24:16 +00:00
|
|
|
QTimer * autoScrollTimer;
|
2005-02-18 18:24:45 +00:00
|
|
|
// annotations
|
2005-03-04 23:06:24 +00:00
|
|
|
PageViewAnnotator * annotator;
|
2005-02-01 18:24:16 +00:00
|
|
|
// other stuff
|
|
|
|
QTimer * delayResizeTimer;
|
2004-09-30 18:04:09 +00:00
|
|
|
bool dirtyLayout;
|
2005-02-01 18:24:16 +00:00
|
|
|
bool blockViewport; // prevents changes to viewport
|
2005-01-21 20:05:36 +00:00
|
|
|
bool blockPixmapsRequest; // prevent pixmap requests
|
|
|
|
PageViewMessage * messageWindow; // in pageviewutils.h
|
2004-09-26 23:39:39 +00:00
|
|
|
|
|
|
|
// actions
|
2005-07-20 22:28:23 +00:00
|
|
|
KSelectAction * aOrientation;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
KSelectAction * aPaperSizes;
|
2006-03-24 21:31:46 +00:00
|
|
|
KAction * aMouseNormal;
|
|
|
|
KAction * aMouseSelect;
|
2005-03-04 23:06:24 +00:00
|
|
|
KToggleAction * aToggleAnnotator;
|
2004-10-29 21:52:06 +00:00
|
|
|
KSelectAction * aZoom;
|
|
|
|
KToggleAction * aZoomFitWidth;
|
|
|
|
KToggleAction * aZoomFitPage;
|
|
|
|
KToggleAction * aZoomFitText;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
KSelectAction * aRenderMode;
|
2005-03-05 15:59:15 +00:00
|
|
|
KToggleAction * aViewContinuous;
|
2005-01-28 17:21:28 +00:00
|
|
|
KAction * aPrevAction;
|
2006-06-25 16:34:11 +00:00
|
|
|
KActionCollection * actionCollection;
|
2004-09-26 23:39:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-10-20 16:41:13 +00:00
|
|
|
|
2004-09-30 18:16:12 +00:00
|
|
|
/* PageView. What's in this file? -> quick overview.
|
|
|
|
* Code weight (in rows) and meaning:
|
|
|
|
* 160 - constructor and creating actions plus their connected slots (empty stuff)
|
|
|
|
* 70 - DocumentObserver inherited methodes (important)
|
2005-01-09 23:37:07 +00:00
|
|
|
* 550 - events: mouse, keyboard, drag/drop
|
2005-03-05 15:59:15 +00:00
|
|
|
* 170 - slotRelayoutPages: set contents of the scrollview on continuous/single modes
|
2004-09-30 18:16:12 +00:00
|
|
|
* 100 - zoom: zooming pages in different ways, keeping update the toolbar actions, etc..
|
2004-10-30 20:54:48 +00:00
|
|
|
* other misc functions: only slotRequestVisiblePixmaps and pickItemOnPoint noticeable,
|
2004-09-30 18:16:12 +00:00
|
|
|
* and many insignificant stuff like this comment :-)
|
2004-09-26 23:39:39 +00:00
|
|
|
*/
|
|
|
|
PageView::PageView( QWidget *parent, KPDFDocument *document )
|
2006-06-03 13:01:15 +00:00
|
|
|
: Q3ScrollView( parent )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
|
|
|
// create and initialize private storage structure
|
|
|
|
d = new PageViewPrivate();
|
|
|
|
d->document = document;
|
2005-07-20 22:28:23 +00:00
|
|
|
d->aOrientation = 0;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
d->aRenderMode = 0;
|
2005-11-04 11:59:51 +00:00
|
|
|
d->zoomMode = (PageView::ZoomMode) KpdfSettings::zoomMode();
|
|
|
|
d->zoomFactor = KpdfSettings::zoomFactor();
|
2004-09-26 23:39:39 +00:00
|
|
|
d->mouseMode = MouseNormal;
|
2005-03-24 19:10:41 +00:00
|
|
|
d->mouseMidZooming = false;
|
2005-06-24 16:41:55 +00:00
|
|
|
d->mouseSelecting = false;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
d->mouseTextSelecting = false;
|
2004-12-10 16:04:45 +00:00
|
|
|
d->mouseOnRect = false;
|
2005-02-01 18:24:16 +00:00
|
|
|
d->typeAheadActive = false;
|
|
|
|
d->findTimeoutTimer = 0;
|
|
|
|
d->viewportMoveActive = false;
|
|
|
|
d->viewportMoveTimer = 0;
|
2004-10-06 00:05:49 +00:00
|
|
|
d->scrollIncrement = 0;
|
2005-02-01 18:24:16 +00:00
|
|
|
d->autoScrollTimer = 0;
|
2005-03-04 23:06:24 +00:00
|
|
|
d->annotator = 0;
|
2005-02-01 18:24:16 +00:00
|
|
|
d->delayResizeTimer = 0;
|
2004-09-30 18:04:09 +00:00
|
|
|
d->dirtyLayout = false;
|
2005-01-09 23:37:07 +00:00
|
|
|
d->blockViewport = false;
|
2005-01-21 20:05:36 +00:00
|
|
|
d->blockPixmapsRequest = false;
|
2004-10-20 16:41:13 +00:00
|
|
|
d->messageWindow = new PageViewMessage(this);
|
2005-01-28 17:21:28 +00:00
|
|
|
d->aPrevAction = 0;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
d->mouseTextSelectionRect=0;
|
|
|
|
d->mouseTextSelectionInfo=0;
|
|
|
|
d->mouseTextSelectionPainted=0;
|
|
|
|
d->aPaperSizes=0;
|
2004-09-27 21:36:25 +00:00
|
|
|
|
2006-06-03 13:01:15 +00:00
|
|
|
setAttribute( Qt::WA_StaticContents );
|
|
|
|
|
2006-06-12 18:25:18 +00:00
|
|
|
setObjectName( QLatin1String( "okular::pageView" ) );
|
2006-06-03 13:01:15 +00:00
|
|
|
|
2004-09-27 21:36:25 +00:00
|
|
|
// widget setup: setup focus, accept drops and track mouse
|
|
|
|
viewport()->setFocusProxy( this );
|
2006-03-24 20:40:02 +00:00
|
|
|
viewport()->setFocusPolicy( Qt::StrongFocus );
|
2004-11-16 17:36:02 +00:00
|
|
|
//viewport()->setPaletteBackgroundColor( Qt::white );
|
2006-06-03 13:01:15 +00:00
|
|
|
viewport()->setAttribute( Qt::WA_OpaquePaintEvent );
|
2004-09-27 21:36:25 +00:00
|
|
|
setResizePolicy( Manual );
|
2004-09-26 23:39:39 +00:00
|
|
|
setAcceptDrops( true );
|
2004-09-30 18:16:12 +00:00
|
|
|
setDragAutoScroll( false );
|
2004-09-26 23:39:39 +00:00
|
|
|
viewport()->setMouseTracking( true );
|
2004-09-27 21:36:25 +00:00
|
|
|
|
|
|
|
// conntect the padding of the viewport to pixmaps requests
|
|
|
|
connect( this, SIGNAL(contentsMoving(int, int)), this, SLOT(slotRequestVisiblePixmaps(int, int)) );
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2005-01-02 14:29:37 +00:00
|
|
|
// show initial welcome text
|
|
|
|
d->messageWindow->display( i18n( "Welcome" ), PageViewMessage::Info, 2000 );
|
2004-12-10 16:04:45 +00:00
|
|
|
|
2004-09-26 23:39:39 +00:00
|
|
|
// set a corner button to resize the view to the page size
|
2004-10-29 21:52:06 +00:00
|
|
|
// QPushButton * resizeButton = new QPushButton( viewport() );
|
|
|
|
// resizeButton->setPixmap( SmallIcon("crop") );
|
|
|
|
// setCornerWidget( resizeButton );
|
|
|
|
// resizeButton->setEnabled( false );
|
2004-09-26 23:39:39 +00:00
|
|
|
// connect(...);
|
|
|
|
}
|
|
|
|
|
|
|
|
PageView::~PageView()
|
|
|
|
{
|
2005-02-18 18:24:45 +00:00
|
|
|
// delete the local storage structure
|
2006-02-18 12:06:52 +00:00
|
|
|
d->document->removeObserver( this );
|
2004-09-26 23:39:39 +00:00
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
|
2004-10-27 14:13:17 +00:00
|
|
|
void PageView::setupActions( KActionCollection * ac )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2006-06-25 16:34:11 +00:00
|
|
|
d->actionCollection = ac;
|
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aOrientation=new KSelectAction( i18n( "&Orientation" ), ac, "view_orientation" );
|
|
|
|
d->aPaperSizes=new KSelectAction( i18n( "&Paper sizes" ), ac, "view_papersizes" );
|
2006-06-02 20:42:57 +00:00
|
|
|
QStringList rotations;
|
|
|
|
rotations.append( i18n( "Default" ) );
|
|
|
|
rotations.append( i18n( "Rotated 90 Degrees" ) );
|
|
|
|
rotations.append( i18n( "Rotated 180 Degrees" ) );
|
|
|
|
rotations.append( i18n( "Rotated 270 Degrees" ) );
|
|
|
|
d->aOrientation->setItems( rotations );
|
2005-07-20 22:28:23 +00:00
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
connect( d->aOrientation , SIGNAL( triggered( int ) ),
|
2006-06-02 20:42:57 +00:00
|
|
|
d->document , SLOT( slotRotation( int ) ) );
|
2006-04-13 11:24:57 +00:00
|
|
|
connect( d->aPaperSizes , SIGNAL( triggered( int ) ),
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
d->document , SLOT( slotPaperSizes( int ) ) );
|
2005-07-20 22:28:23 +00:00
|
|
|
|
|
|
|
d->aOrientation->setEnabled(d->document->supportsRotation());
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
bool paperSizes=d->document->supportsPaperSizes();
|
|
|
|
d->aPaperSizes->setEnabled(paperSizes);
|
|
|
|
if (paperSizes)
|
|
|
|
d->aPaperSizes->setItems(d->document->paperSizes());
|
2005-07-20 22:28:23 +00:00
|
|
|
|
2004-09-30 18:04:09 +00:00
|
|
|
// Zoom actions ( higher scales takes lots of memory! )
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aZoom = new KSelectAction( KIcon( "viewmag" ), i18n( "Zoom" ), ac, "zoom_to" );
|
2004-09-30 18:04:09 +00:00
|
|
|
d->aZoom->setEditable( true );
|
2005-06-13 18:06:32 +00:00
|
|
|
d->aZoom->setMaxComboViewCount( 13 );
|
2006-07-21 11:26:45 +00:00
|
|
|
connect( d->aZoom, SIGNAL( triggered(QAction *) ), this, SLOT( slotZoom() ) );
|
2004-09-30 18:04:09 +00:00
|
|
|
updateZoomText();
|
2004-09-26 23:39:39 +00:00
|
|
|
|
|
|
|
KStdAction::zoomIn( this, SLOT( slotZoomIn() ), ac, "zoom_in" );
|
|
|
|
|
|
|
|
KStdAction::zoomOut( this, SLOT( slotZoomOut() ), ac, "zoom_out" );
|
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aZoomFitWidth = new KToggleAction( KIcon( "view_fit_width" ), i18n("Fit to Page &Width"), ac, "zoom_fit_width" );
|
2004-09-26 23:39:39 +00:00
|
|
|
connect( d->aZoomFitWidth, SIGNAL( toggled( bool ) ), SLOT( slotFitToWidthToggled( bool ) ) );
|
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aZoomFitPage = new KToggleAction( KIcon( "view_fit_window" ), i18n("Fit to &Page"), ac, "zoom_fit_page" );
|
2004-09-26 23:39:39 +00:00
|
|
|
connect( d->aZoomFitPage, SIGNAL( toggled( bool ) ), SLOT( slotFitToPageToggled( bool ) ) );
|
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aZoomFitText = new KToggleAction( KIcon( "viewmagfit" ), i18n("Fit to &Text"), ac, "zoom_fit_text" );
|
2004-09-30 18:04:09 +00:00
|
|
|
connect( d->aZoomFitText, SIGNAL( toggled( bool ) ), SLOT( slotFitToTextToggled( bool ) ) );
|
|
|
|
|
2004-09-26 23:39:39 +00:00
|
|
|
// View-Layout actions
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
QStringList renderModes;
|
|
|
|
renderModes.append( i18n( "Single" ) );
|
|
|
|
renderModes.append( i18n( "Facing" ) );
|
|
|
|
renderModes.append( i18n( "Overview" ) );
|
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aRenderMode = new KSelectAction( KIcon( "view_left_right" ), i18n("&Render Mode"), ac, "view_render_mode" );
|
|
|
|
connect( d->aRenderMode, SIGNAL( triggered( int ) ), SLOT( slotRenderMode( int ) ) );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
d->aRenderMode->setItems( renderModes );
|
|
|
|
d->aRenderMode->setCurrentItem( KpdfSettings::renderMode() );
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aViewContinuous = new KToggleAction( KIcon( "view_text" ), i18n("&Continuous"), ac, "view_continuous" );
|
2005-03-05 15:59:15 +00:00
|
|
|
connect( d->aViewContinuous, SIGNAL( toggled( bool ) ), SLOT( slotContinuousToggled( bool ) ) );
|
2005-11-04 11:59:51 +00:00
|
|
|
d->aViewContinuous->setChecked( KpdfSettings::viewContinuous() );
|
2004-09-26 23:39:39 +00:00
|
|
|
|
|
|
|
// Mouse-Mode actions
|
2006-03-24 21:31:46 +00:00
|
|
|
QActionGroup * actGroup = new QActionGroup( this );
|
|
|
|
actGroup->setExclusive( true );
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aMouseNormal = new KAction( KIcon( "mouse" ), i18n("&Browse Tool"), ac, "mouse_drag" );
|
|
|
|
connect( d->aMouseNormal, SIGNAL( triggered() ), this, SLOT( slotSetMouseNormal() ) );
|
2006-04-01 15:12:32 +00:00
|
|
|
d->aMouseNormal->setCheckable( true );
|
2006-03-24 21:31:46 +00:00
|
|
|
d->aMouseNormal->setActionGroup( actGroup );
|
2005-01-28 17:21:28 +00:00
|
|
|
d->aMouseNormal->setChecked( true );
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
KAction * mz = new KAction( KIcon( "viewmag" ), i18n("&Zoom Tool"), ac, "mouse_zoom" );
|
|
|
|
connect( mz, SIGNAL( triggered() ), this, SLOT( slotSetMouseZoom() ) );
|
2006-04-01 15:12:32 +00:00
|
|
|
mz->setCheckable( true );
|
2006-03-24 21:31:46 +00:00
|
|
|
mz->setActionGroup( actGroup );
|
2004-11-03 17:35:48 +00:00
|
|
|
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aMouseSelect = new KAction( KIcon( "frame_edit" ), i18n("&Select Tool"), ac, "mouse_select" );
|
|
|
|
connect( d->aMouseSelect, SIGNAL( triggered() ), this, SLOT( slotSetMouseSelect() ) );
|
2006-04-01 15:12:32 +00:00
|
|
|
d->aMouseSelect->setCheckable( true );
|
2006-03-24 21:31:46 +00:00
|
|
|
d->aMouseSelect->setActionGroup( actGroup );
|
2004-11-03 17:35:48 +00:00
|
|
|
|
2006-04-13 11:41:36 +00:00
|
|
|
d->aToggleAnnotator = new KToggleAction( KIcon( "pencil" ), i18n("&Review"), ac, "mouse_toggle_annotate" );
|
2006-04-01 15:12:32 +00:00
|
|
|
d->aToggleAnnotator->setCheckable( true );
|
2005-03-04 23:06:24 +00:00
|
|
|
connect( d->aToggleAnnotator, SIGNAL( toggled( bool ) ), SLOT( slotToggleAnnotator( bool ) ) );
|
2006-04-10 18:50:27 +00:00
|
|
|
d->aToggleAnnotator->setShortcut( Qt::Key_F6 );
|
2004-09-26 23:39:39 +00:00
|
|
|
|
|
|
|
// Other actions
|
2006-04-13 11:41:36 +00:00
|
|
|
KAction * su = new KAction( i18n("Scroll Up"), ac, "view_scroll_up" );
|
|
|
|
connect( su, SIGNAL( triggered() ), this, SLOT( slotScrollUp() ) );
|
|
|
|
su->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Up) );
|
2004-10-06 00:05:49 +00:00
|
|
|
|
2006-04-13 11:41:36 +00:00
|
|
|
KAction * sd = new KAction( i18n("Scroll Down"), ac, "view_scroll_down" );
|
|
|
|
connect( sd, SIGNAL( triggered() ), this, SLOT( slotScrollDown() ) );
|
|
|
|
sd->setShortcut( QKeySequence(Qt::SHIFT + Qt::Key_Down) );
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
|
2005-01-10 13:43:44 +00:00
|
|
|
bool PageView::canFitPageWidth()
|
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
return KpdfSettings::renderMode() != 0 || d->zoomMode != ZoomFitWidth;
|
2005-01-10 13:43:44 +00:00
|
|
|
}
|
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
void PageView::fitPageWidth( int page )
|
2004-12-04 23:23:18 +00:00
|
|
|
{
|
2005-01-09 23:37:07 +00:00
|
|
|
// zoom: Fit Width, columns: 1. setActions + relayout + setPage + update
|
2004-12-04 23:23:18 +00:00
|
|
|
d->zoomMode = ZoomFitWidth;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
KpdfSettings::setRenderMode( 0 );
|
2004-12-04 23:23:18 +00:00
|
|
|
d->aZoomFitWidth->setChecked( true );
|
|
|
|
d->aZoomFitPage->setChecked( false );
|
|
|
|
d->aZoomFitText->setChecked( false );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
d->aRenderMode->setCurrentItem( 0 );
|
2004-12-04 23:23:18 +00:00
|
|
|
viewport()->setUpdatesEnabled( false );
|
|
|
|
slotRelayoutPages();
|
|
|
|
viewport()->setUpdatesEnabled( true );
|
2005-01-09 23:37:07 +00:00
|
|
|
d->document->setViewportPage( page );
|
2005-01-10 13:43:44 +00:00
|
|
|
updateZoomText();
|
2005-06-13 10:22:37 +00:00
|
|
|
setFocus();
|
2004-12-04 23:23:18 +00:00
|
|
|
}
|
|
|
|
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
void PageView::displayMessage( const QString & message,PageViewMessage::Icon icon,int duration )
|
2005-03-04 23:06:24 +00:00
|
|
|
{
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( !KpdfSettings::showOSD() )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
|
|
|
if (icon == PageViewMessage::Error)
|
|
|
|
KMessageBox::error( this, message );
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
2005-03-04 23:06:24 +00:00
|
|
|
|
|
|
|
// hide messageWindow if string is empty
|
|
|
|
if ( message.isEmpty() )
|
|
|
|
return d->messageWindow->hide();
|
|
|
|
|
|
|
|
// display message (duration is length dependant)
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
if (duration==-1)
|
|
|
|
duration = 500 + 100 * message.length();
|
|
|
|
d->messageWindow->display( message, icon, duration );
|
2005-03-04 23:06:24 +00:00
|
|
|
}
|
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
//BEGIN DocumentObserver inherited methods
|
2006-03-24 20:40:02 +00:00
|
|
|
void PageView::notifySetup( const QVector< KPDFPage * > & pageSet, bool documentChanged )
|
2004-10-10 13:21:30 +00:00
|
|
|
{
|
|
|
|
// reuse current pages if nothing new
|
2004-11-05 00:14:00 +00:00
|
|
|
if ( ( pageSet.count() == d->items.count() ) && !documentChanged )
|
2004-10-10 13:21:30 +00:00
|
|
|
{
|
|
|
|
int count = pageSet.count();
|
|
|
|
for ( int i = 0; (i < count) && !documentChanged; i++ )
|
2004-11-05 00:14:00 +00:00
|
|
|
if ( (int)pageSet[i]->number() != d->items[i]->pageNumber() )
|
2004-10-10 13:21:30 +00:00
|
|
|
documentChanged = true;
|
|
|
|
if ( !documentChanged )
|
|
|
|
return;
|
|
|
|
}
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
2004-10-10 13:21:30 +00:00
|
|
|
// delete all widgets (one for each page in pageSet)
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector< PageViewItem * >::iterator dIt = d->items.begin(), dEnd = d->items.end();
|
2004-09-26 23:39:39 +00:00
|
|
|
for ( ; dIt != dEnd; ++dIt )
|
|
|
|
delete *dIt;
|
2004-11-05 00:14:00 +00:00
|
|
|
d->items.clear();
|
2005-01-03 01:10:27 +00:00
|
|
|
d->visibleItems.clear();
|
2004-09-26 23:39:39 +00:00
|
|
|
|
|
|
|
// create children widgets
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector< KPDFPage * >::const_iterator setIt = pageSet.begin(), setEnd = pageSet.end();
|
2004-09-26 23:39:39 +00:00
|
|
|
for ( ; setIt != setEnd; ++setIt )
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
{
|
2004-11-05 00:14:00 +00:00
|
|
|
d->items.push_back( new PageViewItem( *setIt ) );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#ifdef PAGEVIEW_DEBUG
|
2006-03-29 13:52:17 +00:00
|
|
|
kDebug() << "geom for " << d->items.last()->pageNumber() << " is " << d->items.last()->geometry() << endl;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#endif
|
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// invalidate layout so relayout/repaint will happen on next viewport change
|
2005-01-27 17:31:07 +00:00
|
|
|
if ( pageSet.count() > 0 )
|
2005-07-15 18:20:57 +00:00
|
|
|
// TODO for Enrico: Check if doing always the slotRelayoutPages() is not
|
|
|
|
// suboptimal in some cases, i'd say it is not but a recheck will not hurt
|
|
|
|
// Need slotRelayoutPages() here instead of d->dirtyLayout = true
|
|
|
|
// because opening a pdf from another pdf will not trigger a viewportchange
|
|
|
|
// so pages are never relayouted
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
QTimer::singleShot(0, this, SLOT(slotRelayoutPages())); // was used
|
2005-01-27 17:31:07 +00:00
|
|
|
else
|
2005-11-04 11:59:51 +00:00
|
|
|
{
|
|
|
|
// update the mouse cursor when closing because we may have close through a link and
|
|
|
|
// want the cursor to come back to the normal cursor
|
|
|
|
updateCursor( viewportToContents( mapFromGlobal( QCursor::pos() ) ) );
|
2005-01-27 17:31:07 +00:00
|
|
|
resizeContents( 0, 0 );
|
2005-11-04 11:59:51 +00:00
|
|
|
}
|
2004-10-29 20:20:21 +00:00
|
|
|
|
|
|
|
// OSD to display pages
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( documentChanged && pageSet.count() > 0 && KpdfSettings::showOSD() )
|
2004-10-29 20:20:21 +00:00
|
|
|
d->messageWindow->display(
|
2006-04-10 18:50:27 +00:00
|
|
|
i18np(" Loaded a one-page document.",
|
2005-01-17 14:57:18 +00:00
|
|
|
" Loaded a %n-page document.",
|
2004-11-30 20:03:45 +00:00
|
|
|
pageSet.count() ),
|
2004-10-29 20:20:21 +00:00
|
|
|
PageViewMessage::Info, 4000 );
|
2005-07-20 22:28:23 +00:00
|
|
|
|
|
|
|
d->aOrientation->setEnabled(d->document->supportsRotation());
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
bool paperSizes=d->document->supportsPaperSizes();
|
|
|
|
d->aPaperSizes->setEnabled(paperSizes);
|
2006-06-02 10:30:32 +00:00
|
|
|
// set the new paper sizes:
|
|
|
|
// - if the generator supports them
|
|
|
|
// - if the document changed
|
|
|
|
if (paperSizes && documentChanged)
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
d->aPaperSizes->setItems(d->document->paperSizes());
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
void PageView::notifyViewportChanged( bool smoothMove )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2005-01-09 23:37:07 +00:00
|
|
|
// if we are the one changing viewport, skip this nofity
|
|
|
|
if ( d->blockViewport )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// block setViewport outgoing calls
|
|
|
|
d->blockViewport = true;
|
|
|
|
|
|
|
|
// find PageViewItem matching the viewport description
|
2005-01-21 20:05:36 +00:00
|
|
|
const DocumentViewport & vp = d->document->viewport();
|
2005-01-09 23:37:07 +00:00
|
|
|
PageViewItem * item = 0;
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector< PageViewItem * >::iterator iIt = d->items.begin(), iEnd = d->items.end();
|
2004-11-05 00:14:00 +00:00
|
|
|
for ( ; iIt != iEnd; ++iIt )
|
2005-01-21 20:05:36 +00:00
|
|
|
if ( (*iIt)->pageNumber() == vp.pageNumber )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2005-01-09 23:37:07 +00:00
|
|
|
item = *iIt;
|
2004-09-26 23:39:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-01-09 23:37:07 +00:00
|
|
|
if ( !item )
|
|
|
|
{
|
2006-03-29 13:52:17 +00:00
|
|
|
kDebug() << "viewport has no matching item!" << endl;
|
2005-11-04 11:59:51 +00:00
|
|
|
d->blockViewport = false;
|
2004-09-30 18:16:12 +00:00
|
|
|
return;
|
2005-01-09 23:37:07 +00:00
|
|
|
}
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#ifdef PAGEVIEW_DEBUG
|
2006-03-29 13:52:17 +00:00
|
|
|
kDebug() << "document viewport changed\n";
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#endif
|
2004-10-10 13:21:30 +00:00
|
|
|
// relayout in "Single Pages" mode or if a relayout is pending
|
2005-01-21 20:05:36 +00:00
|
|
|
d->blockPixmapsRequest = true;
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( !KpdfSettings::viewContinuous() || d->dirtyLayout )
|
2004-09-30 18:16:12 +00:00
|
|
|
slotRelayoutPages();
|
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
// restore viewport center or use default {x-center,v-top} alignment
|
2005-01-09 23:37:07 +00:00
|
|
|
const QRect & r = item->geometry();
|
2005-02-01 18:24:16 +00:00
|
|
|
int newCenterX = r.left(),
|
|
|
|
newCenterY = r.top();
|
2005-06-13 11:53:47 +00:00
|
|
|
if ( vp.rePos.enabled )
|
2004-11-05 18:14:20 +00:00
|
|
|
{
|
2005-06-13 11:53:47 +00:00
|
|
|
if ( vp.rePos.pos == DocumentViewport::Center )
|
|
|
|
{
|
|
|
|
newCenterX += (int)( vp.rePos.normalizedX * (double)r.width() );
|
|
|
|
newCenterY += (int)( vp.rePos.normalizedY * (double)r.height() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// TopLeft
|
|
|
|
newCenterX += (int)( vp.rePos.normalizedX * (double)r.width() + viewport()->width() / 2 );
|
|
|
|
newCenterY += (int)( vp.rePos.normalizedY * (double)r.height() + viewport()->height() / 2 );
|
|
|
|
}
|
2005-02-01 18:24:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
newCenterX += r.width() / 2;
|
|
|
|
newCenterY += visibleHeight() / 2 - 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if smooth movement requested, setup parameters and start it
|
|
|
|
if ( smoothMove )
|
|
|
|
{
|
|
|
|
d->viewportMoveActive = true;
|
|
|
|
d->viewportMoveTime.start();
|
|
|
|
d->viewportMoveDest.setX( newCenterX );
|
|
|
|
d->viewportMoveDest.setY( newCenterY );
|
|
|
|
if ( !d->viewportMoveTimer )
|
|
|
|
{
|
|
|
|
d->viewportMoveTimer = new QTimer( this );
|
|
|
|
connect( d->viewportMoveTimer, SIGNAL( timeout() ),
|
|
|
|
this, SLOT( slotMoveViewport() ) );
|
|
|
|
}
|
|
|
|
d->viewportMoveTimer->start( 25 );
|
|
|
|
verticalScrollBar()->setEnabled( false );
|
|
|
|
horizontalScrollBar()->setEnabled( false );
|
2004-11-05 18:14:20 +00:00
|
|
|
}
|
2005-01-09 23:37:07 +00:00
|
|
|
else
|
2005-02-01 18:24:16 +00:00
|
|
|
center( newCenterX, newCenterY );
|
2005-01-21 20:05:36 +00:00
|
|
|
d->blockPixmapsRequest = false;
|
2005-01-09 23:37:07 +00:00
|
|
|
|
|
|
|
// request visible pixmaps in the current viewport and recompute it
|
2004-09-30 18:16:12 +00:00
|
|
|
slotRequestVisiblePixmaps();
|
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// enable setViewport calls
|
|
|
|
d->blockViewport = false;
|
|
|
|
|
2004-09-30 18:16:12 +00:00
|
|
|
// update zoom text if in a ZoomFit/* zoom mode
|
|
|
|
if ( d->zoomMode != ZoomFixed )
|
|
|
|
updateZoomText();
|
2005-01-01 21:50:34 +00:00
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// since the page has moved below cursor, update it
|
2005-01-01 21:50:34 +00:00
|
|
|
updateCursor( viewportToContents( mapFromGlobal( QCursor::pos() ) ) );
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
2004-12-21 12:38:52 +00:00
|
|
|
|
2005-01-30 00:58:16 +00:00
|
|
|
void PageView::notifyPageChanged( int pageNumber, int changedFlags )
|
2004-12-21 12:38:52 +00:00
|
|
|
{
|
2005-01-30 00:58:16 +00:00
|
|
|
// only handle pixmap / highlight changes notifies
|
|
|
|
if ( changedFlags & DocumentObserver::Bookmark )
|
|
|
|
return;
|
2004-12-21 12:38:52 +00:00
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// iterate over visible items: if page(pageNumber) is one of them, repaint it
|
2006-03-24 20:40:02 +00:00
|
|
|
QLinkedList< PageViewItem * >::iterator iIt = d->visibleItems.begin(), iEnd = d->visibleItems.end();
|
2004-12-21 12:38:52 +00:00
|
|
|
for ( ; iIt != iEnd; ++iIt )
|
|
|
|
if ( (*iIt)->pageNumber() == pageNumber )
|
|
|
|
{
|
|
|
|
// update item's rectangle plus the little outline
|
|
|
|
QRect expandedRect = (*iIt)->geometry();
|
2006-03-29 16:46:09 +00:00
|
|
|
expandedRect.adjust( -1, -1, 3, 3 );
|
2004-12-21 12:38:52 +00:00
|
|
|
updateContents( expandedRect );
|
2005-01-02 11:50:38 +00:00
|
|
|
|
2005-01-02 13:40:40 +00:00
|
|
|
// if we were "zoom-dragging" do not overwrite the "zoom-drag" cursor
|
2005-01-09 23:37:07 +00:00
|
|
|
if ( cursor().shape() != Qt::SizeVerCursor )
|
2005-01-02 11:50:38 +00:00
|
|
|
{
|
2005-01-09 23:37:07 +00:00
|
|
|
// since the page has been regenerated below cursor, update it
|
2005-01-02 11:50:38 +00:00
|
|
|
updateCursor( viewportToContents( mapFromGlobal( QCursor::pos() ) ) );
|
|
|
|
}
|
2004-12-21 12:38:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
void PageView::notifyContentsCleared( int changedFlags )
|
2004-12-21 12:38:52 +00:00
|
|
|
{
|
2005-01-09 23:37:07 +00:00
|
|
|
// if pixmaps were cleared, re-ask them
|
|
|
|
if ( changedFlags & DocumentObserver::Pixmap )
|
|
|
|
slotRequestVisiblePixmaps();
|
2004-12-21 12:38:52 +00:00
|
|
|
}
|
2005-01-09 23:37:07 +00:00
|
|
|
|
|
|
|
bool PageView::canUnloadPixmap( int pageNumber )
|
|
|
|
{
|
|
|
|
// if the item is visible, forbid unloading
|
2006-03-24 20:40:02 +00:00
|
|
|
QLinkedList< PageViewItem * >::iterator vIt = d->visibleItems.begin(), vEnd = d->visibleItems.end();
|
2005-01-09 23:37:07 +00:00
|
|
|
for ( ; vIt != vEnd; ++vIt )
|
|
|
|
if ( (*vIt)->pageNumber() == pageNumber )
|
|
|
|
return false;
|
|
|
|
// if hidden premit unloading
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
//END DocumentObserver inherited methods
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2004-10-10 12:42:42 +00:00
|
|
|
//BEGIN widget events
|
2004-10-31 12:43:13 +00:00
|
|
|
void PageView::viewportPaintEvent( QPaintEvent * pe )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if ( d->document->handleEvent( pe ) )
|
2004-11-01 14:22:24 +00:00
|
|
|
{
|
2004-10-31 12:43:13 +00:00
|
|
|
// create the rect into contents from the clipped screen rect
|
2004-10-31 13:55:07 +00:00
|
|
|
QRect viewportRect = viewport()->rect();
|
|
|
|
QRect contentsRect = pe->rect().intersect( viewportRect );
|
2006-03-29 16:46:09 +00:00
|
|
|
contentsRect.translate( contentsX(), contentsY() );
|
2004-10-31 12:43:13 +00:00
|
|
|
if ( !contentsRect.isValid() )
|
2004-10-30 23:59:09 +00:00
|
|
|
return;
|
2004-10-30 20:54:48 +00:00
|
|
|
|
2005-03-24 19:10:41 +00:00
|
|
|
// create the screen painter. a pixel painted at contentsX,contentsY
|
2004-10-31 12:43:13 +00:00
|
|
|
// appears to the top-left corner of the scrollview.
|
2006-03-24 20:40:02 +00:00
|
|
|
QPainter screenPainter( viewport() );
|
2004-10-31 12:43:13 +00:00
|
|
|
screenPainter.translate( -contentsX(), -contentsY() );
|
2004-10-30 20:54:48 +00:00
|
|
|
|
2004-10-31 17:04:04 +00:00
|
|
|
// selectionRect is the normalized mouse selection rect
|
|
|
|
QRect selectionRect = d->mouseSelectionRect;
|
|
|
|
if ( !selectionRect.isNull() )
|
2006-03-29 16:46:09 +00:00
|
|
|
selectionRect = selectionRect.normalized();
|
2004-10-31 17:04:04 +00:00
|
|
|
// selectionRectInternal without the border
|
|
|
|
QRect selectionRectInternal = selectionRect;
|
2006-03-29 16:46:09 +00:00
|
|
|
selectionRectInternal.adjust( 1, 1, -1, -1 );
|
2004-10-31 17:04:04 +00:00
|
|
|
// color for blending
|
2005-01-29 12:32:59 +00:00
|
|
|
QColor selBlendColor = (selectionRect.width() > 8 || selectionRect.height() > 8) ?
|
2005-06-24 16:41:55 +00:00
|
|
|
d->mouseSelectionColor : Qt::red;
|
2004-10-31 17:04:04 +00:00
|
|
|
|
2004-11-01 14:37:15 +00:00
|
|
|
// subdivide region into rects
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector<QRect> allRects = pe->region().rects();
|
|
|
|
int numRects = allRects.count();
|
2004-11-01 14:37:15 +00:00
|
|
|
|
|
|
|
// preprocess rects area to see if it worths or not using subdivision
|
|
|
|
uint summedArea = 0;
|
2006-03-24 20:40:02 +00:00
|
|
|
for ( int i = 0; i < numRects; i++ )
|
2004-10-30 20:54:48 +00:00
|
|
|
{
|
2004-11-01 14:37:15 +00:00
|
|
|
const QRect & r = allRects[i];
|
|
|
|
summedArea += r.width() * r.height();
|
|
|
|
}
|
|
|
|
// very elementary check: SUMj(Region[j].area) is less than boundingRect.area
|
2005-04-05 15:05:54 +00:00
|
|
|
bool useSubdivision = summedArea < (0.6 * contentsRect.width() * contentsRect.height());
|
2004-11-01 14:37:15 +00:00
|
|
|
if ( !useSubdivision )
|
|
|
|
numRects = 1;
|
2004-11-08 13:13:46 +00:00
|
|
|
|
|
|
|
// iterate over the rects (only one loop if not using subdivision)
|
2004-11-01 14:37:15 +00:00
|
|
|
for ( uint i = 0; i < numRects; i++ )
|
|
|
|
{
|
|
|
|
if ( useSubdivision )
|
|
|
|
{
|
|
|
|
// set 'contentsRect' to a part of the sub-divided region
|
2006-03-29 16:46:09 +00:00
|
|
|
contentsRect = allRects[i].normalized().intersect( viewportRect );
|
|
|
|
contentsRect.translate( contentsX(), contentsY() );
|
2004-11-01 14:37:15 +00:00
|
|
|
if ( !contentsRect.isValid() )
|
|
|
|
continue;
|
|
|
|
}
|
2004-10-31 12:43:13 +00:00
|
|
|
|
2004-11-08 13:13:46 +00:00
|
|
|
// note: this check will take care of all things requiring alpha blending (not only selection)
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
bool wantCompositing = ( !selectionRect.isNull() && contentsRect.intersects( selectionRect ) )
|
|
|
|
|| d->mouseTextSelecting;
|
2004-11-08 13:13:46 +00:00
|
|
|
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( wantCompositing && KpdfSettings::enableCompositing() )
|
2004-10-30 20:54:48 +00:00
|
|
|
{
|
2004-11-08 13:13:46 +00:00
|
|
|
// create pixmap and open a painter over it (contents{left,top} becomes pixmap {0,0})
|
2004-10-31 13:55:07 +00:00
|
|
|
QPixmap doubleBuffer( contentsRect.size() );
|
|
|
|
QPainter pixmapPainter( &doubleBuffer );
|
|
|
|
pixmapPainter.translate( -contentsRect.left(), -contentsRect.top() );
|
|
|
|
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// calculate the color
|
|
|
|
XRenderColor col;
|
|
|
|
float alpha=0.2f;
|
|
|
|
QColor blCol=selBlendColor.dark(140);
|
|
|
|
col.red=( (blCol.red() << 8) | blCol.red() ) * alpha;
|
|
|
|
col.green=( (blCol.green() << 8) | blCol.green() )*alpha;
|
|
|
|
col.blue=( (blCol.blue() << 8) | blCol.blue())*alpha;
|
|
|
|
col.alpha=alpha*0xffff;
|
|
|
|
|
2004-11-01 14:22:24 +00:00
|
|
|
// 1) Layer 0: paint items and clear bg on unpainted rects
|
2005-04-01 16:24:11 +00:00
|
|
|
drawDocumentOnPainter( contentsRect, &pixmapPainter );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// 2) Layer 1a: paint (blend) transparent selection
|
2004-11-08 13:13:46 +00:00
|
|
|
if ( !selectionRect.isNull() && selectionRect.intersects( contentsRect ) &&
|
|
|
|
!selectionRectInternal.contains( contentsRect ) )
|
2004-10-31 13:55:07 +00:00
|
|
|
{
|
2004-10-31 17:04:04 +00:00
|
|
|
QRect blendRect = selectionRectInternal.intersect( contentsRect );
|
|
|
|
// skip rectangles covered by the selection's border
|
|
|
|
if ( blendRect.isValid() )
|
|
|
|
{
|
|
|
|
// grab current pixmap into a new one to colorize contents
|
|
|
|
QPixmap blendedPixmap( blendRect.width(), blendRect.height() );
|
|
|
|
copyBlt( &blendedPixmap, 0,0, &doubleBuffer,
|
|
|
|
blendRect.left() - contentsRect.left(), blendRect.top() - contentsRect.top(),
|
|
|
|
blendRect.width(), blendRect.height() );
|
|
|
|
// blend selBlendColor into the background pixmap
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// QImage blendedImage = blendedPixmap.convertToImage();
|
|
|
|
// KImageEffect::blend( selBlendColor.dark(140), blendedImage, 0.2 );
|
2006-06-11 23:38:12 +00:00
|
|
|
XRenderFillRectangle(x11Info().display(), PictOpOver, blendedPixmap.x11PictureHandle(), &col,
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
0,0, blendRect.width(), blendRect.height());
|
2004-10-31 17:04:04 +00:00
|
|
|
// copy the blended pixmap back to its place
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
pixmapPainter.drawPixmap( blendRect.left(), blendRect.top(), blendedPixmap );
|
2004-10-31 17:04:04 +00:00
|
|
|
}
|
|
|
|
// draw border (red if the selection is too small)
|
|
|
|
pixmapPainter.setPen( selBlendColor );
|
|
|
|
pixmapPainter.drawRect( selectionRect );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
}
|
|
|
|
if ( d->mouseTextSelecting )
|
|
|
|
{
|
|
|
|
QRect blendRect;
|
2006-03-24 21:31:46 +00:00
|
|
|
QList<QRect>::iterator it=d->mouseTextSelectionRect->begin(),
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
end=d->mouseTextSelectionRect->end();
|
|
|
|
XRenderColor col;
|
|
|
|
float alpha=0.2f;
|
|
|
|
QColor blCol=d->mouseTextSelectionColor.dark(140);
|
|
|
|
col.red=( (blCol.red() << 8) | blCol.red() ) * alpha;
|
|
|
|
col.green=( (blCol.green() << 8) | blCol.green() )*alpha;
|
|
|
|
col.blue=( (blCol.blue() << 8) | blCol.blue())*alpha;
|
|
|
|
col.alpha=alpha*0xffff;
|
|
|
|
|
|
|
|
for (;it!=end;++it)
|
|
|
|
{
|
|
|
|
if (! ((*it).intersects( contentsRect )))
|
|
|
|
continue;
|
|
|
|
blendRect = (*it).intersect(contentsRect);
|
|
|
|
QPixmap blendedPixmap( blendRect.width(), blendRect.height() );
|
|
|
|
copyBlt( &blendedPixmap, 0,0, &doubleBuffer,
|
|
|
|
blendRect.left() - contentsRect.left(), blendRect.top() - contentsRect.top(),
|
|
|
|
blendRect.width(), blendRect.height() );
|
|
|
|
// blend selBlendColor into the background pixmap
|
2006-06-11 23:38:12 +00:00
|
|
|
XRenderFillRectangle(x11Info().display(), PictOpOver, blendedPixmap.x11PictureHandle(), &col,
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
0,0, blendRect.width(), blendRect.height());
|
|
|
|
|
|
|
|
// KImageEffect::blend( d->mouseTextSelectionColor.dark(140), blendedImage, 0.2 );
|
|
|
|
|
|
|
|
// copy the blended pixmap back to its place
|
|
|
|
pixmapPainter.drawPixmap( blendRect.left(), blendRect.top(), blendedPixmap );
|
|
|
|
|
|
|
|
// draw border (red if the selection is too small)
|
|
|
|
pixmapPainter.setPen( d->mouseTextSelectionColor );
|
|
|
|
pixmapPainter.drawRect( selectionRect );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-31 13:55:07 +00:00
|
|
|
}
|
2005-04-01 16:24:11 +00:00
|
|
|
// 3) Layer 1: give annotator painting control
|
|
|
|
if ( d->annotator && d->annotator->routePaints( contentsRect ) )
|
|
|
|
d->annotator->routePaint( &pixmapPainter, contentsRect );
|
|
|
|
// 4) Layer 2: overlays
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( KpdfSettings::debugDrawBoundaries() )
|
2004-10-31 13:55:07 +00:00
|
|
|
{
|
|
|
|
pixmapPainter.setPen( Qt::blue );
|
|
|
|
pixmapPainter.drawRect( contentsRect );
|
|
|
|
}
|
2004-10-30 20:54:48 +00:00
|
|
|
|
2004-10-31 13:55:07 +00:00
|
|
|
// finish painting and draw contents
|
|
|
|
pixmapPainter.end();
|
|
|
|
screenPainter.drawPixmap( contentsRect.left(), contentsRect.top(), doubleBuffer );
|
|
|
|
}
|
2004-11-08 13:13:46 +00:00
|
|
|
else
|
2004-10-31 12:43:13 +00:00
|
|
|
{
|
2004-11-01 14:22:24 +00:00
|
|
|
// 1) Layer 0: paint items and clear bg on unpainted rects
|
2005-04-01 16:24:11 +00:00
|
|
|
drawDocumentOnPainter( contentsRect, &screenPainter );
|
|
|
|
// 2) Layer 1: paint opaque selection
|
2004-11-08 13:13:46 +00:00
|
|
|
if ( !selectionRect.isNull() && selectionRect.intersects( contentsRect ) &&
|
|
|
|
!selectionRectInternal.contains( contentsRect ) )
|
2004-10-31 13:55:07 +00:00
|
|
|
{
|
2006-06-07 18:33:25 +00:00
|
|
|
screenPainter.setPen( palette().color( QPalette::Active, QPalette::Highlight ).dark(110) );
|
2004-11-08 13:13:46 +00:00
|
|
|
screenPainter.drawRect( selectionRect );
|
2004-10-31 13:55:07 +00:00
|
|
|
}
|
2005-04-01 16:24:11 +00:00
|
|
|
// 3) Layer 1: give annotator painting control
|
|
|
|
if ( d->annotator && d->annotator->routePaints( contentsRect ) )
|
|
|
|
d->annotator->routePaint( &screenPainter, contentsRect );
|
|
|
|
// 4) Layer 2: overlays
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( KpdfSettings::debugDrawBoundaries() )
|
2004-10-31 13:55:07 +00:00
|
|
|
{
|
|
|
|
screenPainter.setPen( Qt::red );
|
|
|
|
screenPainter.drawRect( contentsRect );
|
|
|
|
}
|
2004-10-31 12:43:13 +00:00
|
|
|
}
|
2004-10-30 20:54:48 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
void PageView::viewportResizeEvent( QResizeEvent * event)
|
|
|
|
{
|
|
|
|
if (d->document->handleEvent( event ) )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
2005-02-26 18:05:01 +00:00
|
|
|
if ( d->items.isEmpty() )
|
|
|
|
return;
|
|
|
|
|
2005-03-24 19:10:41 +00:00
|
|
|
// start a timer that will refresh the pixmap after 0.2s
|
2005-02-26 18:05:01 +00:00
|
|
|
if ( !d->delayResizeTimer )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
2005-02-26 18:05:01 +00:00
|
|
|
d->delayResizeTimer = new QTimer( this );
|
2006-05-28 21:52:36 +00:00
|
|
|
d->delayResizeTimer->setSingleShot( true );
|
2005-02-26 18:05:01 +00:00
|
|
|
connect( d->delayResizeTimer, SIGNAL( timeout() ), this, SLOT( slotRelayoutPages() ) );
|
2004-10-29 21:52:06 +00:00
|
|
|
}
|
2006-05-28 21:52:36 +00:00
|
|
|
d->delayResizeTimer->start( 200 );
|
2004-10-29 21:52:06 +00:00
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
|
|
|
|
void PageView::keyPressEvent( QKeyEvent * e )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
|
|
|
if (d->document->handleEvent( e ) )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
|
|
|
e->accept();
|
2005-01-18 16:43:36 +00:00
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
// if performing a selection or dyn zooming, disable keys handling
|
2005-06-24 16:41:55 +00:00
|
|
|
if ( d->mouseSelecting || d->mouseMidZooming )
|
2005-02-01 18:24:16 +00:00
|
|
|
return;
|
|
|
|
|
2005-01-18 16:43:36 +00:00
|
|
|
// handle 'find as you type' (based on khtml/khtmlview.cpp)
|
2005-02-01 18:24:16 +00:00
|
|
|
if( d->typeAheadActive )
|
2005-01-14 23:19:04 +00:00
|
|
|
{
|
2005-02-01 18:26:56 +00:00
|
|
|
// backspace: remove a char and search or terminates search
|
2006-06-03 13:01:15 +00:00
|
|
|
if( e->key() == Qt::Key_Backspace )
|
2005-01-14 23:19:04 +00:00
|
|
|
{
|
2005-02-01 18:26:56 +00:00
|
|
|
if( d->typeAheadString.length() > 1 )
|
2005-01-14 23:19:04 +00:00
|
|
|
{
|
2005-02-01 18:26:56 +00:00
|
|
|
d->typeAheadString = d->typeAheadString.left( d->typeAheadString.length() - 1 );
|
2005-02-02 18:18:26 +00:00
|
|
|
bool found = d->document->searchText( PAGEVIEW_SEARCH_ID, d->typeAheadString, true, false,
|
2005-02-03 17:09:33 +00:00
|
|
|
KPDFDocument::NextMatch, true, qRgb( 128, 255, 128 ), true );
|
2006-04-10 19:50:00 +00:00
|
|
|
KLocalizedString status = found ? ki18n("Text found: \"%1\".") : ki18n("Text not found: \"%1\".");
|
|
|
|
d->messageWindow->display( status.subs(d->typeAheadString.toLower()).toString(),
|
2005-02-01 18:26:56 +00:00
|
|
|
found ? PageViewMessage::Find : PageViewMessage::Warning, 4000 );
|
2006-05-28 21:52:36 +00:00
|
|
|
d->findTimeoutTimer->start( 3000 );
|
2005-01-14 23:19:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-18 18:24:45 +00:00
|
|
|
slotStopFindAhead();
|
2005-02-02 18:18:26 +00:00
|
|
|
d->document->resetSearch( PAGEVIEW_SEARCH_ID );
|
2005-01-14 23:19:04 +00:00
|
|
|
}
|
|
|
|
}
|
2006-06-25 16:34:11 +00:00
|
|
|
// go to next occurrency
|
|
|
|
else if( e->key() == d->actionCollection->action( "find_next" )->shortcut().keyQt() )
|
2005-01-18 16:43:36 +00:00
|
|
|
{
|
|
|
|
// part doesn't get this key event because of the keyboard grab
|
2005-02-01 18:24:16 +00:00
|
|
|
d->findTimeoutTimer->stop(); // restore normal operation during possible messagebox is displayed
|
2005-06-18 15:45:26 +00:00
|
|
|
// (1/4) it is needed to grab the keyboard becase people may have Space assigned
|
|
|
|
// to a accel and without grabbing the keyboard you can not vim-search for space
|
|
|
|
// because it activates the accel
|
2005-01-18 16:43:36 +00:00
|
|
|
releaseKeyboard();
|
2005-02-02 18:18:26 +00:00
|
|
|
if ( d->document->continueSearch( PAGEVIEW_SEARCH_ID ) )
|
2006-04-10 19:50:00 +00:00
|
|
|
d->messageWindow->display( i18n("Text found: \"%1\".", d->typeAheadString.toLower()),
|
2005-01-20 17:33:05 +00:00
|
|
|
PageViewMessage::Find, 3000 );
|
2006-05-28 21:52:36 +00:00
|
|
|
d->findTimeoutTimer->start( 3000 );
|
2005-06-18 15:45:26 +00:00
|
|
|
// (2/4) it is needed to grab the keyboard becase people may have Space assigned
|
|
|
|
// to a accel and without grabbing the keyboard you can not vim-search for space
|
|
|
|
// because it activates the accel
|
2005-01-18 16:43:36 +00:00
|
|
|
grabKeyboard();
|
2005-01-14 23:19:04 +00:00
|
|
|
}
|
2005-02-01 18:26:56 +00:00
|
|
|
// esc and return: end search
|
2006-03-24 20:40:02 +00:00
|
|
|
else if( e->key() == Qt::Key_Escape || e->key() == Qt::Key_Return )
|
2005-01-14 23:19:04 +00:00
|
|
|
{
|
2005-02-18 18:24:45 +00:00
|
|
|
slotStopFindAhead();
|
2005-01-14 23:19:04 +00:00
|
|
|
}
|
2005-02-02 18:18:26 +00:00
|
|
|
// other key: add to text and search
|
2005-02-01 18:26:56 +00:00
|
|
|
else if( !e->text().isEmpty() )
|
2005-01-14 23:19:04 +00:00
|
|
|
{
|
2005-02-01 18:24:16 +00:00
|
|
|
d->typeAheadString += e->text();
|
2005-02-02 18:18:26 +00:00
|
|
|
bool found = d->document->searchText( PAGEVIEW_SEARCH_ID, d->typeAheadString, false, false,
|
2005-02-03 17:09:33 +00:00
|
|
|
KPDFDocument::NextMatch, true, qRgb( 128, 255, 128 ), true );
|
2006-04-10 19:50:00 +00:00
|
|
|
KLocalizedString status = found ? ki18n("Text found: \"%1\".") : ki18n("Text not found: \"%1\".");
|
|
|
|
d->messageWindow->display( status.subs(d->typeAheadString.toLower()).toString(),
|
2005-02-01 18:26:56 +00:00
|
|
|
found ? PageViewMessage::Find : PageViewMessage::Warning, 4000 );
|
2006-05-28 21:52:36 +00:00
|
|
|
d->findTimeoutTimer->start( 3000 );
|
2005-01-14 23:19:04 +00:00
|
|
|
}
|
2005-02-01 18:26:56 +00:00
|
|
|
return;
|
2005-01-14 23:19:04 +00:00
|
|
|
}
|
2005-06-24 16:45:25 +00:00
|
|
|
else if( e->key() == '/' && d->document->isOpened() && d->document->supportsSearching() )
|
2005-01-14 23:19:04 +00:00
|
|
|
{
|
2005-02-01 18:24:16 +00:00
|
|
|
// stop scrolling the page (if doing it)
|
|
|
|
if ( d->autoScrollTimer )
|
|
|
|
{
|
|
|
|
d->scrollIncrement = 0;
|
|
|
|
d->autoScrollTimer->stop();
|
|
|
|
}
|
|
|
|
// start type-adeas search
|
|
|
|
d->typeAheadString = QString();
|
2005-02-01 18:26:56 +00:00
|
|
|
d->messageWindow->display( i18n("Starting -- find text as you type"), PageViewMessage::Find, 3000 );
|
2005-02-01 18:24:16 +00:00
|
|
|
d->typeAheadActive = true;
|
|
|
|
if ( !d->findTimeoutTimer )
|
2005-01-18 16:43:36 +00:00
|
|
|
{
|
|
|
|
// create the timer on demand
|
2005-02-01 18:24:16 +00:00
|
|
|
d->findTimeoutTimer = new QTimer( this );
|
2006-05-28 21:52:36 +00:00
|
|
|
d->findTimeoutTimer->setSingleShot( true );
|
2005-02-18 18:24:45 +00:00
|
|
|
connect( d->findTimeoutTimer, SIGNAL( timeout() ), this, SLOT( slotStopFindAhead() ) );
|
2005-01-18 16:43:36 +00:00
|
|
|
}
|
2006-05-28 21:52:36 +00:00
|
|
|
d->findTimeoutTimer->start( 3000 );
|
2005-06-18 15:45:26 +00:00
|
|
|
// (3/4) it is needed to grab the keyboard becase people may have Space assigned
|
|
|
|
// to a accel and without grabbing the keyboard you can not vim-search for space
|
|
|
|
// because it activates the accel
|
2005-01-14 23:19:04 +00:00
|
|
|
grabKeyboard();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-02-02 18:18:26 +00:00
|
|
|
// if viewport is moving, disable keys handling
|
|
|
|
if ( d->viewportMoveActive )
|
|
|
|
return;
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
// move/scroll page by using keys
|
|
|
|
switch ( e->key() )
|
|
|
|
{
|
2006-03-24 20:40:02 +00:00
|
|
|
case Qt::Key_Up:
|
|
|
|
case Qt::Key_PageUp:
|
2006-07-04 21:57:19 +00:00
|
|
|
case Qt::Key_Backspace:
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// if in single page mode and at the top of the screen, go to \ page
|
2006-03-29 13:52:17 +00:00
|
|
|
if ( KpdfSettings::viewContinuous() || verticalScrollBar()->value() > verticalScrollBar()->minimum() )
|
2004-11-05 01:11:50 +00:00
|
|
|
{
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( e->key() == Qt::Key_Up )
|
2006-04-02 12:36:55 +00:00
|
|
|
verticalScrollBar()->triggerAction( QScrollBar::SliderSingleStepSub );
|
2004-11-05 01:11:50 +00:00
|
|
|
else
|
2006-04-02 12:36:55 +00:00
|
|
|
verticalScrollBar()->triggerAction( QScrollBar::SliderPageStepSub );
|
2004-11-05 01:11:50 +00:00
|
|
|
}
|
2005-01-09 23:37:07 +00:00
|
|
|
else if ( d->document->currentPage() > 0 )
|
|
|
|
{
|
|
|
|
// more optimized than document->setPrevPage and then move view to bottom
|
|
|
|
DocumentViewport newViewport = d->document->viewport();
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
newViewport.pageNumber -= viewColumns();
|
2005-04-14 11:33:28 +00:00
|
|
|
if ( newViewport.pageNumber < 0 )
|
|
|
|
newViewport.pageNumber = 0;
|
2005-06-13 11:53:47 +00:00
|
|
|
newViewport.rePos.enabled = true;
|
|
|
|
newViewport.rePos.normalizedY = 1.0;
|
2005-01-09 23:37:07 +00:00
|
|
|
d->document->setViewport( newViewport );
|
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
break;
|
2006-03-24 20:40:02 +00:00
|
|
|
case Qt::Key_Down:
|
|
|
|
case Qt::Key_PageDown:
|
2006-07-04 21:57:19 +00:00
|
|
|
case Qt::Key_Space:
|
2004-10-29 21:52:06 +00:00
|
|
|
// if in single page mode and at the bottom of the screen, go to next page
|
2006-03-29 13:52:17 +00:00
|
|
|
if ( KpdfSettings::viewContinuous() || verticalScrollBar()->value() < verticalScrollBar()->maximum() )
|
2004-11-05 01:11:50 +00:00
|
|
|
{
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( e->key() == Qt::Key_Down )
|
2006-04-02 12:36:55 +00:00
|
|
|
verticalScrollBar()->triggerAction( QScrollBar::SliderSingleStepAdd );
|
2004-11-05 01:11:50 +00:00
|
|
|
else
|
2006-04-02 12:36:55 +00:00
|
|
|
verticalScrollBar()->triggerAction( QScrollBar::SliderPageStepAdd );
|
2004-11-05 01:11:50 +00:00
|
|
|
}
|
2005-01-09 23:37:07 +00:00
|
|
|
else if ( d->document->currentPage() < d->items.count() - 1 )
|
|
|
|
{
|
2005-06-13 11:53:47 +00:00
|
|
|
// more optimized than document->setNextPage and then move view to top
|
2005-01-09 23:37:07 +00:00
|
|
|
DocumentViewport newViewport = d->document->viewport();
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
newViewport.pageNumber += d->document->currentPage() ? viewColumns() : 1;
|
2005-04-14 11:33:28 +00:00
|
|
|
if ( newViewport.pageNumber >= (int)d->items.count() )
|
|
|
|
newViewport.pageNumber = d->items.count() - 1;
|
2005-06-13 11:53:47 +00:00
|
|
|
newViewport.rePos.enabled = true;
|
|
|
|
newViewport.rePos.normalizedY = 0.0;
|
2005-01-09 23:37:07 +00:00
|
|
|
d->document->setViewport( newViewport );
|
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
break;
|
2006-03-24 20:40:02 +00:00
|
|
|
case Qt::Key_Left:
|
2006-04-02 12:36:55 +00:00
|
|
|
horizontalScrollBar()->triggerAction( QScrollBar::SliderSingleStepSub );
|
2004-10-29 21:52:06 +00:00
|
|
|
break;
|
2006-03-24 20:40:02 +00:00
|
|
|
case Qt::Key_Right:
|
2006-04-02 12:36:55 +00:00
|
|
|
horizontalScrollBar()->triggerAction( QScrollBar::SliderSingleStepAdd );
|
2004-10-29 21:52:06 +00:00
|
|
|
break;
|
2006-03-24 20:40:02 +00:00
|
|
|
case Qt::Key_Shift:
|
|
|
|
case Qt::Key_Control:
|
2005-02-01 18:24:16 +00:00
|
|
|
if ( d->autoScrollTimer )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
2005-02-01 18:24:16 +00:00
|
|
|
if ( d->autoScrollTimer->isActive() )
|
|
|
|
d->autoScrollTimer->stop();
|
2004-10-29 21:52:06 +00:00
|
|
|
else
|
|
|
|
slotAutoScoll();
|
|
|
|
return;
|
|
|
|
}
|
2006-04-23 15:49:14 +00:00
|
|
|
// else fall trhough
|
2004-10-29 21:52:06 +00:00
|
|
|
default:
|
|
|
|
e->ignore();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// if a known key has been pressed, stop scrolling the page
|
2005-02-01 18:24:16 +00:00
|
|
|
if ( d->autoScrollTimer )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
|
|
|
d->scrollIncrement = 0;
|
2005-02-01 18:24:16 +00:00
|
|
|
d->autoScrollTimer->stop();
|
2004-10-29 21:52:06 +00:00
|
|
|
}
|
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
|
|
|
|
void PageView::contentsMouseMoveEvent( QMouseEvent * e )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
|
|
|
if (d->document->handleEvent( e ) )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
2005-01-29 12:32:59 +00:00
|
|
|
// don't perform any mouse action when no document is shown
|
|
|
|
if ( d->items.isEmpty() )
|
|
|
|
return;
|
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
// don't perform any mouse action when viewport is autoscrolling
|
|
|
|
if ( d->viewportMoveActive )
|
|
|
|
return;
|
|
|
|
|
2004-11-16 17:36:02 +00:00
|
|
|
// if holding mouse mid button, perform zoom
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( d->mouseMidZooming && (e->state() & Qt::MidButton) )
|
2004-11-16 17:36:02 +00:00
|
|
|
{
|
2005-03-24 19:10:41 +00:00
|
|
|
int mouseY = e->globalPos().y();
|
|
|
|
int deltaY = d->mouseMidLastY - mouseY;
|
|
|
|
|
|
|
|
// wrap mouse from top to bottom
|
|
|
|
QRect mouseContainer = KGlobalSettings::desktopGeometry( this );
|
|
|
|
if ( mouseY <= mouseContainer.top() + 4 &&
|
|
|
|
d->zoomFactor < 3.99 )
|
|
|
|
{
|
|
|
|
mouseY = mouseContainer.bottom() - 5;
|
|
|
|
QCursor::setPos( e->globalPos().x(), mouseY );
|
|
|
|
}
|
|
|
|
// wrap mouse from bottom to top
|
|
|
|
else if ( mouseY >= mouseContainer.bottom() - 4 &&
|
|
|
|
d->zoomFactor > 0.11 )
|
|
|
|
{
|
|
|
|
mouseY = mouseContainer.top() + 5;
|
|
|
|
QCursor::setPos( e->globalPos().x(), mouseY );
|
|
|
|
}
|
|
|
|
// remember last position
|
|
|
|
d->mouseMidLastY = mouseY;
|
|
|
|
|
|
|
|
// update zoom level, perform zoom and redraw
|
|
|
|
if ( deltaY )
|
|
|
|
{
|
|
|
|
d->zoomFactor *= ( 1.0 + ( (double)deltaY / 500.0 ) );
|
|
|
|
updateZoom( ZoomRefreshCurrent );
|
2006-06-03 13:01:15 +00:00
|
|
|
viewport()->repaint();
|
2005-03-24 19:10:41 +00:00
|
|
|
}
|
2004-11-16 17:36:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
|
2005-02-18 18:24:45 +00:00
|
|
|
// if we're editing an annotation, dispatch event to it
|
2005-03-04 23:06:24 +00:00
|
|
|
if ( d->annotator && d->annotator->routeEvents() )
|
2005-02-18 18:24:45 +00:00
|
|
|
{
|
2005-03-04 23:06:24 +00:00
|
|
|
PageViewItem * pageItem = pickItemOnPoint( e->x(), e->y() );
|
|
|
|
d->annotator->routeEvent( e, pageItem );
|
2005-02-18 18:24:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-06-10 17:06:03 +00:00
|
|
|
bool leftButton = e->state() & Qt::LeftButton,
|
2006-03-24 20:40:02 +00:00
|
|
|
rightButton = e->state() & Qt::RightButton;
|
2004-10-29 21:52:06 +00:00
|
|
|
switch ( d->mouseMode )
|
|
|
|
{
|
|
|
|
case MouseNormal:
|
|
|
|
if ( leftButton )
|
|
|
|
{
|
|
|
|
// drag page
|
|
|
|
if ( !d->mouseGrabPos.isNull() )
|
|
|
|
{
|
2005-03-24 19:10:41 +00:00
|
|
|
QPoint mousePos = e->globalPos();
|
|
|
|
QPoint delta = d->mouseGrabPos - mousePos;
|
|
|
|
|
|
|
|
// wrap mouse from top to bottom
|
|
|
|
QRect mouseContainer = KGlobalSettings::desktopGeometry( this );
|
|
|
|
if ( mousePos.y() <= mouseContainer.top() + 4 &&
|
2006-03-29 13:52:17 +00:00
|
|
|
verticalScrollBar()->value() < verticalScrollBar()->maximum() - 10 )
|
2005-03-24 19:10:41 +00:00
|
|
|
{
|
|
|
|
mousePos.setY( mouseContainer.bottom() - 5 );
|
|
|
|
QCursor::setPos( mousePos );
|
|
|
|
}
|
|
|
|
// wrap mouse from bottom to top
|
|
|
|
else if ( mousePos.y() >= mouseContainer.bottom() - 4 &&
|
|
|
|
verticalScrollBar()->value() > 10 )
|
|
|
|
{
|
|
|
|
mousePos.setY( mouseContainer.top() + 5 );
|
|
|
|
QCursor::setPos( mousePos );
|
|
|
|
}
|
|
|
|
// remember last position
|
|
|
|
d->mouseGrabPos = mousePos;
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
// scroll page by position increment
|
|
|
|
scrollBy( delta.x(), delta.y() );
|
|
|
|
}
|
|
|
|
}
|
2005-01-29 12:32:59 +00:00
|
|
|
else if ( rightButton && !d->mousePressPos.isNull() )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// if mouse moves 5 px away from the press point, do 'textselection'
|
|
|
|
int deltaX = e->x() - d->mouseSelectPos.x(),
|
|
|
|
deltaY = e->y() - d->mouseSelectPos.y();
|
|
|
|
if ( d->document->supportsSearching() && ( deltaX > 5 || deltaX < -5 || deltaY > 5 || deltaY < -5 ) )
|
2005-01-29 12:32:59 +00:00
|
|
|
{
|
2006-03-29 17:16:46 +00:00
|
|
|
PageViewItem * currentItem = d->items[ qMax( 0, (int)d->document->currentPage() ) ];
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// PageViewItem* item=pickItemOnPoint(e->x(),e->y());
|
|
|
|
const KPDFPage * kpdfPage = currentItem->page();
|
|
|
|
// build a proper rectangle (make sure left/top is to the left of right/bottom)
|
|
|
|
// QRect rect (d->mouseSelectPos,e->pos());
|
|
|
|
// rect=rect.normalize();
|
|
|
|
//
|
|
|
|
QRect vRect = currentItem->geometry();
|
2006-03-29 13:52:17 +00:00
|
|
|
// kDebug() << "viewport " << vRect << endl;
|
|
|
|
// kDebug() << "selection (UN) " << rect << endl;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// // move selection area over to relevant viewport
|
|
|
|
// rect.moveBy(-vRect.left(),-vRect.top());
|
2006-03-29 13:52:17 +00:00
|
|
|
// kDebug() << "selection (MV) " << rect << endl;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// clip to viewport
|
|
|
|
// rect &= vRect;
|
2006-03-29 13:52:17 +00:00
|
|
|
// kDebug() << "selection (CL) " << rect << endl;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// FIXME: width and height are greater by 1 then the selection.
|
|
|
|
// rect.addCoords(1,1,-1,-1);
|
|
|
|
|
|
|
|
if ( !kpdfPage->hasSearchPage() )
|
|
|
|
d->document->requestTextPage( kpdfPage->number() );
|
|
|
|
NormalizedPoint startCursor(d->mouseSelectPos.x()-vRect.left(),d->mouseSelectPos.y()-vRect.top(),
|
|
|
|
vRect.width(), vRect.height());
|
|
|
|
NormalizedPoint endCursor(e->x()-vRect.left(),e->y()-vRect.top(),vRect.width(), vRect.height());
|
|
|
|
|
|
|
|
if ( ! d->mouseTextSelectionInfo )
|
|
|
|
d->mouseTextSelectionInfo=new TextSelection(startCursor,endCursor);
|
|
|
|
else
|
|
|
|
d->mouseTextSelectionInfo->end(endCursor);
|
|
|
|
RegularAreaRect * selectionArea=kpdfPage->getTextArea(d->mouseTextSelectionInfo);
|
2006-03-29 13:52:17 +00:00
|
|
|
kWarning () << "text areas: " << selectionArea->count() << endl;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( selectionArea->count() > 0 )
|
|
|
|
{
|
2006-06-07 18:33:25 +00:00
|
|
|
QColor selColor = palette().color( QPalette::Active, QPalette::Highlight );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
textSelection(selectionArea->geometry(vRect.width(),vRect.height(),vRect.left(),vRect.top())
|
|
|
|
,selColor);
|
|
|
|
}
|
|
|
|
delete selectionArea;
|
2005-01-29 12:32:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// only hovering the page, so update the cursor
|
2004-12-26 21:20:17 +00:00
|
|
|
updateCursor( e->pos() );
|
2004-10-31 17:12:52 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
break;
|
|
|
|
|
2004-11-03 17:35:48 +00:00
|
|
|
case MouseZoom:
|
2004-11-16 17:36:02 +00:00
|
|
|
case MouseSelect:
|
2005-01-28 17:21:28 +00:00
|
|
|
// set second corner of selection
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// TODO: does this condition make sense?
|
|
|
|
if ( d->mouseSelecting || (d->mouseSelecting && d->aPrevAction) )
|
2004-11-03 17:35:48 +00:00
|
|
|
selectionEndPoint( e->x(), e->y() );
|
2004-10-29 21:52:06 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
|
2004-09-26 23:39:39 +00:00
|
|
|
void PageView::contentsMousePressEvent( QMouseEvent * e )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( d->document->handleEvent( e ) )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2005-01-29 12:32:59 +00:00
|
|
|
// don't perform any mouse action when no document is shown
|
|
|
|
if ( d->items.isEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// if performing a selection or dyn zooming, disable mouse press
|
2005-06-24 16:41:55 +00:00
|
|
|
if ( d->mouseSelecting || d->mouseMidZooming || d->viewportMoveActive )
|
2005-01-29 12:32:59 +00:00
|
|
|
return;
|
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
// if the page is scrolling, stop it
|
|
|
|
if ( d->autoScrollTimer )
|
|
|
|
{
|
|
|
|
d->scrollIncrement = 0;
|
|
|
|
d->autoScrollTimer->stop();
|
|
|
|
}
|
|
|
|
|
2005-03-24 19:10:41 +00:00
|
|
|
// if pressing mid mouse button while not doing other things, begin 'continuous zoom' mode
|
2006-06-07 20:24:32 +00:00
|
|
|
if ( e->button() == Qt::MidButton )
|
2004-11-16 17:36:02 +00:00
|
|
|
{
|
2005-03-24 19:10:41 +00:00
|
|
|
d->mouseMidZooming = true;
|
|
|
|
d->mouseMidLastY = e->globalPos().y();
|
2006-06-03 13:01:15 +00:00
|
|
|
setCursor( Qt::SizeVerCursor );
|
2004-11-16 17:36:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-10-20 16:41:13 +00:00
|
|
|
|
2005-02-18 18:24:45 +00:00
|
|
|
// if we're editing an annotation, dispatch event to it
|
2005-03-04 23:06:24 +00:00
|
|
|
if ( d->annotator && d->annotator->routeEvents() )
|
2005-02-18 18:24:45 +00:00
|
|
|
{
|
2005-03-04 23:06:24 +00:00
|
|
|
PageViewItem * pageItem = pickItemOnPoint( e->x(), e->y() );
|
|
|
|
d->annotator->routeEvent( e, pageItem );
|
2005-02-18 18:24:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-01-29 12:32:59 +00:00
|
|
|
// update press / 'start drag' mouse position
|
|
|
|
d->mousePressPos = e->globalPos();
|
|
|
|
|
2004-10-20 16:41:13 +00:00
|
|
|
// handle mode dependant mouse press actions
|
2006-06-10 17:06:03 +00:00
|
|
|
bool leftButton = e->button() & Qt::LeftButton,
|
2006-03-24 20:40:02 +00:00
|
|
|
rightButton = e->button() & Qt::RightButton;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
|
|
|
// Not sure we should erase the selection when clicking with left.
|
2006-06-10 17:06:03 +00:00
|
|
|
if ( !(rightButton && d->mouseMode==MouseNormal) && d->mouseTextSelectionPainted )
|
|
|
|
textSelectionClear();
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
2004-09-26 23:39:39 +00:00
|
|
|
switch ( d->mouseMode )
|
|
|
|
{
|
2005-01-29 12:32:59 +00:00
|
|
|
case MouseNormal: // drag start / click / link following
|
2004-10-20 16:41:13 +00:00
|
|
|
if ( leftButton )
|
2004-09-30 18:16:12 +00:00
|
|
|
{
|
2005-01-29 12:32:59 +00:00
|
|
|
d->mouseGrabPos = d->mouseOnRect ? QPoint() : d->mousePressPos;
|
2004-12-10 16:04:45 +00:00
|
|
|
if ( !d->mouseOnRect )
|
2006-06-03 13:01:15 +00:00
|
|
|
setCursor( Qt::SizeAllCursor );
|
2004-09-30 18:16:12 +00:00
|
|
|
}
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
else if (rightButton)
|
|
|
|
d->mouseSelectPos=e->pos() ; // just check
|
2004-10-20 16:41:13 +00:00
|
|
|
break;
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2005-01-29 12:32:59 +00:00
|
|
|
case MouseZoom: // set first corner of the zoom rect
|
|
|
|
if ( leftButton )
|
2006-06-07 18:33:25 +00:00
|
|
|
selectionStart( e->x(), e->y(), palette().color( QPalette::Active, QPalette::Highlight ), false );
|
2005-01-29 12:32:59 +00:00
|
|
|
else if ( rightButton )
|
|
|
|
updateZoom( ZoomOut );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MouseSelect: // set first corner of the selection rect
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// if ( leftButton )
|
|
|
|
// {
|
2006-06-07 18:33:25 +00:00
|
|
|
QColor selColor = palette().color( QPalette::Active, QPalette::Highlight ).light( 120 );
|
2005-01-29 12:32:59 +00:00
|
|
|
selectionStart( e->x(), e->y(), selColor, false );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// }
|
2004-11-03 17:35:48 +00:00
|
|
|
break;
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2004-09-28 13:53:47 +00:00
|
|
|
void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
|
|
|
if (d->document->handleEvent( e ) )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2005-02-26 18:05:01 +00:00
|
|
|
// don't perform any mouse action when no document is shown..
|
2005-01-29 12:32:59 +00:00
|
|
|
if ( d->items.isEmpty() )
|
2005-02-26 18:05:01 +00:00
|
|
|
{
|
|
|
|
// ..except for right Clicks (emitted even it viewport is empty)
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( e->button() == Qt::RightButton )
|
2005-02-26 18:05:01 +00:00
|
|
|
emit rightClick( 0, e->globalPos() );
|
2005-01-29 12:32:59 +00:00
|
|
|
return;
|
2005-02-26 18:05:01 +00:00
|
|
|
}
|
2005-01-29 12:32:59 +00:00
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
// don't perform any mouse action when viewport is autoscrolling
|
|
|
|
if ( d->viewportMoveActive )
|
|
|
|
return;
|
|
|
|
|
2004-11-16 17:36:02 +00:00
|
|
|
// handle mode indepent mid buttom zoom
|
2006-06-07 20:24:32 +00:00
|
|
|
if ( d->mouseMidZooming && (e->button() == Qt::MidButton) )
|
2004-11-16 17:36:02 +00:00
|
|
|
{
|
2005-03-24 19:10:41 +00:00
|
|
|
d->mouseMidZooming = false;
|
|
|
|
// request pixmaps since it was disabled during drag
|
|
|
|
slotRequestVisiblePixmaps();
|
|
|
|
// the cursor may now be over a link.. update it
|
2005-01-02 11:50:38 +00:00
|
|
|
updateCursor( e->pos() );
|
2004-11-16 17:36:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-02-18 18:24:45 +00:00
|
|
|
// if we're editing an annotation, dispatch event to it
|
2005-03-04 23:06:24 +00:00
|
|
|
if ( d->annotator && d->annotator->routeEvents() )
|
2005-02-18 18:24:45 +00:00
|
|
|
{
|
2005-03-04 23:06:24 +00:00
|
|
|
PageViewItem * pageItem = pickItemOnPoint( e->x(), e->y() );
|
|
|
|
d->annotator->routeEvent( e, pageItem );
|
2005-02-18 18:24:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-06-10 17:06:03 +00:00
|
|
|
bool leftButton = e->buttons() & Qt::LeftButton,
|
2006-06-07 20:24:32 +00:00
|
|
|
rightButton = e->buttons() & Qt::RightButton;
|
2004-09-26 23:39:39 +00:00
|
|
|
switch ( d->mouseMode )
|
|
|
|
{
|
2005-01-29 12:32:59 +00:00
|
|
|
case MouseNormal:{
|
2005-01-02 11:50:38 +00:00
|
|
|
// return the cursor to its normal state after dragging
|
2005-01-29 12:32:59 +00:00
|
|
|
if ( cursor().shape() == Qt::SizeAllCursor )
|
|
|
|
updateCursor( e->pos() );
|
2005-01-02 11:50:38 +00:00
|
|
|
|
2005-01-02 17:24:50 +00:00
|
|
|
PageViewItem * pageItem = pickItemOnPoint( e->x(), e->y() );
|
|
|
|
|
2005-01-29 12:32:59 +00:00
|
|
|
// if the mouse has not moved since the press, that's a -click-
|
|
|
|
if ( leftButton && pageItem && d->mousePressPos == e->globalPos())
|
2004-10-02 14:30:30 +00:00
|
|
|
{
|
2005-02-08 15:24:23 +00:00
|
|
|
double nX = (double)(e->x() - pageItem->geometry().left()) / (double)pageItem->width(),
|
|
|
|
nY = (double)(e->y() - pageItem->geometry().top()) / (double)pageItem->height();
|
2005-07-15 18:20:57 +00:00
|
|
|
const ObjectRect * rect;
|
|
|
|
rect = pageItem->page()->getObjectRect( ObjectRect::Link, nX, nY );
|
2004-12-10 16:04:45 +00:00
|
|
|
if ( rect )
|
2004-10-20 16:41:13 +00:00
|
|
|
{
|
2005-07-15 18:20:57 +00:00
|
|
|
// handle click over a link
|
|
|
|
const KPDFLink * link = static_cast< const KPDFLink * >( rect->pointer() );
|
|
|
|
d->document->processLink( link );
|
2004-10-20 16:41:13 +00:00
|
|
|
}
|
2005-07-15 18:20:57 +00:00
|
|
|
else
|
2004-10-20 16:41:13 +00:00
|
|
|
{
|
2005-07-15 18:20:57 +00:00
|
|
|
// a link can move us to another page or even to another document, there's no point in trying to
|
|
|
|
// process the click on the image once we have processes the click on the link
|
|
|
|
rect = pageItem->page()->getObjectRect( ObjectRect::Image, nX, nY );
|
|
|
|
if ( rect )
|
|
|
|
{
|
|
|
|
// handle click over a image
|
|
|
|
}
|
|
|
|
/* Enrico and me have decided this is not worth the trouble it generates
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// if not on a rect, the click selects the page
|
|
|
|
// if ( pageItem->pageNumber() != (int)d->document->currentPage() )
|
|
|
|
d->document->setViewportPage( pageItem->pageNumber(), PAGEVIEW_ID );
|
|
|
|
}*/
|
2004-10-20 16:41:13 +00:00
|
|
|
}
|
2004-10-02 14:30:30 +00:00
|
|
|
}
|
2004-12-04 23:23:18 +00:00
|
|
|
else if ( rightButton )
|
2004-09-28 13:53:47 +00:00
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( d->mouseTextSelecting )
|
|
|
|
{
|
|
|
|
d->mouseTextSelecting = false;
|
|
|
|
delete d->mouseTextSelectionInfo;
|
|
|
|
d->mouseTextSelectionInfo=0;
|
2006-06-10 17:06:03 +00:00
|
|
|
// textSelectionClear();
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// textSelectionToClipboard();
|
|
|
|
}
|
|
|
|
else
|
2005-01-29 12:32:59 +00:00
|
|
|
// right click (if not within 5 px of the press point, the mode
|
|
|
|
// had been already changed to 'Selection' instead of 'Normal')
|
|
|
|
emit rightClick( pageItem ? pageItem->page() : 0, e->globalPos() );
|
2004-09-28 13:53:47 +00:00
|
|
|
}
|
2004-11-16 17:36:02 +00:00
|
|
|
}break;
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2005-01-29 12:32:59 +00:00
|
|
|
case MouseZoom:
|
|
|
|
// if a selection rect has been defined, zoom into it
|
2005-06-24 16:41:55 +00:00
|
|
|
if ( leftButton && d->mouseSelecting )
|
2004-11-03 17:35:48 +00:00
|
|
|
{
|
2006-03-29 16:46:09 +00:00
|
|
|
QRect selRect = d->mouseSelectionRect.normalized();
|
2005-01-29 12:32:59 +00:00
|
|
|
if ( selRect.width() <= 8 && selRect.height() <= 8 )
|
|
|
|
{
|
|
|
|
selectionClear();
|
2004-11-05 01:11:50 +00:00
|
|
|
break;
|
2005-01-29 12:32:59 +00:00
|
|
|
}
|
2004-11-03 17:35:48 +00:00
|
|
|
|
2004-11-05 01:11:50 +00:00
|
|
|
// find out new zoom ratio and normalized view center (relative to the contentsRect)
|
2006-03-29 16:46:09 +00:00
|
|
|
double zoom = qMin( (double)visibleWidth() / (double)selRect.width(), (double)visibleHeight() / (double)selRect.height() );
|
2004-11-10 17:08:46 +00:00
|
|
|
double nX = (double)(selRect.left() + selRect.right()) / (2.0 * (double)contentsWidth());
|
|
|
|
double nY = (double)(selRect.top() + selRect.bottom()) / (2.0 * (double)contentsHeight());
|
2004-11-03 17:35:48 +00:00
|
|
|
|
|
|
|
// zoom up to 400%
|
|
|
|
if ( d->zoomFactor <= 4.0 || zoom <= 1.0 )
|
|
|
|
{
|
|
|
|
d->zoomFactor *= zoom;
|
2004-11-05 01:11:50 +00:00
|
|
|
viewport()->setUpdatesEnabled( false );
|
2004-11-03 17:35:48 +00:00
|
|
|
updateZoom( ZoomRefreshCurrent );
|
2004-11-05 01:11:50 +00:00
|
|
|
viewport()->setUpdatesEnabled( true );
|
2004-11-03 17:35:48 +00:00
|
|
|
}
|
|
|
|
|
2004-11-05 01:11:50 +00:00
|
|
|
// recenter view and update the viewport
|
2004-11-03 17:35:48 +00:00
|
|
|
center( (int)(nX * contentsWidth()), (int)(nY * contentsHeight()) );
|
2004-11-05 01:11:50 +00:00
|
|
|
updateContents();
|
2004-11-03 17:35:48 +00:00
|
|
|
|
|
|
|
// hide message box and delete overlay window
|
|
|
|
selectionClear();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-01-29 12:32:59 +00:00
|
|
|
case MouseSelect:{
|
2005-06-13 11:28:15 +00:00
|
|
|
// if mouse is released and selection is null this is a rightClick
|
2005-06-24 16:41:55 +00:00
|
|
|
if ( rightButton && !d->mouseSelecting )
|
2005-03-05 15:59:15 +00:00
|
|
|
{
|
|
|
|
PageViewItem * pageItem = pickItemOnPoint( e->x(), e->y() );
|
|
|
|
emit rightClick( pageItem ? pageItem->page() : 0, e->globalPos() );
|
2005-06-13 11:28:15 +00:00
|
|
|
break;
|
2005-03-05 15:59:15 +00:00
|
|
|
}
|
2005-06-13 11:28:15 +00:00
|
|
|
|
2005-01-29 12:32:59 +00:00
|
|
|
// if a selection is defined, display a popup
|
2005-03-24 19:10:41 +00:00
|
|
|
if ( (!leftButton && !d->aPrevAction) || (!rightButton && d->aPrevAction) ||
|
2005-06-24 16:41:55 +00:00
|
|
|
!d->mouseSelecting )
|
2004-11-16 17:36:02 +00:00
|
|
|
break;
|
2004-10-20 16:41:13 +00:00
|
|
|
|
2006-03-29 16:46:09 +00:00
|
|
|
QRect selectionRect = d->mouseSelectionRect.normalized();
|
2005-01-29 12:32:59 +00:00
|
|
|
if ( selectionRect.width() <= 8 && selectionRect.height() <= 8 )
|
2005-01-02 10:46:33 +00:00
|
|
|
{
|
|
|
|
selectionClear();
|
2005-01-29 12:32:59 +00:00
|
|
|
if ( d->aPrevAction )
|
|
|
|
{
|
2006-03-24 20:40:02 +00:00
|
|
|
d->aPrevAction->trigger();
|
2005-01-29 12:32:59 +00:00
|
|
|
d->aPrevAction = 0;
|
|
|
|
}
|
2004-11-16 17:36:02 +00:00
|
|
|
break;
|
2005-01-02 10:46:33 +00:00
|
|
|
}
|
2004-11-03 17:35:48 +00:00
|
|
|
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
// if we support text generation
|
2006-05-26 14:32:35 +00:00
|
|
|
QString selectedText;
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
if (d->document->supportsSearching())
|
|
|
|
{
|
2006-05-24 08:52:16 +00:00
|
|
|
// grab text in selection by extracting it from all intersected pages
|
|
|
|
RegularAreaRect * rects=new RegularAreaRect;
|
|
|
|
const KPDFPage * kpdfPage=0;
|
|
|
|
QVector< PageViewItem * >::iterator iIt = d->items.begin(), iEnd = d->items.end();
|
|
|
|
for ( ; iIt != iEnd; ++iIt )
|
|
|
|
{
|
|
|
|
PageViewItem * item = *iIt;
|
|
|
|
const QRect & itemRect = item->geometry();
|
|
|
|
if ( selectionRect.intersects( itemRect ) )
|
|
|
|
{
|
|
|
|
// request the textpage if there isn't one
|
|
|
|
kpdfPage= item->page();
|
|
|
|
kWarning() << "checking if page " << item->pageNumber() << " has text " << kpdfPage->hasSearchPage() << endl;
|
|
|
|
if ( !kpdfPage->hasSearchPage() )
|
|
|
|
d->document->requestTextPage( kpdfPage->number() );
|
|
|
|
// grab text in the rect that intersects itemRect
|
|
|
|
QRect relativeRect = selectionRect.intersect( itemRect );
|
|
|
|
relativeRect.translate( -itemRect.left(), -itemRect.top() );
|
|
|
|
rects->append(new NormalizedRect( relativeRect, item->width(), item->height() ));
|
|
|
|
}
|
|
|
|
}
|
2006-05-25 20:00:56 +00:00
|
|
|
if (kpdfPage) selectedText = kpdfPage->getText( rects );
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-11-03 17:35:48 +00:00
|
|
|
|
2004-11-16 17:36:02 +00:00
|
|
|
// popup that ask to copy:text and copy/save:image
|
2006-03-24 20:40:02 +00:00
|
|
|
KMenu menu( this );
|
|
|
|
QAction *textToClipboard = 0, *speakText = 0, *imageToClipboard = 0, *imageToFile = 0;
|
2006-05-26 14:32:35 +00:00
|
|
|
if ( d->document->supportsSearching() && !selectedText.isEmpty() )
|
2004-11-16 17:36:02 +00:00
|
|
|
{
|
2006-05-26 14:32:35 +00:00
|
|
|
menu.addTitle( i18np( "Text (1 character)", "Text (%n characters)", selectedText.length() ) );
|
2006-04-05 17:49:44 +00:00
|
|
|
textToClipboard = menu.addAction( SmallIconSet("editcopy"), i18n( "Copy to Clipboard" ) );
|
2005-03-05 15:59:15 +00:00
|
|
|
if ( !d->document->isAllowed( KPDFDocument::AllowCopy ) )
|
2006-05-19 18:22:54 +00:00
|
|
|
{
|
2006-04-05 17:49:44 +00:00
|
|
|
textToClipboard->setEnabled( false );
|
2006-05-19 18:22:54 +00:00
|
|
|
textToClipboard->setText( i18n("Copy forbidden by DRM") );
|
|
|
|
}
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( KpdfSettings::useKTTSD() )
|
2006-04-05 17:49:44 +00:00
|
|
|
speakText = menu.addAction( SmallIconSet("kttsd"), i18n( "Speak Text" ) );
|
2004-11-16 17:36:02 +00:00
|
|
|
}
|
2006-04-10 19:50:00 +00:00
|
|
|
menu.addTitle( i18n( "Image (%1 by %2 pixels)", selectionRect.width(), selectionRect.height() ) );
|
2006-03-24 20:40:02 +00:00
|
|
|
imageToClipboard = menu.addAction( QIcon(SmallIcon("image")), i18n( "Copy to Clipboard" ) );
|
|
|
|
imageToFile = menu.addAction( QIcon(SmallIcon("filesave")), i18n( "Save to File..." ) );
|
|
|
|
QAction *choice = menu.exec( e->globalPos() );
|
2006-06-02 10:32:29 +00:00
|
|
|
// check if the user really selected an action
|
2006-06-02 10:30:32 +00:00
|
|
|
if ( choice )
|
|
|
|
{
|
2006-06-02 10:32:29 +00:00
|
|
|
// IMAGE operation choosen
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( choice == imageToClipboard || choice == imageToFile )
|
2004-11-03 17:35:48 +00:00
|
|
|
{
|
2004-11-16 17:36:02 +00:00
|
|
|
// renders page into a pixmap
|
|
|
|
QPixmap copyPix( selectionRect.width(), selectionRect.height() );
|
|
|
|
QPainter copyPainter( ©Pix );
|
|
|
|
copyPainter.translate( -selectionRect.left(), -selectionRect.top() );
|
2005-04-01 16:24:11 +00:00
|
|
|
drawDocumentOnPainter( selectionRect, ©Painter );
|
2004-11-16 17:36:02 +00:00
|
|
|
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( choice == imageToClipboard )
|
2004-11-03 17:35:48 +00:00
|
|
|
{
|
2004-11-16 17:36:02 +00:00
|
|
|
// [2] copy pixmap to clipboard
|
|
|
|
QClipboard *cb = QApplication::clipboard();
|
|
|
|
cb->setPixmap( copyPix, QClipboard::Clipboard );
|
|
|
|
if ( cb->supportsSelection() )
|
|
|
|
cb->setPixmap( copyPix, QClipboard::Selection );
|
2006-04-10 19:50:00 +00:00
|
|
|
d->messageWindow->display( i18n( "Image [%1x%2] copied to clipboard.", copyPix.width(), copyPix.height() ) );
|
2004-11-16 17:36:02 +00:00
|
|
|
}
|
2006-03-24 20:40:02 +00:00
|
|
|
else if ( choice == imageToFile )
|
2004-11-16 17:36:02 +00:00
|
|
|
{
|
|
|
|
// [3] save pixmap to file
|
2006-07-03 10:15:55 +00:00
|
|
|
QString fileName = KFileDialog::getSaveFileName( KUrl(), "image/png image/jpeg", this );
|
2006-06-12 10:51:07 +00:00
|
|
|
if ( fileName.isEmpty() )
|
2004-11-16 17:36:02 +00:00
|
|
|
d->messageWindow->display( i18n( "File not saved." ), PageViewMessage::Warning );
|
|
|
|
else
|
2004-11-03 17:35:48 +00:00
|
|
|
{
|
2006-03-24 20:40:02 +00:00
|
|
|
KMimeType::Ptr mime = KMimeType::findByURL( fileName );
|
|
|
|
QString type;
|
|
|
|
if ( !mime )
|
2004-11-16 17:36:02 +00:00
|
|
|
type = "PNG";
|
2006-03-24 20:40:02 +00:00
|
|
|
else
|
2006-06-12 10:51:07 +00:00
|
|
|
type = mime->name().section( '/', -1 ).toUpper();
|
|
|
|
copyPix.save( fileName, qPrintable( type ) );
|
|
|
|
d->messageWindow->display( i18n( "Image [%1x%2] saved to %3 file.", copyPix.width(), copyPix.height(), type ) );
|
2004-11-03 17:35:48 +00:00
|
|
|
}
|
|
|
|
}
|
2004-10-20 16:41:13 +00:00
|
|
|
}
|
2004-11-16 17:36:02 +00:00
|
|
|
// TEXT operation choosen
|
2005-01-29 12:32:59 +00:00
|
|
|
else
|
2004-11-16 17:36:02 +00:00
|
|
|
{
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( choice == textToClipboard )
|
2005-01-29 12:32:59 +00:00
|
|
|
{
|
|
|
|
// [1] copy text to clipboard
|
|
|
|
QClipboard *cb = QApplication::clipboard();
|
2006-05-26 14:32:35 +00:00
|
|
|
cb->setText( selectedText, QClipboard::Clipboard );
|
2005-01-29 12:32:59 +00:00
|
|
|
if ( cb->supportsSelection() )
|
2006-05-26 14:32:35 +00:00
|
|
|
cb->setText( selectedText, QClipboard::Selection );
|
2005-01-29 12:32:59 +00:00
|
|
|
}
|
2006-03-24 20:40:02 +00:00
|
|
|
else if ( choice == speakText )
|
2005-01-29 12:32:59 +00:00
|
|
|
{
|
|
|
|
// [2] speech selection using KTTSD
|
2005-02-04 22:35:44 +00:00
|
|
|
// Albert says is this ever necessary?
|
|
|
|
// we already attached on Part constructor
|
2005-03-05 15:59:15 +00:00
|
|
|
// If KTTSD not running, start it.
|
2006-07-03 10:15:55 +00:00
|
|
|
QDBusReply<bool> reply = QDBus::sessionBus().interface()->isServiceRegistered("org.kde.kttsd");
|
|
|
|
bool kttsdactive = false;
|
|
|
|
if ( reply.isValid() )
|
|
|
|
kttsdactive = reply.value();
|
2006-07-09 09:00:08 +00:00
|
|
|
if ( !kttsdactive )
|
2005-03-05 15:59:15 +00:00
|
|
|
{
|
|
|
|
QString error;
|
2006-03-24 20:40:02 +00:00
|
|
|
if (KToolInvocation::startServiceByDesktopName("kttsd", QStringList(), &error))
|
2005-03-05 15:59:15 +00:00
|
|
|
{
|
2006-04-10 19:50:00 +00:00
|
|
|
d->messageWindow->display( i18n("Starting KTTSD Failed: %1", error) );
|
2006-07-09 09:00:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
kttsdactive = true;
|
2005-03-05 15:59:15 +00:00
|
|
|
}
|
|
|
|
}
|
2006-07-09 09:00:08 +00:00
|
|
|
if ( kttsdactive )
|
2005-02-01 17:20:33 +00:00
|
|
|
{
|
2006-07-09 09:00:08 +00:00
|
|
|
// creating the connection to the kspeech interface
|
|
|
|
QDBusInterface kspeech("org.kde.kttsd", "/KSpeech", "org.kde.KSpeech");
|
|
|
|
kspeech.call("setApplicationName", "okular");
|
|
|
|
kspeech.call("say", selectedText, 0);
|
2005-02-01 17:20:33 +00:00
|
|
|
}
|
2005-01-29 12:32:59 +00:00
|
|
|
}
|
2004-11-16 17:36:02 +00:00
|
|
|
}
|
2006-06-02 10:30:32 +00:00
|
|
|
}
|
2004-11-16 17:36:02 +00:00
|
|
|
// clear widget selection and invalidate rect
|
|
|
|
selectionClear();
|
2005-01-28 17:21:28 +00:00
|
|
|
|
|
|
|
// restore previous action if came from it using right button
|
|
|
|
if ( d->aPrevAction )
|
|
|
|
{
|
2006-03-24 20:40:02 +00:00
|
|
|
d->aPrevAction->trigger();
|
2005-01-28 17:21:28 +00:00
|
|
|
d->aPrevAction = 0;
|
|
|
|
}
|
2004-11-16 17:36:02 +00:00
|
|
|
}break;
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
2005-01-29 12:32:59 +00:00
|
|
|
|
|
|
|
// reset mouse press / 'drag start' position
|
|
|
|
d->mousePressPos = QPoint();
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
|
|
|
|
void PageView::wheelEvent( QWheelEvent *e )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
|
|
|
if (d->document->handleEvent( e ) )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2005-02-01 18:24:16 +00:00
|
|
|
// don't perform any mouse action when viewport is autoscrolling
|
|
|
|
if ( d->viewportMoveActive )
|
|
|
|
return;
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
int delta = e->delta(),
|
|
|
|
vScroll = verticalScrollBar()->value();
|
2004-09-26 23:39:39 +00:00
|
|
|
e->accept();
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( (e->state() & Qt::ControlButton) == Qt::ControlButton ) {
|
2004-10-24 07:06:04 +00:00
|
|
|
if ( e->delta() < 0 )
|
2004-09-26 23:39:39 +00:00
|
|
|
slotZoomOut();
|
|
|
|
else
|
|
|
|
slotZoomIn();
|
|
|
|
}
|
2006-03-29 13:52:17 +00:00
|
|
|
else if ( delta <= -120 && !KpdfSettings::viewContinuous() && vScroll == verticalScrollBar()->maximum() )
|
2004-09-30 18:16:12 +00:00
|
|
|
{
|
2004-10-29 21:52:06 +00:00
|
|
|
// go to next page
|
2005-01-09 23:37:07 +00:00
|
|
|
if ( d->document->currentPage() < d->items.count() - 1 )
|
|
|
|
{
|
2005-06-13 11:53:47 +00:00
|
|
|
// more optimized than document->setNextPage and then move view to top
|
2005-01-09 23:37:07 +00:00
|
|
|
DocumentViewport newViewport = d->document->viewport();
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
newViewport.pageNumber += d->document->currentPage() ? viewColumns() : 1;
|
2005-04-14 11:33:28 +00:00
|
|
|
if ( newViewport.pageNumber >= (int)d->items.count() )
|
|
|
|
newViewport.pageNumber = d->items.count() - 1;
|
2005-06-13 11:53:47 +00:00
|
|
|
newViewport.rePos.enabled = true;
|
|
|
|
newViewport.rePos.normalizedY = 0.0;
|
2005-01-09 23:37:07 +00:00
|
|
|
d->document->setViewport( newViewport );
|
|
|
|
}
|
2004-09-30 18:16:12 +00:00
|
|
|
}
|
2006-03-29 13:52:17 +00:00
|
|
|
else if ( delta >= 120 && !KpdfSettings::viewContinuous() && vScroll == verticalScrollBar()->minimum() )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
|
|
|
// go to prev page
|
2005-01-09 23:37:07 +00:00
|
|
|
if ( d->document->currentPage() > 0 )
|
2004-12-12 22:57:54 +00:00
|
|
|
{
|
2005-06-13 11:53:47 +00:00
|
|
|
// more optimized than document->setPrevPage and then move view to bottom
|
2005-01-09 23:37:07 +00:00
|
|
|
DocumentViewport newViewport = d->document->viewport();
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
newViewport.pageNumber -= viewColumns();
|
2005-04-14 11:33:28 +00:00
|
|
|
if ( newViewport.pageNumber < 0 )
|
|
|
|
newViewport.pageNumber = 0;
|
2005-06-13 11:53:47 +00:00
|
|
|
newViewport.rePos.enabled = true;
|
|
|
|
newViewport.rePos.normalizedY = 1.0;
|
2005-01-09 23:37:07 +00:00
|
|
|
d->document->setViewport( newViewport );
|
2004-12-12 22:57:54 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
}
|
|
|
|
else
|
2006-03-24 20:40:02 +00:00
|
|
|
Q3ScrollView::wheelEvent( e );
|
2005-01-02 17:12:35 +00:00
|
|
|
|
2004-12-26 21:20:17 +00:00
|
|
|
QPoint cp = viewportToContents(e->pos());
|
|
|
|
updateCursor(cp);
|
2004-09-30 18:16:12 +00:00
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-09-30 18:16:12 +00:00
|
|
|
|
2004-09-26 23:39:39 +00:00
|
|
|
void PageView::dragEnterEvent( QDragEnterEvent * ev )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
|
|
|
if (d->document->handleEvent( ev ) )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
|
|
|
ev->accept();
|
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
|
|
|
|
void PageView::dropEvent( QDropEvent * ev )
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
{
|
|
|
|
if (d->document->handleEvent( ev ) )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2006-03-24 20:40:02 +00:00
|
|
|
if ( KUrl::List::canDecode( ev->mimeData() ) )
|
|
|
|
emit urlDropped( KUrl::List::fromMimeData( ev->mimeData() ).first() );
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
//END widget events
|
|
|
|
|
2005-04-01 16:24:11 +00:00
|
|
|
void PageView::drawDocumentOnPainter( const QRect & contentsRect, QPainter * p )
|
2004-10-30 20:54:48 +00:00
|
|
|
{
|
|
|
|
// when checking if an Item is contained in contentsRect, instead of
|
|
|
|
// growing PageViewItems rects (for keeping outline into account), we
|
|
|
|
// grow the contentsRect
|
|
|
|
QRect checkRect = contentsRect;
|
2006-03-29 16:46:09 +00:00
|
|
|
checkRect.adjust( -3, -3, 1, 1 );
|
2004-10-30 20:54:48 +00:00
|
|
|
|
2004-11-03 17:35:48 +00:00
|
|
|
// create a region from wich we'll subtract painted rects
|
|
|
|
QRegion remainingArea( contentsRect );
|
|
|
|
|
2005-04-01 16:24:11 +00:00
|
|
|
// iterate over all items painting the ones intersecting contentsRect
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector< PageViewItem * >::iterator iIt = d->items.begin(), iEnd = d->items.end();
|
2004-11-05 00:14:00 +00:00
|
|
|
for ( ; iIt != iEnd; ++iIt )
|
2004-10-30 20:54:48 +00:00
|
|
|
{
|
|
|
|
// check if a piece of the page intersects the contents rect
|
2004-11-05 18:14:20 +00:00
|
|
|
if ( !(*iIt)->geometry().intersects( checkRect ) )
|
|
|
|
continue;
|
2004-10-30 20:54:48 +00:00
|
|
|
|
2005-04-01 16:24:11 +00:00
|
|
|
// get item and item's outline geometries
|
2004-11-05 18:14:20 +00:00
|
|
|
PageViewItem * item = *iIt;
|
2005-04-01 16:24:11 +00:00
|
|
|
QRect itemGeometry = item->geometry(),
|
|
|
|
outlineGeometry = itemGeometry;
|
2006-03-29 16:46:09 +00:00
|
|
|
outlineGeometry.adjust( -1, -1, 3, 3 );
|
2004-10-30 20:54:48 +00:00
|
|
|
|
2005-04-01 16:24:11 +00:00
|
|
|
// move the painter to the top-left corner of the page
|
2004-11-05 18:14:20 +00:00
|
|
|
p->save();
|
2005-04-01 16:24:11 +00:00
|
|
|
p->translate( itemGeometry.left(), itemGeometry.top() );
|
2004-11-05 18:14:20 +00:00
|
|
|
|
2005-04-01 16:24:11 +00:00
|
|
|
// draw the page outline (black border and 2px bottom-right shadow)
|
|
|
|
if ( !itemGeometry.contains( contentsRect ) )
|
2004-11-05 18:14:20 +00:00
|
|
|
{
|
2005-04-01 16:24:11 +00:00
|
|
|
int itemWidth = itemGeometry.width(),
|
|
|
|
itemHeight = itemGeometry.height();
|
2004-11-05 18:14:20 +00:00
|
|
|
// draw simple outline
|
|
|
|
p->setPen( Qt::black );
|
2005-04-01 16:24:11 +00:00
|
|
|
p->drawRect( -1, -1, itemWidth + 2, itemHeight + 2 );
|
2004-11-05 18:14:20 +00:00
|
|
|
// draw bottom/right gradient
|
|
|
|
int levels = 2;
|
2006-03-24 20:40:02 +00:00
|
|
|
int r = QColor(Qt::gray).red() / (levels + 2),
|
|
|
|
g = QColor(Qt::gray).green() / (levels + 2),
|
|
|
|
b = QColor(Qt::gray).blue() / (levels + 2);
|
2004-11-05 18:14:20 +00:00
|
|
|
for ( int i = 0; i < levels; i++ )
|
2004-10-30 20:54:48 +00:00
|
|
|
{
|
2004-11-05 18:14:20 +00:00
|
|
|
p->setPen( QColor( r * (i+2), g * (i+2), b * (i+2) ) );
|
2005-04-01 16:24:11 +00:00
|
|
|
p->drawLine( i, i + itemHeight + 1, i + itemWidth + 1, i + itemHeight + 1 );
|
|
|
|
p->drawLine( i + itemWidth + 1, i, i + itemWidth + 1, i + itemHeight );
|
2004-11-05 18:14:20 +00:00
|
|
|
p->setPen( Qt::gray );
|
2005-04-01 16:24:11 +00:00
|
|
|
p->drawLine( -1, i + itemHeight + 1, i - 1, i + itemHeight + 1 );
|
|
|
|
p->drawLine( i + itemWidth + 1, -1, i + itemWidth + 1, i - 1 );
|
2004-10-30 20:54:48 +00:00
|
|
|
}
|
2004-11-05 18:14:20 +00:00
|
|
|
}
|
2004-10-30 20:54:48 +00:00
|
|
|
|
2005-02-18 18:24:45 +00:00
|
|
|
// draw the page using the PagePainter whith all flags active
|
2005-04-01 16:24:11 +00:00
|
|
|
if ( contentsRect.intersects( itemGeometry ) )
|
2004-11-05 18:14:20 +00:00
|
|
|
{
|
2005-04-01 16:24:11 +00:00
|
|
|
QRect pixmapRect = contentsRect.intersect( itemGeometry );
|
2006-03-29 16:46:09 +00:00
|
|
|
pixmapRect.translate( -itemGeometry.left(), -itemGeometry.top() );
|
2006-07-09 11:10:24 +00:00
|
|
|
PagePainter::paintPageOnPainter( p, item->page(), PAGEVIEW_ID, pageflags,
|
2005-04-01 16:24:11 +00:00
|
|
|
itemGeometry.width(), itemGeometry.height(), pixmapRect );
|
2004-10-30 20:54:48 +00:00
|
|
|
}
|
2004-11-05 18:14:20 +00:00
|
|
|
|
|
|
|
// remove painted area from 'remainingArea' and restore painter
|
|
|
|
remainingArea -= outlineGeometry.intersect( contentsRect );
|
|
|
|
p->restore();
|
2004-10-30 20:54:48 +00:00
|
|
|
}
|
2004-11-03 17:35:48 +00:00
|
|
|
|
2005-04-01 16:24:11 +00:00
|
|
|
// fill with background color the unpainted area
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector<QRect> backRects = remainingArea.rects();
|
|
|
|
int backRectsNumber = backRects.count();
|
2005-03-24 19:10:41 +00:00
|
|
|
QColor backColor = /*d->items.isEmpty() ? Qt::lightGray :*/ Qt::gray;
|
2006-03-24 20:40:02 +00:00
|
|
|
for ( int jr = 0; jr < backRectsNumber; jr++ )
|
2005-03-24 19:10:41 +00:00
|
|
|
p->fillRect( backRects[ jr ], backColor );
|
2004-10-30 20:54:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PageView::updateItemSize( PageViewItem * item, int colWidth, int rowHeight )
|
|
|
|
{
|
|
|
|
const KPDFPage * kpdfPage = item->page();
|
|
|
|
double width = kpdfPage->width(),
|
|
|
|
height = kpdfPage->height(),
|
|
|
|
zoom = d->zoomFactor;
|
|
|
|
|
|
|
|
if ( d->zoomMode == ZoomFixed )
|
|
|
|
{
|
|
|
|
width *= zoom;
|
|
|
|
height *= zoom;
|
|
|
|
item->setWHZ( (int)width, (int)height, d->zoomFactor );
|
|
|
|
}
|
|
|
|
else if ( d->zoomMode == ZoomFitWidth )
|
|
|
|
{
|
|
|
|
height = kpdfPage->ratio() * colWidth;
|
|
|
|
item->setWHZ( colWidth, (int)height, (double)colWidth / width );
|
2005-07-15 18:20:57 +00:00
|
|
|
d->zoomFactor = (double)colWidth / width;
|
2004-10-30 20:54:48 +00:00
|
|
|
}
|
|
|
|
else if ( d->zoomMode == ZoomFitPage )
|
|
|
|
{
|
|
|
|
double scaleW = (double)colWidth / (double)width;
|
|
|
|
double scaleH = (double)rowHeight / (double)height;
|
2006-03-29 17:16:46 +00:00
|
|
|
zoom = qMin( scaleW, scaleH );
|
2004-10-30 20:54:48 +00:00
|
|
|
item->setWHZ( (int)(zoom * width), (int)(zoom * height), zoom );
|
2005-07-15 18:20:57 +00:00
|
|
|
d->zoomFactor = zoom;
|
2004-10-30 20:54:48 +00:00
|
|
|
}
|
|
|
|
#ifndef NDEBUG
|
|
|
|
else
|
2006-03-29 13:52:17 +00:00
|
|
|
kDebug() << "calling updateItemSize with unrecognized d->zoomMode!" << endl;
|
2004-10-30 20:54:48 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
PageViewItem * PageView::pickItemOnPoint( int x, int y )
|
|
|
|
{
|
|
|
|
PageViewItem * item = 0;
|
2006-03-24 20:40:02 +00:00
|
|
|
QLinkedList< PageViewItem * >::iterator iIt = d->visibleItems.begin(), iEnd = d->visibleItems.end();
|
2004-11-05 00:14:00 +00:00
|
|
|
for ( ; iIt != iEnd; ++iIt )
|
2004-10-30 20:54:48 +00:00
|
|
|
{
|
2004-11-05 00:14:00 +00:00
|
|
|
PageViewItem * i = *iIt;
|
2004-10-30 20:54:48 +00:00
|
|
|
const QRect & r = i->geometry();
|
|
|
|
if ( x < r.right() && x > r.left() && y < r.bottom() )
|
|
|
|
{
|
|
|
|
if ( y > r.top() )
|
|
|
|
item = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2006-03-24 20:40:02 +00:00
|
|
|
void PageView::textSelection( QList<QRect> * area, const QColor & color )
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
{
|
2006-05-10 19:33:15 +00:00
|
|
|
setCursor( Qt::IBeamCursor );
|
2006-03-24 20:40:02 +00:00
|
|
|
QList<QRect> toUpdate;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( d->mouseTextSelectionRect && d->mouseTextSelectionRect )
|
|
|
|
{
|
|
|
|
toUpdate+=*(d->mouseTextSelectionRect);
|
|
|
|
delete d->mouseTextSelectionRect;
|
|
|
|
d->mouseTextSelectionRect=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (area)
|
|
|
|
toUpdate+=*(area);
|
|
|
|
|
|
|
|
d->mouseTextSelecting = true;
|
|
|
|
d->mouseTextSelectionRect = area;
|
|
|
|
d->mouseTextSelectionColor = color;
|
|
|
|
// ensures page doesn't scroll
|
|
|
|
if ( d->autoScrollTimer )
|
|
|
|
{
|
|
|
|
d->scrollIncrement = 0;
|
|
|
|
d->autoScrollTimer->stop();
|
|
|
|
}
|
2006-03-24 20:40:02 +00:00
|
|
|
QList<QRect>::Iterator it=toUpdate.begin(), end=toUpdate.end();
|
2006-06-11 23:38:12 +00:00
|
|
|
QRect r;
|
|
|
|
if ( it != end )
|
|
|
|
r = (*it).adjusted( 0, 0, 1, 1 );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
for (;it!=end;++it)
|
|
|
|
{
|
2006-06-11 23:38:12 +00:00
|
|
|
r |= (*it).adjusted( 0, 0, 1, 1 );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
}
|
2006-06-11 23:38:12 +00:00
|
|
|
if ( !r.isNull() )
|
|
|
|
updateContents( r );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
d->mouseTextSelectionPainted=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PageView::textSelectionClear()
|
|
|
|
{
|
2006-06-10 17:06:03 +00:00
|
|
|
// nothing no clear
|
|
|
|
if ( !d->mouseTextSelectionRect ) return;
|
|
|
|
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
setCursor( Qt::ArrowCursor );
|
2006-03-24 20:40:02 +00:00
|
|
|
QList<QRect>::iterator it=d->mouseTextSelectionRect->begin(),
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
end=d->mouseTextSelectionRect->end();
|
|
|
|
for (;it!=end;++it)
|
|
|
|
{
|
|
|
|
updateContents( *it );
|
|
|
|
}
|
|
|
|
delete d->mouseTextSelectionRect;
|
|
|
|
d->mouseTextSelectionRect=0;
|
|
|
|
}
|
|
|
|
|
2005-01-29 12:32:59 +00:00
|
|
|
void PageView::selectionStart( int x, int y, const QColor & color, bool /*aboveAll*/ )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2005-06-24 16:41:55 +00:00
|
|
|
d->mouseSelecting = true;
|
2004-11-03 17:35:48 +00:00
|
|
|
d->mouseSelectionRect.setRect( x, y, 1, 1 );
|
2005-06-24 16:41:55 +00:00
|
|
|
d->mouseSelectionColor = color;
|
2004-11-03 17:35:48 +00:00
|
|
|
// ensures page doesn't scroll
|
2005-02-01 18:24:16 +00:00
|
|
|
if ( d->autoScrollTimer )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
2004-11-03 17:35:48 +00:00
|
|
|
d->scrollIncrement = 0;
|
2005-02-01 18:24:16 +00:00
|
|
|
d->autoScrollTimer->stop();
|
2004-10-29 21:52:06 +00:00
|
|
|
}
|
2004-11-03 17:35:48 +00:00
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2004-11-03 17:35:48 +00:00
|
|
|
void PageView::selectionEndPoint( int x, int y )
|
|
|
|
{
|
2004-11-16 17:36:02 +00:00
|
|
|
// clip selection to the viewport
|
2006-06-10 17:06:03 +00:00
|
|
|
QRect viewportRect( viewport()->rect() );
|
|
|
|
x = qBound( viewportRect.left(), x, viewportRect.right() );
|
|
|
|
y = qBound( viewportRect.top(), y, viewportRect.bottom() );
|
2004-11-03 17:35:48 +00:00
|
|
|
// if selection changed update rect
|
|
|
|
if ( d->mouseSelectionRect.right() != x || d->mouseSelectionRect.bottom() != y )
|
|
|
|
{
|
|
|
|
// send incremental paint events
|
2006-03-29 16:46:09 +00:00
|
|
|
QRect oldRect = d->mouseSelectionRect.normalized();
|
2004-11-03 17:35:48 +00:00
|
|
|
d->mouseSelectionRect.setRight( x );
|
|
|
|
d->mouseSelectionRect.setBottom( y );
|
2006-03-29 16:46:09 +00:00
|
|
|
QRect newRect = d->mouseSelectionRect.normalized();
|
2004-11-03 17:35:48 +00:00
|
|
|
// generate diff region: [ OLD.unite(NEW) - OLD.intersect(NEW) ]
|
|
|
|
QRegion compoundRegion = QRegion( oldRect ).unite( newRect );
|
|
|
|
if ( oldRect.intersects( newRect ) )
|
|
|
|
{
|
|
|
|
QRect intersection = oldRect.intersect( newRect );
|
2006-03-29 16:46:09 +00:00
|
|
|
intersection.adjust( 1, 1, -1, -1 );
|
2004-11-03 17:35:48 +00:00
|
|
|
if ( intersection.width() > 20 && intersection.height() > 20 )
|
|
|
|
compoundRegion -= intersection;
|
|
|
|
}
|
2006-06-11 23:38:12 +00:00
|
|
|
// tassellate region with rects and enqueue a global paint event
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector<QRect> rects = compoundRegion.rects();
|
2006-06-11 23:38:12 +00:00
|
|
|
QRect r;
|
|
|
|
if ( rects.count() > 0 )
|
|
|
|
r = rects.at(0).adjusted( 0, 0, 1, 1 );
|
2006-03-24 20:40:02 +00:00
|
|
|
for ( int i = 0; i < rects.count(); i++ )
|
2006-06-11 23:38:12 +00:00
|
|
|
{
|
|
|
|
r |= rects.at(i).adjusted( 0, 0, 1, 1 );
|
|
|
|
}
|
|
|
|
if ( !r.isNull() )
|
|
|
|
updateContents( r );
|
2004-11-03 17:35:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PageView::selectionClear()
|
|
|
|
{
|
2006-06-11 23:38:12 +00:00
|
|
|
QRect updatedRect = d->mouseSelectionRect.normalized().adjusted( 0, 0, 1, 1 );
|
2005-06-24 16:41:55 +00:00
|
|
|
d->mouseSelecting = false;
|
2006-06-11 23:38:12 +00:00
|
|
|
d->mouseSelectionRect.setCoords( 0, 0, 0, 0 );
|
2005-06-24 16:41:55 +00:00
|
|
|
updateContents( updatedRect );
|
2004-11-03 17:35:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PageView::updateZoom( ZoomMode newZoomMode )
|
|
|
|
{
|
2004-10-29 21:52:06 +00:00
|
|
|
if ( newZoomMode == ZoomFixed )
|
|
|
|
{
|
|
|
|
if ( d->aZoom->currentItem() == 0 )
|
|
|
|
newZoomMode = ZoomFitWidth;
|
|
|
|
else if ( d->aZoom->currentItem() == 1 )
|
|
|
|
newZoomMode = ZoomFitPage;
|
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
float newFactor = d->zoomFactor;
|
|
|
|
KAction * checkedZoomAction = 0;
|
|
|
|
switch ( newZoomMode )
|
|
|
|
{
|
2004-11-03 17:35:48 +00:00
|
|
|
case ZoomFixed:{ //ZoomFixed case
|
2004-10-29 21:52:06 +00:00
|
|
|
QString z = d->aZoom->currentText();
|
2006-03-29 20:43:48 +00:00
|
|
|
newFactor = KGlobal::locale()->readNumber( z.remove( z.indexOf( '%' ), 1 ) ) / 100.0;
|
2004-10-29 21:52:06 +00:00
|
|
|
}break;
|
|
|
|
case ZoomIn:
|
2004-11-05 01:11:50 +00:00
|
|
|
newFactor += (newFactor > 0.99) ? ( newFactor > 1.99 ? 0.5 : 0.2 ) : 0.1;
|
2004-10-29 21:52:06 +00:00
|
|
|
newZoomMode = ZoomFixed;
|
|
|
|
break;
|
|
|
|
case ZoomOut:
|
2004-11-05 01:11:50 +00:00
|
|
|
newFactor -= (newFactor > 0.99) ? ( newFactor > 1.99 ? 0.5 : 0.2 ) : 0.1;
|
2004-10-29 21:52:06 +00:00
|
|
|
newZoomMode = ZoomFixed;
|
|
|
|
break;
|
|
|
|
case ZoomFitWidth:
|
|
|
|
checkedZoomAction = d->aZoomFitWidth;
|
|
|
|
break;
|
|
|
|
case ZoomFitPage:
|
|
|
|
checkedZoomAction = d->aZoomFitPage;
|
|
|
|
break;
|
|
|
|
case ZoomFitText:
|
|
|
|
checkedZoomAction = d->aZoomFitText;
|
|
|
|
break;
|
|
|
|
case ZoomRefreshCurrent:
|
|
|
|
newZoomMode = ZoomFixed;
|
|
|
|
d->zoomFactor = -1;
|
|
|
|
break;
|
|
|
|
}
|
2004-10-30 23:59:09 +00:00
|
|
|
if ( newFactor > 4.0 )
|
|
|
|
newFactor = 4.0;
|
|
|
|
if ( newFactor < 0.1 )
|
|
|
|
newFactor = 0.1;
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
if ( newZoomMode != d->zoomMode || (newZoomMode == ZoomFixed && newFactor != d->zoomFactor ) )
|
|
|
|
{
|
2004-10-30 23:59:09 +00:00
|
|
|
// rebuild layout and update the whole viewport
|
2004-10-29 21:52:06 +00:00
|
|
|
d->zoomMode = newZoomMode;
|
|
|
|
d->zoomFactor = newFactor;
|
2005-01-09 23:37:07 +00:00
|
|
|
// be sure to block updates to document's viewport
|
|
|
|
bool prevState = d->blockViewport;
|
|
|
|
d->blockViewport = true;
|
2004-10-29 21:52:06 +00:00
|
|
|
slotRelayoutPages();
|
2005-01-09 23:37:07 +00:00
|
|
|
d->blockViewport = prevState;
|
2004-10-30 23:59:09 +00:00
|
|
|
// request pixmaps
|
|
|
|
slotRequestVisiblePixmaps();
|
|
|
|
// update zoom text
|
2004-10-29 21:52:06 +00:00
|
|
|
updateZoomText();
|
|
|
|
// update actions checked state
|
|
|
|
d->aZoomFitWidth->setChecked( checkedZoomAction == d->aZoomFitWidth );
|
|
|
|
d->aZoomFitPage->setChecked( checkedZoomAction == d->aZoomFitPage );
|
|
|
|
d->aZoomFitText->setChecked( checkedZoomAction == d->aZoomFitText );
|
2005-06-24 16:43:19 +00:00
|
|
|
// store zoom settings
|
2005-11-04 11:59:51 +00:00
|
|
|
KpdfSettings::setZoomMode( newZoomMode );
|
|
|
|
KpdfSettings::setZoomFactor( newFactor );
|
|
|
|
KpdfSettings::writeConfig();
|
2004-10-29 21:52:06 +00:00
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::updateZoomText()
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2004-10-29 21:52:06 +00:00
|
|
|
// use current page zoom as zoomFactor if in ZoomFit/* mode
|
2004-11-05 00:14:00 +00:00
|
|
|
if ( d->zoomMode != ZoomFixed && d->items.count() > 0 )
|
2006-03-29 17:16:46 +00:00
|
|
|
d->zoomFactor = d->items[ qMax( 0, (int)d->document->currentPage() ) ]->zoomFactor();
|
2004-10-29 21:52:06 +00:00
|
|
|
float newFactor = d->zoomFactor;
|
2006-04-13 11:24:57 +00:00
|
|
|
d->aZoom->removeAllActions();
|
2004-09-26 23:39:39 +00:00
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
// add items that describe fit actions
|
|
|
|
QStringList translated;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
translated << i18n("Fit Width") << i18n("Fit Page") /*<< i18n("Fit Text")*/;
|
2004-10-20 16:41:13 +00:00
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
// add percent items
|
|
|
|
QString double_oh( "00" );
|
|
|
|
const float zoomValue[10] = { 0.125, 0.25, 0.333, 0.5, 0.667, 0.75, 1, 1.25, 1.50, 2 };
|
|
|
|
int idx = 0,
|
|
|
|
selIdx = 2; // use 3 if "fit text" present
|
|
|
|
bool inserted = false; //use: "d->zoomMode != ZoomFixed" to hide Fit/* zoom ratio
|
|
|
|
while ( idx < 10 || !inserted )
|
2004-09-28 13:53:47 +00:00
|
|
|
{
|
2004-10-29 21:52:06 +00:00
|
|
|
float value = idx < 10 ? zoomValue[ idx ] : newFactor;
|
|
|
|
if ( !inserted && newFactor < (value - 0.0001) )
|
|
|
|
value = newFactor;
|
|
|
|
else
|
|
|
|
idx ++;
|
|
|
|
if ( value > (newFactor - 0.0001) && value < (newFactor + 0.0001) )
|
|
|
|
inserted = true;
|
|
|
|
if ( !inserted )
|
|
|
|
selIdx++;
|
|
|
|
QString localValue( KGlobal::locale()->formatNumber( value * 100.0, 2 ) );
|
|
|
|
localValue.remove( KGlobal::locale()->decimalSymbol() + double_oh );
|
|
|
|
translated << QString( "%1%" ).arg( localValue );
|
2004-09-28 13:53:47 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
d->aZoom->setItems( translated );
|
|
|
|
|
|
|
|
// select current item in list
|
|
|
|
if ( d->zoomMode == ZoomFitWidth )
|
|
|
|
selIdx = 0;
|
|
|
|
else if ( d->zoomMode == ZoomFitPage )
|
|
|
|
selIdx = 1;
|
|
|
|
else if ( d->zoomMode == ZoomFitText )
|
|
|
|
selIdx = 2;
|
|
|
|
d->aZoom->setCurrentItem( selIdx );
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
|
2004-12-26 21:20:17 +00:00
|
|
|
void PageView::updateCursor( const QPoint &p )
|
|
|
|
{
|
|
|
|
// detect the underlaying page (if present)
|
|
|
|
PageViewItem * pageItem = pickItemOnPoint( p.x(), p.y() );
|
|
|
|
if ( pageItem )
|
|
|
|
{
|
2005-02-08 15:24:23 +00:00
|
|
|
double nX = (double)(p.x() - pageItem->geometry().left()) / (double)pageItem->width(),
|
|
|
|
nY = (double)(p.y() - pageItem->geometry().top()) / (double)pageItem->height();
|
2004-12-26 21:20:17 +00:00
|
|
|
|
2005-02-09 17:45:16 +00:00
|
|
|
// if over a ObjectRect (of type Link) change cursor to hand
|
2005-07-15 18:20:57 +00:00
|
|
|
d->mouseOnRect = pageItem->page()->getObjectRect( ObjectRect::Link, nX, nY );
|
2005-02-09 17:45:16 +00:00
|
|
|
if ( d->mouseOnRect )
|
2006-06-03 13:01:15 +00:00
|
|
|
setCursor( Qt::PointingHandCursor );
|
2005-01-02 11:50:38 +00:00
|
|
|
else
|
2006-06-03 13:01:15 +00:00
|
|
|
setCursor( Qt::ArrowCursor );
|
2004-12-26 21:20:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// if there's no page over the cursor and we were showing the pointingHandCursor
|
|
|
|
// go back to the normal one
|
2005-01-02 11:50:38 +00:00
|
|
|
d->mouseOnRect = false;
|
2006-06-03 13:01:15 +00:00
|
|
|
setCursor( Qt::ArrowCursor );
|
2004-12-26 21:20:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
int PageView::viewColumns()
|
|
|
|
{
|
|
|
|
int nr=KpdfSettings::renderMode();
|
|
|
|
if (nr<2)
|
|
|
|
return nr+1;
|
|
|
|
return KpdfSettings::viewColumns();
|
|
|
|
}
|
|
|
|
|
|
|
|
int PageView::viewRows()
|
|
|
|
{
|
|
|
|
if (KpdfSettings::renderMode()<2)
|
|
|
|
return 1;
|
|
|
|
return KpdfSettings::viewRows();
|
|
|
|
}
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
//BEGIN private SLOTS
|
2004-09-30 18:04:09 +00:00
|
|
|
void PageView::slotRelayoutPages()
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
// called by: notifySetup, viewportResizeEvent, slotRenderMode, slotContinuousToggled, updateZoom
|
2004-09-27 21:36:25 +00:00
|
|
|
{
|
|
|
|
// set an empty container if we have no pages
|
2004-11-05 00:14:00 +00:00
|
|
|
int pageCount = d->items.count();
|
2004-09-27 21:36:25 +00:00
|
|
|
if ( pageCount < 1 )
|
|
|
|
{
|
2004-10-30 23:59:09 +00:00
|
|
|
resizeContents( 0, 0 );
|
2004-09-27 21:36:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
// if viewport was auto-moving, stop it
|
|
|
|
if ( d->viewportMoveActive )
|
|
|
|
{
|
|
|
|
d->viewportMoveActive = false;
|
|
|
|
d->viewportMoveTimer->stop();
|
|
|
|
verticalScrollBar()->setEnabled( true );
|
|
|
|
horizontalScrollBar()->setEnabled( true );
|
|
|
|
}
|
|
|
|
|
2004-11-05 00:14:00 +00:00
|
|
|
// common iterator used in this method and viewport parameters
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector< PageViewItem * >::iterator iIt, iEnd = d->items.end();
|
2004-10-30 20:54:48 +00:00
|
|
|
int viewportWidth = visibleWidth(),
|
|
|
|
viewportHeight = visibleHeight(),
|
2004-09-30 18:16:12 +00:00
|
|
|
fullWidth = 0,
|
|
|
|
fullHeight = 0;
|
2004-11-05 00:14:00 +00:00
|
|
|
QRect viewportRect( contentsX(), contentsY(), viewportWidth, viewportHeight );
|
|
|
|
|
2005-04-14 11:33:28 +00:00
|
|
|
// handle the 'center first page in row' stuff
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
int nCols = viewColumns();
|
2005-11-04 11:59:51 +00:00
|
|
|
bool centerFirstPage = KpdfSettings::centerFirstPageInRow() && nCols > 1;
|
2005-04-14 11:33:28 +00:00
|
|
|
|
2005-03-05 15:59:15 +00:00
|
|
|
// set all items geometry and resize contents. handle 'continuous' and 'single' modes separately
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( KpdfSettings::viewContinuous() )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2005-04-14 11:33:28 +00:00
|
|
|
// handle the 'centering on first row' stuff
|
|
|
|
if ( centerFirstPage )
|
|
|
|
pageCount += nCols - 1;
|
2004-09-27 21:36:25 +00:00
|
|
|
// Here we find out column's width and row's height to compute a table
|
|
|
|
// so we can place widgets 'centered in virtual cells'.
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
int nRows;
|
|
|
|
|
|
|
|
// if ( KpdfSettings::renderMode() < 2 )
|
|
|
|
nRows = (int)ceil( (float)pageCount / (float)nCols );
|
|
|
|
// nRows=(int)ceil( (float)pageCount / (float) KpdfSettings::viewRows() );
|
|
|
|
// else
|
|
|
|
// nRows = KpdfSettings::viewRows();
|
|
|
|
|
|
|
|
int * colWidth = new int[ nCols ],
|
2004-09-27 21:36:25 +00:00
|
|
|
* rowHeight = new int[ nRows ],
|
|
|
|
cIdx = 0,
|
|
|
|
rIdx = 0;
|
|
|
|
for ( int i = 0; i < nCols; i++ )
|
|
|
|
colWidth[ i ] = viewportWidth / nCols;
|
|
|
|
for ( int i = 0; i < nRows; i++ )
|
|
|
|
rowHeight[ i ] = 0;
|
2005-04-14 11:33:28 +00:00
|
|
|
// handle the 'centering on first row' stuff
|
|
|
|
if ( centerFirstPage )
|
|
|
|
pageCount -= nCols - 1;
|
2004-09-27 21:36:25 +00:00
|
|
|
|
|
|
|
// 1) find the maximum columns width and rows height for a grid in
|
|
|
|
// which each page must well-fit inside a cell
|
2004-11-05 00:14:00 +00:00
|
|
|
for ( iIt = d->items.begin(); iIt != iEnd; ++iIt )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2004-11-05 00:14:00 +00:00
|
|
|
PageViewItem * item = *iIt;
|
2004-10-30 20:54:48 +00:00
|
|
|
// update internal page size (leaving a little margin in case of Fit* modes)
|
2005-04-14 11:33:28 +00:00
|
|
|
updateItemSize( item, colWidth[ cIdx ] - 6, viewportHeight - 12 );
|
2004-09-27 21:36:25 +00:00
|
|
|
// find row's maximum height and column's max width
|
2005-01-03 15:51:05 +00:00
|
|
|
if ( item->width() + 6 > colWidth[ cIdx ] )
|
|
|
|
colWidth[ cIdx ] = item->width() + 6;
|
2005-04-14 11:33:28 +00:00
|
|
|
if ( item->height() + 12 > rowHeight[ rIdx ] )
|
|
|
|
rowHeight[ rIdx ] = item->height() + 12;
|
|
|
|
// handle the 'centering on first row' stuff
|
|
|
|
if ( centerFirstPage && !item->pageNumber() )
|
|
|
|
cIdx += nCols - 1;
|
2004-09-27 21:36:25 +00:00
|
|
|
// update col/row indices
|
|
|
|
if ( ++cIdx == nCols )
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2004-09-27 21:36:25 +00:00
|
|
|
cIdx = 0;
|
|
|
|
rIdx++;
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-27 21:36:25 +00:00
|
|
|
|
2005-04-14 11:33:28 +00:00
|
|
|
// 2) compute full size
|
|
|
|
for ( int i = 0; i < nCols; i++ )
|
|
|
|
fullWidth += colWidth[ i ];
|
|
|
|
for ( int i = 0; i < nRows; i++ )
|
|
|
|
fullHeight += rowHeight[ i ];
|
|
|
|
|
|
|
|
// 3) arrange widgets inside cells (and refine fullHeight if needed)
|
2004-09-27 21:36:25 +00:00
|
|
|
int insertX = 0,
|
2005-04-14 11:33:28 +00:00
|
|
|
insertY = fullHeight < viewportHeight ? ( viewportHeight - fullHeight ) / 2 : 0;
|
2004-10-30 20:54:48 +00:00
|
|
|
cIdx = 0;
|
|
|
|
rIdx = 0;
|
2004-11-05 00:14:00 +00:00
|
|
|
for ( iIt = d->items.begin(); iIt != iEnd; ++iIt )
|
2004-09-27 21:36:25 +00:00
|
|
|
{
|
2004-11-05 00:14:00 +00:00
|
|
|
PageViewItem * item = *iIt;
|
2004-10-30 20:54:48 +00:00
|
|
|
int cWidth = colWidth[ cIdx ],
|
2004-09-27 21:36:25 +00:00
|
|
|
rHeight = rowHeight[ rIdx ];
|
2005-04-14 11:33:28 +00:00
|
|
|
if ( centerFirstPage && !rIdx && !cIdx )
|
|
|
|
{
|
|
|
|
// handle the 'centering on first row' stuff
|
|
|
|
item->moveTo( insertX + (fullWidth - item->width()) / 2,
|
|
|
|
insertY + (rHeight - item->height()) / 2 );
|
|
|
|
cIdx += nCols - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// center widget inside 'cells'
|
|
|
|
item->moveTo( insertX + (cWidth - item->width()) / 2,
|
|
|
|
insertY + (rHeight - item->height()) / 2 );
|
|
|
|
}
|
2004-09-27 21:36:25 +00:00
|
|
|
// advance col/row index
|
|
|
|
insertX += cWidth;
|
|
|
|
if ( ++cIdx == nCols )
|
|
|
|
{
|
|
|
|
cIdx = 0;
|
|
|
|
rIdx++;
|
|
|
|
insertX = 0;
|
2005-04-14 11:33:28 +00:00
|
|
|
insertY += rHeight;
|
2004-09-27 21:36:25 +00:00
|
|
|
}
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#ifdef PAGEVIEW_DEBUG
|
2006-03-29 13:52:17 +00:00
|
|
|
kWarning() << "updating size for pageno " << item->pageNumber() << " to " << item->geometry() << endl;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#endif
|
2004-09-27 21:36:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
delete [] colWidth;
|
|
|
|
delete [] rowHeight;
|
|
|
|
}
|
2006-05-13 11:17:24 +00:00
|
|
|
else // viewContinuous is FALSE
|
2004-09-27 21:36:25 +00:00
|
|
|
{
|
2006-03-29 17:16:46 +00:00
|
|
|
PageViewItem * currentItem = d->items[ qMax( 0, (int)d->document->currentPage() ) ];
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
|
|
|
int nRows=viewRows();
|
2004-09-30 18:16:12 +00:00
|
|
|
|
2005-04-14 11:33:28 +00:00
|
|
|
// handle the 'centering on first row' stuff
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( centerFirstPage && d->document->currentPage() < 1 && KpdfSettings::renderMode() == 1 )
|
|
|
|
nCols = 1, nRows=1;
|
|
|
|
|
|
|
|
// setup varialbles for a M(row) x N(columns) grid
|
2005-04-14 11:33:28 +00:00
|
|
|
int * colWidth = new int[ nCols ],
|
2004-09-30 18:16:12 +00:00
|
|
|
cIdx = 0;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
|
|
|
int * rowHeight = new int[ nRows ],
|
|
|
|
rIdx = 0;
|
|
|
|
|
2004-09-30 18:16:12 +00:00
|
|
|
for ( int i = 0; i < nCols; i++ )
|
|
|
|
colWidth[ i ] = viewportWidth / nCols;
|
|
|
|
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
for ( int i = 0; i < nRows; i++ )
|
|
|
|
rowHeight[ i ] = viewportHeight / nRows;
|
|
|
|
|
2004-09-30 18:16:12 +00:00
|
|
|
// 1) find out maximum area extension for the pages
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
bool wasCurrent = false;
|
2004-11-05 00:14:00 +00:00
|
|
|
for ( iIt = d->items.begin(); iIt != iEnd; ++iIt )
|
2004-09-30 18:16:12 +00:00
|
|
|
{
|
2004-11-05 00:14:00 +00:00
|
|
|
PageViewItem * item = *iIt;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( rIdx >= 0 && rIdx < nRows )
|
2004-09-30 18:16:12 +00:00
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( item == currentItem )
|
|
|
|
wasCurrent=true;
|
|
|
|
if ( wasCurrent && cIdx >= 0 && cIdx < nCols )
|
|
|
|
{
|
|
|
|
// update internal page size (leaving a little margin in case of Fit* modes)
|
|
|
|
updateItemSize( item, colWidth[ cIdx ] - 6, rowHeight[ rIdx ] - 12 );
|
|
|
|
// find row's maximum height and column's max width
|
|
|
|
if ( item->width() + 6 > colWidth[ cIdx ] )
|
|
|
|
colWidth[ cIdx ] = item->width() + 6;
|
|
|
|
if ( item->height() + 12 > rowHeight[ rIdx ] )
|
|
|
|
rowHeight[ rIdx ] = item->height() + 12;
|
|
|
|
cIdx++;
|
|
|
|
}
|
|
|
|
if( cIdx>=nCols )
|
|
|
|
{
|
|
|
|
rIdx++;
|
|
|
|
cIdx=0;
|
|
|
|
}
|
2004-09-30 18:16:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-14 11:33:28 +00:00
|
|
|
// 2) calc full size (fullHeight is alredy ok)
|
|
|
|
for ( int i = 0; i < nCols; i++ )
|
|
|
|
fullWidth += colWidth[ i ];
|
|
|
|
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
for ( int i = 0; i < nRows; i++ )
|
|
|
|
fullHeight += rowHeight[ i ];
|
|
|
|
|
2005-04-14 11:33:28 +00:00
|
|
|
// 3) hide all widgets except the displayable ones and dispose those
|
2004-10-30 23:59:09 +00:00
|
|
|
int insertX = 0;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
int insertY = 0;
|
2004-10-30 20:54:48 +00:00
|
|
|
cIdx = 0;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
rIdx = 0;
|
|
|
|
wasCurrent=false;
|
2004-11-05 00:14:00 +00:00
|
|
|
for ( iIt = d->items.begin(); iIt != iEnd; ++iIt )
|
2004-09-30 18:16:12 +00:00
|
|
|
{
|
2004-11-05 00:14:00 +00:00
|
|
|
PageViewItem * item = *iIt;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( rIdx >= 0 && rIdx < nRows )
|
2004-09-30 18:16:12 +00:00
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
if ( item == currentItem )
|
|
|
|
wasCurrent=true;
|
|
|
|
if ( wasCurrent && cIdx >= 0 && cIdx < nCols )
|
|
|
|
{
|
|
|
|
// center widget inside 'cells'
|
|
|
|
item->moveTo( insertX + (colWidth[ cIdx ] - item->width()) / 2,
|
|
|
|
insertY + ( rowHeight[ rIdx ] - item->height() ) / 2 );
|
|
|
|
// advance col index
|
|
|
|
insertX += colWidth[ cIdx ];
|
|
|
|
cIdx++;
|
|
|
|
} else
|
2006-04-23 12:44:10 +00:00
|
|
|
// pino: I used invalidate() instead of setGeometry() so
|
|
|
|
// the geometry rect of the item is really invalidated
|
|
|
|
//item->setGeometry( 0, 0, -1, -1 );
|
|
|
|
item->invalidate();
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
|
|
|
if( cIdx>=nCols)
|
|
|
|
{
|
|
|
|
insertY += rowHeight[ rIdx ];
|
|
|
|
rIdx++;
|
|
|
|
insertX = 0;
|
|
|
|
cIdx=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2006-04-23 12:44:10 +00:00
|
|
|
// pino: I used invalidate() instead of setGeometry() so
|
|
|
|
// the geometry rect of the item is really invalidated
|
|
|
|
//item->setGeometry( 0, 0, -1, -1 );
|
|
|
|
item->invalidate();
|
2004-09-30 18:16:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
delete [] colWidth;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
delete [] rowHeight;
|
2004-09-30 18:16:12 +00:00
|
|
|
}
|
|
|
|
|
2004-11-05 00:14:00 +00:00
|
|
|
// 3) reset dirty state
|
|
|
|
d->dirtyLayout = false;
|
|
|
|
|
|
|
|
// 4) update scrollview's contents size and recenter view
|
2006-03-30 15:27:27 +00:00
|
|
|
bool wasUpdatesEnabled = viewport()->updatesEnabled();
|
2004-11-05 00:14:00 +00:00
|
|
|
if ( fullWidth != contentsWidth() || fullHeight != contentsHeight() )
|
2004-09-30 18:16:12 +00:00
|
|
|
{
|
2005-01-09 23:37:07 +00:00
|
|
|
// disable updates and resize the viewportContents
|
2005-01-10 13:43:44 +00:00
|
|
|
if ( wasUpdatesEnabled )
|
|
|
|
viewport()->setUpdatesEnabled( false );
|
2004-09-30 18:16:12 +00:00
|
|
|
resizeContents( fullWidth, fullHeight );
|
2005-01-10 13:43:44 +00:00
|
|
|
// restore previous viewport if defined and updates enabled
|
|
|
|
if ( wasUpdatesEnabled )
|
2004-11-05 00:14:00 +00:00
|
|
|
{
|
2005-01-10 13:43:44 +00:00
|
|
|
const DocumentViewport & vp = d->document->viewport();
|
|
|
|
if ( vp.pageNumber >= 0 )
|
|
|
|
{
|
2005-06-13 10:37:41 +00:00
|
|
|
int prevX = contentsX(),
|
|
|
|
prevY = contentsY();
|
2005-01-10 13:43:44 +00:00
|
|
|
const QRect & geometry = d->items[ vp.pageNumber ]->geometry();
|
2005-06-13 11:53:47 +00:00
|
|
|
double nX = vp.rePos.enabled ? vp.rePos.normalizedX : 0.5,
|
|
|
|
nY = vp.rePos.enabled ? vp.rePos.normalizedY : 0.0;
|
2005-01-10 13:43:44 +00:00
|
|
|
center( geometry.left() + ROUND( nX * (double)geometry.width() ),
|
|
|
|
geometry.top() + ROUND( nY * (double)geometry.height() ) );
|
2005-06-13 10:37:41 +00:00
|
|
|
// center() usually moves the viewport, that requests pixmaps too.
|
|
|
|
// if that doesn't happen we have to request them by hand
|
|
|
|
if ( prevX == contentsX() && prevY == contentsY() )
|
|
|
|
slotRequestVisiblePixmaps();
|
2005-01-10 13:43:44 +00:00
|
|
|
}
|
|
|
|
// or else go to center page
|
|
|
|
else
|
|
|
|
center( fullWidth / 2, 0 );
|
|
|
|
viewport()->setUpdatesEnabled( true );
|
2004-11-05 00:14:00 +00:00
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
2004-09-27 21:36:25 +00:00
|
|
|
|
2005-01-10 13:43:44 +00:00
|
|
|
// 5) update the whole viewport if updated enabled
|
|
|
|
if ( wasUpdatesEnabled )
|
|
|
|
updateContents();
|
2004-09-30 18:04:09 +00:00
|
|
|
}
|
|
|
|
|
2004-09-30 18:16:12 +00:00
|
|
|
void PageView::slotRequestVisiblePixmaps( int newLeft, int newTop )
|
|
|
|
{
|
2005-01-21 20:05:36 +00:00
|
|
|
// if requests are blocked (because raised by an unwanted event), exit
|
2005-03-24 19:10:41 +00:00
|
|
|
if ( d->blockPixmapsRequest || d->viewportMoveActive ||
|
|
|
|
d->mouseMidZooming )
|
2005-01-21 20:05:36 +00:00
|
|
|
return;
|
|
|
|
|
2004-09-30 18:16:12 +00:00
|
|
|
// precalc view limits for intersecting with page coords inside the lOOp
|
2005-01-09 23:37:07 +00:00
|
|
|
bool isEvent = newLeft != -1 && newTop != -1 && !d->blockViewport;
|
|
|
|
QRect viewportRect( isEvent ? newLeft : contentsX(),
|
|
|
|
isEvent ? newTop : contentsY(),
|
2004-10-30 20:54:48 +00:00
|
|
|
visibleWidth(), visibleHeight() );
|
2004-09-30 18:16:12 +00:00
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// some variables used to determine the viewport
|
2005-01-28 17:21:28 +00:00
|
|
|
int nearPageNumber = -1;
|
|
|
|
double viewportCenterX = (viewportRect.left() + viewportRect.right()) / 2.0,
|
|
|
|
viewportCenterY = (viewportRect.top() + viewportRect.bottom()) / 2.0,
|
|
|
|
focusedX = 0.5,
|
2005-01-09 23:37:07 +00:00
|
|
|
focusedY = 0.0,
|
|
|
|
minDistance = -1.0;
|
|
|
|
|
|
|
|
// iterate over all items
|
2004-12-21 12:38:52 +00:00
|
|
|
d->visibleItems.clear();
|
2006-03-24 20:40:02 +00:00
|
|
|
QLinkedList< PixmapRequest * > requestedPixmaps;
|
2006-06-23 21:11:52 +00:00
|
|
|
QVector< VisiblePageRect * > visibleRects;
|
2006-03-24 20:40:02 +00:00
|
|
|
QVector< PageViewItem * >::iterator iIt = d->items.begin(), iEnd = d->items.end();
|
2004-11-05 00:14:00 +00:00
|
|
|
for ( ; iIt != iEnd; ++iIt )
|
2004-09-30 18:16:12 +00:00
|
|
|
{
|
2004-12-22 18:21:36 +00:00
|
|
|
PageViewItem * i = *iIt;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#ifdef PAGEVIEW_DEBUG
|
2006-03-29 13:52:17 +00:00
|
|
|
kWarning() << "checking page " << i->pageNumber() << endl;
|
|
|
|
kWarning() << "viewportRect is " << viewportRect << ", page item is " << i->geometry() << " intersect : " << viewportRect.intersects( i->geometry() ) << endl;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#endif
|
2005-01-09 23:37:07 +00:00
|
|
|
// if the item doesn't intersect the viewport, skip it
|
2006-06-23 21:11:52 +00:00
|
|
|
QRect intersectionRect = viewportRect.intersect( i->geometry() );
|
|
|
|
if ( intersectionRect.isEmpty() )
|
2004-12-22 18:21:36 +00:00
|
|
|
continue;
|
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// add the item to the 'visible list'
|
2004-12-22 18:21:36 +00:00
|
|
|
d->visibleItems.push_back( i );
|
2006-06-23 21:11:52 +00:00
|
|
|
VisiblePageRect * vItem = new VisiblePageRect( i->pageNumber(), NormalizedRect( intersectionRect.translated( -i->geometry().topLeft() ), i->geometry().width(), i->geometry().height() ) );
|
|
|
|
visibleRects.push_back( vItem );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#ifdef PAGEVIEW_DEBUG
|
2006-03-29 13:52:17 +00:00
|
|
|
kWarning() << "checking for pixmap for page " << i->pageNumber() << " = " << i->page()->hasPixmap( PAGEVIEW_ID, i->width(), i->height() ) << "\n";
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#endif
|
2006-03-29 13:52:17 +00:00
|
|
|
kWarning() << "checking for text for page " << i->pageNumber() << " = " << i->page()->hasSearchPage() << "\n";
|
2005-01-09 23:37:07 +00:00
|
|
|
// if the item has not the right pixmap, add a request for it
|
2004-12-22 18:21:36 +00:00
|
|
|
if ( !i->page()->hasPixmap( PAGEVIEW_ID, i->width(), i->height() ) )
|
2005-01-18 16:43:36 +00:00
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#ifdef PAGEVIEW_DEBUG
|
2006-03-29 13:52:17 +00:00
|
|
|
kWarning() << "rerequesting visible pixmaps for page " << i->pageNumber() << " !\n";
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#endif
|
2005-01-18 16:43:36 +00:00
|
|
|
PixmapRequest * p = new PixmapRequest(
|
2006-06-02 20:42:57 +00:00
|
|
|
PAGEVIEW_ID, i->pageNumber(), i->width(), i->height(), PAGEVIEW_PRIO, true );
|
2005-01-18 16:43:36 +00:00
|
|
|
requestedPixmaps.push_back( p );
|
|
|
|
}
|
2005-01-09 23:37:07 +00:00
|
|
|
|
|
|
|
// look for the item closest to viewport center and the relative
|
|
|
|
// position between the item and the viewport center
|
|
|
|
if ( isEvent )
|
|
|
|
{
|
|
|
|
const QRect & geometry = i->geometry();
|
2005-04-14 11:33:28 +00:00
|
|
|
// compute distance between item center and viewport center (slightly moved left)
|
|
|
|
double distance = hypot( (geometry.left() + geometry.right()) / 2 - (viewportCenterX - 4),
|
2005-01-10 13:43:44 +00:00
|
|
|
(geometry.top() + geometry.bottom()) / 2 - viewportCenterY );
|
2005-01-09 23:37:07 +00:00
|
|
|
if ( distance >= minDistance && nearPageNumber != -1 )
|
|
|
|
continue;
|
|
|
|
nearPageNumber = i->pageNumber();
|
|
|
|
minDistance = distance;
|
|
|
|
if ( geometry.height() > 0 && geometry.width() > 0 )
|
|
|
|
{
|
2005-01-28 17:21:28 +00:00
|
|
|
focusedX = ( viewportCenterX - (double)geometry.left() ) / (double)geometry.width();
|
|
|
|
focusedY = ( viewportCenterY - (double)geometry.top() ) / (double)geometry.height();
|
2005-01-09 23:37:07 +00:00
|
|
|
}
|
|
|
|
}
|
2004-12-21 12:38:52 +00:00
|
|
|
}
|
|
|
|
|
2005-01-20 17:33:05 +00:00
|
|
|
// if preloading is enabled, add the pages before and after in preloading
|
|
|
|
if ( !d->visibleItems.isEmpty() &&
|
2005-11-04 11:59:51 +00:00
|
|
|
KpdfSettings::memoryLevel() != KpdfSettings::EnumMemoryLevel::Low &&
|
|
|
|
KpdfSettings::enableThreading() )
|
2005-01-18 16:43:36 +00:00
|
|
|
{
|
2005-01-20 17:33:05 +00:00
|
|
|
// add the page before the 'visible series' in preload
|
|
|
|
int headRequest = d->visibleItems.first()->pageNumber() - 1;
|
|
|
|
if ( headRequest >= 0 )
|
2005-01-18 16:43:36 +00:00
|
|
|
{
|
2005-01-20 17:33:05 +00:00
|
|
|
PageViewItem * i = d->items[ headRequest ];
|
|
|
|
// request the pixmap if not already present
|
2005-01-21 20:05:36 +00:00
|
|
|
if ( !i->page()->hasPixmap( PAGEVIEW_ID, i->width(), i->height() ) && i->width() > 0 )
|
2005-01-20 17:33:05 +00:00
|
|
|
requestedPixmaps.push_back( new PixmapRequest(
|
2006-06-02 20:42:57 +00:00
|
|
|
PAGEVIEW_ID, i->pageNumber(), i->width(), i->height(), PAGEVIEW_PRELOAD_PRIO, true ) );
|
2005-01-20 17:33:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// add the page after the 'visible series' in preload
|
|
|
|
int tailRequest = d->visibleItems.last()->pageNumber() + 1;
|
|
|
|
if ( tailRequest < (int)d->items.count() )
|
|
|
|
{
|
|
|
|
PageViewItem * i = d->items[ tailRequest ];
|
|
|
|
// request the pixmap if not already present
|
2005-01-21 20:05:36 +00:00
|
|
|
if ( !i->page()->hasPixmap( PAGEVIEW_ID, i->width(), i->height() ) && i->width() > 0 )
|
2005-01-20 17:33:05 +00:00
|
|
|
requestedPixmaps.push_back( new PixmapRequest(
|
2006-06-02 20:42:57 +00:00
|
|
|
PAGEVIEW_ID, i->pageNumber(), i->width(), i->height(), PAGEVIEW_PRELOAD_PRIO, true ) );
|
2005-01-18 16:43:36 +00:00
|
|
|
}
|
|
|
|
}
|
2005-01-09 23:37:07 +00:00
|
|
|
|
2005-01-20 17:33:05 +00:00
|
|
|
// send requests to the document
|
|
|
|
if ( !requestedPixmaps.isEmpty() )
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
{
|
2005-01-20 17:33:05 +00:00
|
|
|
d->document->requestPixmaps( requestedPixmaps );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
}
|
2005-01-28 17:21:28 +00:00
|
|
|
// if this functions was invoked by viewport events, send update to document
|
2005-01-09 23:37:07 +00:00
|
|
|
if ( isEvent && nearPageNumber != -1 )
|
|
|
|
{
|
|
|
|
// determine the document viewport
|
|
|
|
DocumentViewport newViewport( nearPageNumber );
|
2005-06-13 11:53:47 +00:00
|
|
|
newViewport.rePos.enabled = true;
|
|
|
|
newViewport.rePos.normalizedX = focusedX;
|
|
|
|
newViewport.rePos.normalizedY = focusedY;
|
2005-01-09 23:37:07 +00:00
|
|
|
// set the viewport to other observers
|
2005-01-10 13:43:44 +00:00
|
|
|
d->document->setViewport( newViewport , PAGEVIEW_ID);
|
2005-01-09 23:37:07 +00:00
|
|
|
}
|
2006-06-23 21:11:52 +00:00
|
|
|
d->document->setVisiblePageRects( visibleRects, PAGEVIEW_ID );
|
2004-09-30 18:16:12 +00:00
|
|
|
}
|
2004-10-06 00:05:49 +00:00
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
void PageView::slotMoveViewport()
|
|
|
|
{
|
|
|
|
// converge to viewportMoveDest in 1 second
|
|
|
|
int diffTime = d->viewportMoveTime.elapsed();
|
|
|
|
if ( diffTime >= 667 || !d->viewportMoveActive )
|
|
|
|
{
|
|
|
|
center( d->viewportMoveDest.x(), d->viewportMoveDest.y() );
|
|
|
|
d->viewportMoveTimer->stop();
|
|
|
|
d->viewportMoveActive = false;
|
|
|
|
slotRequestVisiblePixmaps();
|
|
|
|
verticalScrollBar()->setEnabled( true );
|
|
|
|
horizontalScrollBar()->setEnabled( true );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-04-04 23:55:40 +00:00
|
|
|
// move the viewport smoothly (kmplot: p(x)=1+0.47*(x-1)^3-0.25*(x-1)^4)
|
2005-02-01 18:24:16 +00:00
|
|
|
float convergeSpeed = (float)diffTime / 667.0,
|
|
|
|
x = ((float)visibleWidth() / 2.0) + contentsX(),
|
|
|
|
y = ((float)visibleHeight() / 2.0) + contentsY(),
|
|
|
|
diffX = (float)d->viewportMoveDest.x() - x,
|
|
|
|
diffY = (float)d->viewportMoveDest.y() - y;
|
|
|
|
convergeSpeed *= convergeSpeed * (1.4 - convergeSpeed);
|
|
|
|
center( (int)(x + diffX * convergeSpeed),
|
|
|
|
(int)(y + diffY * convergeSpeed ) );
|
|
|
|
}
|
|
|
|
|
2004-10-06 00:05:49 +00:00
|
|
|
void PageView::slotAutoScoll()
|
|
|
|
{
|
|
|
|
// the first time create the timer
|
2005-02-01 18:24:16 +00:00
|
|
|
if ( !d->autoScrollTimer )
|
2004-10-06 00:05:49 +00:00
|
|
|
{
|
2005-02-01 18:24:16 +00:00
|
|
|
d->autoScrollTimer = new QTimer( this );
|
2006-05-28 21:52:36 +00:00
|
|
|
d->autoScrollTimer->setSingleShot( true );
|
2005-02-01 18:24:16 +00:00
|
|
|
connect( d->autoScrollTimer, SIGNAL( timeout() ), this, SLOT( slotAutoScoll() ) );
|
2004-10-06 00:05:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// if scrollIncrement is zero, stop the timer
|
|
|
|
if ( !d->scrollIncrement )
|
|
|
|
{
|
2005-02-01 18:24:16 +00:00
|
|
|
d->autoScrollTimer->stop();
|
2004-10-06 00:05:49 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// compute delay between timer ticks and scroll amount per tick
|
|
|
|
int index = abs( d->scrollIncrement ) - 1; // 0..9
|
|
|
|
const int scrollDelay[10] = { 200, 100, 50, 30, 20, 30, 25, 20, 30, 20 };
|
|
|
|
const int scrollOffset[10] = { 1, 1, 1, 1, 1, 2, 2, 2, 4, 4 };
|
2006-05-28 21:52:36 +00:00
|
|
|
d->autoScrollTimer->start( scrollDelay[ index ] );
|
2004-10-06 00:05:49 +00:00
|
|
|
scrollBy( 0, d->scrollIncrement > 0 ? scrollOffset[ index ] : -scrollOffset[ index ] );
|
|
|
|
}
|
2004-09-30 18:16:12 +00:00
|
|
|
|
2005-02-18 18:24:45 +00:00
|
|
|
void PageView::slotStopFindAhead()
|
2005-02-01 18:26:56 +00:00
|
|
|
{
|
|
|
|
d->typeAheadActive = false;
|
|
|
|
d->typeAheadString = "";
|
|
|
|
d->messageWindow->display( i18n("Find stopped."), PageViewMessage::Find, 1000 );
|
2005-06-18 15:45:26 +00:00
|
|
|
// (4/4) it is needed to grab the keyboard becase people may have Space assigned
|
|
|
|
// to a accel and without grabbing the keyboard you can not vim-search for space
|
|
|
|
// because it activates the accel
|
2005-02-01 18:26:56 +00:00
|
|
|
releaseKeyboard();
|
|
|
|
}
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::slotZoom()
|
2004-09-30 18:04:09 +00:00
|
|
|
{
|
2004-12-13 18:21:37 +00:00
|
|
|
setFocus();
|
2004-10-29 21:52:06 +00:00
|
|
|
updateZoom( ZoomFixed );
|
|
|
|
}
|
2004-10-20 16:41:13 +00:00
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::slotZoomIn()
|
|
|
|
{
|
|
|
|
updateZoom( ZoomIn );
|
|
|
|
}
|
2004-09-30 18:04:09 +00:00
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::slotZoomOut()
|
|
|
|
{
|
|
|
|
updateZoom( ZoomOut );
|
|
|
|
}
|
2004-09-30 18:04:09 +00:00
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::slotFitToWidthToggled( bool on )
|
|
|
|
{
|
|
|
|
if ( on ) updateZoom( ZoomFitWidth );
|
2004-09-30 18:04:09 +00:00
|
|
|
}
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::slotFitToPageToggled( bool on )
|
2004-09-30 18:04:09 +00:00
|
|
|
{
|
2004-10-29 21:52:06 +00:00
|
|
|
if ( on ) updateZoom( ZoomFitPage );
|
|
|
|
}
|
2004-09-30 18:04:09 +00:00
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::slotFitToTextToggled( bool on )
|
|
|
|
{
|
|
|
|
if ( on ) updateZoom( ZoomFitText );
|
|
|
|
}
|
2004-09-30 18:04:09 +00:00
|
|
|
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
void PageView::slotRenderMode( int nr )
|
2004-10-29 21:52:06 +00:00
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
uint newColumns;
|
|
|
|
if (nr<2)
|
|
|
|
newColumns = nr+1;
|
|
|
|
else
|
|
|
|
newColumns = KpdfSettings::viewColumns();
|
|
|
|
|
|
|
|
if ( KpdfSettings::renderMode() != nr )
|
2004-09-30 18:04:09 +00:00
|
|
|
{
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
KpdfSettings::setRenderMode( nr );
|
2005-11-04 11:59:51 +00:00
|
|
|
KpdfSettings::writeConfig();
|
2004-10-29 21:52:06 +00:00
|
|
|
if ( d->document->pages() > 0 )
|
|
|
|
slotRelayoutPages();
|
2004-09-30 18:04:09 +00:00
|
|
|
}
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
|
2005-03-05 15:59:15 +00:00
|
|
|
void PageView::slotContinuousToggled( bool on )
|
2004-09-28 13:53:47 +00:00
|
|
|
{
|
2005-11-04 11:59:51 +00:00
|
|
|
if ( KpdfSettings::viewContinuous() != on )
|
2004-09-28 13:53:47 +00:00
|
|
|
{
|
2005-11-04 11:59:51 +00:00
|
|
|
KpdfSettings::setViewContinuous( on );
|
|
|
|
KpdfSettings::writeConfig();
|
2004-10-29 21:52:06 +00:00
|
|
|
if ( d->document->pages() > 0 )
|
|
|
|
slotRelayoutPages();
|
2004-09-28 13:53:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::slotSetMouseNormal()
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2004-10-29 21:52:06 +00:00
|
|
|
d->mouseMode = MouseNormal;
|
2005-02-12 17:42:54 +00:00
|
|
|
// hide the messageWindow
|
2004-11-03 17:35:48 +00:00
|
|
|
d->messageWindow->hide();
|
2005-03-04 23:06:24 +00:00
|
|
|
// reshow the annotator toolbar if hiding was forced
|
|
|
|
if ( d->aToggleAnnotator->isChecked() )
|
|
|
|
slotToggleAnnotator( true );
|
2004-11-03 17:35:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PageView::slotSetMouseZoom()
|
|
|
|
{
|
|
|
|
d->mouseMode = MouseZoom;
|
2005-02-12 17:42:54 +00:00
|
|
|
// change the text in messageWindow (and show it if hidden)
|
2005-01-17 14:57:18 +00:00
|
|
|
d->messageWindow->display( i18n( "Select zooming area. Right-click to zoom out." ), PageViewMessage::Info, -1 );
|
2005-03-04 23:06:24 +00:00
|
|
|
// force hiding of annotator toolbar
|
|
|
|
if ( d->annotator )
|
|
|
|
d->annotator->setEnabled( false );
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
|
2004-11-16 17:36:02 +00:00
|
|
|
void PageView::slotSetMouseSelect()
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2004-11-16 17:36:02 +00:00
|
|
|
d->mouseMode = MouseSelect;
|
2005-02-12 17:42:54 +00:00
|
|
|
// change the text in messageWindow (and show it if hidden)
|
2005-01-17 14:57:18 +00:00
|
|
|
d->messageWindow->display( i18n( "Draw a rectangle around the text/graphics to copy." ), PageViewMessage::Info, -1 );
|
2005-03-04 23:06:24 +00:00
|
|
|
// force hiding of annotator toolbar
|
|
|
|
if ( d->annotator )
|
|
|
|
d->annotator->setEnabled( false );
|
2005-02-18 18:24:45 +00:00
|
|
|
}
|
|
|
|
|
2005-03-04 23:06:24 +00:00
|
|
|
void PageView::slotToggleAnnotator( bool on )
|
2005-02-18 18:24:45 +00:00
|
|
|
{
|
2005-03-04 23:06:24 +00:00
|
|
|
// only use annotator in normal mouse mode
|
|
|
|
if ( on && d->mouseMode != MouseNormal )
|
|
|
|
return;
|
2005-02-18 18:24:45 +00:00
|
|
|
|
2005-03-04 23:06:24 +00:00
|
|
|
// create the annotator object if not present
|
|
|
|
if ( !d->annotator )
|
|
|
|
d->annotator = new PageViewAnnotator( this, d->document );
|
|
|
|
|
|
|
|
// initialize/reset annotator (and show/hide toolbar)
|
|
|
|
d->annotator->setEnabled( on );
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
void PageView::slotScrollUp()
|
2004-09-26 23:39:39 +00:00
|
|
|
{
|
2004-10-29 21:52:06 +00:00
|
|
|
if ( d->scrollIncrement < -9 )
|
|
|
|
return;
|
|
|
|
d->scrollIncrement--;
|
|
|
|
slotAutoScoll();
|
2004-10-30 20:54:48 +00:00
|
|
|
setFocus();
|
2004-10-29 21:52:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PageView::slotScrollDown()
|
|
|
|
{
|
|
|
|
if ( d->scrollIncrement > 9 )
|
|
|
|
return;
|
|
|
|
d->scrollIncrement++;
|
|
|
|
slotAutoScoll();
|
2004-10-30 20:54:48 +00:00
|
|
|
setFocus();
|
2004-09-26 23:39:39 +00:00
|
|
|
}
|
2004-10-29 21:52:06 +00:00
|
|
|
//END private SLOTS
|
2004-09-26 23:39:39 +00:00
|
|
|
|
|
|
|
#include "pageview.moc"
|