r17013 by fschmid - Fixed Bug 9560: "[patch] Preflight Verifier - making text based error items put cursor in error place"

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 23 12:30:02 UTC 2011


Author: fschmid
Date: Wed Nov 23 12:30:02 2011
New Revision: 17013

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17013
Log:
Fixed Bug 9560: "[patch] Preflight Verifier - making text based error items put cursor in error place"

Modified:
    trunk/Scribus/scribus/documentchecker.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/ui/checkDocument.cpp
    trunk/Scribus/scribus/ui/checkDocument.h

Modified: trunk/Scribus/scribus/documentchecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17013&path=/trunk/Scribus/scribus/documentchecker.cpp
==============================================================================
--- trunk/Scribus/scribus/documentchecker.cpp (original)
+++ trunk/Scribus/scribus/documentchecker.cpp Wed Nov 23 12:30:02 2011
@@ -334,7 +334,7 @@
 							}
 							chr = chstr[0].unicode();
 							if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
-								itemError.insert(MissingGlyph, 0);
+								itemError.insert(MissingGlyph, e);
 						}
 						for (int t1 = 0; t1 < currItem->itemText.defaultStyle().tabValues().count(); t1++)
 						{
@@ -348,7 +348,7 @@
 							}
 							chr = chstr[0].unicode();
 							if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
-								itemError.insert(MissingGlyph, 0);
+								itemError.insert(MissingGlyph, e);
 						}
 						continue;
 					}
@@ -357,12 +357,12 @@
 						for (int numco = 0x30; numco < 0x3A; ++numco)
 						{
 							if ((!currItem->itemText.charStyle(e).font().canRender(numco)) && (checkerSettings.checkGlyphs))
-								itemError.insert(MissingGlyph, 0);
+								itemError.insert(MissingGlyph, e);
 						}
 						continue;
 					}
 					if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
-						itemError.insert(MissingGlyph, 0);
+						itemError.insert(MissingGlyph, e);
 				}
 	#endif
 			}
@@ -625,7 +625,7 @@
 							}
 							chr = chstr[0].unicode();
 							if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
-								itemError.insert(MissingGlyph, 0);
+								itemError.insert(MissingGlyph, e);
 						}
 						for (int t1 = 0; t1 < currItem->itemText.defaultStyle().tabValues().count(); t1++)
 						{
@@ -639,7 +639,7 @@
 							}
 							chr = chstr[0].unicode();
 							if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
-								itemError.insert(MissingGlyph, 0);
+								itemError.insert(MissingGlyph, e);
 						}
 						continue;
 					}
@@ -648,12 +648,12 @@
 						for (uint numco = 0x30; numco < 0x3A; ++numco)
 						{
 							if ((!currItem->itemText.charStyle(e).font().canRender(numco)) && (checkerSettings.checkGlyphs))
-								itemError.insert(MissingGlyph, 0);
+								itemError.insert(MissingGlyph, e);
 						}
 						continue;
 					}
 					if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
-						itemError.insert(MissingGlyph, 0);
+						itemError.insert(MissingGlyph, e);
 				}
 	#endif
 			}

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17013&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Nov 23 12:30:02 2011
@@ -583,6 +583,7 @@
 
 //	connect(docCheckerPalette, SIGNAL(selectElement(int, int)), this, SLOT(selectItemsFromOutlines(int, int)));
 	connect(docCheckerPalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool)));
+	connect(docCheckerPalette, SIGNAL(selectElement(PageItem *, bool, int)), this, SLOT(selectItemFromOutlines(PageItem *, bool, int)));
 	connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int)));
 	connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(manageMasterPages(QString)));
 //	connect(outlinePalette, SIGNAL(selectElement(int, int, bool)), this, SLOT(selectItemsFromOutlines(int, int, bool)));
@@ -7518,6 +7519,21 @@
 	}
 }
 
