r18846 by jghali - #12090: Properties window + value fields + Enter --> New paragraph in the document edited text box
scribus-commit
scribus-commit at lists.scribus.net
Tue Feb 25 23:56:28 UTC 2014
Author: jghali
Date: Tue Feb 25 23:56:28 2014
New Revision: 18846
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18846
Log:
#12090: Properties window + value fields + Enter --> New paragraph in the document edited text box
Modified:
trunk/Scribus/scribus/canvasmode_edit.cpp
trunk/Scribus/scribus/canvasmode_edit.h
trunk/Scribus/scribus/scribus.cpp
Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18846&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Tue Feb 25 23:56:28 2014
@@ -37,6 +37,7 @@
#include "fpoint.h"
#include "fpointarray.h"
#include "hyphenator.h"
+#include "pageitem_noteframe.h"
#include "pageitem_textframe.h"
#include "prefscontext.h"
#include "prefsfile.h"
@@ -72,6 +73,7 @@
connect(view->horizRuler, SIGNAL(MarkerMoved(double, double)), this, SLOT(rulerPreview(double, double)));
mRulerGuide = -1;
m_longCursorTime=false;
+ m_keyRepeat = false;
}
inline bool CanvasMode_Edit::GetItem(PageItem** pi)
@@ -95,31 +97,57 @@
void CanvasMode_Edit::keyPressEvent(QKeyEvent *e)
{
+ if (m_keyRepeat)
+ return;
+ m_keyRepeat = true;
+
PageItem* currItem;
- if (GetItem(&currItem))
- {
- PageItem_TextFrame* textframe = currItem->asTextFrame();
- if (textframe)
- {
- m_cursorVisible=true;
- int kk = e->key();
- switch (kk)
- {
- case Qt::Key_PageUp:
- case Qt::Key_PageDown:
- case Qt::Key_Up:
- case Qt::Key_Down:
- case Qt::Key_Home:
- case Qt::Key_End:
- m_longCursorTime=true;
- break;
- default:
- m_longCursorTime=false;
- break;
- }
- blinkTextCursor();
- }
- }
+ if (!GetItem(&currItem))
+ {
+ m_keyRepeat = false;
+ return;
+ }
+
+ if (currItem->asImageFrame() && !currItem->locked())
+ {
+ currItem->handleModeEditKey(e, m_keyRepeat);
+ }
+ if (currItem->asTextFrame())
+ {
+ bool oldKeyRepeat = m_keyRepeat;
+
+ m_cursorVisible = true;
+ switch (e->key())
+ {
+ case Qt::Key_PageUp:
+ case Qt::Key_PageDown:
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ case Qt::Key_Home:
+ case Qt::Key_End:
+ m_longCursorTime=true;
+ break;
+ default:
+ m_longCursorTime=false;
+ break;
+ }
+ blinkTextCursor();
+
+ currItem->handleModeEditKey(e, m_keyRepeat);
+ if (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty())
+ {
+ if (!currItem->asNoteFrame()->isEndNotesFrame())
+ {
+ currItem->asNoteFrame()->masterFrame()->invalidateLayout(false);
+ currItem->asNoteFrame()->masterFrame()->updateLayout();
+ }
+ }
+ m_keyRepeat = oldKeyRepeat;
+ if (!currItem->isTextFrame() || (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty()))
+ m_ScMW->slotDocCh(false);
+ m_doc->regionsChanged()->update(QRectF());
+ }
+ m_keyRepeat = false;
}
Modified: trunk/Scribus/scribus/canvasmode_edit.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18846&path=/trunk/Scribus/scribus/canvasmode_edit.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.h (original)
+++ trunk/Scribus/scribus/canvasmode_edit.h Tue Feb 25 23:56:28 2014
@@ -50,7 +50,8 @@
virtual void mouseReleaseEvent(QMouseEvent *m);
virtual void mouseMoveEvent(QMouseEvent *m);
virtual void mousePressEvent(QMouseEvent *m);
-
+
+ virtual bool handleKeyEvents() { return true; }
virtual void keyPressEvent(QKeyEvent *e);
virtual void drawControls(QPainter* p);
@@ -76,6 +77,7 @@
bool m_lastPosWasOverGuide;
double mRulerGuide;
bool m_longCursorTime;
+ bool m_keyRepeat;
private slots:
void blinkTextCursor();
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18846&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Feb 25 23:56:28 2014
@@ -52,7 +52,7 @@
#include <QProgressBar>
//<<QML testing
#include <QHBoxLayout>
-#include <QQuickView>
+//#include <QQuickView>
//>>
#include <QRegExp>
#include <QScopedPointer>
@@ -1710,46 +1710,6 @@
break;
}
}
- /** Now if we have an item selected
- * - In normal mode we can:
- * -- Use backspace or delete to delete the item
- * -- In edit mode of an image frame, use the arrow keys to resize the image:
- (flows to pageitem_imageframe for control)
- Alt right arrow, move right side of image outwards (expand)
- Alt left arrow, move right side inwards (shrink)
- Alt down arrow, move bottom side downwards (expand)
- Alt up arrow, move top side inwards (shrink)
- */
- if (doc->m_Selection->count() != 0)
- {
- PageItem *currItem = doc->m_Selection->itemAt(0);
- if (doc->appMode == modeEdit)
- {
- if (currItem->asImageFrame() && !currItem->locked())
- {
- currItem->handleModeEditKey(k, keyrep);
- }
-//FIXME:av view->oldCp = currItem->CPos;
- if (currItem->isTextFrame())
- {
- bool kr=keyrep;
- view->canvasMode()->keyPressEvent(k); //Hack for 1.4.x for stopping the cursor blinking while moving about
- currItem->handleModeEditKey(k, keyrep);
- if (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty())
- {
- if (!currItem->asNoteFrame()->isEndNotesFrame())
- {
- currItem->asNoteFrame()->masterFrame()->invalidateLayout(false);
- currItem->asNoteFrame()->masterFrame()->updateLayout();
- }
- }
- keyrep=kr;
- }
- if (!currItem->isTextFrame() || (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty()))
- slotDocCh(false);
- doc->regionsChanged()->update(QRectF());
- }
- }
}
switch(kk)
{
More information about the scribus-commit
mailing list