r14087 by fschmid - Created an scimgdataloader_wpg. Made the picbrowser display all of our supported Image formats.

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 4 14:45:31 CEST 2009


Revision: 14087
Author: fschmid
Date: 2009-10-04T12:44:19.527157Z
Commit message: Created an scimgdataloader_wpg. Made the picbrowser display all of our supported Image formats.

Changeset: 
M  /trunk/Scribus/scribus/scimage.cpp
M  /trunk/Scribus/scribus/util_formats.cpp
M  /trunk/Scribus/scribus/plugins/wpgimplugin/importwpg.cpp
M  /trunk/Scribus/scribus/CMakeLists.txt
A  /trunk/Scribus/scribus/plugins/wpgimplugin/wpg/CMakeLists.txt
M  /trunk/Scribus/scribus/plugins/wpgimplugin/wpg/WPGColor.cpp
M  /trunk/Scribus/scribus/plugins/CMakeLists.txt
M  /trunk/Scribus/scribus/util_formats.h
M  /trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
M  /trunk/Scribus/scribus/plugins/wpgimplugin/CMakeLists.txt

Diffs:
Index: scribus/util_formats.cpp
===================================================================
--- scribus/util_formats.cpp	(revision 14086)
+++ scribus/util_formats.cpp	(revision 14087)
@@ -33,7 +33,7 @@
 	m_fmts.insert(FormatsManager::CVG,  QStringList() << "cvg");
 	m_fmts.insert(FormatsManager::WPG,  QStringList() << "wpg");
 #ifdef GMAGICK_FOUND
-	m_fmts.insert(FormatsManager::GMAGICK, QStringList() << "xbm" << "wpg" << "tga" << "ptif" << "ppm" << "pnm" << "pgm" << "pcds" << "pcd" << "pbm" << "mng" << "ico" << "gif" << "fax" << "dpx" << "bmp" << "xcf");
+	m_fmts.insert(FormatsManager::GMAGICK, QStringList() << "xbm" << "tga" << "ptif" << "ppm" << "pnm" << "pgm" << "pcds" << "pcd" << "pbm" << "mng" << "ico" << "gif" << "fax" << "dpx" << "bmp" << "xcf");
 #endif
 	m_fmts.insert(FormatsManager::UNICONV, QStringList() << "cdr" << "cdt" << "ccx" << "cmx" << "cgm" << "aff" << "sk" << "sk1");
 	m_fmts.insert(FormatsManager::PCT,  QStringList() << "pct" << "pic" << "pict");
