r13853 by jghali - #8335, page import blocks scribus : improve page import speed when undo is enabled, not a complete fix, page import is still dead slow in that case
scribus-commit
scribus-commit at lists.scribus.net
Wed Aug 26 05:36:56 CEST 2009
Revision: 13853
Author: jghali
Date: 2009-08-13T07:00:25.974571Z
Commit message: #8335, page import blocks scribus : improve page import speed when undo is enabled, not a complete fix, page import is still dead slow in that case
Changeset:
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
Diffs:
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 13852)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 13853)
@@ -16,7 +16,7 @@
#include "scribusview.h"
#include "sctextstream.h"
#include "sccolorengine.h"
-
+#include "undomanager.h"
#include "units.h"
#include "util.h"
#include "util_color.h"
@@ -2034,6 +2034,7 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(offsX, offsY);
currItem->Pfile = Relative2Path(obj->attribute("PFILE"), baseDir);
@@ -2102,6 +2103,7 @@
doc->loadPict(currItem->Pfile, currItem, true);
}
}
+ UndoManager::instance()->setUndoEnabled(true);
break;
// OBSOLETE CR 2005-02-06
case PageItem::ItemType3:
@@ -2116,6 +2118,7 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
if ((obj->attribute("ANNOTATION", "0").toInt()) && (static_cast<bool>(obj->attribute("ANICON", "0").toInt())))
{
currItem->setImageXYScale(scx, scy);
@@ -2136,12 +2139,14 @@
currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
}
//currItem->convertTo(pt);
+ UndoManager::instance()->setUndoEnabled(true);
break;
case PageItem::TextFrame:
z = doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor, true);
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
if ((obj->attribute("ANNOTATION", "0").toInt()) && (static_cast<bool>(obj->attribute("ANICON", "0").toInt())))
{
currItem->setImageXYScale(scx, scy);
@@ -2161,7 +2166,8 @@
currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
}
- //currItem->convertTo(pt);
+ //currItem->convertTo(pt);
+ UndoManager::instance()->setUndoEnabled(true);
break;
case PageItem::Line:
z = doc->itemAdd(PageItem::Line, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor2, true);
@@ -2186,6 +2192,8 @@
assert(false);
break;
}
+
+ UndoManager::instance()->setUndoEnabled(false);
currItem->FrameType = obj->attribute("FRTYPE", "0").toInt();
int startArrowIndex = obj->attribute("startArrowIndex", "0").toInt();
if ((startArrowIndex < 0) || (startArrowIndex > static_cast<int>(doc->arrowStyles.size())))
@@ -2534,6 +2542,7 @@
}
//currItem->setRedrawBounding();
//currItem->OwnPage = view->OnPage(currItem);
+ UndoManager::instance()->setUndoEnabled(true);
return currItem;
}
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 13852)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 13853)
@@ -22,6 +22,7 @@
#include "scribusview.h"
#include "sctextstream.h"
#include "scxmlstreamreader.h"
+#include "undomanager.h"
#include "units.h"
#include "util.h"
#include "util_math.h"
@@ -2202,6 +2203,7 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX"), attrs.valueAsDouble("LOCALY"));
// if (!currItem->asLatexFrame())
@@ -2280,6 +2282,7 @@
currItem->ScaleType = attrs.valueAsInt("SCALETYPE", 1);
currItem->AspectRatio = attrs.valueAsInt("RATIO", 0);
currItem->setLineWidth(pw);
+ UndoManager::instance()->setUndoEnabled(true);
break;
// OBSOLETE CR 2005-02-06
case PageItem::ItemType3:
@@ -2294,6 +2297,7 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
if (attrs.valueAsInt("ANNOTATION", 0) && attrs.valueAsBool("ANICON", false))
{
currItem->setImageXYScale(scx, scy);
@@ -2314,12 +2318,14 @@
currItem->AspectRatio = attrs.valueAsInt("RATIO", 0);
}
//currItem->convertTo(pt);
+ UndoManager::instance()->setUndoEnabled(true);
break;
case PageItem::TextFrame:
z = doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor, true);
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
if ((attrs.valueAsInt("ANNOTATION", 0)) && (attrs.valueAsBool("ANICON", false)))
{
currItem->setImageXYScale(scx, scy);
@@ -2339,7 +2345,8 @@
currItem->ScaleType = attrs.valueAsInt("SCALETYPE", 1);
currItem->AspectRatio = attrs.valueAsInt("RATIO", 0);
}
- //currItem->convertTo(pt);
+ //currItem->convertTo(pt);
+ UndoManager::instance()->setUndoEnabled(true);
break;
case PageItem::Line:
z = doc->itemAdd(PageItem::Line, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor2, true);
@@ -2363,6 +2370,8 @@
Q_ASSERT(false);
break;
}
+
+ UndoManager::instance()->setUndoEnabled(false);
currItem->FrameType = attrs.valueAsInt("FRTYPE", 0);
int startArrowIndex = attrs.valueAsInt("startArrowIndex", 0);
if ((startArrowIndex < 0) || (startArrowIndex > static_cast<int>(doc->arrowStyles.size())))
@@ -2726,6 +2735,7 @@
}
//currItem->setRedrawBounding();
//currItem->OwnPage = view->OnPage(currItem);
+ UndoManager::instance()->setUndoEnabled(true);
return currItem;
}
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 13852)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 13853)
@@ -22,6 +22,7 @@
#include "scribusview.h"
#include "sctextstream.h"
#include "scxmlstreamreader.h"
+#include "undomanager.h"
#include "units.h"
#include "util.h"
#include "util_math.h"
@@ -2267,6 +2268,7 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX"), attrs.valueAsDouble("LOCALY"));
if (!currItem->asLatexFrame())
@@ -2331,6 +2333,7 @@
currItem->ScaleType = attrs.valueAsInt("SCALETYPE", 1);
currItem->AspectRatio = attrs.valueAsInt("RATIO", 0);
currItem->setLineWidth(pw);
+ UndoManager::instance()->setUndoEnabled(true);
break;
// OBSOLETE CR 2005-02-06
case PageItem::ItemType3:
@@ -2345,6 +2348,7 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
if (attrs.valueAsInt("ANNOTATION", 0) && attrs.valueAsBool("ANICON", false))
{
currItem->setImageXYScale(scx, scy);
@@ -2365,12 +2369,14 @@
currItem->AspectRatio = attrs.valueAsInt("RATIO", 0);
}
//currItem->convertTo(pt);
+ UndoManager::instance()->setUndoEnabled(true);
break;
case PageItem::TextFrame:
z = doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor, true);
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ UndoManager::instance()->setUndoEnabled(false);
if ((attrs.valueAsInt("ANNOTATION", 0)) && (attrs.valueAsBool("ANICON", false)))
{
currItem->setImageXYScale(scx, scy);
@@ -2390,7 +2396,8 @@
currItem->ScaleType = attrs.valueAsInt("SCALETYPE", 1);
currItem->AspectRatio = attrs.valueAsInt("RATIO", 0);
}
- //currItem->convertTo(pt);
+ //currItem->convertTo(pt);
+ UndoManager::instance()->setUndoEnabled(true);
break;
case PageItem::Line:
z = doc->itemAdd(PageItem::Line, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor2, true);
@@ -2414,6 +2421,8 @@
Q_ASSERT(false);
break;
}
+
+ UndoManager::instance()->setUndoEnabled(false);
currItem->FrameType = attrs.valueAsInt("FRTYPE", 0);
int startArrowIndex = attrs.valueAsInt("startArrowIndex", 0);
if ((startArrowIndex < 0) || (startArrowIndex > static_cast<int>(doc->arrowStyles.size())))
@@ -2801,6 +2810,7 @@
}
//currItem->setRedrawBounding();
//currItem->OwnPage = view->OnPage(currItem);
+ UndoManager::instance()->setUndoEnabled(true);
return currItem;
}
More information about the scribus-commit
mailing list