r15950 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:18:24 CET 2010


Author: craig
Date: Mon Nov 22 14:18:24 2010
New Revision: 15950

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

Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/canvasmode_edit.cpp
    trunk/Scribus/scribus/prefsstructs.h
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15950&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Mon Nov 22 14:18:24 2010
@@ -542,6 +542,7 @@
   hyphenator.cpp
 #  ui/hysettings.cpp
   ui/imageinfodialog.cpp
+  indexmanager.cpp
   ui/insertTable.cpp
   ui/insertaframe.cpp
   ui/inspage.cpp

Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15950&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Mon Nov 22 14:18:24 2010
@@ -416,10 +416,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
@@ -677,16 +711,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
 				{

Modified: trunk/Scribus/scribus/prefsstructs.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15950&path=/trunk/Scribus/scribus/prefsstructs.h
==============================================================================
--- trunk/Scribus/scribus/prefsstructs.h (original)
+++ trunk/Scribus/scribus/prefsstructs.h Mon Nov 22 14:18:24 2010
@@ -16,6 +16,7 @@
 #include <QList>
 #include <QSet>
 #include <QHash>
+#include <QVariant>
 #include "pagestructs.h"
 #include "pdfoptions.h"
 #include "scfonts.h"
@@ -387,6 +388,14 @@
 	int compressionLevel; //!< Cache image compression level (see QImage)
 };
 
+struct IndexPrefs
+{
+	//Index Map
+	//Map of Index Names, containing a Map of words/phrases with a list of page numbers
+	QMap<QString, QMap<QString, QList<int> > > indexMap;
+	QMap<QString, QVariant> indexVMap;
+};
+
 
 struct ApplicationPrefs
 {
@@ -432,6 +441,7 @@
 	//Added for Doc Only
 	DocumentInformation docInfo;
 	DocumentSectionMap docSectionMap;
+	IndexPrefs indexPrefs;
 };
 
 #endif

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15950&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Mon Nov 22 14:18:24 2010
@@ -356,6 +356,8 @@
 	m_itemsChanged.connectObserver(m_docUpdater);
 	m_pagesChanged.connectObserver(m_docUpdater);
 
+	m_indexManager = new IndexManager(docPrefsData.indexPrefs.indexMap,docPrefsData.indexPrefs.indexVMap);
+
 	PrefsManager *prefsManager = PrefsManager::instance();
 	docPrefsData.colorPrefs.DCMSset = prefsManager->appPrefs.colorPrefs.DCMSset;
 	docPrefsData.pdfPrefs.SolidProf = docPrefsData.colorPrefs.DCMSset.DefaultSolidColorRGBProfile;
@@ -469,6 +471,8 @@
 	m_masterPageMode=true; // quick hack to force the change of pointers in setMasterPageMode();
 	setMasterPageMode(false);
 	addSymbols();
+
+	docPrefsData.indexPrefs.indexMap.insert("Index", QMap<QString, QList<int> >());
 }
 
 

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15950&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Mon Nov 22 14:18:24 2010
@@ -40,6 +40,7 @@
 #include "scribusapi.h"
 #include "colormgmt/sccolormgmtengine.h"
 #include "documentinformation.h"
+#include "indexmanager.h"
 #include "observable.h"
 #include "page.h"
 #include "pageitem.h"
@@ -223,6 +224,9 @@
 	void setSections(DocumentSectionMap dsm) { docPrefsData.docSectionMap=dsm; }
 	const QMap<QString, int> & usedFonts() { return UsedFonts; }
 
+	QMap<QString, QMap<QString, QList<int> > >& indexMap() { return docPrefsData.indexPrefs.indexMap; }
+	IndexManager* indexManager() { return m_indexManager; }
+
 	const ApplicationPrefs& prefsData() { return docPrefsData; }
 	void setNewPrefs(const ApplicationPrefs& prefsData, const ApplicationPrefs& oldPrefsData, bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins);
 
@@ -1038,6 +1042,7 @@
 	ScribusView* m_View;
 	ScGuardedObject<ScribusDoc> m_guardedObject;
 	Serializer *m_serializer;
+	IndexManager* m_indexManager;
 	
 public: // Public attributes
 	bool is12doc; //public for now, it will be removed later




More information about the scribus-commit mailing list