Commit graph

78 commits

Author SHA1 Message Date
Tobias Deiminger 0957abc39a Add annotation resize functionality
Usage:
If you left-click an annotation, it gets selected. Resize handles appear on the selection rectangle. When cursor is moved over one of the 8 resize handles on the corners/edges, the cursor shape changes to indicate resize mode. Everywhere else on the annotation means "move", just as it was before resize feature was added. Pressing ESC or clicking an area outside the annotation cancels a selection. Pressing Del deletes a selected annotation.

Feature is only applicable for annotation types AText, AStamp and AGeom.

Implementation:
It works by eventually changing AnnotationPrivate::m_boundary and notifying generator (i.e. poppler) about that change. Annotation state handling is shifted out of PageView into a new class MouseAnnotation (ui/pageviewmouseannotation.cpp). Some functionality not related to resizing but to annotation interaction in general is also shifted to class MouseAnnotation, to build a single place of responsiblity.

Other changes:
Add method Document::adjustPageAnnotation, backed by a QUndoCommand.
class Okular::AdjustAnnotationCommand.
Add Annotation::adjust and Annotation::canBeResized methods.
Draw resize handles in PagePainter::paintCroppedPageOnPainter.

Resize and move work
-for types AText, AStamp and AGeom
-on all pages of document
-when viewport position changes
-when zoom level changes
-for all page rotations (0°, 90°, 180°, 270°)

Selection is canceled
-when currently selected annotation is deleted
-on mouse click outside of currently selected annotation
-ESC is pressed

Viewport is shifted when mouse cursor during move/resize comes close to viewport border.
Resize to negative is prevented.
Tiny annotations are still selectable.
If mouse is moved over an annotation type that we can focus, and the annotation is not yet focused, mouse cursor shape changes to arrow.
If mouse cursor rests over an annotation A, while annotation B is focused, a tooltip for annotation A is shown.
Selected Annotation is deleted when Del is pressed.

Test for regressions:
-Annotation interaction (focus, move, resize, start playback, ...) are only done in mode EnumMouseMode::Browse.
-If mouse is moved over an annotation type where we can start an action, mouse cursor shape changes to pointing hand.
-If mouse is moved over an annotation type that we can't interact with, mouse cursor shape stays a open hand.
-If mouse cursor rests over an annotation of any type, a tooltip for that annotation is shown.
-Grab/move scroll area (on left click + mouse move) is prevented, if mouse is over focused annotation, or over AMovie/AScreen/AFileAttachment annotation.
-A double click on a annotation starts the "annotator".

REVIEW: 127366
BUG: 177778
BUG: 314843
BUG: 358060
2017-03-19 23:18:17 +01:00
Albert Vaca 3c93b2523e Added missing overrides found by clang-tidy 2016-10-29 17:07:10 +02:00
Montel Laurent 466eb79615 Use QStringLiteral 2015-10-29 13:37:11 +01:00
Tobias Koenig 8b603c174d Add basic support for RichMedia annotations in PDF files
That patch extracts the video file, which is defined in a
rich media annotation as parameter for the flash player,
and uses the normal multimedia player, to playback the video
file.

This feature requires poppler-qt5 in version 0.36.

FEATURE: 326230
REVIEW: 124612
2015-08-20 08:59:34 +02:00
Frederik Gladhorn 75031eee7e Fix includes 2014-08-08 01:59:55 +02:00
Fabio D'Urso 850deab286 Allow selection of filled polygons through the filled region 2013-07-02 00:44:15 +02:00
Fabio D'Urso d77ed7e998 Fix HighlightAnnotation selection in rotated documents 2013-07-02 00:04:01 +02:00
Fabio D'Urso 5888f65a2e Allow selection of polygons through the segment that closes the path too 2013-07-01 22:19:28 +02:00
Yuri Chornoivan 3b73357d2f Fix some typos found by Krazy2 2013-06-24 13:46:16 +03:00
Peter Grasch 4d4dd68ca2 Fix usability issues with selecting annotations
REVIEW: 109627
2013-06-23 19:22:21 +02:00
Albert Astals Cid bfbcbffc80 Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
	generators/spectre/okularApplication_ghostview.desktop
2013-05-16 23:53:29 +02:00
Albert Astals Cid c9964acdc6 Fix clicking on notes being hard on high zooms
It is still not perfect because for some reason poppler is painting outside the boundaries box (or we are not creating/setting it correctly)
but at least now it's not ultra hard to click in a note application at high zoom

