r14444 by fschmid - Applied and extended patch from Bug #8657

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 21 14:56:02 CET 2009


Revision: 14444
Author: fschmid
Date: 2009-12-21T02:04:13.289163Z
Commit message: Applied and extended patch from Bug #8657

Changeset: 
M  /trunk/Scribus/scribus/pdflib_core.cpp
M  /trunk/Scribus/scribus/ui/propertiespalette.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M  /trunk/Scribus/scribus/pageitem.cpp
M  /trunk/Scribus/scribus/scribusXml.cpp
M  /trunk/Scribus/scribus/pdflib_core.h
M  /trunk/Scribus/scribus/ui/propertiespalette.h
M  /trunk/Scribus/scribus/pageitem.h
M  /trunk/Scribus/scribus/scribusdoc.cpp
M  /trunk/Scribus/scribus/pageitem_desaxe.cpp
M  /trunk/Scribus/scribus/scribusdoc.h
M  /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
M  /trunk/Scribus/scribus/scribusstructs.h

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 14443)
+++ scribus/pdflib_core.cpp	(revision 14444)
@@ -501,7 +501,7 @@
 	return (succeed ? bytesWritten : 0);
 }
 
-int PDFLibCore::WriteJPEGImageToStream(ScImage& image, const QString& fn, int ObjNum, bool cmyk,
+int PDFLibCore::WriteJPEGImageToStream(ScImage& image, const QString& fn, int ObjNum, int quality, bool cmyk,
 										bool gray, bool sameFile, bool precal)
 {
 	bool succeed = true;
@@ -516,7 +516,7 @@
 		tmpFile  = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg");
 		if ((gray) && (!precal))
 			image.convertToGray();
-		if (image.Convert2JPG(tmpFile, Options.Quality, cmyk, gray))
+		if (image.Convert2JPG(tmpFile, quality, cmyk, gray))
 			jpgFileName = tmpFile;
 	}
 	if (jpgFileName.isEmpty())
@@ -8918,7 +8918,8 @@
 						PutDoc("/ColorSpace /DeviceCMYK\n");
 				}
 			}
-			enum PDFOptions::PDFCompression cm = Options.CompressMethod;
+			enum PDFOptions::PDFCompression compress_method = Options.CompressMethod;
+ 			enum PDFOptions::PDFCompression cm = Options.CompressMethod;
 			bool exportToCMYK = false, exportToGrayscale = false, jpegUseOriginal = false;
 			if (!Options.UseRGB && !(doc.HasCMS && Options.UseProfiles2 && !realCMYK))
 			{
@@ -8928,6 +8929,8 @@
 				else
 					exportToCMYK      = !Options.UseRGB;
 			}