Index: scribus/util_formats.h
===================================================================
--- scribus/util_formats.h	(revision 14086)
+++ scribus/util_formats.h	(revision 14087)
@@ -39,9 +39,9 @@
 		{
 			ALLIMAGES 		= 1|2|4|8|16|32|64|128|256|512|1024|2048|4096|8192|16384|32768,
 #ifdef GMAGICK_FOUND
-			IMAGESIMGFRAME	= 1|2|4|16|32|64|128|256|512|65536|262144,  // all Types suitable for Image Frames
+			IMAGESIMGFRAME	= 1|2|4|16|32|64|128|256|512|32768|65536|262144,  // all Types suitable for Image Frames
 #else
-			IMAGESIMGFRAME	= 1|2|4|16|32|64|128|256|512|262144,  // all Types suitable for Image Frames
+			IMAGESIMGFRAME	= 1|2|4|16|32|64|128|256|512|32768|262144,  // all Types suitable for Image Frames
 #endif
 			VECTORIMAGES	= 1|64|1024|2048|16384|32768|131072|262144,  // All pure vector image types
 			RASTORIMAGES	= 2|4|8|32|512|65536,  // All pure rastor image types
Index: scribus/scimage.cpp
===================================================================
--- scribus/scimage.cpp	(revision 14086)
+++ scribus/scimage.cpp	(revision 14087)
@@ -22,6 +22,7 @@
 #include "scimgdataloader_pdf.h"
 #include "scimgdataloader_qt.h"
 #include "scimgdataloader_tiff.h"
+#include "scimgdataloader_wpg.h"
 #include "sctextstream.h"
 #include <QMessageBox>
 #include <QList>
@@ -1822,6 +1823,8 @@
 		pDataLoader = new ScImgDataLoader_GIMP();
 	else if ((ext == "pct") || (ext == "pic") || (ext == "pict"))
 		pDataLoader = new ScImgDataLoader_PICT();
+	else if (ext == "wpg")
+		pDataLoader = new ScImgDataLoader_WPG();
 	else if (fmtImg.contains(ext))
 		pDataLoader = new ScImgDataLoader_QT();
 	#ifdef GMAGICK_FOUND
@@ -2032,6 +2035,8 @@
 		pDataLoader.reset( new ScImgDataLoader_GIMP() );
 	else if ((ext == "pct") || (ext == "pic") || (ext == "pict"))
 		pDataLoader.reset( new ScImgDataLoader_PICT() );
+	else if (ext == "wpg")
+		pDataLoader.reset( new ScImgDataLoader_WPG() );
 	else if (fmtImg.contains(ext))
 		pDataLoader.reset( new ScImgDataLoader_QT() );
 	#ifdef GMAGICK_FOUND
Index: scribus/plugins/picbrowser/picturebrowser.cpp
===================================================================
--- scribus/plugins/picbrowser/picturebrowser.cpp	(revision 14086)
+++ scribus/plugins/picbrowser/picturebrowser.cpp	(revision 14087)
@@ -18,6 +18,7 @@
 
 //provides loadIcon()
 #include "util_icon.h"
+#include "util_formats.h"
 
 PictureBrowser::PictureBrowser ( ScribusDoc* doc, QWidget *parent ) : QDialog ( parent )
 {
@@ -224,8 +225,10 @@
 
 
 //set namefilters for global use
-	nameFilters << "*.jpg" << "*.jpeg" << "*.gif" << "*.png" << "*.ps" << "*.psd" << "*.tif" << "*.tiff" << "*.xpm" << "*.eps" << "*.epsf" << "*.epsi" << "*.eps2" << "*.eps3" << "*.epi" << "*.epg";
+//	nameFilters << "*.jpg" << "*.jpeg" << "*.gif" << "*.png" << "*.ps" << "*.psd" << "*.tif" << "*.tiff" << "*.xpm" << "*.eps" << "*.epsf" << "*.epsi" << "*.eps2" << "*.eps3" << "*.epi" << "*.epg";
 
+	QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::IMAGESIMGFRAME, 0));
+	nameFilters = formatD.split(" ", QString::SkipEmptyParts);
 
 //filter/search setup
 	connect ( filterTargetCombobox, SIGNAL ( currentIndexChanged ( int ) ), this, SLOT ( filterTargetComboboxChanged ( int ) ) );
Index: scribus/plugins/wpgimplugin/importwpg.cpp
===================================================================
--- scribus/plugins/wpgimplugin/importwpg.cpp	(revision 14086)
+++ scribus/plugins/wpgimplugin/importwpg.cpp	(revision 14087)
@@ -145,7 +145,7 @@
 		importedColors.append(newColorName);
 		CurrColorStroke = newColorName;
 	}
-	CurrStrokeTrans = pen.foreColor.alpha / 256.0;
+	CurrStrokeTrans = pen.foreColor.alpha / 255.0;
 	if(!pen.solid)
 	{
 		dashArray.clear();
@@ -223,7 +223,7 @@
 			importedColors.append(newColorName);
 			CurrColorFill = newColorName;
 		}
-		CurrFillTrans = brush.foreColor.alpha / 256.0;
+		CurrFillTrans = brush.foreColor.alpha / 255.0;
 	}
 	else if (brush.style == libwpg::WPGBrush::Gradient)
 	{
@@ -387,7 +387,7 @@
 		ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
 		finishItem(ite);
 	}
