r14370 by jghali - improve undo speed when outline palette is visible

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 29 20:50:40 CET 2009


Revision: 14370
Author: jghali
Date: 2009-11-29T10:09:16.460711Z
Commit message: improve undo speed when outline palette is visible

Changeset: 
M  /trunk/Scribus/scribus/scribusdoc.cpp

Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 14369)
+++ scribus/scribusdoc.cpp	(revision 14370)
@@ -101,6 +101,11 @@
 public:
 	DocUpdater(ScribusDoc* d) : doc(d), m_updateEnabled(0), m_docChangeNeeded(false) {}
 
+	bool inUpdateSession() const
+	{ 
+		return m_updateEnabled > 0;
+	}
+
 	void beginUpdate(void)
 	{ 
 		if (m_updateEnabled == 0)
@@ -1233,12 +1238,14 @@
 
 void ScribusDoc::undoRedoBegin()
 {
+	m_docUpdater->beginUpdate();
 	m_Selection->delaySignalsOn();
 }
 
 void ScribusDoc::undoRedoDone()
 {
 	m_Selection->delaySignalsOff();
+	m_docUpdater->endUpdate();
 }
 
 void ScribusDoc::restore(UndoState* state, bool isUndo)
@@ -9317,7 +9324,13 @@
 void ScribusDoc::changed()
 {
 	setModified(true);
-	emit docChanged();
+	// Do not emit docChanged signal() unnecessarily
+	// Processing of that signal is slowwwwwww and
+	// DocUpdater will trigger it when necessary
+	if (!m_docUpdater->inUpdateSession())
+	{
+		emit docChanged();
+	}
 }
 
 void ScribusDoc::invalidateRegion(QRectF region)




More information about the scribus-commit mailing list