Commit 172d78c6 authored by Jake Linder's avatar Jake Linder Committed by Albert Astals Cid

Add "Trim To Selection" feature


C1. Added submenu, moved "Trim margins" (TM mode) to it and added  "Trim To Selection" (TS mode).
C2. Activating "Trim To selection" enters a new mousemode, similar to RectSelect for defining a viewport.
C3. Once a viewport has been defined, it serves as a viewport for all pages in the document.
C4. Left/Right pages are not treated differently.

Manual Testing

T1. Switching between modes enforces at most one active.
T2. Can deactivate a mode by selecting it again from the menu.
T3. When draggin bbox selection, clicking outside page does not crash.
T4. When in "Facing Pages" mode, mouse release must be over any page (or is ignored).
T5. Normalized bbox coords are computed relative to page indicated by point of mouse release.
T6. Behave as expected when switching between any pair of No Trim/Trim Margins/Trim To Selection.
T7. TM mode persisted across app restarts (existing behavior).
T8. TS mode forgotten across app restarts (as desired).
T9. Exiting and reselectin "Trim To Selection" prompts for new bbox.
T10. Choosing a small Trim bbox enforces minimium dimensions size (As percentag of total), as
it does in TM mode, because of the "scale big and crop down" implementation, to avoid huge pixmaps.
TS mode minimum set at 20% (vs. TM mode's 50%).

REVIEW: 124716
BUGS: 351156
parent 21dfb212
......@@ -221,6 +221,14 @@
<choice name="Summary" />
<entry key="TrimMode" type="Enum" >
<choice name="None" />
<choice name="Margins" />
<choice name="Selection" />
<entry key="MouseMode" type="Enum" >
......@@ -230,6 +238,7 @@
<choice name="TextSelect" />
<choice name="TableSelect" />
<choice name="Magnifier" />
<choice name="TrimSelect" />
<entry key="ShowSourceLocationsGraphically" type="Bool" >
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="okular_part_viewermode" version="2">
<kpartgui name="okular_part_viewermode" version="3">
<Menu name="file"><text>&amp;File</text>
......@@ -34,7 +34,7 @@
<Action name="view_orientation_original" group="viewer_menu_merge"/>
<Action name="view_pagesizes" group="viewer_menu_merge"/>
<Action name="view_trim_margins" group="viewer_menu_merge"/>
<Action name="view_trim" group="viewer_menu_merge"/>
<Separator group="viewer_menu_merge"/>
<Action name="go_previous" group="viewer_menu_merge"/>
<Action name="go_next" group="viewer_menu_merge"/>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="okular_part" version="36">
<kpartgui name="okular_part" version="37">
<Menu name="file"><text>&amp;File</text>
<Action name="get_new_stuff" group="file_open"/>
......@@ -43,7 +43,7 @@
<Action name="view_orientation_original"/>
<Action name="view_pagesizes"/>
<Action name="view_trim_margins"/>
<Action name="view_trim_mode"/>
<Action name="view_toggle_forms"/>
This diff is collapsed.
......@@ -187,6 +187,9 @@ Q_OBJECT
// used when selecting stuff, makes the view scroll as necessary to keep the mouse inside the view
void scrollPosIntoView( const QPoint & pos );
// called from slots to turn off trim modes mutually exclusive to id
void updateTrimMode( int except_id );
// don't want to expose classes in here
class PageViewPrivate * d;
......@@ -238,6 +241,7 @@ Q_OBJECT
void slotRotateOriginal();
void slotPageSizes( int );
void slotTrimMarginsToggled( bool );
void slotTrimToSelectionToggled( bool );
void slotToggleForms();
void slotFormChanged( int pageNumber );
void slotRefreshPage();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment