D13450: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Scott Harvey
sharvey added a comment.


  In D13450#294820 , @rkflx wrote:
  
  > It seems you forgot to merge stable into master, which I now have done with
  
  
  I was actually in the process of trying to figure that out... I got a lengthy 
list of warnings when I tried it and the wiki is a bit vague on what to do in 
that case. I was hunting through the diff history trying to figure out if it 
was necessary in this case. Regardless, thanks for taking care of it.
  
  > Thanks again for the quick update so we could get the string changes in in 
time, and hopefully for the RC in two weeks you'll be able to solve the 
remaining problems with `checkBounds`.
  
  `checkBounds` seemed so simple, yet it frustrated me endlessly. I'll dig into 
it and see what's going on. I have a few suspicions.
  
  ---
  
  If you have time, would you mind dropping me a line at `sc...@spharvey.me`? I 
have some unrelated questions I'd like to get your opinion on. Thanks in 
advance.

REPOSITORY
  R166 Spectacle

REVISION DETAIL
  https://phabricator.kde.org/D13450

To: sharvey, rkflx, ngraham, #spectacle, yurchor
Cc: ltoscano, kde-doc-english, abalaji, #spectacle, skadinna


D13450: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Henrik Fehlauer
rkflx added a comment.


  It seems you forgot to merge stable into master, which I now have done with
  
git checkout master
git pull
git merge -Xours origin/Applications/18.08
git push
  
  Thanks again for the quick update so we could get the string changes in in 
time, and hopefully for the RC in two weeks you'll be able to solve the 
remaining problems with `checkBounds`.

REPOSITORY
  R166 Spectacle

REVISION DETAIL
  https://phabricator.kde.org/D13450

To: sharvey, rkflx, ngraham, #spectacle, yurchor
Cc: ltoscano, kde-doc-english, abalaji, #spectacle, skadinna


[spectacle/Applications/18.08] /: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Scott Harvey
Git commit 48eacd1ba1495a9167dd9f9cd8097e86ae6ff6dd by Scott Harvey.
Committed on 19/07/2018 at 10:38.
Pushed by sharvey into branch 'Applications/18.08'.

Add arrow keys to move and resize selection rectangle

Summary:
Add arrow keys to move and resize selection rectangle.
{key Arrows} alone moves in large increment
{key Shift} + {key Arrows} moves in small (single pixel) increments
{key ALT} + {key Arrows} resize rectangle in large increment
{key ALT} + {key Shift} + {key Arrows} resize rectangle in small increment

BUG: 394947