FIXED-IN: 4.10.4
BUGS: 319637
2013-05-16 23:51:11 +02:00
Jon Mease 2ae9e58bb4 Merge window.text, contents and inplaceText annotation properties
BUG: 319442
REVIEW: 110391
2013-05-14 09:43:27 +02:00
Jon Mease 4296ac7e5d Rotate annotation to match page when setting annotation's properties
BUG:318828
REVIEW:110229
2013-05-07 22:06:00 +02:00
Albert Astals Cid d0fd156dc9 Minor tweaks 2013-04-06 00:28:39 +02:00
Jon Mease 78faf1e68f Add undo/redo support for annotations
REVIEW: 107442
2013-04-06 00:22:48 +02:00
Tobias Koenig f713dd0fdf Extended Okular::ScreenAnnotation to take a trigger action
REVIEW: 106604
2012-10-22 13:03:08 +02:00
Tobias Koenig 770e2818bb Evaluate additional actions of screen and widget annotations
This fixes the auto-start feature of PDFs generated with the LaTeX movie
package, which uses the additional action of a widget annotation to start
the movie when entering the page.

BUG: 300051
REVIEW: 106430
FIXED-IN: 4.10
2012-09-21 10:50:57 +02:00
Jan Binder aa6ed8afc0 Replace deprecated QMatrix by QTransform
REVIEW: 105737
2012-09-08 17:06:02 +02:00
Albert Astals Cid a716b3e4e0 kill all the deprecated functions now that we've change ABI anyway 2012-09-06 19:10:03 +02:00
Fabio D'Urso d2fa4c9bf3 TextAnnotation stamp fix
- Make "Comment" the default stamp instead of "Note" (because we used to omit
   the "icon" in the exported DOM if it was "Comment")
 - Don't omit the icon name anymore
2012-06-05 00:48:50 +02:00
Fabio D'Urso 157638f2f9 Added Annotation::BeingMoved flag to avoid refreshing pixmaps while moving annotations 2012-05-17 23:50:39 +02:00
Fabio D'Urso 68127e00ea Do not store flag Annotation::ExternallyDrawn when exporting to DOM
It's an implementation detail
2012-05-17 23:50:17 +02:00
Fabio D'Urso f6fa2a5614 Disable GUI operations on certain types of annotations
Modification and removal of *external* annotations are disabled by this
patch. Note that this change doesn't remove any functionality, because they
have never been implemented (AnnotationProxy is defined by the previous
patch).

The #if0'd blocks will be enabled by a future patch that provides fallback
behavior for generators that don't support saving changes.
2012-05-17 23:50:10 +02:00
Fabio D'Urso ec9f068d77 Added AnnotationProxy to SaveInterface
Based on Pino Toscano's earlier work
2012-05-17 23:49:58 +02:00
Albert Astals Cid 870fd3ba12 Fix point #1 of 213258, open the dialog editor just after adding a note, because adding a note without text is probably not what you want to do.
Will be in KDE *4.7*
Patch by Victor Blazquez <victor.blazquez@gmail.com>
BUGS: 213258

svn path=/trunk/KDE/kdegraphics/okular/; revision=1209674
2010-12-27 22:16:11 +00:00
Albert Astals Cid 667e07a343 setAttribute with doubles is evil as it uses the current locale and we don't want that, use QString::number
BUGS: 211990

svn path=/trunk/KDE/kdegraphics/okular/; revision=1050633
2009-11-17 19:37:57 +00:00
Pino Toscano b95403b0b2 Add a preliminary and simple version of Movie object and MovieAnnotation.
CCBUG: 136574

svn path=/trunk/KDE/kdegraphics/okular/; revision=851145
2008-08-23 00:07:59 +00:00
Pino Toscano d1305c265b Implement the canBeMoved() check for an annotation in the Annotation class itself.
Use this new version and remove the one in GuiUtils.

svn path=/trunk/KDE/kdegraphics/okular/; revision=803073
2008-05-01 20:59:51 +00:00
Pino Toscano 1177ac20ad Add the support in the core library for sound annotations.
svn path=/trunk/KDE/kdegraphics/okular/; revision=796579
2008-04-13 20:00:06 +00:00
Pino Toscano 095d8fc384 Add support in the Okular core for File Attachment annotations.
(Although, they cannot be (de)serialized to XML.)

CCBUG: 155072

