r14681 by fschmid - Fileimport Plugins: the readThumbnail() function doesn't need a ScribusView anymore. Thus this function is now thread-safe (needed to make it work with the Picture Browser).
scribus-commit
scribus-commit at lists.scribus.net
Thu Feb 11 13:21:48 CET 2010
Revision: 14681
Author: fschmid
Date: 2010-02-11T12:12:33.444604Z
Commit message: Fileimport Plugins: the readThumbnail() function doesn't need a ScribusView anymore. Thus this function is now thread-safe (needed to make it work with the Picture Browser).
Changeset:
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/pageitem.h
M /trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
M /trunk/Scribus/scribus/pageitem_polygon.cpp
M /trunk/Scribus/scribus/plugins/import/cvg/importcvgplugin.cpp
M /trunk/Scribus/scribus/pageitem_latexframe.cpp
M /trunk/Scribus/scribus/pageitem_line.h
M /trunk/Scribus/scribus/pageitem_imageframe.cpp
M /trunk/Scribus/scribus/pageitem_polyline.h
M /trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
M /trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
M /trunk/Scribus/scribus/pageitem_textframe.h
M /trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
M /trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
M /trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp
M /trunk/Scribus/scribus/pageitem_pathtext.h
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/plugins/import/drw/importdrwplugin.cpp
M /trunk/Scribus/scribus/plugins/import/wpg/importwpgplugin.cpp
M /trunk/Scribus/scribus/plugins/import/xfig/importxfigplugin.cpp
M /trunk/Scribus/scribus/pageitem_line.cpp
M /trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
M /trunk/Scribus/scribus/pageitem_polyline.cpp
M /trunk/Scribus/scribus/pageitem_polygon.h
M /trunk/Scribus/scribus/pageitem_latexframe.h
M /trunk/Scribus/scribus/pageitem_textframe.cpp
M /trunk/Scribus/scribus/canvas.cpp
M /trunk/Scribus/scribus/pageitem_pathtext.cpp
M /trunk/Scribus/scribus/pageitem_imageframe.h
M /trunk/Scribus/scribus/plugins/import/cgm/importcgmplugin.cpp
M /trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
M /trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
Diffs:
Index: scribus/pageitem_polyline.h
===================================================================
--- scribus/pageitem_polyline.h (revision 14680)
+++ scribus/pageitem_polyline.h (revision 14681)
@@ -46,7 +46,7 @@
virtual QString infoDescription();
protected:
- virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+ virtual void DrawObj_Item(ScPainter *p, QRectF e);
};
Index: scribus/pageitem_imageframe.h
===================================================================
--- scribus/pageitem_imageframe.h (revision 14680)
+++ scribus/pageitem_imageframe.h (revision 14681)
@@ -52,7 +52,7 @@
virtual QString infoDescription();
protected:
- virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+ virtual void DrawObj_Item(ScPainter *p, QRectF e);
};
Index: scribus/pageitem_line.cpp
===================================================================
--- scribus/pageitem_line.cpp (revision 14680)
+++ scribus/pageitem_line.cpp (revision 14681)
@@ -48,7 +48,7 @@
{
}
-void PageItem_Line::DrawObj_Item(ScPainter *p, QRectF /*e*/, double /*sc*/)
+void PageItem_Line::DrawObj_Item(ScPainter *p, QRectF /*e*/)
{
if (!m_Doc->RePos)
{
Index: scribus/pageitem_line.h
===================================================================
--- scribus/pageitem_line.h (revision 14680)
+++ scribus/pageitem_line.h (revision 14681)
@@ -46,7 +46,7 @@
virtual QString infoDescription();
protected:
- virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+ virtual void DrawObj_Item(ScPainter *p, QRectF e);
};
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14680)
+++ scribus/scribusdoc.cpp (revision 14681)
@@ -598,7 +598,8 @@
}
if (docHyphenator)
delete docHyphenator;
- delete m_serializer;
+ if (m_serializer)
+ delete m_serializer;
ScCore->fileWatcher->start();
}
@@ -669,11 +670,16 @@
void ScribusDoc::setGUI(bool hasgui, ScribusMainWindow* mw, ScribusView* view)
{
m_hasGUI = hasgui;
- m_ScMW=mw;
+ m_ScMW = mw;
//FIXME: stop using m_View
- m_View=view;
- docHyphenator=new Hyphenator(m_ScMW, this);
- Q_CHECK_PTR(docHyphenator);
+ m_View = view;
+ if (m_hasGUI)
+ {
+ docHyphenator = new Hyphenator(m_ScMW, this);
+ Q_CHECK_PTR(docHyphenator);
+ }
+ else
+ docHyphenator = NULL;
}
@@ -4112,16 +4118,22 @@
{
if (!reload)
{
- QFileInfo fi(pageItem->Pfile);
- ScCore->fileWatcher->addDir(fi.absolutePath());
+ if (m_hasGUI)
+ {
+ QFileInfo fi(pageItem->Pfile);
+ ScCore->fileWatcher->addDir(fi.absolutePath());
+ }
}
return false;
}
if (!reload)
{
- QFileInfo fi(pageItem->Pfile);
- ScCore->fileWatcher->addDir(fi.absolutePath());
- ScCore->fileWatcher->addFile(pageItem->Pfile);
+ if (m_hasGUI)
+ {
+ QFileInfo fi(pageItem->Pfile);
+ ScCore->fileWatcher->addDir(fi.absolutePath());
+ ScCore->fileWatcher->addFile(pageItem->Pfile);
+ }
}
if (!isLoading())
{
@@ -6770,9 +6782,12 @@
{
if (ScCore->usingGUI())
{
- connect(this, SIGNAL(docChanged()), m_ScMW, SLOT(slotDocCh()));
- connect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel(int)));
- connect(autoSaveTimer, SIGNAL(timeout()), WinHan, SLOT(slotAutoSave()));
+ if (m_hasGUI)
+ {
+ connect(this, SIGNAL(docChanged()), m_ScMW, SLOT(slotDocCh()));
+ connect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel(int)));
+ connect(autoSaveTimer, SIGNAL(timeout()), WinHan, SLOT(slotAutoSave()));
+ }
// connect(this, SIGNAL(refreshItem(PageItem*)), view(), SLOT(RefreshItem(PageItem*)));
// connect(this, SIGNAL(updateContents()), view(), SLOT(slotUpdateContents()));
// connect(this, SIGNAL(updateContents(const QRect&)), view(), SLOT(slotUpdateContents(const QRect&)));
@@ -9968,7 +9983,7 @@
/* if (!loading)
emit UpdtObj(currentPage->pageNr(), b->ItemNr); */
//FIXME: stop using m_View
- QRect oldR(currItem->getRedrawBounding(m_View->scale()));
+// QRect oldR(currItem->getRedrawBounding(m_View->scale()));
setRedrawBounding(currItem);
// QRect newR(currItem->getRedrawBounding(m_View->scale()));
// if ((!m_View->operItemMoving) && (!currItem->Sizing))
Index: scribus/pageitem_pathtext.h
===================================================================
--- scribus/pageitem_pathtext.h (revision 14680)
+++ scribus/pageitem_pathtext.h (revision 14681)
@@ -49,7 +49,7 @@
virtual QString infoDescription();
protected:
- virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+ virtual void DrawObj_Item(ScPainter *p, QRectF e);
};
Index: scribus/pageitem_polyline.cpp
===================================================================
--- scribus/pageitem_polyline.cpp (revision 14680)
+++ scribus/pageitem_polyline.cpp (revision 14681)
@@ -50,7 +50,7 @@
{
}
-void PageItem_PolyLine::DrawObj_Item(ScPainter *p, QRectF /*e*/, double /*sc*/)
+void PageItem_PolyLine::DrawObj_Item(ScPainter *p, QRectF /*e*/)
{
if (!m_Doc->RePos && PoLine.size()>=4)
{
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp (revision 14680)
+++ scribus/canvas.cpp (revision 14681)
@@ -1434,7 +1434,10 @@
currItem->savedOwnPage = currItem->OwnPage;
currItem->OwnPage = page->pageNr();
if ((cullingArea.intersects(currItem->getBoundingRect().adjusted(0.0, 0.0, 1.0, 1.0))) && (m_doc->guidesSettings.layerMarkersShown) && (m_doc->layerCount() > 1))
+ {
currItem->DrawObj(painter, cullingArea);
+ currItem->DrawObj_Decoration(painter);
+ }
FPointArray cl = currItem->PoLine.copy();
QTransform mm;
mm.translate(currItem->xPos(), currItem->yPos());
@@ -1464,6 +1467,7 @@
if (m_viewMode.forceRedraw)
currItem->invalidateLayout();
currItem->DrawObj(painter, cullingArea);
+ currItem->DrawObj_Decoration(painter);
}
// else
// qDebug() << "skip masterpage item (move/resizeEdit/selected)" << m_viewMode.operItemMoving << currItem->isSelected();
@@ -1495,7 +1499,10 @@
cite->BoundingY = OldBY - Mp->yOffset() + page->yOffset();
}
if ((cullingArea.intersects(cite->getBoundingRect().adjusted(0.0, 0.0, 1.0, 1.0))) && (m_doc->guidesSettings.layerMarkersShown) && (m_doc->layerCount() > 1))
+ {
cite->DrawObj(painter, cullingArea);
+ cite->DrawObj_Decoration(painter);
+ }
cite->OwnPage = cite->savedOwnPage;
if (!currItem->ChangedMasterItem)
{
@@ -1649,6 +1656,7 @@
// if (m_viewMode.forceRedraw)
// currItem->invalidateLayout();
currItem->DrawObj(painter, cullingArea);
+ currItem->DrawObj_Decoration(painter);
}
// currItem->Redrawn = true;
if ((currItem->asTextFrame()) && ((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0)))
@@ -1681,7 +1689,10 @@
painter->restore();
PageItem *cite = groupStack2.pop();
if ((cullingArea.intersects(cite->getBoundingRect())) && (((m_doc->guidesSettings.layerMarkersShown) && (m_doc->layerCount() > 1)) || (cite->textFlowUsesContourLine())))
+ {
cite->DrawObj(painter, cullingArea);
+ cite->DrawObj_Decoration(painter);
+ }
groupStack.pop();
if (groupStack.count() == 0)
break;
Index: scribus/pageitem_pathtext.cpp
===================================================================
--- scribus/pageitem_pathtext.cpp (revision 14680)
+++ scribus/pageitem_pathtext.cpp (revision 14681)
@@ -71,7 +71,7 @@
}
-void PageItem_PathText::DrawObj_Item(ScPainter *p, QRectF cullingArea, double sc)
+void PageItem_PathText::DrawObj_Item(ScPainter *p, QRectF cullingArea)
{
itemText.invalidateAll();
firstChar = 0;
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h (revision 14680)
+++ scribus/pageitem.h (revision 14681)
@@ -272,9 +272,10 @@
/** Zeichnet das Item */
void paintObj(QPainter *p);
void DrawObj(ScPainter *p, QRectF e);
- void DrawObj_Pre(ScPainter *p, double &sc);
+ void DrawObj_Pre(ScPainter *p);
virtual void DrawObj_Post(ScPainter *p);
- virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc) = 0;
+ virtual void DrawObj_Decoration(ScPainter *p);
+ virtual void DrawObj_Item(ScPainter *p, QRectF e) = 0;
QImage DrawObj_toImage();
QImage DrawObj_toImage(QList<PageItem*> &emG);
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14680)
+++ scribus/pageitem.cpp (revision 14681)
@@ -736,6 +736,8 @@
{
Width = newWidth;
updateConstants();
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit widthAndHeight(Width, Height);
}
@@ -744,6 +746,8 @@
{
Height = newHeight;
updateConstants();
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit widthAndHeight(Width, Height);
}
@@ -764,6 +768,8 @@
Width = newWidth;
Height = newHeight;
updateConstants();
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit widthAndHeight(Width, Height);
}
@@ -777,6 +783,8 @@
if (dW!=0.0)
Height+=dW;
updateConstants();
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit widthAndHeight(Width, Height);
}
@@ -784,9 +792,9 @@
void PageItem::setRotation(const double newRotation, bool drawingOnly)
{
Rot=newRotation;
- checkChanges();
if (drawingOnly || m_Doc->isLoading())
return;
+ checkChanges();
emit rotation(Rot);
}
@@ -795,6 +803,8 @@
if (dR==0.0)
return;
Rot+=dR;
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit rotation(Rot);
}
@@ -807,6 +817,8 @@
void PageItem::setImageXScale(const double newImageXScale)
{
LocalScX=newImageXScale;
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
}
@@ -814,6 +826,8 @@
void PageItem::setImageYScale(const double newImageYScale)
{
LocalScY=newImageYScale;
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
}
@@ -822,6 +836,8 @@
{
LocalScX=newImageXScale;
LocalScY=newImageYScale;
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
}
@@ -829,6 +845,8 @@
void PageItem::setImageXOffset(const double newImageXOffset)
{
LocalX=newImageXOffset;
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
}
@@ -836,6 +854,8 @@
void PageItem::setImageYOffset(const double newImageYOffset)
{
LocalY=newImageYOffset;
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
}
@@ -844,6 +864,8 @@
{
LocalX=newImageXOffset;
LocalY=newImageYOffset;
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
}
@@ -856,6 +878,8 @@
LocalX+=dX;
if (dY!=0.0)
LocalY+=dY;
+ if (m_Doc->isLoading())
+ return;
checkChanges();
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
}
@@ -1127,37 +1151,30 @@
*/
void PageItem::DrawObj(ScPainter *p, QRectF cullingArea)
{
-// qDebug << "PageItem::DrawObj";
- double sc;
if (!m_Doc->DoDrawing)
- {
-// Tinput = false;
return;
- }
if (cullingArea.isNull())
{
cullingArea = QRectF(QPointF(m_Doc->minCanvasCoordinate.x(), m_Doc->minCanvasCoordinate.y()),
QPointF(m_Doc->maxCanvasCoordinate.x(), m_Doc->maxCanvasCoordinate.y())).toAlignedRect();
}
- DrawObj_Pre(p, sc);
+ DrawObj_Pre(p);
if (m_Doc->layerOutline(LayerID))
{
if ((itemType()==TextFrame || itemType()==ImageFrame || itemType()==PathText || itemType()==Line || itemType()==PolyLine) && (!isGroupControl))
- DrawObj_Item(p, cullingArea, sc);
+ DrawObj_Item(p, cullingArea);
}
else
{
if (!isGroupControl)
- DrawObj_Item(p, cullingArea, sc);
+ DrawObj_Item(p, cullingArea);
}
DrawObj_Post(p);
}
-void PageItem::DrawObj_Pre(ScPainter *p, double &sc)
+void PageItem::DrawObj_Pre(ScPainter *p)
{
- ScribusView* view = m_Doc->view();
- sc = view->scale();
p->save();
if (!isEmbedded)
p->translate(Xpos, Ypos);
@@ -1322,7 +1339,6 @@
void PageItem::DrawObj_Post(ScPainter *p)
{
bool doStroke=true;
- ScribusView* view = m_Doc->view();
if (!isGroupControl)
{
if (m_Doc->layerOutline(LayerID))
@@ -1486,6 +1502,16 @@
p->setBlendModeFill(0);
p->setStrokeMode(ScPainter::Solid);
p->setBlendModeStroke(0);
+ p->restore();
+}
+
+void PageItem::DrawObj_Decoration(ScPainter *p)
+{
+ ScribusView* view = m_Doc->view();
+ p->save();
+ if (!isEmbedded)
+ p->translate(Xpos, Ypos);
+ p->rotate(Rot);
if ((!isEmbedded) && (!m_Doc->RePos))
{
double aestheticFactor(5.0);
@@ -1631,9 +1657,8 @@
p->scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
embedded->Dirty = Dirty;
embedded->invalid = true;
- double sc;
double pws = embedded->m_lineWidth;
- embedded->DrawObj_Pre(p, sc);
+ embedded->DrawObj_Pre(p);
switch(embedded->itemType())
{
case ImageFrame:
@@ -1642,12 +1667,12 @@
case OSGFrame:
case Polygon:
case PathText:
- embedded->DrawObj_Item(p, cullingArea, sc);
+ embedded->DrawObj_Item(p, cullingArea);
break;
case Line:
case PolyLine:
embedded->m_lineWidth = pws * qMin(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
- embedded->DrawObj_Item(p, cullingArea, sc);
+ embedded->DrawObj_Item(p, cullingArea);
break;
default:
break;
@@ -5565,7 +5590,7 @@
}
if (PictureIsAvailable)
{
- if ((m_Doc->view()->m_canvas->usePreviewVisual()))
+ if (m_Doc->view() && (m_Doc->view()->m_canvas->usePreviewVisual()))
{
VisionDefectColor defect;
QColor tmpC;
Index: scribus/pageitem_latexframe.h
===================================================================
--- scribus/pageitem_latexframe.h (revision 14680)
+++ scribus/pageitem_latexframe.h (revision 14681)
@@ -92,7 +92,7 @@
QMap<QString,QString> editorProperties;
protected:
- virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+ virtual void DrawObj_Item(ScPainter *p, QRectF e);
double lastWidth, lastHeight;
QString formulaText;
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp (revision 14680)
+++ scribus/pageitem_textframe.cpp (revision 14681)
@@ -2392,7 +2392,7 @@
}
}
-void PageItem_TextFrame::DrawObj_Item(ScPainter *p, QRectF cullingArea, double sc)
+void PageItem_TextFrame::DrawObj_Item(ScPainter *p, QRectF cullingArea)
{
if(invalid)
layout();
@@ -2678,7 +2678,6 @@
void PageItem_TextFrame::DrawObj_Post(ScPainter *p)
{
- ScribusView* view = m_Doc->view();
if (m_Doc->layerOutline(LayerID))
{
p->setPen(m_Doc->layerMarker(LayerID), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
@@ -2810,6 +2809,13 @@
}
p->setFillMode(ScPainter::Solid);
p->setStrokeMode(ScPainter::Solid);
+ p->restore();
+}
+
+void PageItem_TextFrame::DrawObj_Decoration(ScPainter *p)
+{
+ ScribusView* view = m_Doc->view();
+ p->save();
if ((!isEmbedded) && (!m_Doc->RePos))
{
// added to prevent fat frame outline due to antialiasing and considering you canât pass a cosmetic pen to scpainter - pm
Index: scribus/pageitem_latexframe.cpp
===================================================================
--- scribus/pageitem_latexframe.cpp (revision 14680)
+++ scribus/pageitem_latexframe.cpp (revision 14681)
@@ -118,7 +118,7 @@
imgValid = false;
}
-void PageItem_LatexFrame::DrawObj_Item(ScPainter *p, QRectF e, double sc)
+void PageItem_LatexFrame::DrawObj_Item(ScPainter *p, QRectF e)
{
layout();
if (!imgValid && !err)
@@ -141,7 +141,7 @@
else
{
//Just pass it to ImageFrame
- PageItem_ImageFrame::DrawObj_Item(p, e, sc);
+ PageItem_ImageFrame::DrawObj_Item(p, e);
}
}
Index: scribus/pageitem_imageframe.cpp
===================================================================
--- scribus/pageitem_imageframe.cpp (revision 14680)
+++ scribus/pageitem_imageframe.cpp (revision 14681)
@@ -53,7 +53,7 @@
{
}
-void PageItem_ImageFrame::DrawObj_Item(ScPainter *p, QRectF /*e*/, double sc)
+void PageItem_ImageFrame::DrawObj_Item(ScPainter *p, QRectF /*e*/)
{
if(!m_Doc->RePos)
{
Index: scribus/pageitem_textframe.h
===================================================================
--- scribus/pageitem_textframe.h (revision 14680)
+++ scribus/pageitem_textframe.h (revision 14681)
@@ -78,8 +78,9 @@
#endif
protected:
- virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+ virtual void DrawObj_Item(ScPainter *p, QRectF e);
virtual void DrawObj_Post(ScPainter *p);
+ virtual void DrawObj_Decoration(ScPainter *p);
void drawOverflowMarker(ScPainter *p);
void drawColumnBorders(ScPainter *p);
QRegion availableRegion(QRegion clip);
Index: scribus/plugins/picbrowser/picturebrowser.cpp
===================================================================
--- scribus/plugins/picbrowser/picturebrowser.cpp (revision 14680)
+++ scribus/plugins/picbrowser/picturebrowser.cpp (revision 14681)
@@ -13,6 +13,10 @@
#include "previewimage.h"
#include "loadimage.h"
+#include "fileloader.h"
+#include "loadsaveplugin.h"
+#include "../../plugins/formatidlist.h"
+
#include "prefsfile.h"
#include "prefsmanager.h"
@@ -231,6 +235,13 @@
nameFilters = formatD.split(" ", QString::SkipEmptyParts);
nameFilters.append("*.svg");
+ QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ for (int v = 0; v < vectorFiles.count(); v++)
+ {
+ nameFilters.append("*." + vectorFiles[v]);
+ }
+
+
//filter/search setup
connect ( filterTargetCombobox, SIGNAL ( currentIndexChanged ( int ) ), this, SLOT ( filterTargetComboboxChanged ( int ) ) );
connect ( filterCriteriaCombobox, SIGNAL ( currentIndexChanged ( int ) ), this, SLOT ( filterCriteriaComboboxChanged ( int ) ) );
Index: scribus/plugins/picbrowser/loadimage.cpp
===================================================================
--- scribus/plugins/picbrowser/loadimage.cpp (revision 14680)
+++ scribus/plugins/picbrowser/loadimage.cpp (revision 14681)
@@ -21,6 +21,11 @@
#include "previewimage.h"
#include "picturebrowser.h"
+#include "fileloader.h"
+#include "loadsaveplugin.h"
+#include "../../plugins/formatidlist.h"
+#include "scimagecachemanager.h"
+
#include <QMetaType>
loadImagesThread::loadImagesThread ( PictureBrowser *parent, PreviewImagesModel *parentModel )
@@ -56,6 +61,9 @@
void loadImagesThreadInstance::processLoadImageJob ( int row, QString path, int size, int tpId )
{
+ ScImageCacheManager & icm = ScImageCacheManager::instance();
+ bool cacheEnabled = icm.enabled();
+ icm.setEnabled(false);
//check if list of files has changed and this job is obsolete
if ( pModel->pId != tpId )
{
@@ -68,6 +76,50 @@
return;
}
+ QFileInfo fi = QFileInfo(path);
+ QString ext = fi.suffix().toLower();
+ QStringList allFormatsV = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+ if (allFormatsV.contains(ext.toUtf8()))
+ {
+ FileLoader *fileLoader = new FileLoader(path);
+ int testResult = fileLoader->TestFile();
+ delete fileLoader;
+ if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
+ {
+ const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
+ if( fmt )
+ {
+ QImage im = fmt->readThumbnail(path);
+ if (!im.isNull())
+ {
+ ImageInformation *imgInfo = new ImageInformation;
+ ( *imgInfo ).width = im.text("XSize").toDouble();
+ ( *imgInfo ).height = im.text("YSize").toDouble();
+ ( *imgInfo ).type = 6;
+ ( *imgInfo ).colorspace = 0;
+ ( *imgInfo ).xdpi = 72;
+ ( *imgInfo ).ydpi = 72;
+ ( *imgInfo ).layers = 0;
+ ( *imgInfo ).embedded = false;
+ ( *imgInfo ).profileName = "";
+ ( *imgInfo ).valid = true;
+
+ if ( ( im.width() > ( size-2 ) ) || ( im.height() > ( size-2 ) ) )
+ {
+ emit imageLoaded ( row, im.scaled ( ( size-2 ), ( size-2 ), Qt::KeepAspectRatio, Qt::SmoothTransformation ), imgInfo, tpId );
+ }
+ //image is <= our icon -> put it in as it is
+ else
+ {
+ emit imageLoaded ( row, im.copy(), imgInfo, tpId );
+ }
+ }
+ }
+ }
+ icm.setEnabled(cacheEnabled);
+ return;
+ }
+
ScImage image;
//no realCMYK
bool mode=false;
@@ -120,5 +172,6 @@
( *imgInfo ).valid = false;
emit imageLoaded ( row, QImage(), imgInfo, tpId );
}
+ icm.setEnabled(cacheEnabled);
}
Index: scribus/plugins/import/cvg/importcvgplugin.cpp
===================================================================
--- scribus/plugins/import/cvg/importcvgplugin.cpp (revision 14680)
+++ scribus/plugins/import/cvg/importcvgplugin.cpp (revision 14681)
@@ -173,7 +173,7 @@
UndoManager::instance()->setUndoEnabled(false);
wasUndo = true;
}
- m_Doc = ScCore->primaryMainWindow()->doc;
+ m_Doc = NULL;
CvgPlug *dia = new CvgPlug(m_Doc, lfCreateThumbnail);
Q_CHECK_PTR(dia);
QImage ret = dia->readThumbnail(fileName);
Index: scribus/plugins/import/cvg/importcvg.cpp
===================================================================
--- scribus/plugins/import/cvg/importcvg.cpp (revision 14680)
+++ scribus/plugins/import/cvg/importcvg.cpp (revision 14681)
@@ -60,7 +60,6 @@
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
- bool haveDoc = false;
double b, h;
parseHeader(fName, b, h);
if (b == 0.0)
@@ -69,28 +68,20 @@
h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
docWidth = b;
docHeight = h;
- ScribusView* tempView;
progressDialog = NULL;
- haveDoc = true;
m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- tempView = new ScribusView(0, ScCore->primaryMainWindow(), m_Doc);
- tempView->setScale(1);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), tempView);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- m_Doc->view()->updatesOn(false);
m_Doc->scMW()->ScriptRunning = true;
- qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
- int groupCount = m_Doc->GroupCounter;
- int itemCount = m_Doc->TotalItems;
if (convert(fName))
{
tmpSel->clear();
@@ -156,7 +147,6 @@
}
}
m_Doc->DoDrawing = true;
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
if (Elements.count() > 0)
@@ -174,25 +164,10 @@
tmpImage.setText("XSize", QString("%1").arg(xs));
tmpImage.setText("YSize", QString("%1").arg(ys));
}
- m_Doc->itemSelection_DeleteItem(tmpSel);
- m_Doc->view()->updatesOn(true);
m_Doc->scMW()->ScriptRunning = false;
m_Doc->setLoading(false);
- if (importedColors.count() != 0)
- {
- for (int cd = 0; cd < importedColors.count(); cd++)
- {
- m_Doc->PageColors.remove(importedColors[cd]);
- }
- }
m_Doc->m_Selection->delaySignalsOff();
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
+ delete m_Doc;
return tmpImage;
}
else
@@ -200,16 +175,8 @@
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->ScriptRunning = false;
- m_Doc->view()->updatesOn(true);
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
+ delete m_Doc;
}
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
return QImage();
}
@@ -528,8 +495,10 @@
}
ts.device()->seek(currentFilePos + lenData - 6);
if (progressDialog)
+ {
progressDialog->setProgress("GI", ts.device()->pos());
- qApp->processEvents();
+ qApp->processEvents();
+ }
}
if (Elements.count() == 0)
{
Index: scribus/plugins/import/cgm/importcgmplugin.cpp
===================================================================
--- scribus/plugins/import/cgm/importcgmplugin.cpp (revision 14680)
+++ scribus/plugins/import/cgm/importcgmplugin.cpp (revision 14681)
@@ -174,7 +174,7 @@
UndoManager::instance()->setUndoEnabled(false);
wasUndo = true;
}
- m_Doc = ScCore->primaryMainWindow()->doc;
+ m_Doc = NULL;
CgmPlug *dia = new CgmPlug(m_Doc, lfCreateThumbnail);
Q_CHECK_PTR(dia);
QImage ret = dia->readThumbnail(fileName);
Index: scribus/plugins/import/cgm/importcgm.cpp
===================================================================
--- scribus/plugins/import/cgm/importcgm.cpp (revision 14680)
+++ scribus/plugins/import/cgm/importcgm.cpp (revision 14681)
@@ -67,34 +67,25 @@
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
- bool haveDoc = false;
double b, h;
b = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
docWidth = b;
docHeight = h;
- ScribusView* tempView;
progressDialog = NULL;
- haveDoc = true;
m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- tempView = new ScribusView(0, ScCore->primaryMainWindow(), m_Doc);
- tempView->setScale(1);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), tempView);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- m_Doc->view()->updatesOn(false);
m_Doc->scMW()->ScriptRunning = true;
- qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
- int groupCount = m_Doc->GroupCounter;
- int itemCount = m_Doc->TotalItems;
if (convert(fName))
{
tmpSel->clear();
@@ -160,7 +151,6 @@
}
}
m_Doc->DoDrawing = true;
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
if (Elements.count() > 0)
@@ -178,25 +168,10 @@
tmpImage.setText("XSize", QString("%1").arg(xs));
tmpImage.setText("YSize", QString("%1").arg(ys));
}
- m_Doc->itemSelection_DeleteItem(tmpSel);
- m_Doc->view()->updatesOn(true);
m_Doc->scMW()->ScriptRunning = false;
m_Doc->setLoading(false);
- if (importedColors.count() != 0)
- {
- for (int cd = 0; cd < importedColors.count(); cd++)
- {
- m_Doc->PageColors.remove(importedColors[cd]);
- }
- }
m_Doc->m_Selection->delaySignalsOff();
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
+ delete m_Doc;
return tmpImage;
}
else
@@ -204,16 +179,8 @@
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->ScriptRunning = false;
- m_Doc->view()->updatesOn(true);
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
+ delete m_Doc;
}
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
return QImage();
}
@@ -558,8 +525,10 @@
ts >> paramLen;
decodeBinary(ts, elemClass, elemID, paramLen);
if (progressDialog)
+ {
progressDialog->setProgress("GI", ts.device()->pos());
- qApp->processEvents();
+ qApp->processEvents();
+ }
}
}
f.close();
Index: scribus/plugins/import/pct/importpctplugin.cpp
===================================================================
--- scribus/plugins/import/pct/importpctplugin.cpp (revision 14680)
+++ scribus/plugins/import/pct/importpctplugin.cpp (revision 14681)
@@ -166,7 +166,7 @@
UndoManager::instance()->setUndoEnabled(false);
wasUndo = true;
}
- m_Doc = ScCore->primaryMainWindow()->doc;
+ m_Doc = NULL;
PctPlug *dia = new PctPlug(m_Doc, lfCreateThumbnail);
Q_CHECK_PTR(dia);
QImage ret = dia->readThumbnail(fileName);
Index: scribus/plugins/import/pct/importpct.cpp
===================================================================
--- scribus/plugins/import/pct/importpct.cpp (revision 14680)
+++ scribus/plugins/import/pct/importpct.cpp (revision 14681)
@@ -63,7 +63,6 @@
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
- bool haveDoc = false;
double b, h, x, y;
parseHeader(fName, x, y, b, h);
if (b == 0.0)
@@ -72,28 +71,20 @@
h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
docWidth = b;
docHeight = h;
- ScribusView* tempView;
progressDialog = NULL;
- haveDoc = true;
m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- tempView = new ScribusView(0, ScCore->primaryMainWindow(), m_Doc);
- tempView->setScale(1);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), tempView);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
baseX = m_Doc->currentPage()->xOffset() - x;
baseY = m_Doc->currentPage()->yOffset() - y;
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- m_Doc->view()->updatesOn(false);
m_Doc->scMW()->ScriptRunning = true;
- qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
- int groupCount = m_Doc->GroupCounter;
- int itemCount = m_Doc->TotalItems;
if (convert(fName))
{
tmpSel->clear();
@@ -159,7 +150,6 @@
}
}
m_Doc->DoDrawing = true;
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
if (Elements.count() > 0)
@@ -177,25 +167,10 @@
tmpImage.setText("XSize", QString("%1").arg(xs));
tmpImage.setText("YSize", QString("%1").arg(ys));
}
- m_Doc->itemSelection_DeleteItem(tmpSel);
- m_Doc->view()->updatesOn(true);
m_Doc->scMW()->ScriptRunning = false;
m_Doc->setLoading(false);
- if (importedColors.count() != 0)
- {
- for (int cd = 0; cd < importedColors.count(); cd++)
- {
- m_Doc->PageColors.remove(importedColors[cd]);
- }
- }
m_Doc->m_Selection->delaySignalsOff();
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
+ delete m_Doc;
return tmpImage;
}
else
@@ -203,16 +178,8 @@
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->ScriptRunning = false;
- m_Doc->view()->updatesOn(true);
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
+ delete m_Doc;
}
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
return QImage();
}
@@ -664,7 +631,7 @@
break;
case 0x0002: // Background Pattern
handleLineModeEnd();
- qDebug() << "Background Pattern";
+// qDebug() << "Background Pattern";
alignStreamToWord(ts, 8);
break;
case 0x0003: // Text Font
@@ -676,11 +643,11 @@
case 0x0005: // Text Mode
handleLineModeEnd();
ts >> dataLen;
- qDebug() << "Text Mode" << dataLen;
+// qDebug() << "Text Mode" << dataLen;
// alignStreamToWord(ts, 2);
break;
case 0x0006: // Extra Space
- qDebug() << "Extra Space";
+// qDebug() << "Extra Space";
alignStreamToWord(ts, 4);
break;
case 0x0007: // Pen Size
@@ -689,7 +656,7 @@
case 0x0008: // Pen Mode
handleLineModeEnd();
ts >> dataLen;
- qDebug() << "Pen Mode" << dataLen;
+// qDebug() << "Pen Mode" << dataLen;
// alignStreamToWord(ts, 2);
break;
case 0x0009: // Pen Pattern
@@ -697,14 +664,14 @@
break;
case 0x000A: // Fill Pattern
handleLineModeEnd();
- qDebug() << "Fill Pattern";
+// qDebug() << "Fill Pattern";
alignStreamToWord(ts, 8);
break;
case 0x000B: // Oval Size
handleOvalSize(ts);
break;
case 0x000C: // Origin
- qDebug() << "Origin";
+// qDebug() << "Origin";
alignStreamToWord(ts, 4);
break;
case 0x000D: // Text Size
@@ -722,7 +689,7 @@
alignStreamToWord(ts, 8);
break;
case 0x0011: // Version
- qDebug() << "Version";
+// qDebug() << "Version";
alignStreamToWord(ts, 1);
break;
case 0x0015: // Fractional pen position
@@ -731,7 +698,7 @@
alignStreamToWord(ts, 2);
break;
case 0x0016: // Extra char space
- qDebug() << "Extra char space";
+// qDebug() << "Extra char space";
alignStreamToWord(ts, 2);
break;
case 0x0017:
@@ -746,14 +713,14 @@
handleColorRGB(ts, true);
break;
case 0x001C: // Highlight mode
- qDebug() << "Highlight mode";
+// qDebug() << "Highlight mode";
break;
case 0x001D: // Highlight color RGB
- qDebug() << "Highlight color RGB";
+// qDebug() << "Highlight color RGB";
alignStreamToWord(ts, 6);
break;
case 0x001E: // Use default highlight color
- qDebug() << "Use default highlight color";
+// qDebug() << "Use default highlight color";
break;
case 0x0020: // Line
handleLine(ts);
@@ -792,12 +759,12 @@
break;
case 0x002D: // Line justify
handleLineModeEnd();
- qDebug() << "Line justify";
+// qDebug() << "Line justify";
alignStreamToWord(ts, 10);
break;
case 0x002E: // Glyph state
handleLineModeEnd();
- qDebug() << "Glyph state";
+// qDebug() << "Glyph state";
ts >> dataLen;
alignStreamToWord(ts, dataLen);
break;
@@ -883,27 +850,27 @@
break;
case 0x0060: // Frame arc
handleLineModeEnd();
- qDebug() << "Frame arc";
+// qDebug() << "Frame arc";
alignStreamToWord(ts, 12);
break;
case 0x0061: // Paint arc
handleLineModeEnd();
- qDebug() << "Paint arc";
+// qDebug() << "Paint arc";
alignStreamToWord(ts, 12);
break;
case 0x0062: // Erase arc
handleLineModeEnd();
- qDebug() << "Erase arc";
+// qDebug() << "Erase arc";
alignStreamToWord(ts, 12);
break;
case 0x0063: // Invert arc
handleLineModeEnd();
- qDebug() << "Invert arc";
+// qDebug() << "Invert arc";
alignStreamToWord(ts, 12);
break;
case 0x0064: // Fill arc
handleLineModeEnd();
- qDebug() << "Fill arc";
+// qDebug() << "Fill arc";
alignStreamToWord(ts, 12);
break;
case 0x0065:
@@ -914,27 +881,27 @@
break;
case 0x0068: // Frame same arc
handleLineModeEnd();
- qDebug() << "Frame same arc";
+// qDebug() << "Frame same arc";
alignStreamToWord(ts, 4);
break;
case 0x0069: // Paint same arc
handleLineModeEnd();
- qDebug() << "Paint same arc";
+// qDebug() << "Paint same arc";
alignStreamToWord(ts, 4);
break;
case 0x006A: // Erase same arc
handleLineModeEnd();
- qDebug() << "Erase same arc";
+// qDebug() << "Erase same arc";
alignStreamToWord(ts, 4);
break;
case 0x006B: // Invert same arc
handleLineModeEnd();
- qDebug() << "Invert same arc";
+// qDebug() << "Invert same arc";
alignStreamToWord(ts, 4);
break;
case 0x006C: // Fill same arc
handleLineModeEnd();
- qDebug() << "Fill same arc";
+// qDebug() << "Fill same arc";
alignStreamToWord(ts, 4);
break;
case 0x006D:
@@ -959,23 +926,23 @@
break;
case 0x0078: // Frame same poly
handleLineModeEnd();
- qDebug() << "Frame same poly";
+// qDebug() << "Frame same poly";
break;
case 0x0079: // Paint same poly
handleLineModeEnd();
- qDebug() << "Paint same poly";
+// qDebug() << "Paint same poly";
break;
case 0x007A: // Erase same poly
handleLineModeEnd();
- qDebug() << "Erase same poly";
+// qDebug() << "Erase same poly";
break;
case 0x007B: // Invert same poly
handleLineModeEnd();
- qDebug() << "Invert same poly";
+// qDebug() << "Invert same poly";
break;
case 0x007C: // Fill same poly
handleLineModeEnd();
- qDebug() << "Fill same poly";
+// qDebug() << "Fill same poly";
break;
case 0x007D:
case 0x007E:
@@ -983,31 +950,31 @@
// qDebug() << "Reserved by Apple";
break;
case 0x0080: // Frame region
- qDebug() << "Frame region";
+// qDebug() << "Frame region";
ts >> dataLen;
alignStreamToWord(ts, dataLen-2);
break;
case 0x0081: // Paint region
handleLineModeEnd();
- qDebug() << "Paint region";
+// qDebug() << "Paint region";
ts >> dataLen;
alignStreamToWord(ts, dataLen-2);
break;
case 0x0082: // Erase region
handleLineModeEnd();
- qDebug() << "Erase region";
+// qDebug() << "Erase region";
ts >> dataLen;
alignStreamToWord(ts, dataLen-2);
break;
case 0x0083: // Invert region
handleLineModeEnd();
- qDebug() << "Invert region";
+// qDebug() << "Invert region";
ts >> dataLen;
alignStreamToWord(ts, dataLen-2);
break;
case 0x0084: // Fill region
handleLineModeEnd();
- qDebug() << "Fill region";
+// qDebug() << "Fill region";
ts >> dataLen;
alignStreamToWord(ts, dataLen-2);
break;
@@ -1020,23 +987,23 @@
break;
case 0x0088: // Frame same region
handleLineModeEnd();
- qDebug() << "Frame same region";
+// qDebug() << "Frame same region";
break;
case 0x0089: // Paint same region
handleLineModeEnd();
- qDebug() << "Paint same region";
+// qDebug() << "Paint same region";
break;
case 0x008A: // Erase same region
handleLineModeEnd();
- qDebug() << "Erase same region";
+// qDebug() << "Erase same region";
break;
case 0x008B: // Invert same region
handleLineModeEnd();
- qDebug() << "Invert same region";
+// qDebug() << "Invert same region";
break;
case 0x008C: // Fill same region
handleLineModeEnd();
- qDebug() << "Fill same region";
+// qDebug() << "Fill same region";
break;
case 0x008D:
case 0x008E:
@@ -1044,27 +1011,27 @@
// qDebug() << "Reserved by Apple";
break;
case 0x0090: // Bits Rect
- qDebug() << "Bits Rect";
+// qDebug() << "Bits Rect";
handlePixmap(ts, opCode);
break;
case 0x0091: // Bits Region
- qDebug() << "Bits Region";
+// qDebug() << "Bits Region";
handlePixmap(ts, opCode);
break;
case 0x0098: // Pack Bits Rect
- qDebug() << "Pack Bits Rect";
+// qDebug() << "Pack Bits Rect";
handlePixmap(ts, opCode);
break;
case 0x0099: // Pack Bits Region
- qDebug() << "Pack Bits Region";
+// qDebug() << "Pack Bits Region";
handlePixmap(ts, opCode);
break;
case 0x009A: // Direct Bits Rect
- qDebug() << "Direct Bits Rect";
+// qDebug() << "Direct Bits Rect";
handlePixmap(ts, opCode);
break;
case 0x009B: // Direct Bits Region
- qDebug() << "Direct Bits Region";
+// qDebug() << "Direct Bits Region";
handlePixmap(ts, opCode);
break;
case 0x00A0: // Short Comment
@@ -1093,7 +1060,7 @@
m_Doc->LoadPict(fileName, z);
ite->setImageScalingMode(false, false);
}
- qDebug() << "End of Pict";
+// qDebug() << "End of Pict";
return;
break;
case 0x0200: // Reserved by Apple
@@ -1110,7 +1077,7 @@
alignStreamToWord(ts, dataLenLong);
break;
default:
- qDebug() << QString("Not implemented OpCode: 0x%1 at %2").arg(opCode, 4, 16, QLatin1Char('0')).arg(ts.device()->pos()-2);
+// qDebug() << QString("Not implemented OpCode: 0x%1 at %2").arg(opCode, 4, 16, QLatin1Char('0')).arg(ts.device()->pos()-2);
return;
break;
}
@@ -1329,7 +1296,7 @@
z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorStroke, CommonStrings::None, true);
else
{
- qDebug() << QString("Not implemented OpCode: 0x%1").arg(opCode, 4, 16, QLatin1Char('0'));
+// qDebug() << QString("Not implemented OpCode: 0x%1").arg(opCode, 4, 16, QLatin1Char('0'));
return;
}
ite = m_Doc->Items->at(z);
@@ -1398,7 +1365,7 @@
z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, baseX + bounds.x(), baseY + bounds.y(), bounds.width() - 1, bounds.height() - 1, 0, CurrColorStroke, CommonStrings::None, true);
else
{
- qDebug() << QString("Not implemented OpCode: 0x%1").arg(opCode, 4, 16, QLatin1Char('0'));
+// qDebug() << QString("Not implemented OpCode: 0x%1").arg(opCode, 4, 16, QLatin1Char('0'));
return;
}
ite = m_Doc->Items->at(z);
@@ -1487,7 +1454,7 @@
z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, baseX + currRect.x(), baseY + currRect.y(), currRect.width() - 1, currRect.height() - 1, 0, CurrColorStroke, CommonStrings::None, true);
else
{
- qDebug() << QString("Not implemented OpCode: 0x%1").arg(opCode, 4, 16, QLatin1Char('0'));
+// qDebug() << QString("Not implemented OpCode: 0x%1").arg(opCode, 4, 16, QLatin1Char('0'));
return;
}
ite = m_Doc->Items->at(z);
@@ -2027,137 +1994,137 @@
switch (commentCode)
{
case 100: // picAppComment
- qDebug() << "Comment type: picAppComment";
+// qDebug() << "Comment type: picAppComment";
break;
case 130: // picDwgBeg
- qDebug() << "Comment type: picDwgBeg";
+// qDebug() << "Comment type: picDwgBeg";
break;
case 131: // picDwgEnd
- qDebug() << "Comment type: picDwgEnd";
+// qDebug() << "Comment type: picDwgEnd";
break;
case 140: // picGrpBeg
- qDebug() << "Comment type: picGrpBeg";
+// qDebug() << "Comment type: picGrpBeg";
break;
case 141: // picGrpEnd
- qDebug() << "Comment type: picGrpEnd";
+// qDebug() << "Comment type: picGrpEnd";
break;
case 142: // picBitBeg
- qDebug() << "Comment type: picBitBeg";
+// qDebug() << "Comment type: picBitBeg";
break;
case 143: // picBitEnd
- qDebug() << "Comment type: picBitEnd";
+// qDebug() << "Comment type: picBitEnd";
break;
case 150: // TextBegin
- qDebug() << "Comment type: TextBegin";
+// qDebug() << "Comment type: TextBegin";
break;
case 151: // TextEnd
- qDebug() << "Comment type: TextEnd";
+// qDebug() << "Comment type: TextEnd";
break;
case 152: // StringBegin
- qDebug() << "Comment type: StringBegin";
+// qDebug() << "Comment type: StringBegin";
break;
case 153: // StringEnd
- qDebug() << "Comment type: StringEnd";
+// qDebug() << "Comment type: StringEnd";
break;
case 154: // TextCenter
- qDebug() << "Comment type: TextCenter";
+// qDebug() << "Comment type: TextCenter";
break;
case 155: // LineLayoutOff
- qDebug() << "Comment type: LineLayoutOff";
+// qDebug() << "Comment type: LineLayoutOff";
break;
case 156: // LineLayoutOn
- qDebug() << "Comment type: LineLayoutOn";
+// qDebug() << "Comment type: LineLayoutOn";
break;
case 157: // ClientLineLayout
- qDebug() << "Comment type: ClientLineLayout";
+// qDebug() << "Comment type: ClientLineLayout";
break;
case 160: // PolyBegin
- qDebug() << "Comment type: PolyBegin";
+// qDebug() << "Comment type: PolyBegin";
break;
case 161: // PolyEnd
- qDebug() << "Comment type: PolyEnd";
+// qDebug() << "Comment type: PolyEnd";
break;
case 163: // PolyIgnore
- qDebug() << "Comment type: PolyIgnore";
+// qDebug() << "Comment type: PolyIgnore";
break;
case 164: // PolySmooth
- qDebug() << "Comment type: PolySmooth";
+// qDebug() << "Comment type: PolySmooth";
break;
case 165: // PolyClose
- qDebug() << "Comment type: PolyClose";
+// qDebug() << "Comment type: PolyClose";
break;
case 170: // picArrw1 Arrowhead on 2nd point of line
- qDebug() << "Comment type: picArrw1";
+// qDebug() << "Comment type: picArrw1";
break;
case 171: // picArrw2 Arrowhead on 1nd point of line
- qDebug() << "Comment type: picArrw2";
+// qDebug() << "Comment type: picArrw2";
break;
case 172: // picArrw3 Arrowhead on both endpoints
- qDebug() << "Comment type: picArrw3";
+// qDebug() << "Comment type: picArrw3";
break;
case 173: // picArrwEnd End of arrowhead comment
- qDebug() << "Comment type: picArrwEnd";
+// qDebug() << "Comment type: picArrwEnd";
break;
case 180: // DashedLine
- qDebug() << "Comment type: DashedLine";
+// qDebug() << "Comment type: DashedLine";
break;
case 181: // DashedStop
- qDebug() << "Comment type: DashedStop";
+// qDebug() << "Comment type: DashedStop";
break;
case 182: // SetLineWidth
- qDebug() << "Comment type: SetLineWidth";
+// qDebug() << "Comment type: SetLineWidth";
break;
case 190: // PostScriptBegin
postscriptMode = true;
- qDebug() << "Comment type: PostScriptBegin";
+// qDebug() << "Comment type: PostScriptBegin";
break;
case 191: // PostScriptEnd
postscriptMode = false;
textIsPostScript = false;
- qDebug() << "Comment type: PostScriptEnd";
+// qDebug() << "Comment type: PostScriptEnd";
break;
case 192: // PostScriptHandle
- qDebug() << "Comment type: PostScriptHandle";
+// qDebug() << "Comment type: PostScriptHandle";
break;
case 193: // PostScriptFile
- qDebug() << "Comment type: PostScriptFile";
+// qDebug() << "Comment type: PostScriptFile";
break;
case 194: // TextIsPostScript
textIsPostScript = true;
- qDebug() << "Comment type: TextIsPostScript";
+// qDebug() << "Comment type: TextIsPostScript";
break;
case 195: // ResourcePS
- qDebug() << "Comment type: ResourcePS";
+// qDebug() << "Comment type: ResourcePS";
break;
case 196: // PSBeginNoSave
- qDebug() << "Comment type: PSBeginNoSave";
+// qDebug() << "Comment type: PSBeginNoSave";
break;
case 200: // RotateBegin
- qDebug() << "Comment type: RotateBegin";
+// qDebug() << "Comment type: RotateBegin";
break;
case 201: // RotateEnd
- qDebug() << "Comment type: RotateEnd";
+// qDebug() << "Comment type: RotateEnd";
break;
case 210: // FormsPrinting
- qDebug() << "Comment type: FormsPrinting";
+// qDebug() << "Comment type: FormsPrinting";
break;
case 211: // EndFormsPrinting
- qDebug() << "Comment type: EndFormsPrinting";
+// qDebug() << "Comment type: EndFormsPrinting";
break;
case 220: // CMBeginProfile
- qDebug() << "Comment type: CMBeginProfile";
+// qDebug() << "Comment type: CMBeginProfile";
break;
case 221: // CMEndProfile
- qDebug() << "Comment type: CMEndProfile";
+// qDebug() << "Comment type: CMEndProfile";
break;
case 222: // CMEnableMatching
- qDebug() << "Comment type: CMEnableMatching";
+// qDebug() << "Comment type: CMEnableMatching";
break;
case 223: // CMDisableMatching
- qDebug() << "Comment type: CMDisableMatching";
+// qDebug() << "Comment type: CMDisableMatching";
break;
default:
- qDebug() << "Unknown Pict-Comment" << commentCode;
+// qDebug() << "Unknown Pict-Comment" << commentCode;
break;
}
if (longComment)
Index: scribus/plugins/import/drw/importdrwplugin.cpp
===================================================================
--- scribus/plugins/import/drw/importdrwplugin.cpp (revision 14680)
+++ scribus/plugins/import/drw/importdrwplugin.cpp (revision 14681)
@@ -175,7 +175,7 @@
UndoManager::instance()->setUndoEnabled(false);
wasUndo = true;
}
- m_Doc = ScCore->primaryMainWindow()->doc;
+ m_Doc = NULL;
DrwPlug *dia = new DrwPlug(m_Doc, lfCreateThumbnail);
Q_CHECK_PTR(dia);
QImage ret = dia->readThumbnail(fileName);
Index: scribus/plugins/import/drw/importdrw.cpp
===================================================================
--- scribus/plugins/import/drw/importdrw.cpp (revision 14680)
+++ scribus/plugins/import/drw/importdrw.cpp (revision 14681)
@@ -69,33 +69,24 @@
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
- bool haveDoc = false;
double b = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
double h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
docWidth = b;
docHeight = h;
- ScribusView* tempView;
progressDialog = NULL;
- haveDoc = true;
m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- tempView = new ScribusView(0, ScCore->primaryMainWindow(), m_Doc);
- tempView->setScale(1);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), tempView);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- m_Doc->view()->updatesOn(false);
m_Doc->scMW()->ScriptRunning = true;
- qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
- int groupCount = m_Doc->GroupCounter;
- int itemCount = m_Doc->TotalItems;
if (convert(fName))
{
if (!thumbRead)
@@ -164,7 +155,6 @@
}
}
m_Doc->DoDrawing = true;
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
if (thumbRead)
@@ -191,32 +181,10 @@
tmpImage.setText("YSize", QString("%1").arg(ys));
}
}
- m_Doc->itemSelection_DeleteItem(tmpSel);
- m_Doc->view()->updatesOn(true);
m_Doc->scMW()->ScriptRunning = false;
m_Doc->setLoading(false);
- if (importedColors.count() != 0)
- {
- for (int cd = 0; cd < importedColors.count(); cd++)
- {
- m_Doc->PageColors.remove(importedColors[cd]);
- }
- }
- if (importedPatterns.count() != 0)
- {
- for (int cd = 0; cd < importedPatterns.count(); cd++)
- {
- m_Doc->docPatterns.remove(importedPatterns[cd]);
- }
- }
m_Doc->m_Selection->delaySignalsOff();
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
+ delete m_Doc;
return tmpImage;
}
else
@@ -224,16 +192,8 @@
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->ScriptRunning = false;
- m_Doc->view()->updatesOn(true);
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
+ delete m_Doc;
}
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
return QImage();
}
@@ -550,14 +510,16 @@
decodeCmdData(ts, dataLen, cmd);
decodeCmd(cmd, pos);
if (progressDialog)
+ {
progressDialog->setProgress("GI", ts.device()->pos());
+ qApp->processEvents();
+ }
if (cmd == 254)
break;
if ((importerFlags & LoadSavePlugin::lfCreateThumbnail) && (cmd == 11))
thumbRead = true;
if ((importerFlags & LoadSavePlugin::lfCreateThumbnail) && (cmd == 27) && (thumbRead))
break;
- qApp->processEvents();
}
if (Elements.count() == 0)
{
Index: scribus/plugins/import/wpg/importwpgplugin.cpp
===================================================================
--- scribus/plugins/import/wpg/importwpgplugin.cpp (revision 14680)
+++ scribus/plugins/import/wpg/importwpgplugin.cpp (revision 14681)
@@ -173,7 +173,7 @@
UndoManager::instance()->setUndoEnabled(false);
wasUndo = true;
}
- m_Doc = ScCore->primaryMainWindow()->doc;
+ m_Doc = NULL;
WpgPlug *dia = new WpgPlug(m_Doc, lfCreateThumbnail);
Q_CHECK_PTR(dia);
QImage ret = dia->readThumbnail(fileName);
Index: scribus/plugins/import/wpg/importwpg.cpp
===================================================================
--- scribus/plugins/import/wpg/importwpg.cpp (revision 14680)
+++ scribus/plugins/import/wpg/importwpg.cpp (revision 14681)
@@ -475,34 +475,25 @@
QImage WpgPlug::readThumbnail(QString fName)
{
QFileInfo fi = QFileInfo(fName);
- bool haveDoc = false;
double b, h;
b = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
docWidth = b;
docHeight = h;
- ScribusView* tempView;
progressDialog = NULL;
- haveDoc = true;
m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- tempView = new ScribusView(0, ScCore->primaryMainWindow(), m_Doc);
- tempView->setScale(1);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), tempView);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- m_Doc->view()->updatesOn(false);
m_Doc->scMW()->ScriptRunning = true;
- qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
- int groupCount = m_Doc->GroupCounter;
- int itemCount = m_Doc->TotalItems;
if (convert(fName))
{
tmpSel->clear();
@@ -568,7 +559,6 @@
}
}
m_Doc->DoDrawing = true;
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
if (Elements.count() > 0)
@@ -586,25 +576,10 @@
tmpImage.setText("XSize", QString("%1").arg(xs));
tmpImage.setText("YSize", QString("%1").arg(ys));
}
- m_Doc->itemSelection_DeleteItem(tmpSel);
- m_Doc->view()->updatesOn(true);
m_Doc->scMW()->ScriptRunning = false;
m_Doc->setLoading(false);
- if (importedColors.count() != 0)
- {
- for (int cd = 0; cd < importedColors.count(); cd++)
- {
- m_Doc->PageColors.remove(importedColors[cd]);
- }
- }
m_Doc->m_Selection->delaySignalsOff();
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
+ delete m_Doc;
return tmpImage;
}
else
@@ -612,16 +587,8 @@
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->ScriptRunning = false;
- m_Doc->view()->updatesOn(true);
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
+ delete m_Doc;
}
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
return QImage();
}
Index: scribus/plugins/import/xfig/importxfigplugin.cpp
===================================================================
--- scribus/plugins/import/xfig/importxfigplugin.cpp (revision 14680)
+++ scribus/plugins/import/xfig/importxfigplugin.cpp (revision 14681)
@@ -173,7 +173,7 @@
UndoManager::instance()->setUndoEnabled(false);
wasUndo = true;
}
- m_Doc = ScCore->primaryMainWindow()->doc;
+ m_Doc = NULL;
XfigPlug *dia = new XfigPlug(m_Doc, lfCreateThumbnail);
Q_CHECK_PTR(dia);
QImage ret = dia->readThumbnail(fileName);
Index: scribus/plugins/import/xfig/importxfig.cpp
===================================================================
--- scribus/plugins/import/xfig/importxfig.cpp (revision 14680)
+++ scribus/plugins/import/xfig/importxfig.cpp (revision 14681)
@@ -62,7 +62,6 @@
{
QFileInfo fi = QFileInfo(fName);
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
- bool haveDoc = false;
double b, h, x, y;
parseHeader(fName, x, y, b, h);
docX = x;
@@ -73,16 +72,12 @@
h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
docWidth = b - x;
docHeight = h - y;
- ScribusView* tempView;
progressDialog = NULL;
- haveDoc = true;
m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
- tempView = new ScribusView(0, ScCore->primaryMainWindow(), m_Doc);
- tempView->setScale(1);
- m_Doc->setGUI(false, ScCore->primaryMainWindow(), tempView);
+ m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
Elements.clear();
@@ -151,13 +146,9 @@
CustColors.insert("Gold", ScColor(255, 215, 0));
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- m_Doc->view()->updatesOn(false);
m_Doc->scMW()->ScriptRunning = true;
- qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
- int groupCount = m_Doc->GroupCounter;
- int itemCount = m_Doc->TotalItems;
if (convert(fName))
{
tmpSel->clear();
@@ -223,7 +214,6 @@
}
}
m_Doc->DoDrawing = true;
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
if (Elements.count() > 0)
@@ -241,18 +231,10 @@
tmpImage.setText("XSize", QString("%1").arg(xs));
tmpImage.setText("YSize", QString("%1").arg(ys));
}
- m_Doc->itemSelection_DeleteItem(tmpSel);
- m_Doc->view()->updatesOn(true);
m_Doc->scMW()->ScriptRunning = false;
m_Doc->setLoading(false);
m_Doc->m_Selection->delaySignalsOff();
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
+ delete m_Doc;
return tmpImage;
}
else
@@ -260,16 +242,8 @@
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->ScriptRunning = false;
- m_Doc->view()->updatesOn(true);
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- if (haveDoc)
- {
- delete tempView;
- delete m_Doc;
- }
+ delete m_Doc;
}
- m_Doc->GroupCounter = groupCount;
- m_Doc->TotalItems = itemCount;
return QImage();
}
@@ -1795,8 +1769,10 @@
continue;
processData(ts, tmp);
if (progressDialog)
+ {
progressDialog->setProgress("GI", ts.device()->pos());
- qApp->processEvents();
+ qApp->processEvents();
+ }
}
resortItems();
}
Index: scribus/pageitem_polygon.cpp
===================================================================
--- scribus/pageitem_polygon.cpp (revision 14680)
+++ scribus/pageitem_polygon.cpp (revision 14681)
@@ -48,7 +48,7 @@
{
}
-void PageItem_Polygon::DrawObj_Item(ScPainter *p, QRectF /*e*/, double /*sc*/)
+void PageItem_Polygon::DrawObj_Item(ScPainter *p, QRectF /*e*/)
{
if (!m_Doc->RePos)
{
Index: scribus/pageitem_polygon.h
===================================================================
--- scribus/pageitem_polygon.h (revision 14680)
+++ scribus/pageitem_polygon.h (revision 14681)
@@ -48,7 +48,7 @@
virtual QString infoDescription();
protected:
- virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+ virtual void DrawObj_Item(ScPainter *p, QRectF e);
};
More information about the scribus-commit
mailing list