r18994 by jghali - improve cursor positioning and text selection in table cells

scribus-commit scribus-commit at lists.scribus.net
Fri Apr 4 11:57:34 UTC 2014


Author: jghali
Date: Fri Apr  4 11:57:34 2014
New Revision: 18994

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18994
Log:
improve cursor positioning and text selection in table cells

Modified:
    trunk/Scribus/scribus/canvasmode_edittable.cpp
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/canvasmode_edittable.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18994&path=/trunk/Scribus/scribus/canvasmode_edittable.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edittable.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edittable.cpp Fri Apr  4 11:57:34 2014
@@ -324,11 +324,13 @@
 		// Select text in active cell text frame.
 		activeFrame->itemText.deselectAll();
 		m_view->slotSetCurs(event->globalPos().x(), event->globalPos().y());
+		activeFrame->HasSel = false;
 
 		const int selectionStart = qMin(activeFrame->itemText.cursorPosition(), m_lastCursorPos);
 		const int selectionLength = qAbs(activeFrame->itemText.cursorPosition() - m_lastCursorPos);
 
 		activeFrame->itemText.select(selectionStart, selectionLength);
+		activeFrame->HasSel = (selectionLength > 0);
 	}
 	else
 	{
@@ -337,6 +339,7 @@
 		 * cell selection gesture.
 		 */
 		activeFrame->itemText.deselectAll();
+		activeFrame->HasSel = false;
 
 		m_cellSelectGesture->setup(m_table, activeCell);
 		m_view->startGesture(m_cellSelectGesture);

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18994&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Fri Apr  4 11:57:34 2014
@@ -1494,9 +1494,11 @@
 	{
 		// Move to cell under cursor and position the text cursor.
 		PageItem_Table *table = item->asTable();
-		table->moveTo(table->cellAt(m_canvas->globalToCanvas(QPoint(x,y)).toQPointF()));
+		QPointF tablePoint = m_canvas->globalToCanvas(QPoint(x, y)).toQPointF();
+		table->moveTo(table->cellAt(tablePoint));
 		textFrame = table->activeCell().textFrame();
-		canvasPoint = table->getTransform().inverted().map(m_canvas->globalToCanvas(QPoint(x, y)).toQPointF()) - table->gridOffset();
+		mm = textFrame->getTransform();
+		canvasPoint = table->getTransform().inverted().map(tablePoint) - table->gridOffset();
 	}
 	else if (item->isImageFrame())
 		return true;




More information about the scribus-commit mailing list