r15949 by craig - #9502: Apply supplied patch to allow shift click and double control click for extended text selection again

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 22 15:14:48 CET 2010


Author: craig
Date: Mon Nov 22 14:14:48 2010
New Revision: 15949

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15949
Log:
#9502: Apply supplied patch to allow shift click and double control click for extended text selection again

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=15949&path=/branches/Version135/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/canvasmode_edit.cpp (original)
+++ branches/Version135/Scribus/scribus/canvasmode_edit.cpp Mon Nov 22 14:14:48 2010
@@ -382,10 +382,44 @@
 		}
 		//otherwise, select between the whitespace
 		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);
+		{
+			if (m->modifiers() & Qt::ControlModifier)
+			{
+				int start=0, stop=0;
+
+				if (m->modifiers() & Qt::ShiftModifier)
+				{//Double click with Ctrl+Shift in a frame to select few paragraphs
+					uint oldPar = currItem->itemText.nrOfParagraph(oldCp);
+					uint newPar = currItem->itemText.nrOfParagraph(currItem->CPos);
+					if (oldPar < newPar)
+					{
+						start = currItem->itemText.startOfParagraph(oldPar);
+						stop = currItem->itemText.endOfParagraph(newPar);
+					}
+					else
+					{
+						start = currItem->itemText.startOfParagraph(newPar);
+						stop = currItem->itemText.endOfParagraph(oldPar);
+					}
+				}
+				else
+				{//Double click with Ctrl in a frame to select a paragraph
+					oldCp = currItem->CPos;
+					uint nrPar = currItem->itemText.nrOfParagraph(oldCp);
+					start = currItem->itemText.startOfParagraph(nrPar);
+					stop = currItem->itemText.endOfParagraph(nrPar);
+				}
+				//qDebug() << "start: " << start << "  stop: " << stop;
+				currItem->itemText.extendSelection(start, stop);
+				currItem->CPos   = stop;
+				currItem->HasSel = (currItem->itemText.lengthOfSelection() > 0);
+			}
+			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);
+			}
 		}
 	}
 	else
@@ -614,16 +648,28 @@
 
 			if (m->button() != Qt::RightButton)
 			{
-				currItem->asTextFrame()->deselectAll();
+				//currItem->asTextFrame()->deselectAll();
 				//<<CB Add in shift select to text frames
-				if (m->modifiers() & Qt::ShiftModifier && currItem->itemText.lengthOfSelection() > 0)
-				{
-					if (currItem->CPos < (currItem->itemText.startOfSelection() + currItem->itemText.endOfSelection()) / 2)
-						oldP = currItem->itemText.startOfSelection();
-					else 
-						oldP = currItem->itemText.endOfSelection();
-					currItem->asTextFrame()->itemText.extendSelection(oldP, currItem->CPos);
-					oldCp = currItem->CPos;
+				if (m->modifiers() & Qt::ShiftModifier)
+				{
+					if (currItem->itemText.lengthOfSelection() > 0)
+					{
+						if (currItem->CPos < (currItem->itemText.startOfSelection() + currItem->itemText.endOfSelection()) / 2)
+							oldP = currItem->itemText.startOfSelection();
+						else
+							oldP = currItem->itemText.endOfSelection();
+						currItem->asTextFrame()->itemText.extendSelection(oldP, currItem->CPos);
+						oldCp = currItem->CPos;
+					}
+					else
+					{
+						int dir=1;
+						if (oldCp>currItem->CPos)
+							dir=-1;
+						if (currItem->asTextFrame())
+							currItem->asTextFrame()->ExpandSel(dir, oldP);
+						oldCp = oldP;
+					}
 				}
 				else //>>CB
 				{




More information about the scribus-commit mailing list