+			if (c->OverrideCompressionMethod)
+				compress_method = cm = (enum PDFOptions::PDFCompression) c->CompressionMethodIndex;
 			if (extensionIndicatesJPEG(ext) && (cm != PDFOptions::Compression_None))
 			{
 				if (((Options.UseRGB || Options.UseProfiles2) && (cm == PDFOptions::Compression_Auto) && (c->effectsInUse.count() == 0) && (img.imgInfo.colorspace == ColorSpaceRGB)) && (!img.imgInfo.progressive) && (!((Options.RecalcPic) && (Options.PicRes < (qMax(72.0 / c->imageXScale(), 72.0 / c->imageYScale()))))))
@@ -8946,7 +8949,7 @@
 				}*/
 				else
 				{
-					if (Options.CompressMethod == PDFOptions::Compression_JPEG)
+					if (compress_method == PDFOptions::Compression_JPEG)
 					{
 						if (realCMYK || !((Options.UseRGB) || (Options.UseProfiles2)))
 						{
@@ -8964,7 +8967,7 @@
 			}
 			else
 			{
-				if ((Options.CompressMethod == PDFOptions::Compression_JPEG) || (Options.CompressMethod == PDFOptions::Compression_Auto))
+				if ((compress_method == PDFOptions::Compression_JPEG) || (compress_method == PDFOptions::Compression_Auto))
 				{
 					if (realCMYK || !((Options.UseRGB) || (Options.UseProfiles2)))
 					{
@@ -8975,7 +8978,7 @@
 							exportToCMYK      = !Options.UseRGB;
 					}
 					cm = PDFOptions::Compression_JPEG;
-					/*if (Options.CompressMethod == PDFOptions::Compression_Auto)
+					/*if (compress_method == PDFOptions::Compression_Auto)
 					{
 						QFileInfo fi(tmpFile);
 						if (fi.size() < im.size())
@@ -9011,7 +9014,12 @@
 			if ((hasGrayProfile) && (doc.HasCMS) && (Options.UseProfiles2) && (!hasColorEffect))
 				exportToGrayscale = true;
 			if (cm == PDFOptions::Compression_JPEG)
-				bytesWritten = WriteJPEGImageToStream(img, fn, imageObj, exportToCMYK, exportToGrayscale, jpegUseOriginal, (!hasColorEffect && hasGrayProfile));
+			{
+				int quality = c->OverrideCompressionQuality ? c->CompressionQualityIndex : Options.Quality;
+				if (c->OverrideCompressionQuality)
+					jpegUseOriginal = false;
+				bytesWritten = WriteJPEGImageToStream(img, fn, imageObj, quality, exportToCMYK, exportToGrayscale, jpegUseOriginal, (!hasColorEffect && hasGrayProfile));
+			}
 			else if (cm == PDFOptions::Compression_ZIP)
 				bytesWritten = WriteFlateImageToStream(img, imageObj, exportToCMYK, exportToGrayscale, (!hasColorEffect && hasGrayProfile));
 			else
Index: scribus/pdflib_core.h
===================================================================
--- scribus/pdflib_core.h	(revision 14443)
+++ scribus/pdflib_core.h	(revision 14444)
@@ -105,7 +105,7 @@
 	bool       EncodeArrayToStream(const QByteArray& in, int ObjNum);
 
 	int     WriteImageToStream(ScImage& image, int ObjNum, bool cmyk, bool gray, bool precal);
-	int     WriteJPEGImageToStream(ScImage& image, const QString& fn, int ObjNum, bool cmyk, bool gray, bool sameFile, bool precal);
+	int     WriteJPEGImageToStream(ScImage& image, const QString& fn, int ObjNum, int quality, bool cmyk, bool gray, bool sameFile, bool precal);
 	int     WriteFlateImageToStream(ScImage& image, int ObjNum, bool cmyk, bool gray, bool precal);
 
 	void    CalcOwnerKey(const QString & Owner, const QString & User);
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 14443)
+++ scribus/scribusdoc.cpp	(revision 14444)
@@ -11448,7 +11448,49 @@
 	m_updateManager.setUpdatesEnabled();
 	changed();
 }
+ 
+void ScribusDoc::itemSelection_SetCompressionMethod(int cmIndex, Selection * customSelection)
+{
+	Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+	assert(itemSelection!=0);
+	uint selectedItemCount=itemSelection->count();
+	if (selectedItemCount == 0)
+		return;
+	//TODO Add Undo
+	for (uint i = 0; i < selectedItemCount; ++i)
+	{
+		PageItem *currItem = itemSelection->itemAt(i);
+		if (currItem && currItem->itemType() == PageItem::ImageFrame)
+		{
+			if ((currItem->OverrideCompressionMethod = cmIndex >= 0))
+			{
+				currItem->CompressionMethodIndex = cmIndex;
+			}
+		}
+	}
+}
 
+void ScribusDoc::itemSelection_SetCompressionQuality(int cqIndex, Selection * customSelection)
+{
+	Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+	assert(itemSelection!=0);
+	uint selectedItemCount=itemSelection->count();
+	if (selectedItemCount == 0)
+		return;
+	//TODO Add Undo
+	for (uint i = 0; i < selectedItemCount; ++i)
+	{
+		PageItem *currItem = itemSelection->itemAt(i);
+		if (currItem && currItem->itemType() == PageItem::ImageFrame)
+		{
+			if ((currItem->OverrideCompressionQuality = cqIndex >= 0))
+			{
+				currItem->CompressionQualityIndex = cqIndex;
+			}
+		}
+	}
+}
+
 QMap<PageItem*, QString> ScribusDoc::getDocItemNames(PageItem::ItemType itemType)
 {
 	QMap<PageItem*, QString> namesMap;
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp	(revision 14443)
+++ scribus/scribusXml.cpp	(revision 14444)
@@ -343,6 +343,10 @@
 	OB->EmProfile  = attrAsString(attrs, "EPROF","");
 	OB->IRender    = (eRenderIntent) attrAsInt (attrs, "IRENDER", (int) Intent_Relative_Colorimetric);
 	OB->UseEmbedded= attrAsInt (attrs, "EMBEDDED", 1);
+	OB->OverrideCompressionMethod = attrAsBool(attrs, "COMPRESSIONMETHODOVER", false);
+	OB->OverrideCompressionQuality = attrAsBool(attrs, "COMPRESSIONQUALITYOVER", false);
+	OB->CompressionMethodIndex = attrAsInt (attrs, "COMPRESSIONMETHOD", 0);
+	OB->CompressionQualityIndex = attrAsInt (attrs, "COMPRESSIONQUALITY", 0);
 	OB->Locked       = attrAsBool(attrs, "LOCK", false);
 	OB->LockRes      = attrAsBool(attrs, "LOCKR", false);
 	OB->Reverse      = attrAsBool(attrs, "REVERS", false);
@@ -740,6 +744,13 @@
 	writer.writeAttribute("EPROF"      , item->EmProfile);
 	writer.writeAttribute("IRENDER"    , item->IRender);
 	writer.writeAttribute("EMBEDDED"   , item->UseEmbedded ? "1" : "0");
+	if (item->asImageFrame())
+	{
+		writer.writeAttribute("COMPRESSIONMETHODOVER", item->OverrideCompressionMethod ? 1 : 0);
+		writer.writeAttribute("COMPRESSIONMETHOD", item->CompressionMethodIndex);
+		writer.writeAttribute("COMPRESSIONQUALITYOVER", item->OverrideCompressionQuality ? 1 : 0);
+		writer.writeAttribute("COMPRESSIONQUALITY", item->CompressionQualityIndex);
+	}
 	writer.writeAttribute("LOCK"       , item->locked() ? "1" : "0");
 	writer.writeAttribute("LOCKR"      , item->sizeLocked() ? "1" : "0");
 	writer.writeAttribute("REVERS"     , item->reversed() ? "1" : "0");
@@ -1535,6 +1546,10 @@
 			LastStyles lastStyle;
 			view->PasteItem(&OB, true, true, false);
 			PageItem* Neu = doc->Items->at(doc->Items->count()-1);
+			Neu->OverrideCompressionMethod = OB.OverrideCompressionMethod;
+			Neu->OverrideCompressionQuality = OB.OverrideCompressionQuality;
+			Neu->CompressionMethodIndex = OB.CompressionMethodIndex;
+			Neu->CompressionQualityIndex = OB.CompressionQualityIndex;
 			Neu->setGradient(gradName);
 			Neu->setStrokeGradient(gradNameS);
 			Neu->setGradientMask(gradNameM);
@@ -1907,6 +1922,10 @@
 			LastStyles lastStyle;
 			view->PasteItem(&OB, true, true, false);
 			PageItem* Neu = doc->Items->at(doc->Items->count()-1);
+			Neu->OverrideCompressionMethod = OB.OverrideCompressionMethod;
+			Neu->OverrideCompressionQuality = OB.OverrideCompressionQuality;
+			Neu->CompressionMethodIndex = OB.CompressionMethodIndex;
+			Neu->CompressionQualityIndex = OB.CompressionQualityIndex;
 			Neu->doOverprint = doOverprint;
 			Neu->setGradient(gradName);
 			Neu->setStrokeGradient(gradNameS);
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h	(revision 14443)
+++ scribus/pageitem.h	(revision 14444)
@@ -441,6 +441,14 @@
 	void setCmsRenderingIntent(eRenderIntent val) { IRender = val; }
 	QString cmsProfile() const { return IProfile; }
 	void setCmsProfile(QString val) { IProfile = val; }
+	bool OverrideCompressionMethod;
+	int CompressionMethodIndex;
+	bool OverrideCompressionQuality;
+	int CompressionQualityIndex;
+	void setOverrideCompressionMethod(bool val) { OverrideCompressionMethod = val; }
+	void setCompressionMethodIndex(int val) { CompressionMethodIndex = val; }
+	void setOverrideCompressionQuality(bool val) { OverrideCompressionQuality = val; }
+	void setCompressionQualityIndex(int val) { CompressionQualityIndex = val; }
 	
 	/*! Flag to hiold image file availability */
 	bool PictureIsAvailable;
Index: scribus/scribusstructs.h
===================================================================
--- scribus/scribusstructs.h	(revision 14443)
+++ scribus/scribusstructs.h	(revision 14444)
@@ -169,6 +169,10 @@
 	QString EmProfile;
 	eRenderIntent IRender;
 	bool UseEmbedded;
+	bool OverrideCompressionMethod;
+	int CompressionMethodIndex;
+	bool OverrideCompressionQuality;
+	int CompressionQualityIndex;
 	QString itemText;
 	QPolygon Clip;
 	FPointArray PoLine;
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 14443)
+++ scribus/pageitem.cpp	(revision 14444)
@@ -123,6 +123,10 @@
 	UseEmbedded(other.UseEmbedded),
 	EmProfile(other.EmProfile),
 	IRender(other.IRender),
+	OverrideCompressionMethod(other.OverrideCompressionMethod),
+	CompressionMethodIndex(other.CompressionMethodIndex),
+	OverrideCompressionQuality(other.OverrideCompressionQuality),
+	CompressionQualityIndex(other.CompressionQualityIndex),
 
 	PictureIsAvailable(other.PictureIsAvailable),
 	OrigW(other.OrigW),
@@ -322,6 +326,10 @@
 	// Initialize superclass(es)
 	: QObject(pa), SingleObservable<PageItem>(pa->itemsChanged()),
 	// Initialize member variables
+	OverrideCompressionMethod(false),
+	CompressionMethodIndex(0),
+	OverrideCompressionQuality(false),
+	CompressionQualityIndex(0),
 	itemText(pa),
 	undoManager(UndoManager::instance()),
 	lineShadeVal(100),
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 14443)
+++ scribus/scribusdoc.h	(revision 14444)
@@ -843,6 +843,8 @@
 	void itemSelection_resetOpticalMargins(Selection* customSelection=0);
 	void itemSelection_SetColorProfile(const QString& profileName, Selection* customSelection=0);
 	void itemSelection_SetRenderIntent(int intentIndex, Selection* customSelection=0);
+	void itemSelection_SetCompressionMethod(int cmIndex, Selection* customSelection=0);
+	void itemSelection_SetCompressionQuality(int cqIndex, Selection* customSelection=0);
 	
 //	void chAbStyle(PageItem *currItem, int s);
 
Index: scribus/ui/propertiespalette.h
===================================================================
--- scribus/ui/propertiespalette.h	(revision 14443)
+++ scribus/ui/propertiespalette.h	(revision 14444)
@@ -315,6 +315,8 @@
 	void handleOverprint(int);
 	void ChangeProfile(const QString& prn);
 	void ChangeIntent();
+	void ChangeCompressionMethod();
+	void ChangeCompressionQuality();
 	void NewName();
 	void NewLanguage();
 	void HandleTLines();
@@ -384,6 +386,7 @@
 	QVBoxLayout* DistanceLayout3;
 	QGridLayout* GroupBox3aLayout;
 	QVBoxLayout* GroupBoxCMLayout;
+	QVBoxLayout* GroupBoxCompressionLayout;
 	QVBoxLayout* textFlowOptionsLayout;
 	QVBoxLayout* textFlowOptionsLayout2;
 	QHBoxLayout* layout23;
@@ -450,6 +453,8 @@
 	QLabel* LineModeT;
 	QLabel* TextCms1;
 	QLabel* TextCms2;
+	QLabel* TextCompressionMethod;
+	QLabel* TextCompressionQuality;
 	QLabel* edgesLabel;
 	QLabel* ChBaseTxt;
 	QLabel* ScaleTxt;
@@ -511,6 +516,7 @@
 	QGroupBox* GeoGroup;
 	QGroupBox* LayerGroup;
 	QFrame* GroupBoxCM;
+	QFrame* GroupBoxCompression;
 	QGroupBox* TLines;
 	QGroupBox* GroupBox3a;
 	QGroupBox* TransGroup;
@@ -537,6 +543,8 @@
 	QComboBox* langCombo;
 	QComboBox* InputP;
 	QComboBox* MonitorI;
+	QComboBox* CompressionMethod;
+	QComboBox* CompressionQuality;
 	QComboBox* LineMode;
 	QComboBox* lineSpacingModeCombo;
 	ColorCombo* TxStroke;
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp	(revision 14443)
+++ scribus/ui/propertiespalette.cpp	(revision 14444)
@@ -1381,6 +1381,23 @@
 	GroupBoxCMLayout->addWidget(MonitorI);
 	pageLayout_4->addWidget(GroupBoxCM);
 
+	GroupBoxCompression = new QFrame( page_4 );
+	GroupBoxCompression->setFrameShape( QFrame::NoFrame );
+	GroupBoxCompression->setFrameShadow( QFrame::Plain );
+	GroupBoxCompressionLayout = new QVBoxLayout( GroupBoxCompression );
+	GroupBoxCompressionLayout->setSpacing( 2 );
+	GroupBoxCompressionLayout->setMargin( 5 );
+	GroupBoxCompressionLayout->setAlignment( Qt::AlignTop );
+	TextCompressionMethod = new QLabel( GroupBoxCompression );
+	GroupBoxCompressionLayout->addWidget( TextCompressionMethod );
+	CompressionMethod = new ScComboBox( GroupBoxCompression );
+	GroupBoxCompressionLayout->addWidget(CompressionMethod);
+	TextCompressionQuality = new QLabel( GroupBoxCompression );
+	GroupBoxCompressionLayout->addWidget( TextCompressionQuality );
+	CompressionQuality = new ScComboBox( GroupBoxCompression );
+	GroupBoxCompressionLayout->addWidget( CompressionQuality );
+	pageLayout_4->addWidget( GroupBoxCompression );
+
 	QSpacerItem* spacer9 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
 	pageLayout_4->addItem( spacer9 );
 	idImageItem=TabStack->addItem( page_4, "&Image" );
@@ -1578,6 +1595,8 @@
 	connect(LineW, SIGNAL(valueChanged(double)), this, SLOT(handlePathOffs()));
 	connect(InputP, SIGNAL(activated(const QString&)), this, SLOT(ChangeProfile(const QString&)));
 	connect(MonitorI, SIGNAL(activated(int)), this, SLOT(ChangeIntent()));
+	connect(CompressionMethod, SIGNAL(activated(int)), this, SLOT(ChangeCompressionMethod()));
+	connect(CompressionQuality, SIGNAL(activated(int)), this, SLOT(ChangeCompressionQuality()));
 	connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
 //	connect(langCombo, SIGNAL(activated(int)), this, SLOT(NewLanguage()));
 	connect( TabsButton, SIGNAL( clicked() ), this, SLOT( ManageTabs() ) );
@@ -2164,6 +2183,8 @@
 		disconnect(imagePageNumber, SIGNAL(valueChanged(int)), this, SLOT(NewPage()));
 		imagePageNumber->setMaximum(CurItem->pixm.imgInfo.numberOfPages);
 		imagePageNumber->setValue(CurItem->pixm.imgInfo.actualPageNumber);
+		CompressionMethod->setCurrentIndex(CurItem->OverrideCompressionMethod ? CurItem->CompressionMethodIndex + 1 : 0);
+		CompressionQuality->setCurrentIndex(CurItem->OverrideCompressionQuality ? CurItem->CompressionQualityIndex + 1 : 0);
 		connect(imagePageNumber, SIGNAL(valueChanged(int)), this, SLOT(NewPage()));
 	}
 	Revert->setChecked(CurItem->reversed());
@@ -4950,7 +4971,21 @@
 		return;
 	doc->itemSelection_SetRenderIntent(MonitorI->currentIndex());
 }