-//	qDebug() << "draw Path";
+//	qDebug() << "draw Path" << CurrFillTrans;
 }
 
 void ScrPainter::finishItem(PageItem* ite)
@@ -397,8 +397,6 @@
 	ite->setFillShade(CurrFillShade);
 	ite->setFillEvenOdd(fillrule);
 	ite->setLineShade(CurrStrokeShade);
-	ite->setFillTransparency(CurrFillTrans);
-	ite->setLineTransparency(CurrStrokeTrans);
 	ite->setLineJoin(lineJoin);
 	ite->setLineEnd(lineEnd);
 	ite->DashValues = dashArray;
@@ -420,6 +418,11 @@
 		ite->GrEndX = target.x();
 		ite->GrEndY = target.y();
 	}
+	else
+	{
+		ite->setFillTransparency(CurrFillTrans);
+		ite->setLineTransparency(CurrStrokeTrans);
+	}
 	ite->updateClip();
 	Elements.append(ite);
 	Coords.resize(0);
Index: scribus/plugins/wpgimplugin/CMakeLists.txt
===================================================================
--- scribus/plugins/wpgimplugin/CMakeLists.txt	(revision 14086)
+++ scribus/plugins/wpgimplugin/CMakeLists.txt	(revision 14087)
@@ -2,7 +2,8 @@
     ${CMAKE_SOURCE_DIR}
     ${CMAKE_SOURCE_DIR}/scribus
 )
