Commit graph

12 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
Peter Grasch 4d4dd68ca2 Fix usability issues with selecting annotations
REVIEW: 109627
2013-06-23 19:22:21 +02:00
Jon Mease 78faf1e68f Add undo/redo support for annotations
REVIEW: 107442
2013-04-06 00:22:48 +02:00
Jan Binder aa6ed8afc0 Replace deprecated QMatrix by QTransform
REVIEW: 105737
2012-09-08 17:06:02 +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
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 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 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 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 8114ea7200 fix or add the include guards
svn path=/trunk/KDE/kdegraphics/okular/; revision=688231
2007-07-15 13:53:26 +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