r24269 by jghali - Fix new styles not appearing in combos and style manager after copying text from another doc

scribus-commit scribus-commit at lists.scribus.net
Sat Nov 21 17:20:12 UTC 2020


Author: jghali
Date: Sat Nov 21 17:20:12 2020
New Revision: 24269

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24269
Log:
Fix new styles not appearing in combos and style manager after copying text from another doc

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24269&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sat Nov 21 17:20:12 2020
@@ -4626,16 +4626,6 @@
 			m_undoManager->setUndoEnabled(false);
 			QString buffer  = ScMimeData::clipboardScribusElem();
 			slotElemRead(buffer, 0, 0, false, true, doc, view);
-			// update style lists:
-			m_styleManager->setDoc(doc);
-			propertiesPalette->unsetDoc();
-			propertiesPalette->setDoc(doc);
-			contentPalette->unsetDoc();
-			contentPalette->setDoc(doc);
-			marksManager->setDoc(doc);
-			nsEditor->setDoc(doc);
-			symbolPalette->unsetDoc();
-			symbolPalette->setDoc(doc);
 
 			doc->SnapGrid = savedAlignGrid;
 			doc->SnapGuides = savedAlignGuides;
@@ -4683,8 +4673,6 @@
 			}
 			currItem->itemText.insertObject(fIndex);
 			doc->m_Selection->delaySignalsOff();