-LINK_DIRECTORIES(${PLUGIN_LIBRARIES})
+SET(WPGLIB ${CMAKE_CURRENT_BINARY_DIR}/wpg/wpg)
+LINK_DIRECTORIES(${PLUGIN_LIBRARIES} ${WPGLIB})
 
 SET(IMPORTWPG_PLUGIN_MOC_CLASSES
     importwpg.h
@@ -11,29 +12,11 @@
 SET(IMPORTWPG_PLUGIN_SOURCES
     importwpg.cpp
     importwpgplugin.cpp
-    wpg/WPG1Parser.cpp
-    wpg/WPG2Parser.cpp
-    wpg/WPGBinaryData.cpp
-    wpg/WPGBitmap.cpp
-    wpg/WPGBrush.cpp
-    wpg/WPGColor.cpp
-    wpg/WPGGradient.cpp
-    wpg/WPGHeader.cpp
-    wpg/WPGInternalStream.cpp
-    wpg/WPGOLEStream.cpp
-    wpg/WPGPath.cpp
-    wpg/WPGPen.cpp
-    wpg/WPGPoint.cpp
-    wpg/WPGraphics.cpp
-    wpg/WPGRect.cpp
-    wpg/WPGStreamImplementation.cpp
-    wpg/WPGString.cpp
-    wpg/WPGXParser.cpp
   )
 SET(SCRIBUS_IMPORTWPG_PLUGIN "importwpg")
 QT4_WRAP_CPP(IMPORTWPG_PLUGIN_MOC_SOURCES ${IMPORTWPG_PLUGIN_MOC_CLASSES})
 ADD_LIBRARY(${SCRIBUS_IMPORTWPG_PLUGIN} MODULE ${IMPORTWPG_PLUGIN_SOURCES} ${IMPORTWPG_PLUGIN_MOC_SOURCES})
-TARGET_LINK_LIBRARIES(${SCRIBUS_IMPORTWPG_PLUGIN} ${PLUGIN_LIBRARIES})
+TARGET_LINK_LIBRARIES(${SCRIBUS_IMPORTWPG_PLUGIN} ${PLUGIN_LIBRARIES} wpg)
 INSTALL(TARGETS ${SCRIBUS_IMPORTWPG_PLUGIN}
     LIBRARY
     DESTINATION ${PLUGINDIR}
Index: scribus/plugins/wpgimplugin/wpg/WPGColor.cpp
===================================================================
--- scribus/plugins/wpgimplugin/wpg/WPGColor.cpp	(revision 14086)
+++ scribus/plugins/wpgimplugin/wpg/WPGColor.cpp	(revision 14087)
@@ -29,14 +29,14 @@
 	red(0),
 	green(0),
 	blue(0),
-	alpha(1)
+	alpha(0)
 {}
 
 libwpg::WPGColor::WPGColor(int r, int g, int b):
 	red(r),
 	green(g),
 	blue(b),
-	alpha(1)
+	alpha(0)
 {}
 
 libwpg::WPGColor::WPGColor(int r, int g, int b, int a):
Index: scribus/plugins/wpgimplugin/wpg/CMakeLists.txt
===================================================================
--- scribus/plugins/wpgimplugin/wpg/CMakeLists.txt	(revision 0)
+++ scribus/plugins/wpgimplugin/wpg/CMakeLists.txt	(revision 14087)
@@ -0,0 +1,23 @@
+SET(LIB_TYPE STATIC)
+SET(WPG_SOURCES
+    WPG1Parser.cpp
+    WPG2Parser.cpp
+    WPGBinaryData.cpp
+    WPGBitmap.cpp
+    WPGBrush.cpp
+    WPGColor.cpp
+    WPGGradient.cpp
+    WPGHeader.cpp
+    WPGInternalStream.cpp
+    WPGOLEStream.cpp
+    WPGPath.cpp
+    WPGPen.cpp
+    WPGPoint.cpp
+    WPGraphics.cpp
+    WPGRect.cpp
+    WPGStreamImplementation.cpp
+    WPGString.cpp
+    WPGXParser.cpp
+  )
+ADD_LIBRARY(wpg ${LIB_TYPE} ${WPG_SOURCES})
+TARGET_LINK_LIBRARIES(wpg)
Index: scribus/plugins/CMakeLists.txt
===================================================================
--- scribus/plugins/CMakeLists.txt	(revision 14086)
+++ scribus/plugins/CMakeLists.txt	(revision 14087)
@@ -21,6 +21,6 @@
 ADD_SUBDIRECTORY(wpgimplugin)
 ADD_SUBDIRECTORY(pctimplugin)
 ADD_SUBDIRECTORY(tools)
-# ADD_SUBDIRECTORY(picbrowser)
+ADD_SUBDIRECTORY(picbrowser)
 
 # ADD_SUBDIRECTORY(myplugin)
Index: scribus/CMakeLists.txt
===================================================================
--- scribus/CMakeLists.txt	(revision 14086)
+++ scribus/CMakeLists.txt	(revision 14087)
@@ -19,6 +19,7 @@
 IF(HAVE_OSG)
   ADD_SUBDIRECTORY(prc)
 ENDIF (HAVE_OSG)
+ADD_SUBDIRECTORY (plugins/wpgimplugin/wpg)
 
 
 IF(HAVE_OSG)
@@ -647,6 +648,7 @@
   scimgdataloader_psd.cpp
   scimgdataloader_qt.cpp
   scimgdataloader_tiff.cpp
+  scimgdataloader_wpg.cpp
   ui/scinputdialog.cpp
   sclayer.cpp
   ui/scmenu.cpp
@@ -802,6 +804,7 @@
   ${CMAKE_CURRENT_BINARY_DIR}/text
   ${CMAKE_CURRENT_BINARY_DIR}/styles
   ${CMAKE_CURRENT_BINARY_DIR}/fonts
+  ${CMAKE_CURRENT_BINARY_DIR}/plugins/wpgimplugin/wpg
 )
 
 IF(HAVE_OSG)
@@ -947,6 +950,7 @@
   ${SCRIBUS_TEXT_LIB}
   ${SCRIBUS_STYLES_LIB}
   ${SCRIBUS_FONTS_LIB}
+  wpg
 )
 
 IF(HAVE_PODOFO)




More information about the scribus-commit mailing list