+ 
+void PropertiesPalette::ChangeCompressionMethod()
+{
+	if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->ScriptRunning)
+		return;
+	doc->itemSelection_SetCompressionMethod(CompressionMethod->currentIndex() - 1);
+}
 
+void PropertiesPalette::ChangeCompressionQuality()
+{
+	if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->ScriptRunning)
+		return;
+	doc->itemSelection_SetCompressionQuality(CompressionQuality->currentIndex() - 1);
+}
+
 void PropertiesPalette::ShowCMS()
 {
 	if (!m_ScMW || m_ScMW->ScriptRunning)
@@ -5429,6 +5464,8 @@
 	EditPSDProps->setText( tr("Extended Image Properties"));
 	TextCms1->setText( tr("Input Profile:"));
 	TextCms2->setText( tr("Rendering Intent:"));
+	TextCompressionMethod->setText( tr("PDF Compression Method:"));
+	TextCompressionQuality->setText( tr("PDF Compression Quality:"));
 // 	QList<QAction*> actList = lineSpacingPop->actions();
 // 	actList[0]->setText( tr("Fixed Linespacing"));
 // 	actList[1]->setText( tr("Automatic Linespacing"));
@@ -5446,6 +5483,23 @@
 	MonitorI->addItem( tr("Saturation"));
 	MonitorI->addItem( tr("Absolute Colorimetric"));
 	MonitorI->setCurrentIndex(oldMonitorI);
+	int oldCompressionMethod=CompressionMethod->currentIndex();
+	CompressionMethod->clear();
+	CompressionMethod->addItem( tr( "Global" ) );
+	CompressionMethod->addItem( tr( "Automatic" ) );
+	CompressionMethod->addItem( tr( "Lossy - JPEG" ) );
+	CompressionMethod->addItem( tr( "Lossless - Zip" ) );
+	CompressionMethod->addItem( tr( "None" ) );
+	CompressionMethod->setCurrentIndex(oldCompressionMethod);
+	int oldCompressionQuality=CompressionQuality->currentIndex();
+	CompressionQuality->clear();
+	CompressionQuality->addItem( tr( "Global" ) );
+	CompressionQuality->addItem( tr( "Maximum" ) );
+	CompressionQuality->addItem( tr( "High" ) );
+	CompressionQuality->addItem( tr( "Medium" ) );
+	CompressionQuality->addItem( tr( "Low" ) );
+	CompressionQuality->addItem( tr( "Minimum" ) );
+	CompressionQuality->setCurrentIndex(oldCompressionQuality);
 	int oldLineStyle = LStyle->currentIndex();
 	LStyle->clear();
 	LStyle->updateList();
@@ -5732,6 +5786,8 @@
 	Aspect->setToolTip( tr("Use image proportions rather than those of the frame"));
 	InputP->setToolTip( tr("Source profile of the image"));
 	MonitorI->setToolTip( tr("Rendering intent for the image"));
+	CompressionMethod->setToolTip( tr("Compression method used in PDF export for the image"));
+	CompressionQuality->setToolTip( tr("Compression quality used in PDF export for the image"));
 }
 
 
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(revision 14443)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(revision 14444)
@@ -1662,6 +1662,13 @@
 	docu.writeAttribute("EPROF", item->EmProfile);
 	docu.writeAttribute("IRENDER",item->IRender);
 	docu.writeAttribute("EMBEDDED", item->UseEmbedded ? 1 : 0);
