View Issue Details

IDProjectCategoryView StatusLast Update
0009502ScribusStory Editor / Text Framespublic2010-11-27 23:14
Reportercezaryece Assigned Tocbradney  
PriorityhighSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
PlatformLinux 
Product Version1.3.8 
Fixed in Version1.3.9.svn 
Summary0009502: patch for Shift-LMB selects text again
DescriptionIn 1.3.5 - 1.5 clicking in text with Shift do nothing except moving cursor.
As we all are expecting selection in such action and it is working in 1.3.3.x I made some investigating and bring this feature back.
See, try and test attached patch (for 1.3.9)
TagsNo tags attached.
Patch

Activities

cezaryece

2010-11-19 12:21

updater  

svn_diff_canvasmode_edit.patch (1,729 bytes)   
Index: Scribus/scribus/canvasmode_edit.cpp
===================================================================
--- Scribus/scribus/canvasmode_edit.cpp	(wersja 15812)
+++ Scribus/scribus/canvasmode_edit.cpp	(kopia robocza)
@@ -614,16 +614,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 (m->modifiers() & Qt::ShiftModifier)
                                {
-					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 (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
                                {
svn_diff_canvasmode_edit.patch (1,729 bytes)   

cezaryece

2010-11-19 14:45

updater  

svn_diff_canvasmode_edit_PARASELECT.patch (3,483 bytes)   
Index: Scribus/scribus/canvasmode_edit.cpp
===================================================================
--- Scribus/scribus/canvasmode_edit.cpp	(wersja 15812)
+++ Scribus/scribus/canvasmode_edit.cpp	(kopia robocza)
@@ -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, stop;
+
+				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 (m->modifiers() & Qt::ShiftModifier)
                                {
-					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 (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
                                {

cezaryece

2010-11-19 14:46

updater   ~0024854

In new version of patch is added ability for selecting paragraph with Ctrl+dbl click or few paragraphs by Shift+ctrl+dbl cklick

christoph_s

2010-11-22 22:47

administrator   ~0024878

Thanks for the patch. Works!

Issue History

Date Modified Username Field Change
2010-11-19 12:21 cezaryece New Issue
2010-11-19 12:21 cezaryece File Added: svn_diff_canvasmode_edit.patch
2010-11-19 14:45 cezaryece File Added: svn_diff_canvasmode_edit_PARASELECT.patch
2010-11-19 14:46 cezaryece Note Added: 0024854
2010-11-22 14:47 cbradney Status new => resolved
2010-11-22 14:47 cbradney Fixed in Version => 1.3.9.svn
2010-11-22 14:47 cbradney Resolution open => fixed
2010-11-22 14:47 cbradney Assigned To => cbradney
2010-11-22 22:47 christoph_s Note Added: 0024878
2010-11-22 22:47 christoph_s Status resolved => closed
2010-11-27 14:24 cbradney Status closed => resolved
2010-11-27 23:14 christoph_s Status resolved => closed
2015-09-17 20:08 Kunda Category Story Editor / Text Frames => Story Ed/Txt Frames
2015-09-17 20:12 Kunda Category Story Ed/Txt Frames => Story Editor / Text Frames