svn path=/trunk/KDE/kdegraphics/okular/; revision=796467
2008-04-13 16:34:33 +00:00
Pino Toscano e182f47cba Add the possibility to store in an Annotation a "native id" of the annotation itself.
What it represents is totally in the hands of the various generators.

Add a function hook to cleanup the annotation data (the "native id", basically).

svn path=/trunk/KDE/kdegraphics/okular/; revision=796378
2008-04-13 13:45:32 +00:00
Pino Toscano e786e9dfb9 Deprecate the own point width of the geometric annotation in favour of the width of the style.
svn path=/trunk/KDE/kdegraphics/okular/; revision=794222
2008-04-06 23:12:04 +00:00
Pino Toscano 80cc994c51 the caret symbol is a fixed choice of two
svn path=/trunk/KDE/kdegraphics/okular/; revision=794041
2008-04-06 10:27:46 +00:00
Pino Toscano ba9042c2e0 Add a basic version (just the internal class, not the visualisation) of Caret annotation.
svn path=/trunk/KDE/kdegraphics/okular/; revision=793884
2008-04-05 14:46:07 +00:00
Pino Toscano b654434a0e add private helpers to properly transform the base coordinates of an annotation
svn path=/trunk/KDE/kdegraphics/okular/; revision=722451
2007-10-07 10:52:05 +00:00
Pino Toscano 2a29b247f7 save really few bytes
svn path=/trunk/KDE/kdegraphics/okular/; revision=709414
2007-09-07 13:13:50 +00:00
Pino Toscano a6c0f7d46d it makes no sense having a returned type for the base Annotation class (that can not be instanced directly)
svn path=/trunk/KDE/kdegraphics/okular/; revision=691107
2007-07-22 22:52:47 +00:00
Pino Toscano aa8155f8ed decouple the transformation applying and resetting methods, and reset the transformation when setting a new bonding rect or translating
svn path=/trunk/KDE/kdegraphics/okular/; revision=691056
2007-07-22 20:49:27 +00:00
Pino Toscano 857d423c46 Correctly (hopefully) translate the text annotations now.
svn path=/trunk/KDE/kdegraphics/okular/; revision=691048
2007-07-22 20:20:24 +00:00
Pino Toscano 536b632536 Correctly translate the ink annotations now.
svn path=/trunk/KDE/kdegraphics/okular/; revision=689204
2007-07-17 21:52:22 +00:00
Pino Toscano b41dcfeddc - store a pointer of the owning page in each annotation
- preliminary API for translating an annotation

svn path=/trunk/KDE/kdegraphics/okular/; revision=689133
2007-07-17 18:10:25 +00:00
Pino Toscano 94355bce65 move the transform() hierarchy within the private class; allow AnnotationObjectRect to use the trasform() stuff
svn path=/trunk/KDE/kdegraphics/okular/; revision=661202
2007-05-04 20:45:45 +00:00
Pino Toscano bfe21b46f8 refactor the Annotation hierarchy to use a common d_ptr like Qt; move the AnnotationPrivate definition in an own header (it will be useful later...)
svn path=/trunk/KDE/kdegraphics/okular/; revision=661195
2007-05-04 20:24:12 +00:00
Albert Astals Cid 0d47b62715 krazy include order issues
svn path=/trunk/KDE/kdegraphics/okular/; revision=655893
2007-04-19 18:30:20 +00:00
Dirk Mueller e24f08a75f remove misplaced ';'
svn path=/trunk/playground/graphics/okular/; revision=631926
2007-02-09 14:53:26 +00:00
Pino Toscano 48a772be4b move the ui-related utils functions for annotations in an own utils class
svn path=/trunk/playground/graphics/okular/; revision=617097
2006-12-27 23:56:38 +00:00
Tobias Koenig f83cb1c60a Finished API cleanup of Annotation by moving all private members
behind d-pointers

svn path=/trunk/playground/graphics/okular/; revision=614549
2006-12-18 07:28:02 +00:00
Tobias Koenig 6f9d0df5cd Further annotation API cleanup
svn path=/trunk/playground/graphics/okular/; revision=612395
2006-12-11 07:59:02 +00:00
Tobias Koenig a9f58440df First large commit for the Annotation API cleanup
* Moved all public member variables of Annotation to private
    and add accessors
  * Renamed RevScope and RevType to RevisionScope and RevisionType
  * Add API documentation (@pino, please review)

svn path=/trunk/playground/graphics/okular/; revision=610749
2006-12-05 11:05:50 +00:00