+	if (item->asImageFrame())
+	{
+		docu.writeAttribute("COMPRESSIONMETHODOVER", item->OverrideCompressionMethod ? 1 : 0);
+		docu.writeAttribute("COMPRESSIONMETHOD", item->CompressionMethodIndex);
+		docu.writeAttribute("COMPRESSIONQUALITYOVER", item->OverrideCompressionQuality ? 1 : 0);
+		docu.writeAttribute("COMPRESSIONQUALITY", item->CompressionQualityIndex);
+	}
 	docu.writeAttribute("LOCK", item->locked() ? 1 : 0);
 	docu.writeAttribute("LOCKR", item->sizeLocked() ? 1 : 0);
 	docu.writeAttribute("REVERS", item->reversed() ? 1 : 0);
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 14443)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 14444)
@@ -2348,6 +2348,10 @@
 		currItem->UseEmbedded = attrs.valueAsInt("EMBEDDED", 1);
 		currItem->pixm.imgInfo.lowResType = attrs.valueAsInt("ImageRes", 1);
 		currItem->pixm.imgInfo.actualPageNumber = attrs.valueAsInt("Pagenumber", 0);
+		currItem->OverrideCompressionMethod = attrs.valueAsBool("COMPRESSIONMETHODOVER", false);
+		currItem->CompressionMethodIndex = attrs.valueAsInt("COMPRESSIONMETHOD", 0);
+		currItem->OverrideCompressionQuality = attrs.valueAsBool("COMPRESSIONQUALITYOVER", false);
+		currItem->CompressionQualityIndex = attrs.valueAsInt("COMPRESSIONQUALITY");
 		if (currItem->asLatexFrame())
 		{
 			currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX") * scx, attrs.valueAsDouble("LOCALY") * scy);
Index: scribus/pageitem_desaxe.cpp
===================================================================
--- scribus/pageitem_desaxe.cpp	(revision 14443)
+++ scribus/pageitem_desaxe.cpp	(revision 14444)
@@ -126,6 +126,10 @@
 	result.insert("image-y-scale", toXMLString(item->imageYScale()));
 	result.insert("image-x-position", toXMLString(item->imageXOffset()));
 	result.insert("image-y-position", toXMLString(item->imageYOffset()));
+	if (item->OverrideCompressionMethod)
+		result.insert("COMPRESSIONMETHOD", toXMLString(item->CompressionMethodIndex));
+	if (item->OverrideCompressionQuality)
+		result.insert("COMPRESSIONQUALITY", toXMLString(item->CompressionQualityIndex));
 	//	result.insert("image-x-dpi", toXMLString(item->imageXDpi()));
 	//	result.insert("image-y-dpi", toXMLString(item->imageYDpi()));
 	result.insert("image-shown", toXMLString(item->imageShown()));
@@ -991,6 +995,12 @@
 	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,bool>( & PageItem::setImageFlippedV, "image-flipped-vert", &parseBool ));
 	ruleset.addRule(itemPrefix, SetAttribute<PageItem,QString>( & PageItem::setCmsProfile, "cms-profile" ));
 	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem, eRenderIntent>( & PageItem::setCmsRenderingIntent, "cms-intent", &parseIntent ));
+	
+	
+	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,bool>( & PageItem::setOverrideCompressionMethod, "COMPRESSIONMETHODOVER", &parseBool ));
+	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,bool>( & PageItem::setOverrideCompressionQuality, "COMPRESSIONQUALITYOVER", &parseBool ));
+	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,int>( & PageItem::setCompressionMethodIndex, "COMPRESSIONMETHOD", &parseInt ));
+	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,int>( & PageItem::setCompressionQualityIndex, "COMPRESSIONQUALITY", &parseInt ));
 
 	ruleset.addRule(itemPrefix, SetAttributeWithConversion<PageItem,bool>( & PageItem::setControlsGroup, "isGroupControl", &parseBool ));
 	ruleset.addRule(itemPrefix, PatchIdRefAttribute<PageItem, PageItem>( & PageItem::setGroupsLastItem, "groupsLastItem" ));




More information about the scribus-commit mailing list