-			inlinePalette->unsetDoc();
-			inlinePalette->setDoc(doc);
 		}
 		else if (ScMimeData::clipboardHasKnownData())
 		{
@@ -4707,15 +4695,6 @@
 				double y = (view->contentsY() / view->scale()) + ((view->visibleHeight() / 2.0) / view->scale()) - (retObj->height() / 2.0);
 				retObj->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
 				retObj->setXYPos(x, y, true);
-				m_styleManager->setDoc(doc);
-				propertiesPalette->unsetDoc();
-				propertiesPalette->setDoc(doc);
-				contentPalette->unsetDoc();
-				contentPalette->setDoc(doc);
-				marksManager->setDoc(doc);
-				nsEditor->setDoc(doc);
-				symbolPalette->unsetDoc();
-				symbolPalette->setDoc(doc);
 				doc->SnapGrid = savedAlignGrid;
 				doc->SnapGuides = savedAlignGuides;
 				doc->SnapElement = savedAlignElement;
@@ -4775,76 +4754,76 @@
 			selItem->asTable()->update();
 		else
 			currItem->update();
-		view->DrawNew();
-	}
-	else
-	{
-		if (ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment() || internalCopy)
-		{
-			view->deselectItems(true);
-			int docItemCount = doc->Items->count();
-			bool savedAlignGrid = doc->SnapGrid;
-			bool savedAlignGuides = doc->SnapGuides;
-			bool savedAlignElement = doc->SnapElement;
-			doc->SnapGrid = false;
-			doc->SnapGuides = false;
-			doc->SnapElement = false;
-			if (internalCopy)
-				slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
-			else
-			{
-				QString buffer  = ScMimeData::clipboardScribusElem();
-				slotElemRead(buffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
-			}
-			// update style lists:
-			m_styleManager->setDoc(doc);
-			propertiesPalette->unsetDoc();
-			propertiesPalette->setDoc(doc);
-			contentPalette->unsetDoc();
-			contentPalette->setDoc(doc);
-			marksManager->setDoc(doc);
-			nsEditor->setDoc(doc);
-			symbolPalette->unsetDoc();
-			symbolPalette->setDoc(doc);
-			inlinePalette->unsetDoc();
-			inlinePalette->setDoc(doc);
-
-			doc->SnapGrid = savedAlignGrid;
-			doc->SnapGuides = savedAlignGuides;
-			doc->SnapElement = savedAlignElement;
-			doc->m_Selection->delaySignalsOn();
-			for (int i = docItemCount; i < doc->Items->count(); ++i)
-			{
-				PageItem* currItem = doc->Items->at(i);
-				if (currItem->isBookmark)
-					AddBookMark(currItem);
-				doc->m_Selection->addItem(currItem);
-			}
-			doc->m_Selection->delaySignalsOff();
-			if (doc->m_Selection->count() > 1)
-				doc->m_Selection->setGroupRect();
-		}
-		else if (ScMimeData::clipboardHasKnownData())
-		{
-			QString ext = ScMimeData::clipboardKnownDataExt();
-			QByteArray bitsBits = ScMimeData::clipboardKnownDataData();
-			double x0 = (view->contentsX() / view->scale()) + ((view->visibleWidth() / 2.0) / view->scale());
-			double y0 = (view->contentsY() / view->scale()) + ((view->visibleHeight() / 2.0) / view->scale());
-			PageItem *retObj = getVectorFileFromData(doc, bitsBits, ext, x0, y0);
-			if (retObj != nullptr)
-			{
-				double x = (view->contentsX() / view->scale()) + ((view->visibleWidth() / 2.0) / view->scale()) - (retObj->width() / 2.0);
-				double y = (view->contentsY() / view->scale()) + ((view->visibleHeight() / 2.0) / view->scale()) - (retObj->height() / 2.0);
-				retObj->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
-				retObj->setXYPos(x, y, true);
-			}
-		}
-		view->DrawNew();
+	}
+	else if (ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment() || internalCopy)
+	{
+		view->deselectItems(true);
+		int docItemCount = doc->Items->count();
+		bool savedAlignGrid = doc->SnapGrid;
+		bool savedAlignGuides = doc->SnapGuides;
+		bool savedAlignElement = doc->SnapElement;
+		doc->SnapGrid = false;
+		doc->SnapGuides = false;
+		doc->SnapElement = false;
+		if (internalCopy)
+			slotElemRead(internalCopyBuffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+		else
+		{
+			QString buffer  = ScMimeData::clipboardScribusElem();
+			slotElemRead(buffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
+		}
+
+		doc->SnapGrid = savedAlignGrid;
+		doc->SnapGuides = savedAlignGuides;
+		doc->SnapElement = savedAlignElement;
+		doc->m_Selection->delaySignalsOn();
+		for (int i = docItemCount; i < doc->Items->count(); ++i)
+		{
+			PageItem* currItem = doc->Items->at(i);
+			if (currItem->isBookmark)
+				AddBookMark(currItem);
+			doc->m_Selection->addItem(currItem);
+		}
+		doc->m_Selection->delaySignalsOff();
+		if (doc->m_Selection->count() > 1)
+			doc->m_Selection->setGroupRect();
+	}
+	else if (ScMimeData::clipboardHasKnownData())
+	{
+		QString ext = ScMimeData::clipboardKnownDataExt();
+		QByteArray bitsBits = ScMimeData::clipboardKnownDataData();
+		double x0 = (view->contentsX() / view->scale()) + ((view->visibleWidth() / 2.0) / view->scale());
+		double y0 = (view->contentsY() / view->scale()) + ((view->visibleHeight() / 2.0) / view->scale());
+		PageItem *retObj = getVectorFileFromData(doc, bitsBits, ext, x0, y0);
+		if (retObj != nullptr)
+		{
+			double x = (view->contentsX() / view->scale()) + ((view->visibleWidth() / 2.0) / view->scale()) - (retObj->width() / 2.0);
+			double y = (view->contentsY() / view->scale()) + ((view->visibleHeight() / 2.0) / view->scale()) - (retObj->height() / 2.0);
+			retObj->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
+			retObj->setXYPos(x, y, true);
+		}
 	}
 	if (activeTransaction)
 		activeTransaction.commit();
 	if (doc->notesChanged())
 		doc->notesFramesUpdate();
+	
+	// update style lists:
+	requestUpdate(reqColorsUpdate | reqArrowStylesUpdate | reqLineStylesUpdate | reqTextStylesUpdate);
+
+	m_styleManager->setDoc(doc);
+	propertiesPalette->unsetDoc();
+	propertiesPalette->setDoc(doc);
+	contentPalette->unsetDoc();
+	contentPalette->setDoc(doc);
+	marksManager->setDoc(doc);
+	nsEditor->setDoc(doc);
+	symbolPalette->unsetDoc();
+	symbolPalette->setDoc(doc);
+	inlinePalette->unsetDoc();
+	inlinePalette->setDoc(doc);
+
+	view->DrawNew();
 	slotDocCh(false);
 }
 




More information about the scribus-commit mailing list