View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0015916 | Scribus | Canvas | public | 2019-11-05 14:12 | 2019-12-08 21:24 |
| Reporter | ale | Assigned To | ale | ||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.5.6.svn | ||||
| Fixed in Version | 1.5.6.svn | ||||
| Summary | 0015916: Detect arrow keys while the rotation tool is active | ||||
| Description | While the rotation tool is active, the left and rigth arrow keys should rotate the item. the up and down keys could change the basepoint. | ||||
| Tags | No tags attached. | ||||
| Attached Files | rotate-arrow-keys.diff (3,312 bytes)
diff --git a/scribus/canvasmode_rotate.cpp b/scribus/canvasmode_rotate.cpp
index 8271cadb6..b8a82ade5 100644
--- a/scribus/canvasmode_rotate.cpp
+++ b/scribus/canvasmode_rotate.cpp
@@ -25,6 +25,9 @@
#include "iconmanager.h"
#include "pageitem.h"
#include "prefsmanager.h"
+#include "ui/propertiespalette.h"
+#include "ui/propertiespalette_xyz.h"
+#include "ui/basepointwidget.h"
#include "scribus.h"
#include "scribusdoc.h"
#include "scribusview.h"
@@ -450,6 +453,77 @@ void CanvasMode_Rotate::mouseMoveEvent(QMouseEvent *m)
}
}
+void CanvasMode_Rotate::keyReleaseEvent(QKeyEvent *e)
+{
+ if (e->key() == Qt::Key_Up)
+ {
+ auto id = m_view->m_ScMW->propertiesPalette->xyzPal->basePointWidget->checkedId();
+ id = id > 0 ? id - 1 : 4;
+ m_view->m_ScMW->propertiesPalette->xyzPal->basePointWidget->setCheckedId(id);
+ m_doc->setRotationMode(id);
+ return;
+ }
+ else if (e->key() == Qt::Key_Down)
+ {
+ auto id = m_view->m_ScMW->propertiesPalette->xyzPal->basePointWidget->checkedId();
+ id = (id + 1) % 5;
+ m_view->m_ScMW->propertiesPalette->xyzPal->basePointWidget->setCheckedId(id);
+ m_doc->setRotationMode(id);
+ return;
+ }
+
+ double increment = 0.0;
+ if (e->key() == Qt::Key_Left)
+ increment = 1.0;
+ if (e->key() == Qt::Key_Right)
+ increment = -1.0;
+ if (e->modifiers() & Qt::ControlModifier) {
+ increment *= 10;
+ }
+ if (e->modifiers() & Qt::ShiftModifier) {
+ increment /= 10;
+ }
+ PageItem *currItem;
+ if (increment != 0)
+ {
+ if (GetItem(&currItem)) {
+ if (!m_view->groupTransactionStarted())
+ {
+ m_view->startGroupTransaction(Um::Rotate, "", Um::IRotate);
+ }
+ m_doc->itemSelection_Rotate(currItem->rotation() + increment);
+ m_canvas->setRenderModeUseBuffer(false);
+ if (!m_doc->m_Selection->isMultipleSelection())
+ {
+ m_doc->setRedrawBounding(currItem);
+ currItem->OwnPage = m_doc->OnPage(currItem);
+ if (currItem->asLine())
+ m_view->updateContents();
+ }
+
+ if (m_doc->m_Selection->count() > 1)
+ {
+ m_doc->m_Selection->setGroupRect();
+ double x, y, w, h;
+ m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
+ m_view->updateContents(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10)));
+ }
+ }
+ if (m_view->groupTransactionStarted())
+ {
+ for (int i = 0; i < m_doc->m_Selection->count(); ++i)
+ m_doc->m_Selection->itemAt(i)->checkChanges(true);
+ m_view->endGroupTransaction();
+ }
+ for (int i = 0; i < m_doc->m_Selection->count(); ++i)
+ m_doc->m_Selection->itemAt(i)->checkChanges(true);
+ }
+}
+
+void CanvasMode_Rotate::keyPressEvent(QKeyEvent *e)
+{
+}
+
void CanvasMode_Rotate::createContextMenu(PageItem* currItem, double mx, double my)
{
ContextMenu* cmen=nullptr;
diff --git a/scribus/canvasmode_rotate.h b/scribus/canvasmode_rotate.h
index 2a15d0bdb..9d24266a3 100644
--- a/scribus/canvasmode_rotate.h
+++ b/scribus/canvasmode_rotate.h
@@ -48,6 +48,10 @@ public:
void mousePressEvent(QMouseEvent *m) override;
void mouseReleaseEvent(QMouseEvent *m) override;
void mouseMoveEvent(QMouseEvent *m) override;
+ void keyReleaseEvent(QKeyEvent *e) override;
+ void keyPressEvent(QKeyEvent *e) override;
+
+ bool handleKeyEvents() override { return true; }
private:
inline bool GetItem(PageItem** pi);
| ||||
| Patch | Yes | ||||
|
|
i've created void CanvasMode_Rotate::keyPressEvent(QKeyEvent *e) but never gets called. What makes CanvasMode_NodeEdit::keyPressEvent(QKeyEvent *e) to be called? |
|
|
oooops... the solution was in the .h file... i need bool CanvasMode_Rotate::handleKeyEvents() override { return true; } |
|
|
voilà, after having discussed so much about the basepoint i had to do it: while the rotation tool is active, do the rotation with ←→ and change basepoint with ↓↑ https://gitlab.com/scribus/scribus/merge_requests/12 https://gitlab.com/a.l.e/scribus/-/jobs/343094729/artifacts/file/Scribus-nightly-x86_64.AppImage |
|
|
I totally agree about using arrow keys while rotation tool is active. But honestly I wonder about the basepoint... |
|
|
basepoint: if you want to rotate the current item around a different axis then the one selected, you still have to reach the mouse. after the whole discussion about the exact location of the basepoint widget, i thought that it could use it a bit more. instead of moving the item back in place after the rotation (around the wrong axis). also, i use often the alt(-shift)-arrows to resize items... and, each time, the shift key is a huge mental burden for me. the first times are always a try and error and only after a few minutes it gets less awkward. i'm thinking of a proposal to use the current basepoint instead of relying on the shift modifier. i'm still not sure if it would improve the tool, but if will propose the change, i would definitively need a simple way to change the basepoint with the keyboard and i can't think of a better way than r↑↑↑esc i also thought about using numbers to move to a specific basepoint, but it's not "easy" to link numbers and basepoints... (1 to 5? 1 to 4 and 0 being the center? and when it's a line?) this all discussion is void, if you have a better idea, on how to change the basepoint with the keyboard! |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2019-11-05 14:12 | ale | New Issue | |
| 2019-11-05 14:12 | ale | Summary | Detetct arrow pressingwhile the rotation tool is active => Detetct arrow keys while the rotation tool is active |
| 2019-11-05 19:27 | ale | Note Added: 0046979 | |
| 2019-11-05 21:43 | ale | Note Added: 0046981 | |
| 2019-11-06 10:24 | ale | Note Added: 0046992 | |
| 2019-11-06 10:24 | ale | File Added: rotate-arrow-keys.diff | |
| 2019-11-06 10:24 | ale | Summary | Detetct arrow keys while the rotation tool is active => [PATCH] Detetct arrow keys while the rotation tool is active |
| 2019-11-06 10:24 | ale | Patch | No => Yes |
| 2019-11-07 13:36 | ale | Relationship added | related to 0012439 |
| 2019-11-08 04:34 | jghali | Note Added: 0047026 | |
| 2019-11-08 06:05 | ale | Note Added: 0047027 | |
| 2019-11-08 12:58 | jghali | Summary | [PATCH] Detetct arrow keys while the rotation tool is active => Detect arrow keys while the rotation tool is active |
| 2019-11-08 12:59 | jghali | Assigned To | => ale |
| 2019-11-08 12:59 | jghali | Status | new => resolved |
| 2019-11-08 12:59 | jghali | Resolution | open => fixed |
| 2019-11-08 12:59 | jghali | Fixed in Version | => 1.5.6.svn |
| 2019-12-08 21:24 | cbradney | Status | resolved => closed |