r16019 by craig - #9521: extra patch for control double click in text frames

scribus-commit scribus-commit at lists.scribus.net
Sat Nov 27 15:26:41 CET 2010


Author: craig
Date: Sat Nov 27 14:26:41 2010
New Revision: 16019

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16019
Log:
#9521: extra patch for control double click in text frames

Modified:
    branches/Version135/Scribus/scribus/canvasmode_edit.cpp

Modified: branches/Version135/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16019&path=/branches/Version135/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/canvasmode_edit.cpp (original)
+++ branches/Version135/Scribus/scribus/canvasmode_edit.cpp Sat Nov 27 14:26:41 2010
@@ -409,17 +409,16 @@
 					start = currItem->itemText.startOfParagraph(nrPar);
 					stop = currItem->itemText.endOfParagraph(nrPar);
 				}
-				//qDebug() << "start: " << start << "  stop: " << stop;
+				currItem->itemText.deselectAll();
 				currItem->itemText.extendSelection(start, stop);
-				currItem->CPos   = stop;
-				currItem->HasSel = (currItem->itemText.lengthOfSelection() > 0);
+				currItem->CPos = stop;
 			}
 			else
 			{	//Double click in a frame to select a word
 				oldCp = currItem->CPos;
-				currItem->CPos   = currItem->itemText.selectWord(currItem->CPos);
-				currItem->HasSel = (currItem->itemText.lengthOfSelection() > 0);
-			}
+				currItem->CPos = currItem->itemText.selectWord(currItem->CPos);
+			}
+			currItem->HasSel = (currItem->itemText.lengthOfSelection() > 0);
 		}
 	}
 	else
@@ -657,19 +656,33 @@
 					if (currItem->itemText.lengthOfSelection() > 0)
 					{
 						if (currItem->CPos < (currItem->itemText.startOfSelection() + currItem->itemText.endOfSelection()) / 2)
+						{
+							if (m->modifiers() & Qt::ControlModifier)
+								currItem->CPos = currItem->itemText.startOfParagraph(currItem->itemText.nrOfParagraph(currItem->CPos));
 							oldP = currItem->itemText.startOfSelection();
+						}
 						else
+						{
+							if (m->modifiers() & Qt::ControlModifier)
+								currItem->CPos = currItem->itemText.endOfParagraph(currItem->itemText.nrOfParagraph(currItem->CPos));
 							oldP = currItem->itemText.endOfSelection();
+						}
 						currItem->asTextFrame()->itemText.extendSelection(oldP, currItem->CPos);
 						oldCp = currItem->CPos;
 					}
 					else
 					{
 						int dir=1;
-						if (oldCp>currItem->CPos)
+						if (oldCp > currItem->CPos)
 							dir=-1;
-						if (currItem->asTextFrame())
-							currItem->asTextFrame()->ExpandSel(dir, oldP);
+						if (m->modifiers() & Qt::ControlModifier) //no selection but Ctrl+Shift+click still select paragraphs
+						{
+							if (dir == 1)
+								currItem->CPos = currItem->itemText.endOfParagraph(currItem->itemText.nrOfParagraph(currItem->CPos));
+							else
+								currItem->CPos = currItem->itemText.startOfParagraph(currItem->itemText.nrOfParagraph(currItem->CPos));
+						}
+						currItem->asTextFrame()->ExpandSel(dir, oldP);
 						oldCp = oldP;
 					}
 				}




More information about the scribus-commit mailing list