okular/core
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
..
script Refresh the pixmap of the page that contains the field when setting its text 2017-03-03 00:36:08 +01:00
synctex Fix warning about incompatible pointers in synctex parser 2016-07-24 22:30:39 +02:00
action.cpp Support SetOCGState links 2016-11-26 16:00:46 +01:00
action.h Add override 2017-03-02 20:38:50 +01:00
annotations.cpp Add annotation resize functionality 2017-03-19 23:18:17 +01:00
annotations.h Add annotation resize functionality 2017-03-19 23:18:17 +01:00
annotations_p.h Add annotation resize functionality 2017-03-19 23:18:17 +01:00
area.cpp Implement qHash() for Okular::NormalizedRect. 2015-10-17 15:10:16 +03:00
area.h Add override 2017-03-02 20:38:50 +01:00
audioplayer.cpp Compile++ 2015-03-01 16:02:52 +01:00
audioplayer.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
audioplayer_p.h port KUrl -> QUrl 2015-01-29 20:55:57 +01:00
bookmarkmanager.cpp Added missing overrides found by clang-tidy 2016-10-29 17:07:10 +02:00
bookmarkmanager.h Fix build with Qt 5.5 branch. 2015-03-02 13:09:27 +01:00
chooseenginedialog.cpp Port to new connect api 2015-01-30 22:06:53 +01:00
chooseenginedialog_p.h Fixes suggested by Clazy 2016-10-29 16:33:05 +02:00
chooseenginewidget.ui small touches to the backend choosing dialog: 2007-03-30 15:35:01 +00:00
debug.cpp Only show warning messages by default 2017-01-16 18:41:33 +01:00
debug_p.h Use categorized logging 2014-09-16 23:24:36 +02:00
document.cpp Add annotation resize functionality 2017-03-19 23:18:17 +01:00
document.h Add annotation resize functionality 2017-03-19 23:18:17 +01:00
document_p.h Add annotation resize functionality 2017-03-19 23:18:17 +01:00
documentcommands.cpp Add annotation resize functionality 2017-03-19 23:18:17 +01:00
documentcommands_p.h Add annotation resize functionality 2017-03-19 23:18:17 +01:00
fileprinter.cpp Fixes suggested by Clazy 2016-10-29 16:33:05 +02:00
fileprinter.h Merge remote-tracking branch 'origin/master' into frameworks 2015-03-17 08:47:52 +01:00
fontinfo.cpp Fonts are scanned again by poppler5 2016-07-13 23:46:43 +02:00
fontinfo.h Use QVector 2015-08-04 14:21:25 +02:00
form.cpp Add the additional action to form 2017-03-03 00:41:06 +01:00
form.h Add the additional action to form 2017-03-03 00:41:06 +01:00
form_p.h Add the additional action to form 2017-03-03 00:41:06 +01:00
generator.cpp no need for & here 2017-03-02 22:45:45 +01:00
generator.h no need for & here 2017-03-02 22:45:45 +01:00
generator_p.cpp Port to new connect api 2014-10-01 14:02:01 +02:00
generator_p.h Add override 2017-03-02 20:38:50 +01:00
global.h Move the definition of the 'EmbedMode' enum to 'part.h' 2011-11-02 20:29:31 +00:00
misc.cpp Use categorized logging even more 2014-09-16 23:38:25 +02:00
misc.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
movie.cpp Use QStringLiteral 2015-10-29 13:37:11 +01:00
movie.h Merge remote-tracking branch 'origin/master' into frameworks 2015-10-18 22:29:00 +02:00
observer.cpp Fix my email address 2013-03-14 23:09:07 +01:00
observer.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
okularGenerator.desktop SVN_SILENT made messages (.desktop file) - always resolve ours 2017-02-04 06:23:35 +01:00
page.cpp Add a way to get the PagePrivate if you have the Page 2017-03-03 00:32:08 +01:00
page.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
page_p.h Add a way to get the PagePrivate if you have the Page 2017-03-03 00:32:08 +01:00
pagecontroller.cpp Fix includes 2015-03-20 08:55:32 +01:00
pagecontroller_p.h Port away from signal/slot keyword 2016-07-11 19:34:08 +02:00
pagesize.cpp make PageSize implicitely shared 2007-04-17 21:20:35 +00:00
pagesize.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
pagetransition.cpp Support for non-integer transition durations in PDF presentations 2015-10-15 00:16:55 +02:00
pagetransition.h Merge remote-tracking branch 'origin/master' into frameworks 2015-10-18 22:29:00 +02:00
rotationjob.cpp Fix low hanging unused parameters warnings 2016-07-11 22:57:11 +02:00
rotationjob_p.h Q_DECL_OVERRIDE -> override 2017-03-02 20:39:24 +01:00
scripter.cpp Use categorized logging even more 2014-09-16 23:38:25 +02:00
scripter.h Add a scripter class to execute scripts on request. 2008-04-13 22:31:59 +00:00
sound.cpp krazy include order issues 2007-04-19 18:30:20 +00:00
sound.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
sourcereference.cpp Fix parsing of lilypond URLs 2016-07-24 20:27:04 +02:00
sourcereference.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
sourcereference_p.h More QUrl porting 2014-08-10 20:36:41 +02:00
textdocumentgenerator.cpp Remove #ifdefs for Qt we require in cmake anyway 2017-01-16 00:36:08 +01:00
textdocumentgenerator.h Add override 2017-03-02 20:38:50 +01:00
textdocumentgenerator_p.h Add override 2017-03-02 20:38:50 +01:00
textdocumentsettings.cpp Use QStringLiteral 2015-10-29 13:37:11 +01:00
textdocumentsettings.h Q_NULLPTR -> nullptr 2017-03-02 20:09:32 +01:00
textdocumentsettings_p.h Added missing core/textdocumentsettings_p.h 2013-05-18 17:44:11 +02:00
texteditors_p.h Use QStringLiteral 2015-10-29 13:37:11 +01:00
textpage.cpp core: Fix build without implicit cast to/from ascii 2016-07-11 22:07:57 +02:00
textpage.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
textpage_p.h Improve searching code 2013-10-18 16:30:07 +02:00
tile.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
tilesmanager.cpp Fix tiles issue when zooming out a rotated document 2013-06-22 11:54:36 +02:00
tilesmanager_p.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
utils.cpp Drop libkscreen dependency 2016-01-30 18:15:07 +01:00
utils.h Drop libkscreen dependency 2016-01-30 18:15:07 +01:00
utils_p.h Viewport transition refinements for Find and Undo/Redo actions 2013-12-29 23:27:30 +01:00
view.cpp Start a View class for managing the "views" of a document. 2008-04-27 11:05:59 +00:00
view.h port to qCDebug. Autogenerate export headers 2014-10-27 22:35:06 +01:00
view_p.h Start a View class for managing the "views" of a document. 2008-04-27 11:05:59 +00:00