Test Plan:
- Apply patch
 - Launch Spectacle; begin Rectangular Selection
 - Select a rectangle with the mouse
 - Use {key Arrows} to move rectangle (large increment)
 - Use {key Shift} + {key Arrows} to move in small increment
 - Use {key ALT} + {key Arrows} to resize rectangle (large increment
 - Use {key ALT} + {key Shift} + {key Arrows} to resize rectangle in small 
increment
 - Complete capture with mouse or {key Enter} key
 - Ensure right selection is captured after moving and resizing rectangle

Reviewers: rkflx, ngraham, #spectacle, yurchor

Reviewed By: rkflx, ngraham, #spectacle, yurchor

Subscribers: ltoscano, kde-doc-english, abalaji, #spectacle

Tags: #documentation

Differential Revision: https://phabricator.kde.org/D13450

M  +5-2doc/index.docbook
M  +202  -3src/QuickEditor/EditorRoot.qml

https://commits.kde.org/spectacle/48eacd1ba1495a9167dd9f9cd8097e86ae6ff6dd

diff --git a/doc/index.docbook b/doc/index.docbook
index 4fcfb40..0331d5f 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -29,8 +29,8 @@
 
 
 
-2018-03-06
-Applications 18.04
+2018-07-17
+Applications 18.08
 
 
  is a simple application for capturing desktop 
screenshots. It can capture images of the entire desktop, a single monitor, the 
currently active window, the window currently under the mouse, or a rectangular 
region of the screen. The images can then be printed, sent to other 
applications for manipulation, or quickly be saved as-is.
@@ -150,6 +150,9 @@
 The Rectangular Region 
option allows you to select a rectangular region of your desktop with your 
mouse. This region may be spread across different outputs.
 
 This mode does not immediately take a screenshot 
but allows you to draw a rectangle on your screen, which can be moved and 
resized as needed. Once the desired selection rectangle has been drawn, 
double-clicking anywhere on the screen, or pressing the  button on the 
keyboard will capture the screenshot.
+
+You can use the arrow keys to move and adjust 
the rectangle. Pressing the arrow keys will move the rectangle. Holding the 
Shift key while pressing the arrow keys will move the 
rectangle slowly, for fine-tuning your selection. Holding the 
Alt key while pressing the arrow keys will adjust the size of 
the rectangle.
+
 
 
 
diff --git a/src/QuickEditor/EditorRoot.qml b/src/QuickEditor/EditorRoot.qml
index 583bc37..10560ab 100644
--- a/src/QuickEditor/EditorRoot.qml
+++ b/src/QuickEditor/EditorRoot.qml
@@ -38,6 +38,8 @@ Item {
 property int magZoom: 5;
 property int magPixels: 16;
 property int magOffset: 32;
+property double largeChange: 15;
+property double smallChange: 1 / Screen.devicePixelRatio;
 
 SystemPalette {
 id: systemPalette;
@@ -78,11 +80,202 @@ Item {
 }
 
 Keys.onPressed: {
+
+var change;
+
+// shift key alone = magnifier toggle
 if (event.modifiers & Qt.ShiftModifier) {
 toggleMagnifier = true;
-cropDisplayCanvas.requestPaint();
 }
-}
+
+// nested switches for arrow keys based on modifier keys
+switch(event.modifiers) {
+
+   case Qt.NoModifier:
+   switch (event.key) {
+
+   case Qt.Key_Left:
+change = checkBounds(-largeChange, 0.0, "left");
+selection.x += change;
+break;
+case Qt.Key_Right:
+change = checkBounds(largeChange, 0.0, "right");
+selection.x += change;
+break;
+case Qt.Key_Up:
+change = checkBounds(0.0, -largeChange, "up");
+selection.y += change;
+break;
+case Qt.Key_Down:
+change = checkBounds(0.0, largeChange, "down");
+selection.y += change;
+break;
+}
+
+break; // end no modifier (just arrows)
+
+case Qt.ShiftModifier:
+switch (event.key) {
+
+case Qt.Key_Left:
+ change = checkBounds(-smallChange, 0.0, "left");
+ selection.x += change;
+ 

D13450: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Scott Harvey
This revision was automatically updated to reflect the committed changes.
Closed by commit R166:48eacd1ba149: Add arrow keys to move and resize selection 
rectangle (authored by sharvey).

REPOSITORY
  R166 Spectacle

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D13450?vs=38082=38083

REVISION DETAIL
  https://phabricator.kde.org/D13450

AFFECTED FILES
  doc/index.docbook
  src/QuickEditor/EditorRoot.qml

To: sharvey, rkflx, ngraham, #spectacle, yurchor
Cc: ltoscano, kde-doc-english, abalaji, #spectacle, skadinna


D13450: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Scott Harvey
sharvey added a comment.


  In D13450#294808 , @rkflx wrote:
  
  > Thanks, looking much better now.
  >
  > Please make sure to commit to the stable branch, i.e. `Applications/18.08` 
(let me know if you are unsure what that means).
  
  
  Following the Arcanist/Phabricator docs on the KDE wiki...

REPOSITORY
  R166 Spectacle

BRANCH
  arcpatch-D13450

REVISION DETAIL
  https://phabricator.kde.org/D13450

To: sharvey, rkflx, ngraham, #spectacle, yurchor
Cc: ltoscano, kde-doc-english, abalaji, #spectacle, skadinna


D13450: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Scott Harvey
sharvey updated this revision to Diff 38082.
sharvey added a comment.


  - Minor whitespace cleanup

REPOSITORY
  R166 Spectacle

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D13450?vs=38080=38082

BRANCH
  arcpatch-D13450

REVISION DETAIL
  https://phabricator.kde.org/D13450

AFFECTED FILES
  doc/index.docbook
  src/QuickEditor/EditorRoot.qml

To: sharvey, rkflx, ngraham, #spectacle, yurchor
Cc: ltoscano, kde-doc-english, abalaji, #spectacle, skadinna


D13450: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Henrik Fehlauer
rkflx accepted this revision.
rkflx added a comment.
This revision is now accepted and ready to land.


  Thanks, looking much better now.
  
  Please make sure to commit to the stable branch, i.e. `Applications/18.08` 
(let me know if you are unsure what that means).

REPOSITORY
  R166 Spectacle

BRANCH
  arcpatch-D13450

REVISION DETAIL
  https://phabricator.kde.org/D13450

To: sharvey, rkflx, ngraham, #spectacle, yurchor
Cc: ltoscano, kde-doc-english, abalaji, #spectacle, skadinna


D13450: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Scott Harvey
sharvey marked 2 inline comments as done.

REPOSITORY
  R166 Spectacle

REVISION DETAIL
  https://phabricator.kde.org/D13450

To: sharvey, rkflx, ngraham, #spectacle, yurchor
Cc: ltoscano, kde-doc-english, abalaji, #spectacle, skadinna


D13450: Add arrow keys to move and resize selection rectangle

2018-07-19 Thread Scott Harvey
sharvey updated this revision to Diff 38080.
sharvey added a comment.


  - Fix Alt + Down; Undo layout changes for help text; Reorder help text items

REPOSITORY
  R166 Spectacle

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D13450?vs=38014=38080

BRANCH
  arcpatch-D13450

REVISION DETAIL
  https://phabricator.kde.org/D13450

AFFECTED FILES
  doc/index.docbook
  src/QuickEditor/EditorRoot.qml

To: sharvey, rkflx, ngraham, #spectacle, yurchor
Cc: ltoscano, kde-doc-english, abalaji, #spectacle, skadinna