| Summary: | cannot add text to picture after cancel | ||
|---|---|---|---|
| Product: | [Applications] krita | Reporter: | Brice Hunt <shoalcreek5> |
| Component: | General | Assignee: | Halla Rempt <halla> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | jlermer |
| Priority: | NOR | ||
| Version First Reported In: | 1.6.1 | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Brice Hunt
2006-12-06 07:53:06 UTC
Clarification in item number 5 to reproduce the bug: Should read click the "Cancel" button in the new text dialog box. Ah, bah. This must be related to my fixes for http://bugs.kde.org/show_bug.cgi?id=136151 :-(. Cyrille's fixes, actually. But I'll look at it. SVN commit 617757 by rempt:
BUG: 138429 Simple fix for this bug.
Also: add keyboard handling to the move tool for pixel-precise layer moving
M +72 -3 kis_tool_move.cc
M +14 -1 kis_tool_move.h
M +3 -2 kis_tool_text.cc
--- branches/koffice/1.6/koffice/krita/plugins/tools/defaulttools/kis_tool_move.cc #617756:617757
@@ -39,10 +39,14 @@
KisToolMove::KisToolMove()
: super(i18n("Move Tool"))
+ , m_subject( 0 )
+ , m_keyEvent( 0 )
{
setName("tool_move");
- m_subject = 0;
+
setCursor(KisCursor::moveCursor());
+ m_repeatTimer = new QTimer(this);
+ connect( m_repeatTimer, SIGNAL( timeout() ), this, SLOT( slotMove() ) );
}
KisToolMove::~KisToolMove()
@@ -66,14 +70,13 @@
if (!img || !(dev = img->activeLayer()))
return;
- m_dragStart = pos;
m_strategy.startDrag(pos);
}
}
void KisToolMove::move(KisMoveEvent *e)
{
- if (m_subject) {
+ if (m_subject && e->state() == QMouseEvent::LeftButton) {
QPoint pos = e->pos().floorQPoint();
if((e->state() & Qt::AltButton) || (e->state() & Qt::ControlButton)) {
if(fabs(pos.x() - m_dragStart.x()) > fabs(pos.y() - m_dragStart.y()))
@@ -110,3 +113,69 @@
}
}
+
+void KisToolMove::keyPress( QKeyEvent *e )
+{
+ m_keyEvent = e;
+
+ if (m_subject) {
+
+ KisImageSP img = m_subject->currentImg();
+ KisLayerSP dev;
+
+ if (!img || !(dev = img->activeLayer()))
+ return;
+
+ m_dragStart = QPoint( 0, 0 );
+ m_strategy.startDrag( m_dragStart );
+ m_steps = 1;
+ m_repeatTimer->start(200);
+
+ }
+}
+
+void KisToolMove::keyRelease(QKeyEvent *)
+{
+ m_repeatTimer->stop();
+
+ if ( m_subject && m_keyEvent) {
+
+ if ( m_keyEvent->key() == Qt::Key_Left ) {
+ m_strategy.endDrag(QPoint( -m_steps, 0 ));
+ }
+ else if ( m_keyEvent->key() == Qt::Key_Right ) {
+ m_strategy.endDrag(QPoint(m_steps, 0) );
+ }
+ else if ( m_keyEvent->key() == Qt::Key_Up ) {
+ m_strategy.endDrag(QPoint(0, -m_steps) );
+ }
+ else if ( m_keyEvent->key() == Qt::Key_Down ) {
+ m_strategy.endDrag(QPoint(0, m_steps) );
+ }
+ }
+ m_steps = 0;
+ m_keyEvent = 0;
+
+}
+
+void KisToolMove::slotMove()
+{
+ if (m_subject && m_keyEvent) {
+
+ if ( m_keyEvent->key() == Qt::Key_Left ) {
+ m_strategy.drag(QPoint(-m_steps, 0) );
+ }
+ else if ( m_keyEvent->key() == Qt::Key_Right ) {
+ m_strategy.drag(QPoint(m_steps, 0) );
+ }
+ else if ( m_keyEvent->key() == Qt::Key_Up ) {
+ m_strategy.drag(QPoint(0, -m_steps) );
+ }
+ else if ( m_keyEvent->key() == Qt::Key_Down ) {
+ m_strategy.drag(QPoint(0, m_steps) );
+ }
+
+ ++m_steps;
+ }
+
+}
--- branches/koffice/1.6/koffice/krita/plugins/tools/defaulttools/kis_tool_move.h #617756:617757
@@ -21,11 +21,14 @@
#ifndef KIS_TOOL_MOVE_H_
#define KIS_TOOL_MOVE_H_
+#include <qtimer.h>
+
#include "kis_strategy_move.h"
#include "kis_tool_non_paint.h"
#include "kis_tool_factory.h"
-// XXX: Moving is not nearly smooth enough!
+class QTimer;
+
class KisToolMove : public KisToolNonPaint {
typedef KisToolNonPaint super;
@@ -46,11 +49,21 @@
virtual void buttonPress(KisButtonPressEvent *e);
virtual void move(KisMoveEvent *e);
virtual void buttonRelease(KisButtonReleaseEvent *e);
+ virtual void keyPress(QKeyEvent *e);
+ virtual void keyRelease(QKeyEvent *e);
+private slots:
+
+ void slotMove();
+
private:
+
KisCanvasSubject *m_subject;
KisStrategyMove m_strategy;
QPoint m_dragStart;
+ QTimer * m_repeatTimer;
+ QKeyEvent * m_keyEvent;
+ int m_steps;
};
--- branches/koffice/1.6/koffice/krita/plugins/tools/defaulttools/kis_tool_text.cc #617756:617757
@@ -83,7 +83,6 @@
if (m_subject && e->button() == QMouseEvent::LeftButton) {
if(!m_wasPressed) return;
- m_windowIsBeingShown = true;
m_wasPressed = false;
KisImageSP img = m_subject->currentImg();
@@ -91,8 +90,10 @@
bool ok;
QString text = KInputDialog::getText(i18n("Font Tool"), i18n("Enter text:"),
QString::null, &ok);
- if (!ok)
+ if (!ok) {
+ m_windowIsBeingShown = false;
return;
+ }
KisUndoAdapter *undoAdapter = img->undoAdapter();
if (undoAdapter) {
*** Bug 139013 has been marked as a duplicate of this bug. *** |