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

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


Revision: 14369
Author: jghali
Date: 2009-11-29T10:06:50.436064Z
Commit message: improve undo speed when outline palette is visible

Changeset: 
M  /branches/Version135/Scribus/scribus/scribusdoc.cpp

Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 14368)
+++ scribus/scribusdoc.cpp	(revision 14369)
@@ -98,6 +98,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)
@@ -1284,12 +1289,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)
@@ -8848,7 +8855,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