+void ScribusMainWindow::selectItemFromOutlines(PageItem *ite, bool single, int cPos)
+{
+	selectItemsFromOutlines(ite, single);
+	if (doc->m_Selection->count() != 0)
+	{
+		PageItem *currItem = doc->m_Selection->itemAt(0);
+		if (currItem->isTextFrame())
+		{
+			view->requestMode(modeEdit);
+			currItem->itemText.setCursorPosition(cPos);
+			currItem->update();
+		}
+	}
+}
+
 void ScribusMainWindow::selectPagesFromOutlines(int Page)
 {
 	if (HaveDoc && doc->appMode == modeEditClip)

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17013&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Wed Nov 23 12:30:02 2011
@@ -454,6 +454,7 @@
 	void setAlignmentValue(int a);
 	void editItemsFromOutlines(PageItem *ite);
 	void selectItemsFromOutlines(PageItem *ite, bool single = false);
+	void selectItemFromOutlines(PageItem *ite, bool single, int cPos);
 	void selectPagesFromOutlines(int ScPage);
 	void doPrintPreview();
 	void printPreview();

Modified: trunk/Scribus/scribus/ui/checkDocument.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17013&path=/trunk/Scribus/scribus/ui/checkDocument.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/checkDocument.cpp (original)
+++ trunk/Scribus/scribus/ui/checkDocument.cpp Wed Nov 23 12:30:02 2011
@@ -83,6 +83,7 @@
 	checkMode = checkNULL;
 	languageChange();
 	itemMap.clear();
+	posMap.clear();
 	pageMap.clear();
 	masterPageMap.clear();
 	masterPageItemMap.clear();
@@ -109,7 +110,10 @@
 	if (itemMap.contains(ite))
 	{
 		ScCore->primaryMainWindow()->closeActiveWindowMasterPageEditor();
-		emit selectElementByItem(itemMap[ite], true);
+		if (itemMap[ite]->isTextFrame())
+			emit selectElement(itemMap[ite], true, posMap[ite]);
+		else
+			emit selectElementByItem(itemMap[ite], true);
 		return;
 	}
 	if (pageMap.contains(ite))
@@ -127,7 +131,10 @@
 	{
 		if (!m_Doc->masterPageMode())
 			emit selectMasterPage(masterPageItemMap[ite]->OnMasterPage);
-		emit selectElementByItem(masterPageItemMap[ite], true);
+		if (itemMap[ite]->isTextFrame())
+			emit selectElement(masterPageItemMap[ite], true, posMap[ite]);
+		else
+			emit selectElementByItem(masterPageItemMap[ite], true);
 		return;
 	}
 }
@@ -155,6 +162,7 @@
 	reportDisplay->clear();
 	reportDisplay->setSortingEnabled(false);
 	itemMap.clear();
+	posMap.clear();
 	pageMap.clear();
 	masterPageMap.clear();
 	masterPageItemMap.clear();
@@ -401,6 +409,7 @@
 					{
 						it3 = masterItemErrorsIt.value().begin();
 						buildItem(object, it3.key(), masterItemErrorsIt.key());
+						posMap.insert(object, it3.value());
 					}
 					else
 					{
@@ -408,6 +417,7 @@
 						{
 							QTreeWidgetItem * errorText = new QTreeWidgetItem( object, 0 );
 							buildItem(errorText, it3.key(), masterItemErrorsIt.key());
+							posMap.insert(object, it3.value());
 						}
 						object->setExpanded( true );
 					}
@@ -476,6 +486,7 @@
 					{
 						it3 = docItemErrorsIt.value().begin();
 						buildItem(object, it3.key(), docItemErrorsIt.key());
+						posMap.insert(object, it3.value());
 					}
 					else
 					{
@@ -483,6 +494,7 @@
 						{
 							QTreeWidgetItem * errorText = new QTreeWidgetItem( object);
 							buildItem(errorText, it3.key(), docItemErrorsIt.key());
+							posMap.insert(object, it3.value());
 						}
 						object->setExpanded( true );
 					}
@@ -542,6 +554,7 @@
 					{
 						it3 = freeItemsErrorsIt.value().begin();
 						buildItem(object, it3.key(), freeItemsErrorsIt.key());
+						posMap.insert(object, it3.value());
 					}
 					else
 					{
@@ -549,6 +562,7 @@
 						{
 							QTreeWidgetItem * errorText = new QTreeWidgetItem( object);
 							buildItem(errorText, it3.key(), freeItemsErrorsIt.key());
+							posMap.insert(object, it3.value());
 						}
 						object->setExpanded( true );
 					}

Modified: trunk/Scribus/scribus/ui/checkDocument.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17013&path=/trunk/Scribus/scribus/ui/checkDocument.h
==============================================================================
--- trunk/Scribus/scribus/ui/checkDocument.h (original)
+++ trunk/Scribus/scribus/ui/checkDocument.h Wed Nov 23 12:30:02 2011
@@ -79,7 +79,7 @@
 signals:
 	//void rescan();
 	//! \brief Signal emitted when user selects any page item in error list.
-//	void selectElement(int, int);
+	void selectElement(PageItem *, bool, int);
 	void selectElementByItem(PageItem *, bool);
 	//! \brief Signal emitted when user selects any page in error list.
 	void selectPage(int);
@@ -108,6 +108,8 @@
 	QMap<QTreeWidgetItem*, QString> masterPageMap;
 	//! \brief Mappping MP Item - MP item nr.
 	QMap<QTreeWidgetItem*, PageItem*> masterPageItemMap;
+	//! \brief Mappping Page Item - cursor position in item
+	QMap<QTreeWidgetItem*, int> posMap;
 
 	//! \brief a reference to the current document
 	ScribusDoc* m_Doc;




More information about the scribus-commit mailing list