r16781 by jghali - merge trunk revisions up to r16780

scribus-commit scribus-commit at lists.scribus.net
Wed Aug 10 22:39:41 UTC 2011


Author: jghali
Date: Wed Aug 10 22:39:40 2011
New Revision: 16781

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16781
Log:
merge trunk revisions up to r16780

Added:
    branches/ScribusOIF/scribus/third_party/pgf/PGFstream.cpp
      - copied unchanged from r16780, trunk/Scribus/scribus/third_party/pgf/PGFstream.cpp
    branches/ScribusOIF/scribus/third_party/pgf/PGFstream.h
      - copied unchanged from r16780, trunk/Scribus/scribus/third_party/pgf/PGFstream.h
    branches/ScribusOIF/win32/vc9/pdfimport/
      - copied from r16780, trunk/Scribus/win32/vc9/pdfimport/
Removed:
    branches/ScribusOIF/scribus/third_party/pgf/Stream.cpp
    branches/ScribusOIF/scribus/third_party/pgf/Stream.h
Modified:
    branches/ScribusOIF/BUILDING_win32_msvc.txt
    branches/ScribusOIF/CMakeLists.txt
    branches/ScribusOIF/TRANSLATION
    branches/ScribusOIF/resources/loremipsum/it.xml
    branches/ScribusOIF/resources/translations/po/scribus.lt_LT.ts
    branches/ScribusOIF/scribus/canvas.cpp
    branches/ScribusOIF/scribus/fpointarray.cpp
    branches/ScribusOIF/scribus/pageitem.cpp
    branches/ScribusOIF/scribus/pageitem.h
    branches/ScribusOIF/scribus/pageitem_group.cpp
    branches/ScribusOIF/scribus/pageitem_group.h
    branches/ScribusOIF/scribus/pageitem_symbol.cpp
    branches/ScribusOIF/scribus/pdflib_core.cpp
    branches/ScribusOIF/scribus/plugins/import/ai/importai.cpp
    branches/ScribusOIF/scribus/plugins/import/cgm/importcgm.cpp
    branches/ScribusOIF/scribus/plugins/import/cvg/importcvg.cpp
    branches/ScribusOIF/scribus/plugins/import/drw/importdrw.cpp
    branches/ScribusOIF/scribus/plugins/import/pct/importpct.cpp
    branches/ScribusOIF/scribus/plugins/import/pdf/importpdf.cpp
    branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.cpp
    branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.h
    branches/ScribusOIF/scribus/plugins/import/shape/importshape.cpp
    branches/ScribusOIF/scribus/plugins/import/sml/importsml.cpp
    branches/ScribusOIF/scribus/plugins/import/wpg/importwpg.cpp
    branches/ScribusOIF/scribus/plugins/import/xar/importxar.cpp
    branches/ScribusOIF/scribus/plugins/import/xfig/importxfig.cpp
    branches/ScribusOIF/scribus/plugins/svgexplugin/svgexplugin.cpp
    branches/ScribusOIF/scribus/pslib.cpp
    branches/ScribusOIF/scribus/scpainter.cpp
    branches/ScribusOIF/scribus/scpainter.h
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/scribusdoc.cpp
    branches/ScribusOIF/scribus/third_party/pgf/BitStream.h
    branches/ScribusOIF/scribus/third_party/pgf/CMakeLists.txt
    branches/ScribusOIF/scribus/third_party/pgf/Decoder.cpp
    branches/ScribusOIF/scribus/third_party/pgf/Decoder.h
    branches/ScribusOIF/scribus/third_party/pgf/Encoder.cpp
    branches/ScribusOIF/scribus/third_party/pgf/Encoder.h
    branches/ScribusOIF/scribus/third_party/pgf/PGFimage.cpp
    branches/ScribusOIF/scribus/third_party/pgf/PGFimage.h
    branches/ScribusOIF/scribus/third_party/pgf/PGFplatform.h
    branches/ScribusOIF/scribus/third_party/pgf/PGFtypes.h
    branches/ScribusOIF/scribus/third_party/pgf/Subband.cpp
    branches/ScribusOIF/scribus/third_party/pgf/Subband.h
    branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.cpp
    branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.h
    branches/ScribusOIF/scribus/ui/about.cpp
    branches/ScribusOIF/scribus/ui/fontcombo.cpp
    branches/ScribusOIF/scribus/ui/fontcombo.h
    branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_group.h
    branches/ScribusOIF/scribus/ui/propertiespalette_groupbase.ui
    branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
    branches/ScribusOIF/scribus/ui/propertywidget_flop.cpp
    branches/ScribusOIF/scribus/ui/propertywidget_flop.h
    branches/ScribusOIF/scribus/ui/storyeditor.cpp
    branches/ScribusOIF/win32/vc9/Scribus-build.vsprops
    branches/ScribusOIF/win32/vc9/Scribus.sln
    branches/ScribusOIF/win32/vc9/scribus-pgf/scribus-pgf.vcproj
    branches/ScribusOIF/win32/vc9/win-config.h

Modified: branches/ScribusOIF/BUILDING_win32_msvc.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/BUILDING_win32_msvc.txt
==============================================================================
--- branches/ScribusOIF/BUILDING_win32_msvc.txt (original)
+++ branches/ScribusOIF/BUILDING_win32_msvc.txt Wed Aug 10 22:39:40 2011
@@ -13,14 +13,16 @@
 	- Microsoft Visual Studio 2008 or Visual C++ Express Edition 2008
 	- A recent Qt (version >= 4.6) release built with Visual Studio 2008
 	- Cairo sources from cairographics.org (version >= 1.8.0)
-	- Pixman sources from cairographics.org (version = 0.12.0)
+	- Pixman sources from cairographics.org (version >= 0.18.0)
 	- Boost from www.boost.org (version >= 1.35.0)
 	- Libxml2 win32 binaries from the Libxml project
 	- Libjpeg win32 libs and binaries from the GnuWin32 project
 	- Libtiff win32 libs and binaries from the GnuWin32 project
 	- Freetype sources from freetype.org (version >= 2.4.0)
 	- LittleCMS sources from www.littlecms.com (version >= 2.1)
-	- PoDoFo 0.8.x (and ONLY 0.8.x) sources from podofo.sourceforge.net
+	- PoDoFo sources (version >= 0.8.0) from podofo.sourceforge.net
+	- Poppler sources (version >= 0.17.1) from poppler.freedesktop.org
+	- Poppler data (version >= 0.4.4) from poppler.freedesktop.org
 	- A Python 2.7 Windows binary build.
       For debug builds, you'll need a release that contains the python27_d.dll .
 
@@ -67,6 +69,9 @@
 
 Adjust SCRIBUS_SRC_PATH, SCRIBUS_BUILD_ROOT and SCRIBUS_INSTALL_PATH as needed and run batch script.
 
+Download poppler data package on poppler.freedesktop.org. Copy content of archive 
+in %SCRIBUS_INSTALL_PATH%\share\poppler.
+
 Now copy the DLLs from the zlib, libpng, qt, lcms, freetype, libtiff, libjpeg,
 libxml, and podofo directories into the Scribus install directory (where
 scribus.exe is). Copy also the Dlls, lib and tcl directories from your python 
@@ -260,23 +265,46 @@
 
 Podofo sources can be downloaded from podofo.sourceforge.net. At the moment 
 those instructions are written, the recommended version to build Scribus on 
-Windows is one of the 0.8.x series. Podofo >= 0.9.0 will not work!!!!
+Windows is one of the 0.8.x series.
 
 Follow instructions in sources packages to build Podofo.
 
-You will however probably find easier to directly download packages with Visual 
-Studio 2008 solutions ready to build. You can find required file at 
+You will however probably find easier to directly download packages with a 
+Visual Studio 2008 solution ready to build. You can find required file at 
 following address :
 
 https://sourceforge.net/projects/scribus/files/scribus-libs/win32-msvc2008/
 
-Download the both scribus-podofo-* file. Unpack it.
-
-Open the podofo solution located in podofo-whatever directory and build 
-Debug and Release configurations of PoDoFoLib project.
+Download the scribus-podofo-*.zip archive. Unpack it.
+
+If present, open the PoDoFoLib-build.vsprops file located in podofo-whatever 
+directory and set all build variables according to your system. Then open the 
+podofo solution located in same directory and build Debug and Release configurations 
+of PoDoFoLib project.
 
 Note : freetype, libtiff and libjpeg must have been installed and if 
 necessary compiled before attempting to build podofo.
+
+---
+Poppler :
+
+Poppler sources can be downloaded http://poppler.freedesktop.org. At the moment
+those instruction are written, the only version known to work with scribus is 0.17.1.
+
+As Poppler is a bit tricky to build on Windows, you will however probably find easier 
+to directly download a ready to build package for Visual Studio 2008. You can find 
+required file at following address :
+
+https://sourceforge.net/projects/scribus/files/scribus-libs/win32-msvc2008/
+
+Download the scribus-poppler-*.zip archive. Unpack it.
+
+Open the poppler-build.vsprops file located in poppler-whatever\win32 directory and set
+all build variables according to your system. Then open the poppler.sln solution and 
+buid Debug-static and Release-static configurations.
+
+Note : freetype, libtiff and libjpeg must have been installed and if 
+necessary compiled before attempting to build poppler.
 
 ---
 Python : 

Modified: branches/ScribusOIF/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/CMakeLists.txt
==============================================================================
--- branches/ScribusOIF/CMakeLists.txt (original)
+++ branches/ScribusOIF/CMakeLists.txt Wed Aug 10 22:39:40 2011
@@ -835,8 +835,13 @@
   ${OPENGL_INCLUDE_DIR}
   ${OSG_INCLUDE_DIR}
   ${GSL_INCLUDE_DIR}
-  ${POPPLER_INCLUDE_DIR}
 )
+
+IF (HAVE_POPPLER)
+  INCLUDE_DIRECTORIES(
+	${POPPLER_INCLUDE_DIR}
+  )
+ENDIF (HAVE_POPPLER)
 
 ##############################################################################################################
 ########## Uninstall Setup                                                                          ##########

Modified: branches/ScribusOIF/TRANSLATION
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/TRANSLATION
==============================================================================
--- branches/ScribusOIF/TRANSLATION (original)
+++ branches/ScribusOIF/TRANSLATION Wed Aug 10 22:39:40 2011
@@ -58,16 +58,15 @@
 German (de)
 Johannes Rüschel (jo.rueschel at gmx.de)
 Franz Schmid (Franz.Schmid at altmuehlnet.de)
-Christoph Schäfer (christoph-schaefer at gmx.de)
 
 German (Swiss) (de_CH)
 Christoph Schäfer (christoph-schaefer at gmx.de)
 
-German (Trad.) (de_ol)
-Johannes Rschel (jo.rueschel at gmx.de)
-Christoph Schfer (christoph-schaefer at gmx.de)
+German (Trad.) (de_1901)
+Johannes Rüschel (jo.rueschel at gmx.de)
+Christoph Schäfer (christoph-schaefer at gmx.de)
 
-Galician (ga)
+Galician (gl)
 Xose Calvo (xosecalvo at galizaweb.net)
 Manuel Anxo Rei (manxopar at avogaciagalega.org)
 
@@ -88,13 +87,11 @@
 Jin-Hwan Jeong (yongdoriaa at gmail.com)
 Kitae Kim (neeum at yahoo.com)
 
-Lithuanian
-Aidas Žandaris
-aidas00 at gmail.com
+Lithuanian (lt)
+Aidas Žandaris (aidas00 at gmail.com)
 
 Norwegian (Bokmål) (nb)
 Axel Bojer (axelb at skolelinux.no)
-
 
 Polish (pl)
 Maciej Hański (m.hanski at gmx.at)
@@ -126,7 +123,8 @@
 Göran Bondeson (goran at bondeson.net)
 
 Thai (th_TH)
-Sira Nokyoungthong (Sira Nokyoungthong)
+Sira Nokyoungthong (gumara at msn.com)
+Santhana Sriwanthana (sriwanthana at gmail.com)
 
 Turkish (tr)
 Barış Atasoy (batasoy at pozitifpc.com)

Modified: branches/ScribusOIF/resources/loremipsum/it.xml
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/resources/loremipsum/it.xml
==============================================================================
--- branches/ScribusOIF/resources/loremipsum/it.xml (original)
+++ branches/ScribusOIF/resources/loremipsum/it.xml Wed Aug 10 22:39:40 2011
@@ -11,5 +11,5 @@
 
 <p>Per un buon pezzo, la costa sale con un pendìo lento e continuo; poi si rompe in poggi e in valloncelli, in erte e in ispianate, secondo l’ossatura de’ due monti, e il lavoro dell’acque. Il lembo estremo, tagliato dalle foci de’ torrenti, è quasi tutto ghiaia e ciottoloni; il resto, campi e vigne, sparse di terre, di ville, di casali; in qualche parte boschi, che si prolungano su per la montagna. Lecco, la principale di quelle terre, e che dà nome al territorio, giace poco discosto dal ponte, alla riva del lago, anzi viene in parte a trovarsi nel lago stesso, quando questo ingrossa: un gran borgo al giorno d’oggi, e che s’incammina a diventar città.</p>
 
-<p>Ai tempi in cui accaddero i fatti che prendiamo a raccontare, que1 borgo, già considerabile, era anche un castello, e aveva perciò l’onore d’alloggiare un comandante, e il vantaggio di possedere una stabile guarnigione di soldati spagnoli, che insegnavan la modestia alle fanciulle e alle donne del paese, accarezzavan di tempo in tempo le spalle a qualche marito, a qualche padre; e, sul finir dell’estate, non mancavan mai di spandersi nelle vigne, per diradar l’uve, e alleggerire a’ contadini le fatiche della vendemmia.</p>
-</lorem>
+<p>Ai tempi in cui accaddero i fatti che prendiamo a raccontare, quel borgo, già considerabile, era anche un castello, e aveva perciò l’onore d’alloggiare un comandante, e il vantaggio di possedere una stabile guarnigione di soldati spagnoli, che insegnavan la modestia alle fanciulle e alle donne del paese, accarezzavan di tempo in tempo le spalle a qualche marito, a qualche padre; e, sul finir dell’estate, non mancavan mai di spandersi nelle vigne, per diradar l’uve, e alleggerire a’ contadini le fatiche della vendemmia.</p>
+</lorem>

Modified: branches/ScribusOIF/resources/translations/po/scribus.lt_LT.ts
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/resources/translations/po/scribus.lt_LT.ts
==============================================================================
--- branches/ScribusOIF/resources/translations/po/scribus.lt_LT.ts (original)
+++ branches/ScribusOIF/resources/translations/po/scribus.lt_LT.ts Wed Aug 10 22:39:40 2011
@@ -246,7 +246,7 @@
     <message>
         <location filename="../../../scribus/ui/about.cpp" line="248"/>
         <source>Unable to open licence file. Please check your install directory or the Scribus website for licencing information.</source>
-        <translation>Negalima atverti licencijos failo. Infoirmacijos apie licencijÄ
 ieškokite  programos diegimo aplanke arba„Scribus“ interneto svetainėje.</translation>
+        <translation>Negalima atverti licencijos failo. Informacijos apie licencijÄ
 ieškokite  programos diegimo aplanke arba „Scribus“ interneto svetainėje.</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/about.cpp" line="309"/>
@@ -357,7 +357,7 @@
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1292"/>
         <source>Collect for O&utput...</source>
-        <translation>&Surinkti perdavimui į spaudÄ
...</translation>
+        <translation>&Surinkti maketo failus...</translation>
     </message>
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1293"/>
@@ -434,7 +434,7 @@
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1318"/>
         <source>Paste Image from Clipboard</source>
-        <translation type="unfinished">Puslapio šablonas iš iškarpinės</translation>
+        <translation>Ä®dÄ—ti paveikslÄ
 iš iškarpinės</translation>
     </message>
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1320"/>
@@ -935,7 +935,7 @@
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1466"/>
         <source>Rotate Item</source>
-        <translation>PažymÄ—ti objektÄ
</translation>
+        <translation>Pasukti objektÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1467"/>
@@ -985,12 +985,12 @@
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1483"/>
         <source>Insert Arc</source>
-        <translation type="unfinished"></translation>
+        <translation>Ä®terpti lankÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1484"/>
         <source>Insert Spiral</source>
-        <translation type="unfinished"></translation>
+        <translation>Įterpti spiralę</translation>
     </message>
     <message>
         <location filename="../../../scribus/actionmanager.cpp" line="1486"/>
@@ -2053,17 +2053,17 @@
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="108"/>
         <source>Move</source>
-        <translation type="unfinished">Perkelti</translation>
+        <translation>Perkelti</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="109"/>
         <source>Resize</source>
-        <translation type="unfinished">Keisti dydį</translation>
+        <translation>Keisti dydį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="110"/>
         <source><qt>When aligning one side of an item do one of the following:<ul><li>Always move the other side too (preserve existing width and height)</li><li>Keep the other side fixed (resize the item instead of moving it) whenever possible</li></ul></qt></source>
-        <translation type="unfinished"></translation>
+        <translation><qt>Lygiuojant pagal vienÄ
 kraÅ¡tÄ
:<ul><li>Visuomet pertvarkoma ir kita pusÄ— (iÅ¡laikant nepakeistÄ
 elemento aukštį ir plotį)</li><li>Išlaikoma nepakeista kita pusė (net keičiamas elemento aukštis ir plotis) , jei tik įmanoma</li></ul></qt></translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="116"/>
@@ -2083,17 +2083,17 @@
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="137"/>
         <source>Make horizontal gaps between items equal</source>
-        <translation>Suvienodinti horizontalius tarpus objektų</translation>
+        <translation>Suvienodinti horizontalius tarpelius objektų</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="139"/>
         <source>Make horizontal gaps between items equal to the value specified</source>
-        <translation>Horizontalius tarpus objektų padaryti nurodyto dydžio</translation>
+        <translation>Horizontalius tarpelius tarp objektų padaryti nurodyto dydžio</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="148"/>
         <source>Make vertical gaps between items equal</source>
-        <translation>Išdėstyti vertikaliai vienodais atstumais tarp objektų</translation>
+        <translation>Išdėstyti vertikaliai vienodu atstumu tarp objektų</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="150"/>
@@ -2103,7 +2103,7 @@
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="158"/>
         <source>Make horizontal gaps between items and sides of page equal</source>
-        <translation>Išdėstyti objektus horizontaliai taip, kad atstumai tarp jų ir lapo krašto būtų vienodi</translation>
+        <translation>Išdėstyti objektus horizontaliai taip, kad tarpeliai tarp jų ir lapo krašto būtų vienodi</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="164"/>
@@ -2113,12 +2113,12 @@
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="162"/>
         <source>Make horizontal gaps between items and sides of page margins equal</source>
-        <translation>Išdėstyti objektus horizontaliai taip, kad atstumai tarp jų ir lapo paraščių būtų vienodi</translation>
+        <translation>Išdėstyti objektus horizontaliai taip, kad tarpeliai tarp jų ir lapo paraščių būtų vienodi</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="160"/>
         <source>Make vertical gaps between items and the top and bottom of page equal</source>
-        <translation>Išdėstyti objektus vertikaliai taip, kad atstumai tarp jų ir lapo viršaus ir apačios būtų vienodi</translation>
+        <translation>Išdėstyti objektus vertikaliai taip, kad tarpeliai tarp jų ir lapo viršaus ir apačios būtų vienodi</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/aligndistribute.cpp" line="92"/>
@@ -3116,32 +3116,32 @@
     <message>
         <location filename="../../../scribus/ui/arcvectorbase.ui" line="23"/>
         <source>Edit Arc</source>
-        <translation type="unfinished"></translation>
+        <translation></translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/arcvectorbase.ui" line="31"/>
         <source>Start Angle:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pradžios kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/arcvectorbase.ui" line="51"/>
         <source>End Angle:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pabaigos kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/arcvectorbase.ui" line="71"/>
         <source>Height:</source>
-        <translation type="unfinished">Aukštis:</translation>
+        <translation>Aukštis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/arcvectorbase.ui" line="88"/>
         <source>Width:</source>
-        <translation type="unfinished">Plotis:</translation>
+        <translation>Plotis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/arcvectorbase.ui" line="122"/>
         <source>End Edit</source>
-        <translation type="unfinished"></translation>
+        <translation>Baigti redaguoti</translation>
     </message>
 </context>
 <context>
@@ -3149,22 +3149,22 @@
     <message>
         <location filename="../../../scribus/ui/arcwidgetbase.ui" line="26"/>
         <source>Form</source>
-        <translation type="unfinished"></translation>
+        <translation>Forma</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/arcwidgetbase.ui" line="36"/>
         <source>Start Angle:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pradžios kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/arcwidgetbase.ui" line="56"/>
         <source>End Angle:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pabaigos kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/arcwidgetbase.ui" line="117"/>
         <source>Sample Polygon</source>
-        <translation type="unfinished">Daugiakampio pavyzdys</translation>
+        <translation>Daugiakampio pavyzdys</translation>
     </message>
 </context>
 <context>
@@ -5076,7 +5076,7 @@
     <message>
         <location filename="../../../scribus/ui/checkDocument.cpp" line="623"/>
         <source>Image dimension is smaller than its frame</source>
-        <translation type="unfinished"></translation>
+        <translation>Paveikslo matmuo  mažesnis už rėmelio</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/checkDocument.cpp" line="285"/>
@@ -6036,7 +6036,7 @@
     <message>
         <location filename="../../../scribus/ui/contextmenu.cpp" line="431"/>
         <source>Paste File...</source>
-        <translation>PadÄ—ti failÄ
...</translation>
+        <translation>Importuoti failÄ
...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/contextmenu.cpp" line="464"/>
@@ -6045,7 +6045,7 @@
     </message>
     <message>
         <source>Paste Image from Clipboard</source>
-        <translation type="obsolete">Puslapio šablonas iš iškarpinės</translation>
+        <translation type="obsolete">Rėmelio turinys iš iškarpinės</translation>
     </message>
 </context>
 <context>
@@ -6248,7 +6248,7 @@
         <location filename="../../../scribus/ui/cpalette.cpp" line="360"/>
         <location filename="../../../scribus/ui/cpalette.cpp" line="362"/>
         <source>Pattern</source>
-        <translation type="unfinished">Tekstūra</translation>
+        <translation>Tekstūra</translation>
     </message>
     <message>
         <source>Exclusion</source>
@@ -6274,13 +6274,13 @@
         <location filename="../../../scribus/ui/cpalette.cpp" line="76"/>
         <location filename="../../../scribus/ui/cpalette.cpp" line="78"/>
         <source>Solid</source>
-        <translation type="unfinished">Ryškus</translation>
+        <translation>Gryna</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/cpalette.cpp" line="77"/>
         <location filename="../../../scribus/ui/cpalette.cpp" line="79"/>
         <source>Gradient</source>
-        <translation type="unfinished"></translation>
+        <translation>Gradientas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/cpalette.cpp" line="596"/>
@@ -8193,22 +8193,25 @@
     <message>
         <location filename="../../../scribus/plugins/tools/flattenpath/flattenpath.cpp" line="76"/>
         <source>Flatten Path</source>
-        <translation type="unfinished"></translation>
+        <translatorcomment>Abejoju dÄ—l vertimo...</translatorcomment>
+        <translation>IÅ¡lyginti apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/flattenpath/flattenpath.cpp" line="80"/>
         <source>Path Tools</source>
-        <translation type="unfinished">Apybrėžų įrankiai</translation>
+        <translation>Apybrėžų įrankiai</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/flattenpath/flattenpath.cpp" line="101"/>
         <source>Flattens a Path</source>
-        <translation type="unfinished"></translation>
+        <translatorcomment>Abejoju dÄ—l vertimo...</translatorcomment>
+        <translation>Išlygintos apybrėžos</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/flattenpath/flattenpath.cpp" line="102"/>
         <source>Converts a Bezier Path to a Path made of line segments.</source>
-        <translation type="unfinished"></translation>
+        <translatorcomment>Abejoju...</translatorcomment>
+        <translation>Konvertuoti BezÄ— apybrėžÄ
 į linijos segmentų apybrėžas</translation>
     </message>
 </context>
 <context>
@@ -8954,7 +8957,7 @@
         <location filename="../../../scribus/ui/guidemanager.ui" line="176"/>
         <location filename="../../../scribus/ui/guidemanager.cpp" line="241"/>
         <source>U&se Gap:</source>
-        <translation>Naudoti &intervalÄ
:</translation>
+        <translation>Naudoti &tarpelį:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/guidemanager.ui" line="179"/>
@@ -9002,7 +9005,7 @@
         <location filename="../../../scribus/ui/guidemanager.ui" line="263"/>
         <location filename="../../../scribus/ui/guidemanager.cpp" line="242"/>
         <source>Use &Gap:</source>
-        <translation>Naudoti &intervalÄ
:</translation>
+        <translation>Naudoti &tarpelį:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/guidemanager.ui" line="266"/>
@@ -9086,12 +9089,12 @@
     <message>
         <location filename="../../../scribus/ui/guidemanager.cpp" line="263"/>
         <source>Create rows with guides, with an additional gap between the rows</source>
-        <translation>Sukurti iÅ¡ kreiptinių eilutes naudojant papildomÄ
 intervalÄ
 tarp eilučių</translation>
+        <translation>Sukurti iÅ¡ kreiptinių eilutes naudojant papildomÄ
 tarpelį tarp eilučių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/guidemanager.cpp" line="264"/>
         <source>Create columns with guides, with an additional gap between the columns</source>
-        <translation>Sukurti iÅ¡ kreiptinių stulpelius naudojant papildomÄ
 intervalÄ
 tarp stulpelių</translation>
+        <translation>Sukurti iÅ¡ kreiptinių stulpelius naudojant papildomÄ
 tarpelį tarp stulpelių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/guidemanager.cpp" line="265"/>
@@ -9739,39 +9742,40 @@
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="52"/>
         <source>Import Dia Shapes...</source>
-        <translation type="unfinished"></translation>
+        <translation>Importuoti diagramas...</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="54"/>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="89"/>
         <source>Dia Shapes "*.shape" File</source>
-        <translation type="unfinished"></translation>
+        <translation>Diagramų "*.shape" failas</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="55"/>
         <source>Dia Shapes "*.shape" File (*.shape *.SHAPE)</source>
-        <translation type="unfinished"></translation>
+        <translation>Diagramų "*.shape" failas (*.shape *.SHAPE)</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="73"/>
         <source>Imports Dia shape Files</source>
-        <translation type="unfinished"></translation>
+        <translation>Importuoti diagramos failÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="74"/>
         <source>Imports most Dia shapes into the current document,
 converting their vector data into Scribus objects.</source>
-        <translation type="unfinished"></translation>
+        <translation>Importuoti pagrindines diagramas į dabartinį projektÄ
 
+ir konvertuoti jų vektorinius elementus į „Scribus“ objektus.</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="91"/>
         <source>Dia shapes "*.shape" File (*.shape *.SHAPE)</source>
-        <translation type="unfinished"></translation>
+        <translation>Diagramų "*.shape" failas (*.shape *.SHAPE)</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="123"/>
         <source>All Supported Formats</source>
-        <translation type="unfinished">Visi palaikomi formatai</translation>
+        <translation>Visi palaikomi formatai</translation>
     </message>
 </context>
 <context>
@@ -9779,35 +9783,36 @@
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="59"/>
         <source>Import Sml...</source>
-        <translation type="unfinished"></translation>
+        <translation>Importuoti Å¡abloninÄ™ diagramÄ
...</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="61"/>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="96"/>
         <source>Kivio Stencils "*.sml" File</source>
-        <translation type="unfinished"></translation>
+        <translation>„Kivio“ šabloninės diagramos "*.sml" failas</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="62"/>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="98"/>
         <source>Kivio Stencils "*.sml" File (*.sml *.SML)</source>
-        <translation type="unfinished"></translation>
+        <translation>„Kivio“ šabloninės diagramos "*.sml" failas  (*.sml *.SML)</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="80"/>
         <source>Imports Sml Files</source>
-        <translation type="unfinished"></translation>
+        <translation>Importuoti .sml faillus</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="81"/>
         <source>Imports most Kivio stencils into the current document,
 converting their vector data into Scribus objects.</source>
-        <translation type="unfinished"></translation>
+        <translation>Importuoti dažniausiai naudojamas „Kivio“ diagramas į dabartinį 
+dokumentÄ
 ir konvertuoti jų vektorinius elementus į „Scribus“ objektus.</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="130"/>
         <source>All Supported Formats</source>
-        <translation type="unfinished">Visi palaikomi formatai</translation>
+        <translation>Visi palaikomi formatai</translation>
     </message>
 </context>
 <context>
@@ -10324,7 +10329,7 @@
     <message>
         <location filename="../../../scribus/ui/insertaframe.ui" line="611"/>
         <source>Gap:</source>
-        <translation>Intervalas:</translation>
+        <translation>Tarpelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/insertaframe.ui" line="697"/>
@@ -12025,12 +12030,12 @@
     <message>
         <location filename="../../../scribus/ui/multipleduplicate.cpp" line="69"/>
         <source>&Horizontal Gap:</source>
-        <translation>&Horizontalus tarpas:</translation>
+        <translation>&Horizontalus tarpelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/multipleduplicate.cpp" line="70"/>
         <source>&Vertical Gap:</source>
-        <translation>&Vertikalus tarpas:</translation>
+        <translation>&Vertikalus tarpelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/multipleduplicate.ui" line="14"/>
@@ -12060,7 +12065,7 @@
     <message>
         <location filename="../../../scribus/ui/multipleduplicate.ui" line="82"/>
         <source>Create &Gap Between Items Of</source>
-        <translation>Padaryti &intervalÄ
 tarp objektų</translation>
+        <translation>Padaryti &tarpelį tarp objektų</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/multipleduplicate.ui" line="85"/>
@@ -12080,12 +12085,12 @@
     <message>
         <location filename="../../../scribus/ui/multipleduplicate.ui" line="237"/>
         <source>Vertical Gap:</source>
-        <translation>Vertikalus intervalas:</translation>
+        <translation>Vertikalus tarpelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/multipleduplicate.ui" line="264"/>
         <source>Horizontal Gap:</source>
-        <translation>Horizontalus intervalas:</translation>
+        <translation>Horizontalus tarpelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/multipleduplicate.ui" line="281"/>
@@ -12268,7 +12273,7 @@
     <message>
         <location filename="../../../scribus/ui/newfile.cpp" line="319"/>
         <source>&Gap:</source>
-        <translation>&Intervalai tarp stulpelių:</translation>
+        <translation>&Tarpelis tarp stulpelių:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/newfile.cpp" line="311"/>
@@ -12544,7 +12549,7 @@
     <message>
         <location filename="../../../scribus/ui/nodeeditpalette.cpp" line="915"/>
         <source>Move Control Points</source>
-        <translation>Perkelti valdymo taškus</translation>
+        <translation>Leisti kilnoti valdymo taškus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/nodeeditpalette.cpp" line="916"/>
@@ -13861,22 +13866,22 @@
     <message>
         <location filename="../../../scribus/pageitem.cpp" line="555"/>
         <source>Group</source>
-        <translation type="unfinished">Grupuoti</translation>
+        <translation>GrupÄ—</translation>
     </message>
     <message>
         <location filename="../../../scribus/pageitem.cpp" line="559"/>
         <source>RegularPolygon</source>
-        <translation type="unfinished"></translation>
+        <translation>Taisyklingas daugiakampis</translation>
     </message>
     <message>
         <location filename="../../../scribus/pageitem.cpp" line="563"/>
         <source>Arc</source>
-        <translation type="unfinished"></translation>
+        <translation>Lankas</translation>
     </message>
     <message>
         <location filename="../../../scribus/pageitem.cpp" line="567"/>
         <source>Spiral</source>
-        <translation type="unfinished"></translation>
+        <translation>SpiralÄ—</translation>
     </message>
     <message>
         <location filename="../../../scribus/pageitem.cpp" line="4628"/>
@@ -14542,7 +14547,7 @@
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="90"/>
         <source>Patterns</source>
-        <translation type="unfinished">Tekstūros</translation>
+        <translation>Tekstūros</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="99"/>
@@ -14577,34 +14582,34 @@
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="353"/>
         <source>&Import</source>
-        <translation type="unfinished">&Importuoti</translation>
+        <translation>&Importuoti</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="354"/>
         <source>Add</source>
-        <translation type="unfinished">PridÄ—ti</translation>
+        <translation>PridÄ—ti</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="355"/>
         <source>&Edit</source>
-        <translation type="unfinished"></translation>
+        <translation>&Taisyti</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="382"/>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="393"/>
         <source>Load File</source>
-        <translation type="unfinished">Ä®kelti failÄ
</translation>
+        <translation>Ä®kelti failÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="383"/>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="394"/>
         <source>Load Set</source>
-        <translation type="unfinished">Įkeltį rinkinį</translation>
+        <translation>Įkeltį rinkinį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="384"/>
         <source>Rename</source>
-        <translation type="unfinished">Pervardyti</translation>
+        <translation>Pervardyti</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="442"/>
@@ -14619,7 +14624,7 @@
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="573"/>
         <source>Rename Entry</source>
-        <translation type="unfinished">Pervardyti objektÄ
</translation>
+        <translation>Pervardyti objektÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="628"/>
@@ -14645,7 +14650,7 @@
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="873"/>
         <source>Do you really want to clear all your patterns?</source>
-        <translation type="unfinished"></translation>
+        <translation>Ar tikrai pašalinti visas tekstūras?</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="1000"/>
@@ -14711,12 +14716,12 @@
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="1193"/>
         <source>Choose a Directory</source>
-        <translation type="unfinished"></translation>
+        <translation>Parinkite aplankÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="1221"/>
         <source>Loading Patterns</source>
-        <translation type="unfinished">Įkeliamos tekstūros</translation>
+        <translation>Įkeliamos tekstūros</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/paintmanager.cpp" line="1825"/>
@@ -14927,7 +14932,7 @@
     <message>
         <location filename="../../../scribus/plugins/tools/2geomtools/pathalongpath/pathdialogbase.ui" line="103"/>
         <source>Gap between Objects</source>
-        <translation>Atstumas tarp objektų</translation>
+        <translation>Tarpelis tarp objektų</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/2geomtools/pathalongpath/pathdialogbase.ui" line="113"/>
@@ -16755,12 +16760,12 @@
     <message>
         <location filename="../../../scribus/ui/polyprops.cpp" line="19"/>
         <source>Polygon Properties</source>
-        <translation type="unfinished">Daugiakampio ypatybÄ—s</translation>
+        <translation>Daugiakampio ypatybÄ—s</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/polyprops.cpp" line="32"/>
         <source>End Edit</source>
-        <translation type="unfinished"></translation>
+        <translation>Baigti redaguoti</translation>
     </message>
 </context>
 <context>
@@ -16802,17 +16807,17 @@
     <message>
         <location filename="../../../scribus/ui/polygonwidgetbase.ui" line="98"/>
         <source>Inner Rotation:</source>
-        <translation type="unfinished"></translation>
+        <translation>Vidinis posūkis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/polygonwidgetbase.ui" line="190"/>
         <source>Inner C&urvature:</source>
-        <translation type="unfinished"></translation>
+        <translation>Vidinis kreiv&umas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/polygonwidgetbase.ui" line="223"/>
         <source>Outer Curvature:</source>
-        <translation type="unfinished"></translation>
+        <translation>IÅ¡orinis kreivumas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/polygonwidgetbase.ui" line="284"/>
@@ -17434,12 +17439,12 @@
     <message>
         <location filename="../../../scribus/ui/prefs_colormanagement.cpp" line="28"/>
         <source>Monitor profiles can only be changed when no documents are open.</source>
-        <translation type="unfinished"></translation>
+        <translation>Monitoriaus profilį galima pakeisti tik jei nėra atvertų dokumentų.</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/prefs_colormanagement.cpp" line="53"/>
         <source><qt>Color Management cannot be activated due to missing color profiles.</br>You need to install at least one RGB and one CMYK profile.</source>
-        <translation type="unfinished"></translation>
+        <translation><qt>Negalima suaktyvinti spalvų tvarkymo, nes netinkamas spalvų profilis.</br>Reikia įdiegti po bent vienÄ
 RŽM (RGB) ir ŽPGJ (CMYK) profilį.</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/prefs_colormanagement.cpp" line="62"/>
@@ -17562,7 +17567,7 @@
     <message>
         <location filename="../../../scribus/ui/prefs_displaybase.ui" line="218"/>
         <source>Gaps Between Pages</source>
-        <translation>Intervalas tarp puslapių vaizdų</translation>
+        <translation>Tarpelis tarp puslapių vaizdų</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/prefs_displaybase.ui" line="234"/>
@@ -19143,7 +19148,7 @@
     <message>
         <location filename="../../../scribus/ui/prefs_itemtoolsbase.ui" line="342"/>
         <source>Column Gap:</source>
-        <translation>Atstumas tarp skilčių:</translation>
+        <translation>Tarpelis tarp skilčių:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/prefs_itemtoolsbase.ui" line="412"/>
@@ -19305,12 +19310,12 @@
     <message>
         <location filename="../../../scribus/ui/prefs_itemtoolsbase.ui" line="1445"/>
         <source>Arc</source>
-        <translation type="unfinished"></translation>
+        <translation>Lankas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/prefs_itemtoolsbase.ui" line="1492"/>
         <source>Spiral</source>
-        <translation type="unfinished"></translation>
+        <translation>SpiralÄ—</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/prefs_itemtools.cpp" line="43"/>
@@ -21012,7 +21017,7 @@
     <message>
         <location filename="../../../scribus/ui/prefs_preflightverifierbase.ui" line="242"/>
         <source>Check for part filed image frames</source>
-        <translation type="unfinished"></translation>
+        <translation>Patikrinkite paveikslų rėmelių laukus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/prefs_preflightverifierbase.ui" line="249"/>
@@ -22803,7 +22808,7 @@
     </message>
     <message>
         <source>Switches between Gap or Column width</source>
-        <translation type="obsolete">Perjungia tarp intervalo ir stulpelio pločio</translation>
+        <translation type="obsolete">Perjungia tarp tarpelio ir stulpelio pločio</translation>
     </message>
     <message>
         <source>Distance between columns</source>
@@ -22839,7 +22844,7 @@
     </message>
     <message>
         <source>Allow the image to be a different size to the frame</source>
-        <translation type="obsolete">Leisti skirtinÄ
 paveikslo ir rėmelio dydžius</translation>
+        <translation type="obsolete">Leisti skirtingus paveikslo ir rėmelio dydžius</translation>
     </message>
     <message>
         <source>Horizontal offset of image within frame</source>
@@ -22995,7 +23000,7 @@
     </message>
     <message>
         <source>Gap:</source>
-        <translation type="obsolete">Intervalas:</translation>
+        <translation type="obsolete">Tarpelis:</translation>
     </message>
     <message>
         <source>Width:</source>
@@ -23328,67 +23333,67 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="601"/>
         <source>&Edit...</source>
-        <translation type="unfinished">&Taisyti...</translation>
+        <translation>&Taisyti...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="602"/>
         <source>Shape</source>
-        <translation type="unfinished">Figūra</translation>
+        <translation>Figūra</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="604"/>
         <source>Text &Flow Around Frame</source>
-        <translation type="unfinished">Apgaubti &rėmelį tekstu</translation>
+        <translation>Apgaubti &rėmelį tekstu</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="605"/>
         <source>Disabled</source>
-        <translation type="unfinished"></translation>
+        <translation>Neleidžiama</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="606"/>
         <source>Use Frame &Shape</source>
-        <translation type="unfinished">Naudoti kontÅ«ro &formÄ
</translation>
+        <translation>Naudoti kontÅ«ro &formÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="607"/>
         <source>Use &Bounding Box</source>
-        <translation type="unfinished">&Apybrėžai naudoti stačiakampį</translation>
+        <translation>&Apybrėžai naudoti stačiakampį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="608"/>
         <source>&Use Contour Line</source>
-        <translation type="unfinished">Naudoti &figÅ«ros apybrėžÄ
</translation>
+        <translation>Naudoti &figÅ«ros apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="609"/>
         <source>Use Image Clip Path</source>
-        <translation type="unfinished">Naudoti paveikslo apybrėžÄ
</translation>
+        <translation>Naudoti paveikslo kontÅ«ro apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="611"/>
         <source>Disable text flow from lower frames around object</source>
-        <translation type="unfinished">Drausti apgaubti objektÄ
 žemesniame sluoksnyje esančio teksto rėmelio tekstu</translation>
+        <translation>Drausti apgaubti objektÄ
 žemesniame sluoksnyje esančio teksto rėmelio tekstu</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="612"/>
         <source>Use the frame shape for text flow of text frames below the object.</source>
-        <translation type="unfinished">Objektus, esančius greta teksto rÄ—melio, apgaubti tekstu pagal objektų figÅ«ros formÄ
.</translation>
+        <translation>Objektus, esančius greta teksto rÄ—melio, apgaubti tekstu pagal objektų figÅ«ros formÄ
.</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="613"/>
         <source>Use the bounding box, which is always rectangular, instead of the frame's shape for text flow of text frames below the object. </source>
-        <translation type="unfinished">Naudoti aprėpos stačiakampį tekstui apgaubti (vietoje objektų rėmelių formos).Tekstui apgaubti naudoti apybrėžos stačiakampį (vietoje objektų formos apybrėžos).</translation>
+        <translation>Naudoti aprėpos stačiakampį tekstui apgaubti (vietoje objektų rėmelių formos).Tekstui apgaubti naudoti apybrėžos stačiakampį (vietoje objektų formos apybrėžos).</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="614"/>
         <source>When chosen, the contour line can be edited with the Edit Shape Tool on the palette further above. When edited via the shape palette, this becomes a second separate line originally based on the frame's shape for text flow of text frames below the object.</source>
-        <translation type="unfinished"></translation>
+        <translation>Jei pažymÄ—tas, tai kontÅ«ro linijÄ
 galima redaguoti formų redagavimo priemone iÅ¡ aukščiau esančios paletÄ—s. Jei redaguojama naudojant paletÄ—s formas, tai tampa atskira (antra) linija, sukurta formos rÄ—melio pagrindu, naudojama teksto rÄ—melių tekstuii apgaubti objektÄ
.</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_group.cpp" line="615"/>
         <source>Use the clipping path of the image</source>
-        <translation type="unfinished">Naudoti paveikslo apybrėžÄ
</translation>
+        <translation>Naudoti paveikslo apybrėžÄ
</translation>
     </message>
 </context>
 <context>
@@ -23396,32 +23401,32 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="14"/>
         <source>Form</source>
-        <translation type="unfinished"></translation>
+        <translation>Forma</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="26"/>
         <source>Shape</source>
-        <translation type="unfinished">Figūra</translation>
+        <translation>Figūra</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="56"/>
         <source>...</source>
-        <translation type="unfinished">...</translation>
+        <translation>...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="63"/>
         <source>&Edit...</source>
-        <translation type="unfinished">&Taisyti...</translation>
+        <translation>&Taisyti...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="75"/>
         <source>Text Flow Around Frame</source>
-        <translation type="unfinished"></translation>
+        <translation>Apgaubti rėmelį tekstu</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="96"/>
         <source>Disabled</source>
-        <translation type="unfinished"></translation>
+        <translation>Neleidžiama</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="108"/>
@@ -23430,32 +23435,32 @@
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="183"/>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="208"/>
         <source>textFlowBtnGroup</source>
-        <translation type="unfinished"></translation>
+        <translation>textFlowBtnGroup</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="121"/>
         <source>Use &Frame Shape</source>
-        <translation type="unfinished"></translation>
+        <translation>Naudoti &figūros rėmelį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="146"/>
         <source>Use &Bounding Box</source>
-        <translation type="unfinished">&Apybrėžai naudoti stačiakampį</translation>
+        <translation>&Apybrėžai naudoti stačiakampį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="171"/>
         <source>&Use Contour Line</source>
-        <translation type="unfinished">Naudoti &figÅ«ros apybrėžÄ
</translation>
+        <translation>Naudoti &kontÅ«ro linijÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="196"/>
         <source>Use Image Clip Path</source>
-        <translation type="unfinished">Naudoti paveikslo apybrėžÄ
</translation>
+        <translation>Naudoti paveikslo apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_groupbase.ui" line="215"/>
         <source>Transparency</source>
-        <translation type="unfinished">Permatomumas</translation>
+        <translation>Permatomumas</translation>
     </message>
 </context>
 <context>
@@ -23463,238 +23468,238 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="48"/>
         <source>Auto</source>
-        <translation type="unfinished">Automatiškai</translation>
+        <translation>Automatiškai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="725"/>
         <source>Actual X-DPI:</source>
-        <translation type="unfinished">Reali X raiška (tšk. col.):</translation>
+        <translation>Reali X raiška (tšk. col.):</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="726"/>
         <source>Actual Y-DPI:</source>
-        <translation type="unfinished">Reali Y raiška (tšk. col.):</translation>
+        <translation>Reali Y raiška (tšk. col.):</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="727"/>
         <source>&X-Pos:</source>
-        <translation type="unfinished">&X koord.:</translation>
+        <translation>&X koord.:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="728"/>
         <source>&Y-Pos:</source>
-        <translation type="unfinished">&Y koord:</translation>
+        <translation>&Y koord:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="729"/>
         <source>X-Sc&ale:</source>
-        <translation type="unfinished">X m&astelis:</translation>
+        <translation>X m&astelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="730"/>
         <source>Y-Scal&e:</source>
-        <translation type="unfinished">Y mas&telis:</translation>
+        <translation>Y mas&telis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="731"/>
         <source>&Free Scaling</source>
-        <translation type="unfinished">&Laisvas dydžio keitimas</translation>
+        <translation>&Laisvas rėmelio dydžio keitimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="732"/>
         <source>&Page Number:</source>
-        <translation type="unfinished">&Puslapio numeris:</translation>
+        <translation>&Puslapio numeris:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="733"/>
         <source>Rotation:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pasukimas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="735"/>
         <source>P&roportional</source>
-        <translation type="unfinished">P&roporcingai</translation>
+        <translation>P&roporcingai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="736"/>
         <source>Image Effects</source>
-        <translation type="unfinished">Paveikslų efektai</translation>
+        <translation>Paveikslų efektai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="737"/>
         <source>Extended Properties</source>
-        <translation type="unfinished"></translation>
+        <translation>Papildomos ypatybÄ—s</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="739"/>
         <source>Input Profile:</source>
-        <translation type="unfinished">Įvesties profilis:</translation>
+        <translation>Įvesties profilis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="740"/>
         <source>Rendering Intent:</source>
-        <translation type="unfinished">Vizualizavimo tikslumas:</translation>
+        <translation>Vizualizavimo tikslumas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="741"/>
         <source>Method:</source>
-        <translation type="unfinished"></translation>
+        <translation>Metodas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="742"/>
         <source>Quality:</source>
-        <translation type="unfinished"></translation>
+        <translation>KokybÄ—:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="746"/>
         <source>Perceptual</source>
-        <translation type="unfinished"></translation>
+        <translation>Samprata</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="747"/>
         <source>Relative Colorimetric</source>
-        <translation type="unfinished">Santykinis kolorimetrinis</translation>
+        <translation>Santykinis kolorimetrinis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="748"/>
         <source>Saturation</source>
-        <translation type="unfinished"></translation>
+        <translation>Grynis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="749"/>
         <source>Absolute Colorimetric</source>
-        <translation type="unfinished">Absoliutusis kolorimetrinis</translation>
+        <translation>Absoliutusis kolorimetrinis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="754"/>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="763"/>
         <source>Global</source>
-        <translation type="unfinished">Globaliai</translation>
+        <translation>Globaliai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="755"/>
         <source>Automatic</source>
-        <translation type="unfinished"></translation>
+        <translation>Automatiškai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="756"/>
         <source>Lossy - JPEG</source>
-        <translation type="unfinished">Nuostolingas – JPEG</translation>
+        <translation>Nuostolingas – JPEG</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="757"/>
         <source>Lossless - Zip</source>
-        <translation type="unfinished">Nenuostolingas – Zip</translation>
+        <translation>Nenuostolingas – Zip</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="758"/>
         <source>None</source>
-        <translation type="unfinished"></translation>
+        <translation>Ne</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="764"/>
         <source>Maximum</source>
-        <translation type="unfinished">Maksimali</translation>
+        <translation>Maksimalus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="765"/>
         <source>High</source>
-        <translation type="unfinished"></translation>
+        <translation>Aukštas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="766"/>
         <source>Medium</source>
-        <translation type="unfinished"></translation>
+        <translation>Vidutinis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="767"/>
         <source>Low</source>
-        <translation type="unfinished"></translation>
+        <translation>Žemas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="768"/>
         <source>Minimum</source>
-        <translation type="unfinished">Minimali</translation>
+        <translation>Minimalus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="771"/>
         <source> %</source>
-        <translation type="unfinished"> %</translation>
+        <translation> %</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="777"/>
         <source> pt</source>
-        <translation type="unfinished"> pt</translation>
+        <translation> pt</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="783"/>
         <source>Horizontal offset of image within frame</source>
-        <translation type="unfinished">Horizontalus paveikslo poslinkis rÄ—melyje</translation>
+        <translation>Horizontalus paveikslo poslinkis rÄ—melyje</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="784"/>
         <source>Vertical offset of image within frame</source>
-        <translation type="unfinished">Vertikalus paveikslo poslinkis rÄ—melyje</translation>
+        <translation>Vertikalus paveikslo poslinkis rÄ—melyje</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="785"/>
         <source>Resize the image horizontally</source>
-        <translation type="unfinished">Pakeisti paveikslo plotį</translation>
+        <translation>Pakeisti paveikslo plotį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="786"/>
         <source>Resize the image vertically</source>
-        <translation type="unfinished">Pakeisti paveikslo aukštį</translation>
+        <translation>Pakeisti paveikslo aukštį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="787"/>
         <source>Keep the X and Y scaling the same</source>
-        <translation type="unfinished">X ir Y mastelį laikyti vienodu</translation>
+        <translation>X ir Y mastelį laikyti vienodu</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="788"/>
         <source>Allow the image to be a different size to the frame</source>
-        <translation type="unfinished">Leisti skirtinÄ
 paveikslo ir rėmelio dydžius</translation>
+        <translation>Leisti skirtingÄ
 paveikslo ir rėmelio dydžius</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="789"/>
         <source>Make the image fit within the size of the frame</source>
-        <translation type="unfinished">Kadro matmenis pritaikyti paveikslui</translation>
+        <translation>RÄ—melio matmenis pritaikyti paveikslui</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="790"/>
         <source>Effective horizontal DPI of the image after scaling</source>
-        <translation type="unfinished">Efektyvioji horizontali paveikslo raiška (tšk. col.) pritaikius mastelį</translation>
+        <translation>Efektyvioji horizontali paveikslo raiška (tšk. col.) pritaikius mastelį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="791"/>
         <source>Effective vertical DPI of the image after scaling</source>
-        <translation type="unfinished">Efektyvioji vertikali paveikslo raiška (tšk. col.) pritaikius mastelį</translation>
+        <translation>Efektyvioji vertikali paveikslo raiška (tšk. col.) pritaikius mastelį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="792"/>
         <source>Use image proportions rather than those of the frame</source>
-        <translation type="unfinished">Paveikslo proporcijas naudoti vietoje bloko proporcijų</translation>
+        <translation>Paveikslo proporcijas naudoti vietoje bloko proporcijų</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="793"/>
         <source>Source profile of the image</source>
-        <translation type="unfinished">Paveikslo Å¡altinio profilis</translation>
+        <translation>Paveikslo Å¡altinio profilis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="794"/>
         <source>Rendering intent for the image</source>
-        <translation type="unfinished">Paveikslo vizualizavimo tikslumas</translation>
+        <translation>Paveikslo vizualizavimo tikslumas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="795"/>
         <source>Compression method used in PDF export for the image</source>
-        <translation type="unfinished">Glaudinimo metodas, kurį paveikslams naudoja PDF eksportas</translation>
+        <translation>Glaudinimo metodas, kurį paveikslams naudoja PDF eksportas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_image.cpp" line="796"/>
         <source>Compression quality used in PDF export for the image</source>
-        <translation type="unfinished">Glaudinimo kokybÄ—, kuriÄ
 paveikslams naudoja PDF eksportas</translation>
+        <translation>Glaudinimo kokybÄ—, kuriÄ
 paveikslams naudoja PDF eksportas</translation>
     </message>
 </context>
 <context>
@@ -23702,118 +23707,118 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="14"/>
         <source>Form</source>
-        <translation type="unfinished"></translation>
+        <translation>Forma</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="28"/>
         <source>X-Pos:</source>
-        <translation type="unfinished">X koord.:</translation>
+        <translation>X koord.:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="45"/>
         <source>Rotation:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pasukimas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="62"/>
         <source>&Page Number:</source>
-        <translation type="unfinished">&Puslapio numeris:</translation>
+        <translation>&Puslapio numeris:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="69"/>
         <source>Y-Pos:</source>
-        <translation type="unfinished">Y koord.:</translation>
+        <translation>Y koord.:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="86"/>
         <source>Auto</source>
-        <translation type="unfinished">Automatiškai</translation>
+        <translation>Automatiškai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="95"/>
         <source>Scaling</source>
-        <translation type="unfinished">Mastelis</translation>
+        <translation>Mastelis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="101"/>
         <source>X-Sc&ale:</source>
-        <translation type="unfinished">X m&astelis:</translation>
+        <translation>X m&astelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="118"/>
         <source>Y-Scal&e:</source>
-        <translation type="unfinished">Y mas&telis:</translation>
+        <translation>Y mas&telis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="141"/>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="180"/>
         <source>...</source>
-        <translation type="unfinished">...</translation>
+        <translation>...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="154"/>
         <source>Actual X-DPI:</source>
-        <translation type="unfinished">Reali X raiška (tšk. col.):</translation>
+        <translation>Reali X raiška (tšk. col.):</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="164"/>
         <source>Actual Y-DPI:</source>
-        <translation type="unfinished">Reali Y raiška (tšk. col.):</translation>
+        <translation>Reali Y raiška (tšk. col.):</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="193"/>
         <source>Free</source>
-        <translation type="unfinished"></translation>
+        <translation>Laisvai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="200"/>
         <source>Proportional</source>
-        <translation type="unfinished">Proporcingai</translation>
+        <translation>Proporcingai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="207"/>
         <source>To Frame Size</source>
-        <translation type="unfinished"></translation>
+        <translation>Iki rėmelio dydžio</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="217"/>
         <source>Color Management</source>
-        <translation type="unfinished">Spalvų valdymas</translation>
+        <translation>Spalvų valdymas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="223"/>
         <source>Input Profile</source>
-        <translation type="unfinished"></translation>
+        <translation>Ivesties profilis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="240"/>
         <source>Intent</source>
-        <translation type="unfinished"></translation>
+        <translation>Siekis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="253"/>
         <source>PDF Compression</source>
-        <translation type="unfinished"></translation>
+        <translation>PDF glaudinimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="259"/>
         <source>Method:</source>
-        <translation type="unfinished"></translation>
+        <translation>Metodas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="276"/>
         <source>Quality:</source>
-        <translation type="unfinished"></translation>
+        <translation>KokybÄ—:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="304"/>
         <source>Image Effects</source>
-        <translation type="unfinished">Paveikslų efektai</translation>
+        <translation>Paveikslų efektai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_imagebase.ui" line="317"/>
         <source>Extended Properties</source>
-        <translation type="unfinished"></translation>
+        <translation>Papildomos ypatybÄ—s</translation>
     </message>
 </context>
 <context>
@@ -23822,184 +23827,184 @@
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="48"/>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="684"/>
         <source>Custom</source>
-        <translation type="unfinished">Individualus</translation>
+        <translation>Individualus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="402"/>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="741"/>
         <source>No Style</source>
-        <translation type="unfinished">Be stiliaus</translation>
+        <translation>Be stiliaus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="688"/>
         <source>Left Point</source>
-        <translation type="unfinished">Kairysis taškas</translation>
+        <translation>Kairysis taškas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="689"/>
         <source>End Points</source>
-        <translation type="unfinished">Pabaigos taškai</translation>
+        <translation>Pabaigos taškai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="691"/>
         <source>&Basepoint:</source>
-        <translation type="unfinished">A&tskaitos taškas:</translation>
+        <translation>A&tskaitos taškas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="692"/>
         <source>T&ype of Line:</source>
-        <translation type="unfinished">L&inijos tipas:</translation>
+        <translation>L&inijos tipas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="693"/>
         <source>Start Arrow:</source>
-        <translation type="unfinished">Pradžios rodyklė:</translation>
+        <translation>Pradžios rodyklė:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="694"/>
         <source>End Arrow:</source>
-        <translation type="unfinished">Pabaigos rodyklÄ—:</translation>
+        <translation>Pabaigos rodyklÄ—:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="695"/>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="696"/>
         <source>Scaling:</source>
-        <translation type="unfinished">Mastelis:</translation>
+        <translation>Mastelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="706"/>
         <source>Line &Width:</source>
-        <translation type="unfinished">Linijos st&oris:</translation>
+        <translation>Linijos st&oris:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="707"/>
         <source>Ed&ges:</source>
-        <translation type="unfinished">&Kraštai:</translation>
+        <translation>&Kraštai:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="711"/>
         <source>Miter Join</source>
-        <translation type="unfinished"></translation>
+        <translation>Smailus jungimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="712"/>
         <source>Bevel Join</source>
-        <translation type="unfinished"></translation>
+        <translation>Kampuotas jungimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="713"/>
         <source>Round Join</source>
-        <translation type="unfinished"></translation>
+        <translation>Suapvalintas jungimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="718"/>
         <source>Flat Cap</source>
-        <translation type="unfinished">Plokščias viršus</translation>
+        <translation>Plokščias viršus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="719"/>
         <source>Square Cap</source>
-        <translation type="unfinished">Kvadratinis viršus</translation>
+        <translation>Kvadratinis viršus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="720"/>
         <source>Round Cap</source>
-        <translation type="unfinished">Apvalus viršus</translation>
+        <translation>Apvalus viršus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="722"/>
         <source>&Endings:</source>
-        <translation type="unfinished">&Pabaigos:</translation>
+        <translation>&Pabaigos:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="724"/>
         <source>Cell Lines</source>
-        <translation type="unfinished">Langelio linijos</translation>
+        <translation>Langelio linijos</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="725"/>
         <source>Line at Top</source>
-        <translation type="unfinished">Linija viršuje</translation>
+        <translation>Linija viršuje</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="726"/>
         <source>Line at the Left</source>
-        <translation type="unfinished">Linija kairÄ—je</translation>
+        <translation>Linija kairÄ—je</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="727"/>
         <source>Line at the Right </source>
-        <translation type="unfinished">Linija dešinje</translation>
+        <translation>Linija dešinje</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="728"/>
         <source>Line at Bottom</source>
-        <translation type="unfinished">Linija apačioje</translation>
+        <translation>Linija apačioje</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="730"/>
         <source> %</source>
-        <translation type="unfinished"> %</translation>
+        <translation> %</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="734"/>
         <source> pt</source>
-        <translation type="unfinished"> pt</translation>
+        <translation> pt</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="738"/>
         <source>Hairline</source>
-        <translation type="unfinished">Ploniausia linija</translation>
+        <translation>Ploniausia linija</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="743"/>
         <source>Change settings for left or end points</source>
-        <translation type="unfinished">Pakeisti kairiojo arba paskutinio taško nuostatas</translation>
+        <translation>Pakeisti kairiojo arba paskutinio taško nuostatas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="744"/>
         <source>Pattern of line</source>
-        <translation type="unfinished">Linijos tekstūra</translation>
+        <translation>Linijos tekstūra</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="745"/>
         <source>Thickness of line</source>
-        <translation type="unfinished">Linijos storis</translation>
+        <translation>Linijos storis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="746"/>
         <source>Type of line joins</source>
-        <translation type="unfinished">Linijos sujunginų tipas</translation>
+        <translation>Linijos sujungimų tipas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="747"/>
         <source>Type of line end</source>
-        <translation type="unfinished">Linijos pabaigos tipas</translation>
+        <translation>Linijos pabaigos tipas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="748"/>
         <source>Line style of current object</source>
-        <translation type="unfinished">Aktyviojo objekto linijos stilius</translation>
+        <translation>Aktyviojo objekto linijos stilius</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="749"/>
         <source>Arrow head style for start of line</source>
-        <translation type="unfinished">Pradžios rodyklės stilius</translation>
+        <translation>Pradžios rodyklės stilius</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="750"/>
         <source>Arrow head style for end of line</source>
-        <translation type="unfinished">Pabaigos rodyklÄ—s stilius</translation>
+        <translation>Pabaigos rodyklÄ—s stilius</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="751"/>
         <source>Arrow head scale for start of line</source>
-        <translation type="unfinished">Linijos pradžios rodyklės mastelis</translation>
+        <translation>Linijos pradžios rodyklės mastelis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_line.cpp" line="752"/>
         <source>Arrow head scale for end of line</source>
-        <translation type="unfinished">Linijos pabaigos rodyklÄ—s mastelis</translation>
+        <translation>Linijos pabaigos rodyklÄ—s mastelis</translation>
     </message>
 </context>
 <context>
@@ -24007,78 +24012,78 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="14"/>
         <source>Form</source>
-        <translation type="unfinished"></translation>
+        <translation>Forma</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="20"/>
         <source>&Basepoint:</source>
-        <translation type="unfinished">A&tskaitos taškas:</translation>
+        <translation>A&tskaitos taškas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="27"/>
         <source>T&ype of Line:</source>
-        <translation type="unfinished">L&inijos tipas:</translation>
+        <translation>L&inijos tipas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="34"/>
         <source>Start Arrow:</source>
-        <translation type="unfinished">Pradžios rodyklė:</translation>
+        <translation>Pradžios rodyklė:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="44"/>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="71"/>
         <source>Scaling:</source>
-        <translation type="unfinished">Mastelis:</translation>
+        <translation>Mastelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="87"/>
         <source>End Arrow:</source>
-        <translation type="unfinished">Pabaigos rodyklÄ—:</translation>
+        <translation>Pabaigos rodyklÄ—:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="94"/>
         <source>Line &Width:</source>
-        <translation type="unfinished">Linijos st&oris:</translation>
+        <translation>Linijos st&oris:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="101"/>
         <source>Hairline</source>
-        <translation type="unfinished">Ploniausia linija</translation>
+        <translation>Ploniausia linija</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="111"/>
         <source>Ed&ges:</source>
-        <translation type="unfinished">&Kraštai:</translation>
+        <translation>&Kraštai:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="121"/>
         <source>&Endings:</source>
-        <translation type="unfinished">&Pabaigos:</translation>
+        <translation>&Pabaigos:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="163"/>
         <source>Cell Lines</source>
-        <translation type="unfinished">Langelio linijos</translation>
+        <translation>Langelio linijos</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="169"/>
         <source>Line at the Left</source>
-        <translation type="unfinished">Linija kairÄ—je</translation>
+        <translation>Linija kairÄ—je</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="176"/>
         <source>Line at the Right</source>
-        <translation type="unfinished"></translation>
+        <translation>Linija dešinėje</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="183"/>
         <source>Line at the Bottom</source>
-        <translation type="unfinished"></translation>
+        <translation>Linija apačioje</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_linebase.ui" line="190"/>
         <source>Line at the Top</source>
-        <translation type="unfinished"></translation>
+        <translation>Linija viršuje</translation>
     </message>
 </context>
 <context>
@@ -24086,77 +24091,77 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="529"/>
         <source> pt</source>
-        <translation type="unfinished"> pt</translation>
+        <translation> pt</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="533"/>
         <source>Shape:</source>
-        <translation type="unfinished">Figūra:</translation>
+        <translation>Figūra:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="534"/>
         <source>Choose the shape of frame...</source>
-        <translation type="unfinished">Parinkti figÅ«ros formÄ
...</translation>
+        <translation>Parinkti figÅ«ros formÄ
...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="535"/>
         <source>&Edit...</source>
-        <translation type="unfinished">&Taisyti...</translation>
+        <translation>&Taisyti...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="536"/>
         <source>Set radius of corner rounding</source>
-        <translation type="unfinished">Parinkti kampų suapvalinimo spindulį</translation>
+        <translation>Parinkti kampų suapvalinimo spindulį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="537"/>
         <source>R&ound Corners:</source>
-        <translation type="unfinished"></translation>
+        <translation>Ka&mpų suapvalinimas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="538"/>
         <source>Fill Rule</source>
-        <translation type="unfinished">Ištisinis užpildymas</translation>
+        <translation>Užpildymo būdas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="539"/>
         <source>Even-Odd</source>
-        <translation type="unfinished">Lyginis-nelyginis</translation>
+        <translation>Lyginis-nelyginis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="540"/>
         <source>Non Zero</source>
-        <translation type="unfinished">Ne nulis</translation>
+        <translation>Ne nulis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="542"/>
         <source>Text &Flow Around Frame</source>
-        <translation type="unfinished">Apgaubti &rėmelį tekstu</translation>
+        <translation>Apgaubti &rėmelį tekstu</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="543"/>
         <source>Disabled</source>
-        <translation type="unfinished"></translation>
+        <translation>Neleidžiama</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="544"/>
         <source>Use Frame &Shape</source>
-        <translation type="unfinished">Naudoti kontÅ«ro &formÄ
</translation>
+        <translation>Naudoti kontÅ«ro &formÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="545"/>
         <source>Use &Bounding Box</source>
-        <translation type="unfinished">&Apybrėžai naudoti stačiakampį</translation>
+        <translation>&Apybrėžai naudoti stačiakampį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="546"/>
         <source>&Use Contour Line</source>
-        <translation type="unfinished">Naudoti &figÅ«ros apybrėžÄ
</translation>
+        <translation>Naudoti &figÅ«ros apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shape.cpp" line="547"/>
         <source>Use Image Clip Path</source>
-        <translation type="unfinished">Naudoti paveikslo apybrėžÄ
</translation>
+        <translation>Naudoti paveikslo apybrėžÄ
</translation>
     </message>
 </context>
 <context>
@@ -24164,37 +24169,37 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="14"/>
         <source>Form</source>
-        <translation type="unfinished"></translation>
+        <translation>Forma</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="26"/>
         <source>Shape</source>
-        <translation type="unfinished">Figūra</translation>
+        <translation>Figūra</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="56"/>
         <source>...</source>
-        <translation type="unfinished">...</translation>
+        <translation>...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="63"/>
         <source>&Edit...</source>
-        <translation type="unfinished">&Taisyti...</translation>
+        <translation>&Taisyti...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="74"/>
         <source>Round Corners</source>
-        <translation type="unfinished"></translation>
+        <translation>Kampų suapvalinimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="96"/>
         <source>Text Flow Around Frame</source>
-        <translation type="unfinished"></translation>
+        <translation>Apgaubti rėmelį tekstu</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="117"/>
         <source>Disabled</source>
-        <translation type="unfinished"></translation>
+        <translation>Neleidžiama</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="129"/>
@@ -24203,42 +24208,42 @@
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="204"/>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="229"/>
         <source>textFlowBtnGroup</source>
-        <translation type="unfinished"></translation>
+        <translation>textFlowBtnGroup</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="142"/>
         <source>Use &Frame Shape</source>
-        <translation type="unfinished"></translation>
+        <translation>Naudoti &figÅ«ros apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="167"/>
         <source>Use &Bounding Box</source>
-        <translation type="unfinished">&Apybrėžai naudoti stačiakampį</translation>
+        <translation>&Naudoti stačiakampį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="192"/>
         <source>&Use Contour Line</source>
-        <translation type="unfinished">Naudoti &figÅ«ros apybrėžÄ
</translation>
+        <translation>Naudoti &figÅ«ros apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="217"/>
         <source>Use Image Clip Path</source>
-        <translation type="unfinished">Naudoti paveikslo apybrėžÄ
</translation>
+        <translation>Naudoti paveikslo apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="247"/>
         <source>Fill Rule</source>
-        <translation type="unfinished">Ištisinis užpildymas</translation>
+        <translation>Užpildymo būdas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="281"/>
         <source>Even-Odd</source>
-        <translation type="unfinished">Lyginis-nelyginis</translation>
+        <translation>Lyginis-nelyginis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_shapebase.ui" line="294"/>
         <source>Non Zero</source>
-        <translation type="unfinished">Ne nulis</translation>
+        <translation>Ne nulis</translation>
     </message>
 </context>
 <context>
@@ -24247,122 +24252,122 @@
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="69"/>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="915"/>
         <source>Color & Effects</source>
-        <translation type="unfinished">Spalvos ir efektai</translation>
+        <translation>Spalvos ir efektai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="72"/>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="917"/>
         <source>First Line Offset</source>
-        <translation type="unfinished">Pirmosios eilutÄ—s nuleidimas</translation>
+        <translation>Pirmosios eilutÄ—s nuleidimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="75"/>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="918"/>
         <source>Columns & Text Distances</source>
-        <translation type="unfinished"></translation>
+        <translation>Stulpeliai & Atstumai iki teksto</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="79"/>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="919"/>
         <source>Optical Margins</source>
-        <translation type="unfinished">Optinės paraštės</translation>
+        <translation>Optinės paraštės</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="84"/>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="916"/>
         <source>Advanced Settings</source>
-        <translation type="unfinished">Papildomos nuostatos</translation>
+        <translation>Papildomos nuostatos</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="88"/>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="920"/>
         <source>Path Text Properties</source>
-        <translation type="unfinished">KreivÄ—s teksto ypatybÄ—s</translation>
+        <translation>KreivÄ—s teksto ypatybÄ—s</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="530"/>
         <source>Auto</source>
-        <translation type="unfinished">Automatiškai</translation>
+        <translation>Automatiškai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="532"/>
         <source>Baseline</source>
-        <translation type="unfinished">BazinÄ— linija</translation>
+        <translation>BazinÄ— linija</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="680"/>
         <source>Distance between columns</source>
-        <translation type="unfinished">Atstumas tarp stulpelių</translation>
+        <translation>Atstumas tarp stulpelių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="682"/>
         <source>Column width</source>
-        <translation type="unfinished">Stulpelio plotis</translation>
+        <translation>Stulpelio plotis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="912"/>
         <source>Paragraph St&yle:</source>
-        <translation type="unfinished">Pastraipos st&ilius:</translation>
+        <translation>Pastraipos st&ilius:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="913"/>
         <source>Character St&yle:</source>
-        <translation type="unfinished">Rašmens st&ilius:</translation>
+        <translation>Rašmens st&ilius:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="925"/>
         <source>Fixed Linespacing</source>
-        <translation type="unfinished"></translation>
+        <translation>Fiksuotas intervalas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="926"/>
         <source>Automatic Linespacing</source>
-        <translation type="unfinished"></translation>
+        <translation>Automatinis intervalas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="927"/>
         <source>Align to Baseline Grid</source>
-        <translation type="unfinished"></translation>
+        <translation>Lygiuoti pagal bazinį tinklelį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="930"/>
         <source> pt</source>
-        <translation type="unfinished"> pt</translation>
+        <translation> pt</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="943"/>
         <source>Font Size</source>
-        <translation type="unfinished">Å rifto dydis</translation>
+        <translation>Å rifto dydis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="945"/>
         <source>Line Spacing</source>
-        <translation type="unfinished">Intervalas tarp eilučių</translation>
+        <translation>Intervalas tarp eilučių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="946"/>
         <source>Select the line spacing mode.</source>
-        <translation type="unfinished">Parinkti intervalų tarp eilučių veiksenÄ
.</translation>
+        <translation>Parinkti intervalų tarp eilučių veiksenÄ
.</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="947"/>
         <source>Paragraph style of currently selected text or paragraph</source>
-        <translation type="unfinished">Pastraipos stilius, pritaikytas šiuo metu pažymėtam tekstui ar pastraipai</translation>
+        <translation>Pastraipos stilius, pritaikytas šiuo metu pažymėtam tekstui ar pastraipai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="948"/>
         <source>Character style of currently selected text or paragraph</source>
-        <translation type="unfinished">Rašmens stilius, pritaikytas šiuo metu pažymėtam tekstui ar pastraipai</translation>
+        <translation>Rašmens stilius, pritaikytas šiuo metu pažymėtam tekstui ar pastraipai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="949"/>
         <source>Remove Direct Paragraph Formatting</source>
-        <translation type="unfinished">PaÅ¡alinti tiesioginį pastraipų formatavimÄ
</translation>
+        <translation>PaÅ¡alinti tiesioginį pastraipų formatavimÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_text.cpp" line="950"/>
         <source>Remove Direct Character Formatting</source>
-        <translation type="unfinished">PaÅ¡alinti tiesioginį raÅ¡menų formatavimÄ
</translation>
+        <translation>PaÅ¡alinti tiesioginį raÅ¡menų formatavimÄ
</translation>
     </message>
 </context>
 <context>
@@ -24370,7 +24375,7 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_textbase.ui" line="14"/>
         <source>Form</source>
-        <translation type="unfinished"></translation>
+        <translation>Forma</translation>
     </message>
 </context>
 <context>
@@ -24383,14 +24388,14 @@
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="506"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1381"/>
         <source>&X-Pos:</source>
-        <translation type="unfinished">&X koord.:</translation>
+        <translation>&X koord.:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="215"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="238"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="371"/>
         <source>&Width</source>
-        <translation type="unfinished"></translation>
+        <translation>&Plotis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="216"/>
@@ -24400,7 +24405,7 @@
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="508"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1382"/>
         <source>&Y-Pos:</source>
-        <translation type="unfinished">&Y koord:</translation>
+        <translation>&Y koord:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="217"/>
@@ -24410,178 +24415,178 @@
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="509"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1384"/>
         <source>&Height:</source>
-        <translation type="unfinished">&Aukštis:</translation>
+        <translation>&Aukštis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="247"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="362"/>
         <source>&X1:</source>
-        <translation type="unfinished">&X1:</translation>
+        <translation>&X1:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="248"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="363"/>
         <source>X&2:</source>
-        <translation type="unfinished">X&2:</translation>
+        <translation>X&2:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="249"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="364"/>
         <source>Y&1:</source>
-        <translation type="unfinished">Y&1:</translation>
+        <translation>Y&1:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="250"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="365"/>
         <source>&Y2:</source>
-        <translation type="unfinished">&Y2:</translation>
+        <translation>&Y2:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="439"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="507"/>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1383"/>
         <source>&Width:</source>
-        <translation type="unfinished">&Plotis:</translation>
+        <translation>&Plotis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1314"/>
         <source>Name "%1" isn't unique.<br/>Please choose another.</source>
-        <translation type="unfinished"></translation>
+        <translation>Vardas "%1" jau yra.<br/>PraÅ¡om parinkti kitÄ
.</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1377"/>
         <source>Properties</source>
-        <translation type="unfinished">YpatybÄ—s</translation>
+        <translation>YpatybÄ—s</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1379"/>
         <source>Name</source>
-        <translation type="unfinished">Pavadinimas</translation>
+        <translation>Pavadinimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1380"/>
         <source>Geometry</source>
-        <translation type="unfinished">Geometrija</translation>
+        <translation>Geometrija</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1385"/>
         <source>&Rotation:</source>
-        <translation type="unfinished">Pa&sukimo kampas:</translation>
+        <translation>Pa&sukimo kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1386"/>
         <source>Basepoint:</source>
-        <translation type="unfinished">Atskaitos taškas:</translation>
+        <translation>Atskaitos taškas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1387"/>
         <source>Level</source>
-        <translation type="unfinished">Lygmuo</translation>
+        <translation>Lygmuo</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1389"/>
         <source> pt</source>
-        <translation type="unfinished"> pt</translation>
+        <translation> pt</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1398"/>
         <source>Name of selected object</source>
-        <translation type="unfinished">Pasirinkto objekto pavadinimas</translation>
+        <translation>Pasirinkto objekto pavadinimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1399"/>
         <source>Horizontal position of current basepoint</source>
-        <translation type="unfinished">Atskaitos taško horizontalioji pozicija</translation>
+        <translation>Atskaitos taško horizontalioji pozicija</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1400"/>
         <source>Vertical position of current basepoint</source>
-        <translation type="unfinished">Atskaitos taško vertikalioji pozicija</translation>
+        <translation>Atskaitos taško vertikalioji pozicija</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1401"/>
         <source>Width</source>
-        <translation type="unfinished">Plotis</translation>
+        <translation>Plotis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1402"/>
         <source>Height</source>
-        <translation type="unfinished">Aukštis</translation>
+        <translation>Aukštis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1403"/>
         <source>Rotation of object at current basepoint</source>
-        <translation type="unfinished">Objekto sukimas apie atskaitos taÅ¡kÄ
</translation>
+        <translation>Objekto sukimas apie atskaitos taÅ¡kÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1404"/>
         <source>Point from which measurements or rotation angles are referenced</source>
-        <translation type="unfinished">Taškas, kurio atžvilgiu atliekami skaičiavimai arba sukamas objektas</translation>
+        <translation>Taškas, kurio atžvilgiu atliekami skaičiavimai arba sukamas objektas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1405"/>
         <source>Group the selected objects</source>
-        <translation type="unfinished">Sugrupuoti pažymėtus objektus</translation>
+        <translation>Sugrupuoti pažymėtus objektus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1406"/>
         <source>Ungroup the selected group</source>
-        <translation type="unfinished">IÅ¡grupuoti pažymÄ—tÄ
 grupÄ™</translation>
+        <translation>IÅ¡grupuoti pažymÄ—tÄ
 grupÄ™</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1407"/>
         <source>Flip Horizontal</source>
-        <translation type="unfinished">AtspindÄ—ti horizontaliai</translation>
+        <translation>AtspindÄ—ti horizontaliai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1408"/>
         <source>Flip Vertical</source>
-        <translation type="unfinished">AtspindÄ—ti vertikaliai</translation>
+        <translation>AtspindÄ—ti vertikaliai</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1409"/>
         <source>Move one level up</source>
-        <translation type="unfinished">Pakelti į aukštesnį lygmenį</translation>
+        <translation>Pakelti į aukštesnį lygmenį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1410"/>
         <source>Move one level down</source>
-        <translation type="unfinished">Nuleisti į žemesnį lygmenį</translation>
+        <translation>Nuleisti į žemesnį lygmenį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1411"/>
         <source>Move to front</source>
-        <translation type="unfinished">Perkelti į viršų</translation>
+        <translation>Perkelti į viršų</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1412"/>
         <source>Move to back</source>
-        <translation type="unfinished">Nuleisti į apačiÄ
</translation>
+        <translation>Nuleisti į apačiÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1413"/>
         <source>Indicates the level the object is on, 0 means the object is at the bottom</source>
-        <translation type="unfinished">Objektų lygis kitų objektų atžvilgiu; nulis reiškia kad objektas yra apačioje</translation>
+        <translation>Objektų lygis kitų objektų atžvilgiu; nulis reiškia kad objektas yra apačioje</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1414"/>
         <source>Lock or unlock the object</source>
-        <translation type="unfinished">Prirakinti arba atrakinti objektÄ
</translation>
+        <translation>Prirakinti arba atrakinti objektÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1415"/>
         <source>Lock or unlock the size of the object</source>
-        <translation type="unfinished">Leisti arba drausti keisti objekto dydį</translation>
+        <translation>Leisti arba drausti keisti objekto dydį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1416"/>
         <source>Enable or disable exporting of the object</source>
-        <translation type="unfinished">Leisti arba drausti eksportuoti objektÄ
</translation>
+        <translation>Leisti arba drausti eksportuoti objektÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyz.cpp" line="1418"/>
         <source>Keep the aspect ratio</source>
-        <translation type="unfinished">IÅ¡laikyti proporcijas</translation>
+        <translation>IÅ¡laikyti proporcijas</translation>
     </message>
 </context>
 <context>
@@ -24589,62 +24594,62 @@
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="14"/>
         <source>Form</source>
-        <translation type="unfinished"></translation>
+        <translation>Forma</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="32"/>
         <source>Name</source>
-        <translation type="unfinished">Pavadinimas</translation>
+        <translation>Pavadinimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="60"/>
         <source>Geometry</source>
-        <translation type="unfinished">Geometrija</translation>
+        <translation>Geometrija</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="77"/>
         <source>&X-Pos:</source>
-        <translation type="unfinished">&X koord.:</translation>
+        <translation>&X koord.:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="94"/>
         <source>&Width:</source>
-        <translation type="unfinished">&Plotis:</translation>
+        <translation>&Plotis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="101"/>
         <source>&Y-Pos:</source>
-        <translation type="unfinished">&Y koord:</translation>
+        <translation>&Y koord:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="114"/>
         <source>&Height:</source>
-        <translation type="unfinished">&Aukštis:</translation>
+        <translation>&Aukštis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="124"/>
         <source>&Rotation:</source>
-        <translation type="unfinished">Pa&sukimo kampas:</translation>
+        <translation>Pa&sukimo kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="138"/>
         <source>Basepoint:</source>
-        <translation type="unfinished">Atskaitos taškas:</translation>
+        <translation>Atskaitos taškas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="154"/>
         <source>...</source>
-        <translation type="unfinished">...</translation>
+        <translation>...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="174"/>
         <source>Level</source>
-        <translation type="unfinished">Lygmuo</translation>
+        <translation>Lygmuo</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertiespalette_xyzbase.ui" line="238"/>
         <source>0</source>
-        <translation type="unfinished">270° {0?}</translation>
+        <translation>0</translation>
     </message>
 </context>
 <context>
@@ -24652,73 +24657,73 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="300"/>
         <source>Word Tracking</source>
-        <translation type="unfinished">Žodžių retinimas</translation>
+        <translation>Žodžių retinimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="301"/>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="304"/>
         <source>Min:</source>
-        <translation type="unfinished">Min:</translation>
+        <translation>Min:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="302"/>
         <source>Norm:</source>
-        <translation type="unfinished">Įpr.:</translation>
+        <translation>Įpr.:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="303"/>
         <source>Glyph Extension</source>
-        <translation type="unfinished">Rašmenų išplėtimas</translation>
+        <translation>Rašmenų išplėtimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="305"/>
         <source>Max:</source>
-        <translation type="unfinished">Maks:</translation>
+        <translation>Maks:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="307"/>
         <source> %</source>
-        <translation type="unfinished"> %</translation>
+        <translation> %</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="317"/>
         <source>Offset to baseline of characters</source>
-        <translation type="unfinished">Rašmenų bazinės linijos poslinkis</translation>
+        <translation>Paslinkti iki rašmenų bazinės linijos</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="318"/>
         <source>Manual Tracking</source>
-        <translation type="unfinished"></translation>
+        <translation>Pasirinktinis retinimas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="319"/>
         <source>Scaling width of characters</source>
-        <translation type="unfinished">Rašmenų pločio mastelis</translation>
+        <translation>Rašmenų pločio mastelis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="320"/>
         <source>Scaling height of characters</source>
-        <translation type="unfinished">Rašmenų aukščio mastelis</translation>
+        <translation>Rašmenų aukščio mastelis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="322"/>
         <source>Minimal width of spaces between words</source>
-        <translation type="unfinished">Mažiausias atstumas tarp žodžių</translation>
+        <translation>Mažiausias atstumas tarp žodžių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="323"/>
         <source>Normal width of spaces between words</source>
-        <translation type="unfinished">Normalus tarpų tarp žodžių dydis</translation>
+        <translation>Normalus tarpų tarp žodžių dydis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="324"/>
         <source>Minimal shrinkage of glyphs for justification</source>
-        <translation type="unfinished">Mažiausias rašmenų sutraukimas abipusio lygiavimo atveju</translation>
+        <translation>Mažiausias rašmenų sutraukimas abipusio lygiavimo atveju</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advanced.cpp" line="325"/>
         <source>Maximal extension of glyphs for justification</source>
-        <translation type="unfinished">Maksimalus rašmenų išplėtimas abipusio lygiavimo atveju</translation>
+        <translation>Maksimalus rašmenų išplėtimas abipusio lygiavimo atveju</translation>
     </message>
 </context>
 <context>
@@ -24726,29 +24731,29 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_advancedbase.ui" line="14"/>
         <source>Frame</source>
-        <translation type="unfinished">RÄ—melis</translation>
+        <translation>RÄ—melis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advancedbase.ui" line="79"/>
         <source>Word Spacing</source>
-        <translation type="unfinished"></translation>
+        <translation>Atstumai tarp žodžių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advancedbase.ui" line="86"/>
         <location filename="../../../scribus/ui/propertywidget_advancedbase.ui" line="133"/>
         <source>Min:</source>
-        <translation type="unfinished">Min:</translation>
+        <translation>Min:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advancedbase.ui" line="119"/>
         <location filename="../../../scribus/ui/propertywidget_advancedbase.ui" line="166"/>
         <source>Max:</source>
-        <translation type="unfinished">Maks:</translation>
+        <translation>Maks:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_advancedbase.ui" line="126"/>
         <source>Glyph Extension</source>
-        <translation type="unfinished">Rašmenų išplėtimas</translation>
+        <translation>Rašmenų išplėtimas</translation>
     </message>
 </context>
 <context>
@@ -24756,87 +24761,87 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="111"/>
         <source>Colu&mns:</source>
-        <translation type="unfinished"></translation>
+        <translation>Stu&lpeliai:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="115"/>
         <source>Gap:</source>
-        <translation type="unfinished">Intervalas:</translation>
+        <translation>Tarpelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="116"/>
         <source>Width:</source>
-        <translation type="unfinished">Plotis:</translation>
+        <translation>Plotis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="119"/>
         <source>To&p:</source>
-        <translation type="unfinished">Nuo &viršaus:</translation>
+        <translation>Nuo &viršaus:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="120"/>
         <source>&Bottom:</source>
-        <translation type="unfinished"></translation>
+        <translation>Nuo &apačios:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="121"/>
         <source>&Left:</source>
-        <translation type="unfinished"></translation>
+        <translation>IÅ¡ &kairÄ—s:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="122"/>
         <source>&Right:</source>
-        <translation type="unfinished"></translation>
+        <translation>Iš &dešinės:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="124"/>
         <source>T&abulators...</source>
-        <translation type="unfinished">T&abuliatoriai...</translation>
+        <translation>Ta&buliatoriai...</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="126"/>
         <source> pt</source>
-        <translation type="unfinished"> pt</translation>
+        <translation> pt</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="136"/>
         <source>Number of columns in text frame</source>
-        <translation type="unfinished">Tekstinio rėmelio stulpelių skaičius</translation>
+        <translation>Tekstinio rėmelio stulpelių skaičius</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="137"/>
         <source>Switches between Gap or Column width</source>
-        <translation type="unfinished">Perjungia tarp intervalo ir stulpelio pločio</translation>
+        <translation>Pereiti nuo tarpelio prie stulpelio pločio (arba atvirkščiai)</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="138"/>
         <source>Distance between columns</source>
-        <translation type="unfinished">Atstumas tarp stulpelių</translation>
+        <translation>Atstumas tarp stulpelių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="139"/>
         <source>Distance of text from top of frame</source>
-        <translation type="unfinished">Atstumas iki teksto nuo rėmelio viršaus</translation>
+        <translation>Atstumas iki teksto nuo rėmelio viršaus</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="140"/>
         <source>Distance of text from bottom of frame</source>
-        <translation type="unfinished">Atstumas iki teksto nuo rėmelio apačios</translation>
+        <translation>Atstumas iki teksto nuo rėmelio apačios</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="141"/>
         <source>Distance of text from left of frame</source>
-        <translation type="unfinished">Atstumas iki teksto nuo rÄ—melio kairÄ—s</translation>
+        <translation>Atstumas iki teksto nuo rÄ—melio kairÄ—s</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="142"/>
         <source>Distance of text from right of frame</source>
-        <translation type="unfinished">Atstumas iki teksto nuo rėmelio dešinės</translation>
+        <translation>Atstumas iki teksto nuo rėmelio dešinės</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distance.cpp" line="143"/>
         <source>Edit tab settings of text frame...</source>
-        <translation type="unfinished">Taisyti teksto rÄ—melio nuostatas...</translation>
+        <translation>Taisyti teksto rėmelio tabuliatorių nuostatas...</translation>
     </message>
 </context>
 <context>
@@ -24844,47 +24849,47 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="14"/>
         <source>Frame</source>
-        <translation type="unfinished">RÄ—melis</translation>
+        <translation>RÄ—melis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="32"/>
         <source>Colu&mns:</source>
-        <translation type="unfinished"></translation>
+        <translation>Stu&lpeliai:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="50"/>
         <source>Gap:</source>
-        <translation type="unfinished">Intervalas:</translation>
+        <translation>Tarpelis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="55"/>
         <source>Width:</source>
-        <translation type="unfinished">Plotis:</translation>
+        <translation>Plotis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="66"/>
         <source>To&p:</source>
-        <translation type="unfinished">Nuo &viršaus:</translation>
+        <translation>Nuo &viršaus:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="76"/>
         <source>&Bottom:</source>
-        <translation type="unfinished"></translation>
+        <translation>Nuo &apačios:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="86"/>
         <source>&Left:</source>
-        <translation type="unfinished"></translation>
+        <translation>IÅ¡ &kairÄ—s:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="96"/>
         <source>&Right:</source>
-        <translation type="unfinished"></translation>
+        <translation>Iš &dešinės:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_distancebase.ui" line="112"/>
         <source>T&abulators...</source>
-        <translation type="unfinished">T&abuliatoriai...</translation>
+        <translation>Ta&buliatoriai...</translation>
     </message>
 </context>
 <context>
@@ -24892,32 +24897,32 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_flop.cpp" line="50"/>
         <source>Maximum Ascent</source>
-        <translation type="unfinished">Pagal aukščiausiÄ
 eilutės rašmenį</translation>
+        <translation>Pagal aukščiausiÄ
 eilutės rašmenį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flop.cpp" line="51"/>
         <source>Font Ascent</source>
-        <translation type="unfinished">Pagal aukščiausiÄ
 šrifto rašmenį</translation>
+        <translation>Pagal aukščiausiÄ
 šrifto rašmenį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flop.cpp" line="52"/>
         <source>Line Spacing</source>
-        <translation type="unfinished">Intervalas tarp eilučių</translation>
+        <translation>Intervalas tarp eilučių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flop.cpp" line="54"/>
         <source>Set the height of the first line of the text frame to use the tallest height of the included characters</source>
-        <translation type="unfinished">Nustatyti pirmosios teksto rÄ—melio eilutÄ—s aukÅ¡tį pagal aukščiausiÄ
 tos eilutės rašmenį</translation>
+        <translation>Nustatyti pirmosios teksto rÄ—melio eilutÄ—s aukÅ¡tį pagal aukščiausiÄ
 tos eilutės rašmenį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flop.cpp" line="55"/>
         <source>Set the height of the first line of text frame to use the full ascent of the font(s) in use</source>
-        <translation type="unfinished">Nustatyti pirmosios teksto rÄ—melio eilutÄ—s aukÅ¡tį pagal aukščiausiÄ
 jame panaudotų šriftų rašmenį</translation>
+        <translation>Nustatyti pirmosios teksto rÄ—melio eilutÄ—s aukÅ¡tį pagal aukščiausiÄ
 jame panaudotų šriftų rašmenį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flop.cpp" line="56"/>
         <source>Set the height of the first line of the text frame to the specified line height</source>
-        <translation type="unfinished">Nustatyti nurodytÄ
 pirmosios teksto rėmelio eilutės aukštį</translation>
+        <translation>Nustatyti nurodytÄ
 pirmosios teksto rėmelio eilutės aukštį</translation>
     </message>
 </context>
 <context>
@@ -24925,29 +24930,30 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_flopbase.ui" line="14"/>
         <source>Frame</source>
-        <translation type="unfinished">RÄ—melis</translation>
+        <translation>RÄ—melis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flopbase.ui" line="26"/>
         <source>Maximum Ascent</source>
-        <translation type="unfinished">Pagal aukščiausiÄ
 eilutės rašmenį</translation>
+        <translation>Pagal aukščiausiÄ
 eilutės rašmenį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flopbase.ui" line="29"/>
         <location filename="../../../scribus/ui/propertywidget_flopbase.ui" line="39"/>
         <location filename="../../../scribus/ui/propertywidget_flopbase.ui" line="49"/>
         <source>flopGroup</source>
-        <translation type="unfinished"></translation>
+        <translatorcomment>Nežinau, kas tai...</translatorcomment>
+        <translation>flopGroup</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flopbase.ui" line="36"/>
         <source>Font Ascent</source>
-        <translation type="unfinished">Pagal aukščiausiÄ
 šrifto rašmenį</translation>
+        <translation>Pagal aukščiausiÄ
 šrifto rašmenį</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_flopbase.ui" line="46"/>
         <source>Line Spacing</source>
-        <translation type="unfinished">Intervalas tarp eilučių</translation>
+        <translation>Intervalas tarp eilučių</translation>
     </message>
 </context>
 <context>
@@ -24956,30 +24962,30 @@
         <location filename="../../../scribus/ui/propertywidget_optmargins.cpp" line="48"/>
         <source>None</source>
         <comment>optical margins</comment>
-        <translation type="unfinished"></translation>
+        <translation>NÄ—ra</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmargins.cpp" line="49"/>
         <source>Both Sides</source>
         <comment>optical margins</comment>
-        <translation type="unfinished">Abi pusÄ—s</translation>
+        <translation>Iš abiejų pusių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmargins.cpp" line="50"/>
         <source>Left Only</source>
         <comment>optical margins</comment>
-        <translation type="unfinished">Tik kairÄ—</translation>
+        <translation>Tik iš kairės</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmargins.cpp" line="51"/>
         <source>Right Only</source>
         <comment>optical margins</comment>
-        <translation type="unfinished">Tik dešinė</translation>
+        <translation>Tik iš dešinės</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmargins.cpp" line="52"/>
         <source>Reset</source>
-        <translation type="unfinished">Atstatyti</translation>
+        <translation>Atstatyti</translation>
     </message>
 </context>
 <context>
@@ -24987,32 +24993,32 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmarginsbase.ui" line="14"/>
         <source>Frame</source>
-        <translation type="unfinished">RÄ—melis</translation>
+        <translation>RÄ—melis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmarginsbase.ui" line="32"/>
         <source>None</source>
-        <translation type="unfinished"></translation>
+        <translation>NÄ—ra</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmarginsbase.ui" line="39"/>
         <source>Both Sides</source>
-        <translation type="unfinished">Abi pusÄ—s</translation>
+        <translation>Iš abiejų pusių</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmarginsbase.ui" line="46"/>
         <source>Left Only</source>
-        <translation type="unfinished">Tik kairÄ—</translation>
+        <translation>Tik iš kairės</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmarginsbase.ui" line="53"/>
         <source>Right Only</source>
-        <translation type="unfinished">Tik dešinė</translation>
+        <translation>Tik iš dešinės</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_optmarginsbase.ui" line="60"/>
         <source>Reset</source>
-        <translation type="unfinished">Atstatyti</translation>
+        <translation>Atstatyti</translation>
     </message>
 </context>
 <context>
@@ -25020,47 +25026,47 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="79"/>
         <source>Default</source>
-        <translation type="unfinished">Numatytasis</translation>
+        <translation>Numatytasis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="80"/>
         <source>Stair Step</source>
-        <translation type="unfinished">Žvaigždės pakopa</translation>
+        <translation>Žvaigždės pakopa</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="81"/>
         <source>Skew</source>
-        <translation type="unfinished"></translation>
+        <translation>Pokrypis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="84"/>
         <source>Flip Text</source>
-        <translation type="unfinished">AtspindÄ—ti tekstÄ
</translation>
+        <translation>AtspindÄ—ti tekstÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="85"/>
         <source>Show Curve</source>
-        <translation type="unfinished">Rodyti kreivÄ™</translation>
+        <translation>Rodyti kreivÄ™</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="86"/>
         <source>Type:</source>
-        <translation type="unfinished">Tipas:</translation>
+        <translation>Tipas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="87"/>
         <source>Start Offset:</source>
-        <translation type="unfinished">Poslinkio pradžia:</translation>
+        <translation>Poslinkio pradžia:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="88"/>
         <source>Distance from Curve:</source>
-        <translation type="unfinished">Atstumas nuo kreivÄ—s:</translation>
+        <translation>Atstumas nuo kreivÄ—s:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtext.cpp" line="90"/>
         <source> pt</source>
-        <translation type="unfinished"> pt</translation>
+        <translation> pt</translation>
     </message>
 </context>
 <context>
@@ -25068,32 +25074,32 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtextbase.ui" line="14"/>
         <source>Frame</source>
-        <translation type="unfinished">RÄ—melis</translation>
+        <translation>RÄ—melis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtextbase.ui" line="32"/>
         <source>Type:</source>
-        <translation type="unfinished">Tipas:</translation>
+        <translation>Tipas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtextbase.ui" line="42"/>
         <source>Start Offset:</source>
-        <translation type="unfinished">Poslinkio pradžia:</translation>
+        <translation>Poslinkio pradžia:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtextbase.ui" line="52"/>
         <source>Distance from Curve:</source>
-        <translation type="unfinished">Atstumas nuo kreivÄ—s:</translation>
+        <translation>Atstumas nuo kreivÄ—s:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtextbase.ui" line="62"/>
         <source>Flip Text</source>
-        <translation type="unfinished">AtspindÄ—ti tekstÄ
</translation>
+        <translation>AtspindÄ—ti tekstÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_pathtextbase.ui" line="69"/>
         <source>Show Curve</source>
-        <translation type="unfinished">Rodyti kreivÄ™</translation>
+        <translation>Rodyti kreivÄ™</translation>
     </message>
 </context>
 <context>
@@ -25101,27 +25107,27 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_textcolor.cpp" line="399"/>
         <source>Color of selected text. If Outline text decoration is enabled, this color will be the fill color. If Drop Shadow Text is enabled, then this will be the top most color.</source>
-        <translation type="unfinished">Pažymėto teksto spalva. Jei teksto kontūro puošyba leidžiama, ši spalva bus užpildo spalva. Jei leidžiami teksto šešėliai, tai ši spalva bus viršutinė.</translation>
+        <translation>Pažymėto teksto spalva. Jei teksto kontūro puošyba leidžiama, ši spalva bus užpildo spalva. Jei leidžiami teksto šešėliai, tai ši spalva bus viršutinė.</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_textcolor.cpp" line="400"/>
         <source>Color of text stroke and/or drop shadow, depending which is chosen.If both are chosen, then they share the same color.</source>
-        <translation type="unfinished">Teksto apvado ar šešėlių spalva, priklausomai nuo to, kas pasirinkta. Jei pasirinkti abu, tai jų spalva bus ta pati. </translation>
+        <translation>Teksto apvado ar šešėlių spalva, priklausomai nuo to, kas pasirinkta. Jei pasirinkti abu, tai jų spalva bus ta pati. </translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_textcolor.cpp" line="401"/>
         <source>Saturation of color of text fill</source>
-        <translation type="unfinished">Teksto užpildo spalvos grynis</translation>
+        <translation>Teksto užpildo spalvos grynis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_textcolor.cpp" line="402"/>
         <source>Saturation of color of text stroke</source>
-        <translation type="unfinished">Teksto apvado spalvos grynis</translation>
+        <translation>Teksto apvado spalvos grynis</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/propertywidget_textcolor.cpp" line="404"/>
         <source>Right to Left Writing</source>
-        <translation type="unfinished">Rašymas iš dešinės kairėn</translation>
+        <translation>Rašymas iš dešinės į kairę</translation>
     </message>
 </context>
 <context>
@@ -25129,7 +25135,7 @@
     <message>
         <location filename="../../../scribus/ui/propertywidget_textcolorbase.ui" line="14"/>
         <source>Frame</source>
-        <translation type="unfinished">RÄ—melis</translation>
+        <translation>RÄ—melis</translation>
     </message>
 </context>
 <context>
@@ -26333,7 +26339,7 @@
         <location filename="../../../scribus/plugins/scriptplugin/cmdtext.cpp" line="175"/>
         <source>Cannot get column gap of non-text frame.</source>
         <comment>python error</comment>
-        <translation>Negalima gauti atstumo tarp skilčių netekstiniame rėmelyje.</translation>
+        <translation>Negalima nustatyti tarpelio tarp skilčių netekstiniame rėmelyje.</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/scriptplugin/cmdtext.cpp" line="194"/>
@@ -26644,13 +26650,13 @@
         <location filename="../../../scribus/plugins/scriptplugin/cmdtext.cpp" line="533"/>
         <source>Column gap out of bounds, must be positive.</source>
         <comment>python error</comment>
-        <translation>Atstumas tarp skilčių privalo būti teigiamas skaičius.</translation>
+        <translation>Tarpelis tarp skilčių privalo būti teigiamas skaičius.</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/scriptplugin/cmdtext.cpp" line="541"/>
         <source>Cannot set column gap on a non-text frame.</source>
         <comment>python error</comment>
-        <translation>Netekstiniam objektui negalima nurodyti atstumo tarp skilčių.</translation>
+        <translation>Netekstiniam objektui negalima nurodyti tarpelio tarp skilčių.</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/scriptplugin/cmdtext.cpp" line="560"/>
@@ -28480,27 +28486,27 @@
     <message>
         <location filename="../../../scribus/plugins/fileloader/scribus150format/scribus150format.cpp" line="72"/>
         <source>Scribus 1.5.0+ Support</source>
-        <translation type="unfinished">„Scribus 1.3.4“ ir naujesnių palaikymas {1.5.0+?}</translation>
+        <translation>„Scribus 1.5.0+“ palaikymas</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshapeplugin.cpp" line="65"/>
         <source>Shape Importer</source>
-        <translation type="unfinished"></translation>
+        <translation>Formų importuoklis</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsmlplugin.cpp" line="72"/>
         <source>Sml Importer</source>
-        <translation type="unfinished"></translation>
+        <translation>Diagramų (sml) importuoklis</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/flattenpath/flattenpath.cpp" line="93"/>
         <source>FlattenPath</source>
-        <translation type="unfinished"></translation>
+        <translation>Plokščia apybrėža</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/smoothpath/smoothpath.cpp" line="99"/>
         <source>SmoothPath</source>
-        <translation type="unfinished"></translation>
+        <translation>Glodi apybrėža</translation>
     </message>
 </context>
 <context>
@@ -30222,7 +30228,7 @@
     <message>
         <location filename="../../../scribus/plugins/fileloader/scribus12format/scribus12format.cpp" line="474"/>
         <source>Group%1</source>
-        <translation type="unfinished">GrupÄ— %1</translation>
+        <translation>GrupÄ— %1</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/fileloader/scribus12format/scribus12format.cpp" line="1273"/>
@@ -30298,12 +30304,12 @@
     <message>
         <location filename="../../../scribus/plugins/fileloader/scribus150format/scribus150format.cpp" line="82"/>
         <source>Scribus 1.5.0+ File Format Support</source>
-        <translation type="unfinished">„Scribus 1.3.4“ (ir naujesnių) formato failų palaikymas {1.5.0+?}</translation>
+        <translation>„Scribus 1.5.0+“ formato failų palaikymas</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/fileloader/scribus150format/scribus150format.cpp" line="83"/>
         <source>Allows Scribus to read Scribus 1.5.0 and higher formatted files.</source>
-        <translation type="unfinished">Leisti „Scribus“ skaityti „Scribus 1.3.4“ ir vėlesnių versijų dokumentus. {1.5.0 ?}</translation>
+        <translation>Leisti „Scribus“ skaityti „Scribus 1.5.0“ ir vėlesnių versijų dokumentus.</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/fileloader/scribus150format/scribus150format.cpp" line="100"/>
@@ -30802,8 +30808,8 @@
 Horizontal gap: %2
 Vertical gap: %3</source>
         <translation>Kopijų skaičius: %1
-Horizontalus intervalas: %2
-Vertikalus intervalas: %3</translation>
+Horizontalus tarpelis: %2
+Vertikalus tarpelis: %3</translation>
     </message>
     <message>
         <location filename="../../../scribus/scribusdoc.cpp" line="894"/>
@@ -31036,7 +31042,7 @@
     <message>
         <location filename="../../../scribus/scribus.cpp" line="3734"/>
         <source>The file may be damaged or may have been produced in a later version of Scribus.</source>
-        <translation type="unfinished"></translation>
+        <translation>Failas pažeistas arba sukurtas naujesne programa „Scribus“.</translation>
     </message>
     <message>
         <location filename="../../../scribus/scribus.cpp" line="3760"/>
@@ -31181,7 +31187,7 @@
     <message>
         <location filename="../../../scribus/scribus.cpp" line="7838"/>
         <source>Click the Help button to read Scribus-related Ghostscript help and installation instructions.</source>
-        <translation type="unfinished"></translation>
+        <translation>Paspausk mygtukÄ
 „Pagalba“ norÄ—damas gauti informacijos apie „Ghostscript“ ir jo diegimÄ
.</translation>
     </message>
     <message>
         <location filename="../../../scribus/scribus.cpp" line="7992"/>
@@ -31215,17 +31221,17 @@
     <message>
         <location filename="../../../scribus/scribus.cpp" line="8474"/>
         <source>Click here to leave symbol edit mode.</source>
-        <translation type="unfinished"></translation>
+        <translation>Spragtelėk čia jei nori išeiti iš simbolio redagavimi veiksenos.</translation>
     </message>
     <message>
         <location filename="../../../scribus/scribus.cpp" line="8511"/>
         <source>Editing Symbol: %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Redaguojamas simbolis: %1</translation>
     </message>
     <message>
         <location filename="../../../scribus/scribus.cpp" line="8524"/>
         <source>Close</source>
-        <translation type="unfinished"></translation>
+        <translation>Užverti</translation>
     </message>
     <message>
         <location filename="../../../scribus/scribus.cpp" line="8762"/>
@@ -32338,22 +32344,22 @@
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshape.cpp" line="144"/>
         <source>Importing: %1</source>
-        <translation type="unfinished">Importuojama: %1</translation>
+        <translation>Importuojama: %1</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshape.cpp" line="147"/>
         <source>Analyzing File:</source>
-        <translation type="unfinished">Analizuojamas failas:</translation>
+        <translation>Analizuojamas failas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshape.cpp" line="353"/>
         <source>Generating Items</source>
-        <translation type="unfinished">Generuojami objektai</translation>
+        <translation>Generuojami objektai</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/shape/importshape.cpp" line="638"/>
         <source>Group%1</source>
-        <translation type="unfinished">GrupÄ— %1</translation>
+        <translation>GrupÄ— %1</translation>
     </message>
 </context>
 <context>
@@ -32472,17 +32478,17 @@
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsml.cpp" line="142"/>
         <source>Importing: %1</source>
-        <translation type="unfinished">Importuojama: %1</translation>
+        <translation>Importuojama: %1</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsml.cpp" line="145"/>
         <source>Analyzing File:</source>
-        <translation type="unfinished">Analizuojamas failas:</translation>
+        <translation>Analizuojamas failas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/import/sml/importsml.cpp" line="359"/>
         <source>Generating Items</source>
-        <translation type="unfinished">Generuojami objektai</translation>
+        <translation>Generuojami objektai</translation>
     </message>
 </context>
 <context>
@@ -32490,22 +32496,22 @@
     <message>
         <location filename="../../../scribus/plugins/tools/smoothpath/smoothpath.cpp" line="77"/>
         <source>Smooth Path</source>
-        <translation type="unfinished"></translation>
+        <translation>Glotni apybrėža</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/smoothpath/smoothpath.cpp" line="81"/>
         <source>Path Tools</source>
-        <translation type="unfinished">Apybrėžų įrankiai</translation>
+        <translation>Apybrėžų įrankiai</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/smoothpath/smoothpath.cpp" line="107"/>
         <source>Smoothes a Path</source>
-        <translation type="unfinished"></translation>
+        <translation>Glotninti apybrėžÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/plugins/tools/smoothpath/smoothpath.cpp" line="108"/>
         <source>Converts a Polyline made of straight Lines to a smoothed Bezier Curve.</source>
-        <translation type="unfinished"></translation>
+        <translation>Konvertuoti laužtÄ™ į glotniÄ
 BezjÄ— kreivÄ™.</translation>
     </message>
 </context>
 <context>
@@ -32520,32 +32526,32 @@
     <message>
         <location filename="../../../scribus/ui/spiralvectorbase.ui" line="23"/>
         <source>Edit Spiral</source>
-        <translation type="unfinished"></translation>
+        <translation>Redaguoti spiralÄ™</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralvectorbase.ui" line="31"/>
         <source>Start Angle:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pradžios kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralvectorbase.ui" line="51"/>
         <source>End Angle:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pabaigos kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralvectorbase.ui" line="71"/>
         <source>Factor:</source>
-        <translation type="unfinished"></translation>
+        <translation>Daugiklis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralvectorbase.ui" line="78"/>
         <source> %</source>
-        <translation type="unfinished"> %</translation>
+        <translation> %</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralvectorbase.ui" line="108"/>
         <source>End Edit</source>
-        <translation type="unfinished"></translation>
+        <translation>Baigti redaguoti</translation>
     </message>
 </context>
 <context>
@@ -32553,32 +32559,33 @@
     <message>
         <location filename="../../../scribus/ui/spiralwidgetbase.ui" line="26"/>
         <source>Form</source>
-        <translation type="unfinished"></translation>
+        <translation>Forma</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralwidgetbase.ui" line="36"/>
         <source>Start Angle:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pradžios kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralwidgetbase.ui" line="56"/>
         <source>End Angle:</source>
-        <translation type="unfinished"></translation>
+        <translation>Pabaigos kampas:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralwidgetbase.ui" line="76"/>
         <source>Factor:</source>
-        <translation type="unfinished"></translation>
+        <translatorcomment>Abejoju...</translatorcomment>
+        <translation>Daugiklis:</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralwidgetbase.ui" line="83"/>
         <source> %</source>
-        <translation type="unfinished"> %</translation>
+        <translation> %</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/spiralwidgetbase.ui" line="139"/>
         <source>Sample Polygon</source>
-        <translation type="unfinished">Daugiakampio pavyzdys</translation>
+        <translation>Daugiakampio pavyzdys</translation>
     </message>
 </context>
 <context>
@@ -33480,7 +33487,7 @@
     </message>
     <message>
         <source>Gaps Between Pages</source>
-        <translation type="obsolete">Intervalas tarp puslapių vaizdų</translation>
+        <translation type="obsolete">Tarpelis tarp puslapių vaizdų</translation>
     </message>
     <message>
         <source>Vertical:</source>
@@ -35899,7 +35906,7 @@
     </message>
     <message>
         <source>&Gap:</source>
-        <translation type="obsolete">&Intervalas:</translation>
+        <translation type="obsolete">&Tarpelis:</translation>
     </message>
     <message>
         <source>Woven silk pyjamas exchanged for blue quartz</source>
@@ -35951,7 +35958,7 @@
     </message>
     <message>
         <source>&Free Scaling</source>
-        <translation type="obsolete">&Laisvas dydžio keitimas</translation>
+        <translation type="obsolete">&Laisvas rėmelio dydžio keitimas00002</translation>
     </message>
     <message>
         <source>&Horizontal Scaling:</source>
@@ -36019,7 +36026,7 @@
     </message>
     <message>
         <source>Gap between text frame columns</source>
-        <translation type="obsolete">Intervalas tarp teksto rėmelio stulpelių</translation>
+        <translation type="obsolete">Tarpelis tarp teksto rėmelio stulpelių</translation>
     </message>
     <message>
         <source>Sample of your font</source>
@@ -36789,7 +36796,7 @@
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="838"/>
         <source>Group</source>
-        <translation>Grupuoti</translation>
+        <translation>GrupÄ—</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="839"/>
@@ -37169,12 +37176,12 @@
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="970"/>
         <source>Link text frame</source>
-        <translation type="unfinished"></translation>
+        <translation>Susieti teksto rėmelį</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="971"/>
         <source>Unlink text frame</source>
-        <translation type="unfinished"></translation>
+        <translation>Atsieti teksto rėmelį</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="863"/>
@@ -37214,7 +37221,7 @@
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="934"/>
         <source>Change page properties</source>
-        <translation type="unfinished"></translation>
+        <translation>Keisti puslapio nuostatas</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="935"/>
@@ -37264,32 +37271,32 @@
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="945"/>
         <source>Enable text flow around for lower layers</source>
-        <translation type="unfinished"></translation>
+        <translation>Leisti teksto apÄ—jimÄ
 žemesniesiems sluoksniams</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="946"/>
         <source>Disable text flow around for lower layers</source>
-        <translation type="unfinished"></translation>
+        <translation>Neleisti teksto apėjimo žemesniesiems sluoksniams</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="947"/>
         <source>Set layer blend mode</source>
-        <translation type="unfinished"></translation>
+        <translation>Nustatyti sluoksnio permatomumo veiksenÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="948"/>
         <source>Set layer opacity</source>
-        <translation type="unfinished"></translation>
+        <translation>Nustatyti sluoksnio nepermatomumo veiksenÄ
</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="949"/>
         <source>Lock layer</source>
-        <translation type="unfinished"></translation>
+        <translation>Užrakinti sluoksnį</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="950"/>
         <source>Unlock layer</source>
-        <translation type="unfinished"></translation>
+        <translation>Atrakinti sluoksnį</translation>
     </message>
     <message>
         <location filename="../../../scribus/undomanager.cpp" line="951"/>
@@ -37529,7 +37536,9 @@
         <location filename="../../../scribus/undogui.cpp" line="533"/>
         <source>%1 - %2
 %3</source>
-        <translation type="unfinished"></translation>
+        <translatorcomment>Nežinau, kas čia...</translatorcomment>
+        <translation>%1 – %2
+%3</translation>
     </message>
     <message>
         <location filename="../../../scribus/undogui.cpp" line="310"/>
@@ -38049,18 +38058,18 @@
     <message>
         <location filename="../../../scribus/ui/colorpalette.ui" line="27"/>
         <source>Fill</source>
-        <translation type="unfinished"></translation>
+        <translation>Užpildyti</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/colorpalette.ui" line="41"/>
         <source>Fill Mode</source>
-        <translation type="unfinished"></translation>
+        <translation>Užpildymo būdas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/colorpalette.ui" line="85"/>
         <location filename="../../../scribus/ui/colorpalette.ui" line="650"/>
         <source>%</source>
-        <translation type="unfinished">%</translation>
+        <translation>%</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/colorpalette.ui" line="123"/>
@@ -38124,12 +38133,13 @@
     <message>
         <location filename="../../../scribus/ui/colorpalette.ui" line="592"/>
         <source>Stroke</source>
-        <translation type="unfinished"></translation>
+        <translation>Brūkšnys</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/colorpalette.ui" line="606"/>
         <source>Stroke Mode</source>
-        <translation type="unfinished"></translation>
+        <translatorcomment>Nepatikrinta...</translatorcomment>
+        <translation>Brūkšniavimo būdas</translation>
     </message>
     <message>
         <location filename="../../../scribus/ui/colorpalette.ui" line="809"/>

Modified: branches/ScribusOIF/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/canvas.cpp
==============================================================================
--- branches/ScribusOIF/scribus/canvas.cpp (original)
+++ branches/ScribusOIF/scribus/canvas.cpp Wed Aug 10 22:39:40 2011
@@ -778,11 +778,11 @@
 {
 // 	qDebug()<<"Canvas::paintEvent"<<p->rect()<<m_viewMode.forceRedraw<<m_viewMode.operItemSelecting;
 // 	printBacktrace(62);
-	QTime t;
 	if (m_doc->isLoading())
 		return;
 // #define SHOW_ME_WHAT_YOU_GET_IN_D_CANVA
 #ifdef SHOW_ME_WHAT_YOU_GET_IN_D_CANVA
+	QTime t;
 	QString dmode("");
 	int t1,t2,t3,t4,t5,t6;
 	t1 = t2=t3=t4=t5 =t6= 0;

Modified: branches/ScribusOIF/scribus/fpointarray.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/fpointarray.cpp
==============================================================================
--- branches/ScribusOIF/scribus/fpointarray.cpp (original)
+++ branches/ScribusOIF/scribus/fpointarray.cpp Wed Aug 10 22:39:40 2011
@@ -477,7 +477,7 @@
 QString FPointArray::svgPath(bool closed) const
 {
 	QString tmp = "";
-	FPoint np, np1, np2, np3;
+	FPoint np, np1, np2, np3, np4, firstP;
 	bool nPath = true;
 	bool first = true;
 	if (size() > 3)
@@ -486,18 +486,19 @@
 		{
 			if (point(poi).x() > 900000)
 			{
-//				tmp += "Z ";
 				nPath = true;
 				continue;
 			}
 			if (nPath)
 			{
 				np = point(poi);
-				if ((!first) && (closed))
+				if ((!first) && (closed) && (np4 == firstP))
 					tmp += "Z ";
 				tmp += "M"+QString::number(np.x())+" "+QString::number(np.y())+" ";
 				nPath = false;
 				first = false;
+				firstP = np;
+				np4 = np;
 			}
 			np = point(poi);
 			np1 = point(poi+1);
@@ -507,6 +508,7 @@
 				tmp += QString("L%1 %2 ").arg(np3.x()).arg(np3.y());
 			else
 				tmp += QString("C%1 %2 %3 %4 %5 %6 ").arg(np1.x()).arg(np1.y()).arg(np2.x()).arg(np2.y()).arg(np3.x()).arg(np3.y());
+			np4 = np3;
 		}
 		if (closed)
 			tmp += "Z";
@@ -519,7 +521,7 @@
 	QPainterPath m_path = QPainterPath();
 	bool nPath = true;
 	bool first = true;
-	FPoint np, np1, np2, np3;
+	FPoint np, np1, np2, np3, np4, firstP;
 	if (size() > 3)
 	{
 		for (uint poi = 0; poi < size()-3; poi += 4)
@@ -532,11 +534,13 @@
 			if (nPath)
 			{
 				np = point(poi);
-				if ((!first) && (closed))
+				if ((!first) && (closed) && (np4 == firstP))
 					m_path.closeSubpath();
 				m_path.moveTo(np.x(), np.y());
 				nPath = false;
 				first = false;
+				firstP = np;
+				np4 = np;
 			}
 			np = point(poi);
 			np1 = point(poi+1);
@@ -546,6 +550,7 @@
 				m_path.lineTo(np3.x(), np3.y());
 			else
 				m_path.cubicTo(np1.x(), np1.y(), np2.x(), np2.y(), np3.x(), np3.y());
+			np4 = np3;
 		}
 		if (closed)
 			m_path.closeSubpath();

Modified: branches/ScribusOIF/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/pageitem.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem.cpp Wed Aug 10 22:39:40 2011
@@ -5376,7 +5376,12 @@
 	if (NamedLStyle.isEmpty())
 	{
 		if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0))
-			extraSpace = m_lineWidth / 2.0;
+		{
+			if (isLine() && (PLineEnd == Qt::FlatCap))
+				extraSpace = 0.0;
+			else
+				extraSpace = m_lineWidth / 2.0;
+		}
 		if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)) && (patternStrokePath))
 		{
 			ScPattern *pat = &m_Doc->docPatterns[patternStrokeVal];

Modified: branches/ScribusOIF/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/pageitem.h
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.h (original)
+++ branches/ScribusOIF/scribus/pageitem.h Wed Aug 10 22:39:40 2011
@@ -1077,7 +1077,7 @@
 	* Set the layer for the item
 	* @param layerId layer where this item is moved
 	*/
-	void setLayer(int layerId);
+	virtual void setLayer(int layerId);
 
 	/**
 	 * @brief Check the changes to the item and add undo actions for them.

Modified: branches/ScribusOIF/scribus/pageitem_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/pageitem_group.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem_group.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem_group.cpp Wed Aug 10 22:39:40 2011
@@ -80,6 +80,16 @@
 			ret += embedded->getItemList();
 	}
 	return ret;
+}
+
+void PageItem_Group::setLayer(int newLayerID)
+{
+	for (int em = 0; em < groupItemList.count(); ++em)
+	{
+		PageItem* embedded = groupItemList.at(em);
+		embedded->setLayer(newLayerID);
+	}
+	LayerID = newLayerID;
 }
 
 void PageItem_Group::replaceNamedResources(ResourceCollection& newNames)
@@ -154,6 +164,7 @@
 			}
 			else
 				p->setMaskMode(0);
+			p->setFillRule(fillRule);
 			p->beginLayer(1.0 - fillTransparency(), fillBlendmode(), &PoLine);
 			p->setMaskMode(0);
 			p->scale(Width / groupWidth, Height / groupHeight);

Modified: branches/ScribusOIF/scribus/pageitem_group.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/pageitem_group.h
==============================================================================
--- branches/ScribusOIF/scribus/pageitem_group.h (original)
+++ branches/ScribusOIF/scribus/pageitem_group.h Wed Aug 10 22:39:40 2011
@@ -43,12 +43,13 @@
 	virtual PageItem_Group * asGroupFrame() { return this; }
 	virtual bool isGroup() const { return true; }
 	virtual ItemType realItemType() const { return PageItem::Group; }
+	void adjustXYPosition();
 	virtual QList<PageItem*> getItemList();
+	virtual void setLayer(int layerId);
 	virtual void getNamedResources(ResourceCollection& lists) const;
 	virtual void replaceNamedResources(ResourceCollection& newNames);
 	virtual void applicableActions(QStringList& actionList);
 	virtual QString infoDescription();
-	void adjustXYPosition();
 	
 protected:
 	virtual void DrawObj_Item(ScPainter *p, QRectF e);

Modified: branches/ScribusOIF/scribus/pageitem_symbol.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/pageitem_symbol.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem_symbol.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem_symbol.cpp Wed Aug 10 22:39:40 2011
@@ -105,6 +105,7 @@
 			}
 			else
 				p->setMaskMode(0);
+			p->setFillRule(fillRule);
 			p->beginLayer(1.0 - fillTransparency(), fillBlendmode(), &PoLine);
 			p->setMaskMode(0);
 			ScPattern pat = m_Doc->docPatterns[patternVal];

Modified: branches/ScribusOIF/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/pdflib_core.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pdflib_core.cpp (original)
+++ branches/ScribusOIF/scribus/pdflib_core.cpp Wed Aug 10 22:39:40 2011
@@ -2442,7 +2442,7 @@
 							ScPattern pat = doc.docPatterns[ite->pattern()];
 							PutPage("q\n");
 							PutPage(SetClipPath(ite));
-							PutPage("h W* n\n");
+							PutPage(ite->fillRule ? "h W* n\n" : "h W n\n");
 							if (ite->imageFlippedH())
 								PutPage("-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n");
 							if (ite->imageFlippedV())
@@ -2488,7 +2488,7 @@
 							QString tmpD = "";
 							PutPage("q\n");
 							PutPage(SetClipPath(ite));
-							PutPage("h W* n\n");
+							PutPage(ite->fillRule ? "h W* n\n" : "h W n\n");
 							if (ite->imageFlippedH())
 								PutPage("-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n");
 							if (ite->imageFlippedV())
@@ -4244,7 +4244,10 @@
 				ScPattern pat = doc.docPatterns[ite->pattern()];
 				tmp += "q\n";
 				tmp += SetClipPath(ite);
-				tmp += "h W* n\n";
+				if (ite->fillRule)
+					tmp += "h W* n\n";
+				else
+					tmp += "h W n\n";
 				if (ite->imageFlippedH())
 					tmp += "-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n";
 				if (ite->imageFlippedV())
@@ -4290,7 +4293,10 @@
 				QString tmpD = "";
 				tmp += "q\n";
 				tmp += SetClipPath(ite);
-				tmp += "h W* n\n";
+				if (ite->fillRule)
+					tmp += "h W* n\n";
+				else
+					tmp += "h W n\n";
 				if (ite->imageFlippedH())
 					tmp += "-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n";
 				if (ite->imageFlippedV())
@@ -5736,24 +5742,28 @@
 QString PDFLibCore::SetClipPath(PageItem *ite, bool poly)
 {
 	QString tmp("");
+	FPoint np, np1, np2, np3, np4, firstP;
+	bool nPath = true;
+	bool first = true;
 	if (ite->PoLine.size() > 3)
 	{
-		bool nPath = true;
 		for (uint poi=0; poi<ite->PoLine.size()-3; poi += 4)
 		{
 			if (ite->PoLine.point(poi).x() > 900000)
 			{
-				if (poly)
-					tmp += "h\n";
 				nPath = true;
 				continue;
 			}
-			FPoint np, np1, np2, np3;
 			if (nPath)
 			{
 				np = ite->PoLine.point(poi);
+				if ((!first) && (poly) && (np4 == firstP))
+					tmp += "h\n";
 				tmp += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
 				nPath = false;
+				first = false;
+				firstP = np;
+				np4 = np;
 			}
 			np = ite->PoLine.point(poi);
 			np1 = ite->PoLine.point(poi+1);
@@ -5767,6 +5777,7 @@
 				tmp += FToStr(np2.x())+" "+FToStr(-np2.y())+" ";
 				tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" c\n";
 			}
+			np4 = np3;
 		}
 	}
 	return tmp;
@@ -5775,24 +5786,28 @@
 QString PDFLibCore::SetClipPathArray(FPointArray *ite, bool poly)
 {
 	QString tmp("");
+	FPoint np, np1, np2, np3, np4, firstP;
+	bool nPath = true;
+	bool first = true;
 	if (ite->size() > 3)
 	{
-		bool nPath = true;
 		for (uint poi=0; poi<ite->size()-3; poi += 4)
 		{
 			if (ite->point(poi).x() > 900000)
 			{
-				if (poly)
-					tmp += "h\n";
 				nPath = true;
 				continue;
 			}
-			FPoint np, np1, np2, np3;
 			if (nPath)
 			{
 				np = ite->point(poi);
+				if ((!first) && (poly) && (np4 == firstP))
+					tmp += "h\n";
 				tmp += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
 				nPath = false;
+				first = false;
+				firstP = np;
+				np4 = np;
 			}
 			np = ite->point(poi);
 			np1 = ite->point(poi+1);
@@ -5806,6 +5821,7 @@
 				tmp += FToStr(np2.x())+" "+FToStr(-np2.y())+" ";
 				tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" c\n";
 			}
+			np4 = np3;
 		}
 	}
 	return tmp;

Modified: branches/ScribusOIF/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/ai/importai.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/ai/importai.cpp Wed Aug 10 22:39:40 2011
@@ -1805,7 +1805,61 @@
 		else if (command == "Xy")
 		{
 			ScTextStream ts2(&Cdata, QIODevice::ReadOnly);
-			ts2 >> blendMode >> Opacity;
+			int mode = 0;
+			ts2 >> mode >> Opacity;
+			// Adjusting blendmodes, taken from the PDF importer
+			switch (mode)
+			{
+				default:
+				case 0:
+					blendMode = 0;
+					break;
+				case 4:
+					blendMode = 1;
+					break;
+				case 5:
+					blendMode = 2;
+					break;
+				case 1:
+					blendMode = 3;
+					break;
+				case 2:
+					blendMode = 4;
+					break;
+				case 3:
+					blendMode = 5;
+					break;
+				case 8:
+					blendMode = 6;
+					break;
+				case 9:
+					blendMode = 7;
+					break;
+				case 10:
+					blendMode = 8;
+					break;
+				case 11:
+					blendMode = 9;
+					break;
+				case 6:
+					blendMode = 10;
+					break;
+				case 7:
+					blendMode = 11;
+					break;
+				case 12:
+					blendMode = 12;
+					break;
+				case 13:
+					blendMode = 13;
+					break;
+				case 14:
+					blendMode = 14;
+					break;
+				case 15:
+					blendMode = 15;
+					break;
+			}
 		}
 		else if (command == "XR")
 		{

Modified: branches/ScribusOIF/scribus/plugins/import/cgm/importcgm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/cgm/importcgm.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/cgm/importcgm.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/cgm/importcgm.cpp Wed Aug 10 22:39:40 2011
@@ -61,6 +61,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage CgmPlug::readThumbnail(QString fName)

Modified: branches/ScribusOIF/scribus/plugins/import/cvg/importcvg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/cvg/importcvg.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/cvg/importcvg.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/cvg/importcvg.cpp Wed Aug 10 22:39:40 2011
@@ -54,6 +54,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage CvgPlug::readThumbnail(QString fName)

Modified: branches/ScribusOIF/scribus/plugins/import/drw/importdrw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/drw/importdrw.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/drw/importdrw.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/drw/importdrw.cpp Wed Aug 10 22:39:40 2011
@@ -63,6 +63,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage DrwPlug::readThumbnail(QString fName)
@@ -1221,12 +1222,18 @@
 						popped.groupItem->groupItemList.append(item);
 						item->gXpos = item->xPos() - popped.groupItem->xPos();
 						item->gYpos = item->yPos() - popped.groupItem->yPos();
+						if (groupStack.count() > 0)
+							groupStack.top().GElements.removeAll(tmpSel->itemAt(i));
+						Elements.removeAll(tmpSel->itemAt(i));
+						m_Doc->Items->removeAll(tmpSel->itemAt(i));
 					}
 					if (popped.itemGroupName.isEmpty())
 						popped.groupItem->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
 					else
 						popped.groupItem->setItemName(popped.itemGroupName);
 					popped.groupItem->AutoName = false;
+					popped.groupItem->groupWidth = tmpSel->width();
+					popped.groupItem->groupHeight = tmpSel->height();
 				}
 				m_Doc->GroupCounter++;
 				tmpSel->clear();

Modified: branches/ScribusOIF/scribus/plugins/import/pct/importpct.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/pct/importpct.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/pct/importpct.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/pct/importpct.cpp Wed Aug 10 22:39:40 2011
@@ -57,6 +57,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage PctPlug::readThumbnail(QString fName)

Modified: branches/ScribusOIF/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/pdf/importpdf.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/pdf/importpdf.cpp Wed Aug 10 22:39:40 2011
@@ -57,6 +57,7 @@
 	m_Doc = doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage PdfPlug::readThumbnail(QString fName)
@@ -317,6 +318,16 @@
 					GBool printing = gFalse;
 					dev->startDoc(pdfDoc->getXRef(), pdfDoc->getCatalog());
 					int rotate = pdfDoc->getPageRotate(firstPage);
+				/*	PDFRectangle *rect = pdfDoc->getPage(firstPage)->getMediaBox();
+					qDebug() << "Media Box" << rect->x1 << rect->y1 << rect->x2 << rect->y2;
+					rect = pdfDoc->getPage(firstPage)->getCropBox();
+					qDebug() << "Crop Box " << rect->x1 << rect->y1 << rect->x2 << rect->y2;
+					rect = pdfDoc->getPage(firstPage)->getBleedBox();
+					qDebug() << "Bleed Box" << rect->x1 << rect->y1 << rect->x2 << rect->y2;
+					rect = pdfDoc->getPage(firstPage)->getTrimBox();
+					qDebug() << "Trim Box " << rect->x1 << rect->y1 << rect->x2 << rect->y2;
+					rect = pdfDoc->getPage(firstPage)->getArtBox();
+					qDebug() << "Art Box  " << rect->x1 << rect->y1 << rect->x2 << rect->y2; */
 					if (importerFlags & LoadSavePlugin::lfCreateDoc)
 					{
 						m_Doc->currentPage()->setInitialHeight(pdfDoc->getPageMediaHeight(firstPage));

Modified: branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.cpp Wed Aug 10 22:39:40 2011
@@ -1,5 +1,6 @@
 #include "slaoutput.h"
 #include <GlobalParams.h>
+#include <QApplication>
 #include <QFile>
 #include "commonstrings.h"
 #include "loadsaveplugin.h"
@@ -32,6 +33,7 @@
 	m_font = 0;
 	firstPage = true;
 	pagecount = 1;
+	updateGUICounter = 0;
 }
 
 SlaOutputDev::~SlaOutputDev()
@@ -49,6 +51,7 @@
 	catalog = catA;
 	firstPage = true;
 	pagecount = 1;
+	updateGUICounter = 0;
 	m_fontEngine = new SplashFontEngine(
 #if HAVE_T1LIB_H
 	globalParams->getEnableT1lib(),
@@ -126,12 +129,13 @@
 		}
 	}
 }
-
+/*
 void SlaOutputDev::updateFillColor(GfxState *state)
 {
-	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
-}
-
+	int shade = 100;
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
+}
+*/
 void SlaOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, GfxColorSpace * /*blendingColorSpace*/, GBool /*isolated*/, GBool /*knockout*/, GBool forSoftMask)
 {
 //	qDebug() << "Start Group";
@@ -244,6 +248,7 @@
 	ite->PoLine = out.copy();  //FIXME: try to avoid copy if FPointArray when properly shared
 	ite->ClipEdited = true;
 	ite->FrameType = 3;
+	ite->setFillEvenOdd(false);
 	ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
 	ite->ContourLine = ite->PoLine.copy();
 	ite->setTextFlowMode(PageItem::TextFlowDisabled);
@@ -284,6 +289,7 @@
 	ite->PoLine = out.copy();  //FIXME: try to avoid copy if FPointArray when properly shared
 	ite->ClipEdited = true;
 	ite->FrameType = 3;
+	ite->setFillEvenOdd(true);
 	ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
 	ite->ContourLine = ite->PoLine.copy();
 	ite->setTextFlowMode(PageItem::TextFlowDisabled);
@@ -310,13 +316,15 @@
 	ctm = state->getCTM();
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	CurrColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor());
+	int shade = 100;
+	CurrColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &shade);
 	QString output = convertPath(state->getPath());
 	getPenState(state);
 	if ((m_Elements->count() != 0) && (output == Coords))			// Path is the same as in last fill
 	{
 		PageItem* ite = m_Elements->at(m_Elements->count()-1);
 		ite->setLineColor(CurrColorStroke);
+		ite->setLineShade(shade);
 		ite->setLineEnd(PLineEnd);
 		ite->setLineJoin(PLineJoin);
 		ite->setLineWidth(state->getTransformedLineWidth());
@@ -342,7 +350,7 @@
 			ite->PoLine = out.copy();
 			ite->ClipEdited = true;
 			ite->FrameType = 3;
-			ite->setLineShade(100);
+			ite->setLineShade(shade);
 			ite->setLineTransparency(1.0 - state->getStrokeOpacity());
 			ite->setLineBlendmode(getBlendMode(state));
 			ite->setLineEnd(PLineEnd);
@@ -366,7 +374,8 @@
 	ctm = state->getCTM();
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
+	int shade = 100;
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
 	FPointArray out;
 	QString output = convertPath(state->getPath());
 	out.parseSVG(output);
@@ -385,7 +394,7 @@
 		ite->PoLine = out.copy();
 		ite->ClipEdited = true;
 		ite->FrameType = 3;
-		ite->setFillShade(100);
+		ite->setFillShade(shade);
 		ite->setLineShade(100);
 		ite->setFillEvenOdd(false);
 		ite->setFillTransparency(1.0 - state->getFillOpacity());
@@ -411,7 +420,8 @@
 	ctm = state->getCTM();
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
+	int shade = 100;
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
 	FPointArray out;
 	QString output = convertPath(state->getPath());
 	out.parseSVG(output);
@@ -430,7 +440,7 @@
 		ite->PoLine = out.copy();
 		ite->ClipEdited = true;
 		ite->FrameType = 3;
-		ite->setFillShade(100);
+		ite->setFillShade(shade);
 		ite->setLineShade(100);
 		ite->setFillEvenOdd(true);
 		ite->setFillTransparency(1.0 - state->getFillOpacity());
@@ -455,6 +465,7 @@
 	double GrStartY;
 	double GrEndX;
 	double GrEndY;
+	int shade = 100;
 	Function *func = shading->getFunc(0);
 	VGradient FillGradient = VGradient(VGradient::linear);
 	FillGradient.clearStops();
@@ -469,15 +480,13 @@
 		{
 			GfxColor temp;
 			((GfxAxialShading*)shading)->getColor(bounds[i], &temp);
-			QString stopColor = getColor(color_space, &temp);
-			const ScColor& gradC1 = m_doc->PageColors[stopColor];
-			FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), bounds[i], 0.5, 1.0, stopColor, 100 );
+			QString stopColor = getColor(color_space, &temp, &shade);
+			FillGradient.addStop( ScColorEngine::getRGBColor(m_doc->PageColors[stopColor], m_doc), bounds[i], 0.5, 1.0, stopColor, shade );
 			if (i == num_funcs - 1)
 			{
 				((GfxAxialShading*)shading)->getColor(bounds[i+1], &temp);
-				QString stopColor = getColor(color_space, &temp);
-				const ScColor& gradC1 = m_doc->PageColors[stopColor];
-				FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), bounds[i+1], 0.5, 1.0, stopColor, 100 );
+				QString stopColor = getColor(color_space, &temp, &shade);
+				FillGradient.addStop( ScColorEngine::getRGBColor(m_doc->PageColors[stopColor], m_doc), bounds[i+1], 0.5, 1.0, stopColor, shade );
 			}
 		}
 	}
@@ -485,14 +494,12 @@
 	{
 		GfxColor stop1;
 		((GfxAxialShading*)shading)->getColor(0.0, &stop1);
-		QString stopColor1 = getColor(color_space, &stop1);
-		const ScColor& gradC1 = m_doc->PageColors[stopColor1];
-		FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), 0.0, 0.5, 1.0, stopColor1, 100 );
+		QString stopColor1 = getColor(color_space, &stop1, &shade);
+		FillGradient.addStop( ScColorEngine::getRGBColor(m_doc->PageColors[stopColor1], m_doc), 0.0, 0.5, 1.0, stopColor1, shade );
 		GfxColor stop2;
 		((GfxAxialShading*)shading)->getColor(1.0, &stop2);
-		QString stopColor2 = getColor(color_space, &stop2);
-		const ScColor& gradC2 = m_doc->PageColors[stopColor2];
-		FillGradient.addStop( ScColorEngine::getRGBColor(gradC2, m_doc), 1.0, 0.5, 1.0, stopColor2, 100 );
+		QString stopColor2 = getColor(color_space, &stop2, &shade);
+		FillGradient.addStop( ScColorEngine::getRGBColor(m_doc->PageColors[stopColor2], m_doc), 1.0, 0.5, 1.0, stopColor2, shade );
 	}
 	((GfxAxialShading*)shading)->getCoords(&GrStartX, &GrStartY, &GrEndX, &GrEndY);
 	double xmin, ymin, xmax, ymax;
@@ -513,7 +520,7 @@
 	GrEndY = gr.point(1).y() - crect.y();
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
 	QString output = QString("M %1 %2").arg(0.0).arg(0.0);
 	output += QString("L %1 %2").arg(crect.width()).arg(0.0);
 	output += QString("L %1 %2").arg(crect.width()).arg(crect.height());
@@ -526,7 +533,7 @@
 	PageItem* ite = m_doc->Items->at(z);
 	ite->ClipEdited = true;
 	ite->FrameType = 3;
-	ite->setFillShade(100);
+	ite->setFillShade(shade);
 	ite->setLineShade(100);
 	ite->setFillEvenOdd(false);
 	ite->setFillTransparency(1.0 - state->getFillOpacity());
@@ -553,6 +560,7 @@
 	double GrStartY;
 	double GrEndX;
 	double GrEndY;
+	int shade = 100;
 	Function *func = shading->getFunc(0);
 	VGradient FillGradient = VGradient(VGradient::linear);
 	FillGradient.clearStops();
@@ -567,15 +575,13 @@
 		{
 			GfxColor temp;
 			((GfxRadialShading*)shading)->getColor(bounds[i], &temp);
-			QString stopColor = getColor(color_space, &temp);
-			const ScColor& gradC1 = m_doc->PageColors[stopColor];
-			FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), bounds[i], 0.5, 1.0, stopColor, 100 );
+			QString stopColor = getColor(color_space, &temp, &shade);
+			FillGradient.addStop( ScColorEngine::getRGBColor(m_doc->PageColors[stopColor], m_doc), bounds[i], 0.5, 1.0, stopColor, shade );
 			if (i == num_funcs - 1)
 			{
 				((GfxRadialShading*)shading)->getColor(bounds[i+1], &temp);
-				QString stopColor = getColor(color_space, &temp);
-				const ScColor& gradC1 = m_doc->PageColors[stopColor];
-				FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), bounds[i+1], 0.5, 1.0, stopColor, 100 );
+				QString stopColor = getColor(color_space, &temp, &shade);
+				FillGradient.addStop( ScColorEngine::getRGBColor(m_doc->PageColors[stopColor], m_doc), bounds[i+1], 0.5, 1.0, stopColor, shade );
 			}
 		}
 	}
@@ -583,14 +589,12 @@
 	{
 		GfxColor stop1;
 		((GfxRadialShading*)shading)->getColor(0.0, &stop1);
-		QString stopColor1 = getColor(color_space, &stop1);
-		const ScColor& gradC1 = m_doc->PageColors[stopColor1];
-		FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), 0.0, 0.5, 1.0, stopColor1, 100 );
+		QString stopColor1 = getColor(color_space, &stop1, &shade);
+		FillGradient.addStop( ScColorEngine::getRGBColor(m_doc->PageColors[stopColor1], m_doc), 0.0, 0.5, 1.0, stopColor1, shade );
 		GfxColor stop2;
 		((GfxRadialShading*)shading)->getColor(1.0, &stop2);
-		QString stopColor2 = getColor(color_space, &stop2);
-		const ScColor& gradC2 = m_doc->PageColors[stopColor2];
-		FillGradient.addStop( ScColorEngine::getRGBColor(gradC2, m_doc), 1.0, 0.5, 1.0, stopColor2, 100 );
+		QString stopColor2 = getColor(color_space, &stop2, &shade);
+		FillGradient.addStop( ScColorEngine::getRGBColor(m_doc->PageColors[stopColor2], m_doc), 1.0, 0.5, 1.0, stopColor2, shade );
 	}
 	double r0, x1, y1, r1;
 	((GfxRadialShading*)shading)->getCoords(&GrStartX, &GrStartY, &r0, &x1, &y1, &r1);
@@ -619,7 +623,7 @@
 	GrFocalY = gr.point(2).y() - crect.y();
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
 	QString output = QString("M %1 %2").arg(0.0).arg(0.0);
 	output += QString("L %1 %2").arg(crect.width()).arg(0.0);
 	output += QString("L %1 %2").arg(crect.width()).arg(crect.height());
@@ -632,7 +636,7 @@
 	PageItem* ite = m_doc->Items->at(z);
 	ite->ClipEdited = true;
 	ite->FrameType = 3;
-	ite->setFillShade(100);
+	ite->setFillShade(shade);
 	ite->setLineShade(100);
 	ite->setFillEvenOdd(false);
 	ite->setFillTransparency(1.0 - state->getFillOpacity());
@@ -653,12 +657,12 @@
 	return gTrue;
 }
 
-GBool SlaOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading)
-{
-//	qDebug() << "mesh shaded fill";
+GBool SlaOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading)
+{
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
+	int shade = 100;
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
 	double xmin, ymin, xmax, ymax;
 	// get the clip region bbox
 	state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
@@ -694,16 +698,94 @@
 		m_groupStack.top().Items.append(ite);
 		applyMask(ite);
 	}
+	GfxColor color[3];
+	double x0, y0, x1, y1, x2, y2;
+	for (int i = 0; i < shading->getNTriangles(); i++)
+	{
+		meshGradientPatch patchM;
+		shading->getTriangle(i, &x0, &y0, &color[0],  &x1, &y1, &color[1],  &x2, &y2, &color[2]);
+		patchM.BL.resetTo(FPoint(x0, y0));
+		patchM.BL.shade = 100;
+		patchM.BL.transparency = 1.0;
+		patchM.BL.colorName = getColor(shading->getColorSpace(), &color[0], &shade);
+		patchM.BL.color = ScColorEngine::getShadeColorProof(m_doc->PageColors[patchM.BL.colorName], m_doc, shade);
+		patchM.TL.resetTo(FPoint(x1, y1));
+		patchM.TL.shade = 100;
+		patchM.TL.transparency = 1.0;
+		patchM.TL.colorName = getColor(shading->getColorSpace(), &color[1], &shade);
+		patchM.TL.color = ScColorEngine::getShadeColorProof(m_doc->PageColors[patchM.TL.colorName], m_doc, shade);
+		patchM.TR.resetTo(FPoint(x2, y2));
+		patchM.TR.shade = 100;
+		patchM.TR.transparency = 1.0;
+		patchM.TR.colorName = getColor(shading->getColorSpace(), &color[2], &shade);
+		patchM.TR.color = ScColorEngine::getShadeColorProof(m_doc->PageColors[patchM.TR.colorName], m_doc, shade);
+		patchM.BR.resetTo(FPoint(x0, y0));
+		patchM.BR.shade = 100;
+		patchM.BR.transparency = 1.0;
+		patchM.BR.colorName = getColor(shading->getColorSpace(), &color[0], &shade);
+		patchM.BR.color = ScColorEngine::getShadeColorProof(m_doc->PageColors[patchM.BR.colorName], m_doc, shade);
+		patchM.TL.transform(m_ctm);
+		patchM.TL.moveRel(-crect.x(), -crect.y());
+		patchM.TR.transform(m_ctm);
+		patchM.TR.moveRel(-crect.x(), -crect.y());
+		patchM.BR.transform(m_ctm);
+		patchM.BR.moveRel(-crect.x(), -crect.y());
+		patchM.BL.transform(m_ctm);
+		patchM.BL.moveRel(-crect.x(), -crect.y());
+		ite->meshGradientPatches.append(patchM);
+	}
+	ite->GrType = 12;
+	return gTrue;
+}
+
+GBool SlaOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading)
+{
+//	qDebug() << "mesh shaded fill";
+	double xCoor = m_doc->currentPage()->xOffset();
+	double yCoor = m_doc->currentPage()->yOffset();
+	int shade = 100;
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
+	double xmin, ymin, xmax, ymax;
+	// get the clip region bbox
+	state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
+	QRectF crect = QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
+	crect = crect.normalized();
+	QString output = QString("M %1 %2").arg(0.0).arg(0.0);
+	output += QString("L %1 %2").arg(crect.width()).arg(0.0);
+	output += QString("L %1 %2").arg(crect.width()).arg(crect.height());
+	output += QString("L %1 %2").arg(0.0).arg(crect.height());
+	output += QString("L %1 %2").arg(0.0).arg(0.0);
+	output += QString("Z");
+	pathIsClosed = true;
+	Coords = output;
+	double *ctm;
+	ctm = state->getCTM();
+	m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
+	int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, CurrColorFill, CommonStrings::None, true);
+	PageItem* ite = m_doc->Items->at(z);
+	ite->ClipEdited = true;
+	ite->FrameType = 3;
+	ite->setFillShade(shade);
+	ite->setLineShade(100);
+	ite->setFillEvenOdd(false);
+	ite->setFillTransparency(1.0 - state->getFillOpacity());
+	ite->setFillBlendmode(getBlendMode(state));
+	ite->setLineEnd(PLineEnd);
+	ite->setLineJoin(PLineJoin);
+	ite->setTextFlowMode(PageItem::TextFlowDisabled);
+	m_doc->AdjustItemSize(ite);
+	m_Elements->append(ite);
+	if (m_groupStack.count() != 0)
+	{
+		m_groupStack.top().Items.append(ite);
+		applyMask(ite);
+	}
 //	qDebug() << "Mesh of" << shading->getNPatches() << "Patches";
 	for (int i = 0; i < shading->getNPatches(); i++)
 	{
 		GfxPatch *patch = shading->getPatch(i);
 		GfxColor color;
 		meshGradientPatch patchM;
-		meshPoint mp1;
-		meshPoint mp2;
-		meshPoint mp3;
-		meshPoint mp4;
 		int u, v;
 		patchM.BL.resetTo(FPoint(patch->x[0][0], patch->y[0][0]));
 		patchM.BL.controlTop = FPoint(patch->x[0][1], patch->y[0][1]);
@@ -721,11 +803,10 @@
 				color.c[k] = GfxColorComp (patch->color[u][v].c[k]);
 			}
 		}
-		patchM.BL.colorName = getColor(shading->getColorSpace(), &color);
+		patchM.BL.colorName = getColor(shading->getColorSpace(), &color, &shade);
 		patchM.BL.shade = 100;
 		patchM.BL.transparency = 1.0;
-		const ScColor& col1 = m_doc->PageColors[patchM.BL.colorName];
-		patchM.BL.color = ScColorEngine::getShadeColorProof(col1, m_doc, 100);
+		patchM.BL.color = ScColorEngine::getShadeColorProof(m_doc->PageColors[patchM.BL.colorName], m_doc, shade);
 
 		u = 0;
 		v = 1;
@@ -743,11 +824,10 @@
 				color.c[k] = GfxColorComp (patch->color[u][v].c[k]);
 			}
 		}
-		patchM.TL.colorName = getColor(shading->getColorSpace(), &color);
+		patchM.TL.colorName = getColor(shading->getColorSpace(), &color, &shade);
 		patchM.TL.shade = 100;
 		patchM.TL.transparency = 1.0;
-		const ScColor& col2 = m_doc->PageColors[patchM.TL.colorName];
-		patchM.TL.color = ScColorEngine::getShadeColorProof(col2, m_doc, 100);
+		patchM.TL.color = ScColorEngine::getShadeColorProof(m_doc->PageColors[patchM.TL.colorName], m_doc, shade);
 
 		u = 1;
 		v = 1;
@@ -765,11 +845,10 @@
 				color.c[k] = GfxColorComp (patch->color[u][v].c[k]);
 			}
 		}
-		patchM.TR.colorName = getColor(shading->getColorSpace(), &color);
+		patchM.TR.colorName = getColor(shading->getColorSpace(), &color, &shade);
 		patchM.TR.shade = 100;
 		patchM.TR.transparency = 1.0;
-		const ScColor& col4 = m_doc->PageColors[patchM.TR.colorName];
-		patchM.TR.color = ScColorEngine::getShadeColorProof(col4, m_doc, 100);
+		patchM.TR.color = ScColorEngine::getShadeColorProof(m_doc->PageColors[patchM.TR.colorName], m_doc, shade);
 
 		u = 1;
 		v = 0;
@@ -787,11 +866,10 @@
 				color.c[k] = GfxColorComp (patch->color[u][v].c[k]);
 			}
 		}
-		patchM.BR.colorName = getColor(shading->getColorSpace(), &color);
+		patchM.BR.colorName = getColor(shading->getColorSpace(), &color, &shade);
 		patchM.BR.shade = 100;
 		patchM.BR.transparency = 1.0;
-		const ScColor& col3 = m_doc->PageColors[patchM.BR.colorName];
-		patchM.BR.color = ScColorEngine::getShadeColorProof(col3, m_doc, 100);
+		patchM.BR.color = ScColorEngine::getShadeColorProof(m_doc->PageColors[patchM.BR.colorName], m_doc, shade);
 
 		patchM.TL.transform(m_ctm);
 		patchM.TL.moveRel(-crect.x(), -crect.y());
@@ -872,7 +950,8 @@
 	}
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
+	int shade = 100;
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
 	double xmin, ymin, xmax, ymax;
 	// get the clip region bbox
 	state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
@@ -890,7 +969,7 @@
 	ite = m_doc->Items->at(z);
 	ite->ClipEdited = true;
 	ite->FrameType = 3;
-	ite->setFillShade(100);
+	ite->setFillShade(shade);
 	ite->setLineShade(100);
 	ite->setFillEvenOdd(false);
 	ite->setFillTransparency(1.0 - state->getFillOpacity());
@@ -912,12 +991,153 @@
 	return gTrue;
 }
 
+void SlaOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool interpolate, GBool inlineImg)
+{
+//	qDebug() << "Draw Image Mask";
+	QImage * image = 0;
+	int invert_bit;
+	int row_stride;
+	int x, y, i, bit;
+	unsigned char *dest = 0;
+	unsigned char *buffer;
+	Guchar *pix;
+	ImageStream * imgStr = new ImageStream(str, width, 1, 1);
+	imgStr->reset();
+#ifdef WORDS_BIGENDIAN
+	image = new QImage(width, height, QImage::Format_Mono);
+#else
+	image = new QImage(width, height, QImage::Format_MonoLSB);
+#endif
+	if (image == NULL || image->isNull())
+	{
+		delete imgStr;
+		delete image;
+		return;
+	}
+	invert_bit = invert ? 1 : 0;
+	buffer = image->bits();
+	row_stride = image->bytesPerLine();
+	for (y = 0; y < height; y++)
+	{
+		pix = imgStr->getLine();
+		dest = buffer + y * row_stride;
+		i = 0;
+		bit = 0;
+		for (x = 0; x < width; x++)
+		{
+			if (bit == 0)
+				dest[i] = 0;
+			if (!(pix[x] ^ invert_bit))
+			{
+#ifdef WORDS_BIGENDIAN
+				dest[i] |= (1 << (7 - bit));
+#else
+				dest[i] |= (1 << bit);
+#endif
+			}
+			bit++;
+			if (bit > 7)
+			{
+				bit = 0;
+				i++;
+			}
+		}
+	}
+	int shade = 100;
+	CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
+	QColor backColor = ScColorEngine::getShadeColorProof(m_doc->PageColors[CurrColorFill], m_doc, shade);
+	QImage res = QImage(width, height, QImage::Format_ARGB32);
+	res.fill(backColor.rgb());
+	unsigned char cc, cm, cy, ck;
+	for( int yi = 0; yi < res.height(); ++yi )
+	{
+		QRgb *t = (QRgb*)(res.scanLine( yi ));
+		for(int xi = 0; xi < res.width(); ++xi )
+		{
+			cc = qRed(*t);
+			cm = qGreen(*t);
+			cy = qBlue(*t);
+			ck = image->pixel(xi, yi);
+			if (ck == 0)
+				(*t) = qRgba(cc, cm, cy, 0);
+			else
+				(*t) = qRgba(cc, cm, cy, 255);
+			t++;
+		}
+	}
+	double *ctm;
+	ctm = state->getCTM();
+	double xCoor = m_doc->currentPage()->xOffset();
+	double yCoor = m_doc->currentPage()->yOffset();
+	QRectF crect = QRectF(0, 0, width, height);
+	m_ctm = QTransform(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, ctm[2] + ctm[4], ctm[3] + ctm[5]);
+	QLineF cline = QLineF(0, 0, width, 0);
+	QLineF tline = m_ctm.map(cline);
+	QRectF trect = m_ctm.mapRect(crect);
+	double sx = m_ctm.m11();
+	double sy = m_ctm.m22();
+	QTransform mm = QTransform(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, 0, 0);
+	if ((mm.type() == QTransform::TxShear) || (mm.type() == QTransform::TxRotate))
+	{
+		mm.reset();
+		mm.rotate(-tline.angle());
+	}
+	else
+	{
+		mm.reset();
+		if (sx < 0)
+			mm.scale(-1, 1);
+		if (sy < 0)
+			mm.scale(1, -1);
+	}
+	res = res.transformed(mm);
+	if (res.isNull())
+	{
+		delete imgStr;
+		delete image;
+		return;
+	}
+	int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor + trect.x(), yCoor + trect.y(), trect.width(), trect.height(), 0, CommonStrings::None, CommonStrings::None, true);
+	PageItem* ite = m_doc->Items->at(z);
+	ite->SetRectFrame();
+	m_doc->setRedrawBounding(ite);
+	ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
+	ite->setTextFlowMode(PageItem::TextFlowDisabled);
+	ite->setFillShade(100);
+	ite->setLineShade(100);
+	ite->setFillEvenOdd(false);
+	ite->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pdf_XXXXXX.png");
+	if (ite->tempImageFile->open())
+	{
+		QString fileName = getLongPathName(ite->tempImageFile->fileName());
+		if (!fileName.isEmpty())
+		{
+			ite->tempImageFile->close();
+			ite->isInlineImage = true;
+			res.save(fileName, "PNG");
+			m_doc->LoadPict(fileName, z);
+			ite->setImageScalingMode(false, true);
+			m_doc->AdjustItemSize(ite);
+			m_Elements->append(ite);
+			if (m_groupStack.count() != 0)
+			{
+				m_groupStack.top().Items.append(ite);
+				applyMask(ite);
+			}
+		}
+		else
+			m_doc->Items->removeAll(ite);
+	}
+	else
+		m_doc->Items->removeAll(ite);
+	imgStr->close();
+	delete imgStr;
+	delete image;
+}
+
 void SlaOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight,
 				   GfxImageColorMap *maskColorMap, GBool maskInterpolate)
 {
-	double *ctm;
-	ctm = state->getCTM();
-	m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
 	ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
 	imgStr->reset();
 	unsigned int *dest = 0;
@@ -973,19 +1193,33 @@
 			t++;
 		}
 	}
+	double *ctm;
+	ctm = state->getCTM();
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	double sx = ctm[0] / width;
-	double sy = ctm[3] / height;
-	if (sx < 0)
-		xCoor = xCoor + ctm[4] - (fabs(sx) * width);
+	QRectF crect = QRectF(0, 0, width, height);
+	m_ctm = QTransform(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, ctm[2] + ctm[4], ctm[3] + ctm[5]);
+	QLineF cline = QLineF(0, 0, width, 0);
+	QLineF tline = m_ctm.map(cline);
+	QRectF trect = m_ctm.mapRect(crect);
+	double sx = m_ctm.m11();
+	double sy = m_ctm.m22();
+	QTransform mm = QTransform(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, 0, 0);
+	if ((mm.type() == QTransform::TxShear) || (mm.type() == QTransform::TxRotate))
+	{
+		mm.reset();
+		mm.rotate(-tline.angle());
+	}
 	else
-		xCoor = xCoor + ctm[4];
-	if (sy < 0)
-		yCoor = yCoor + ctm[5] - (fabs(sy) * height);
-	else
-		yCoor = yCoor + ctm[5];
-	int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor , yCoor, fabs(sx) * width, fabs(sy) * height, 0, CommonStrings::None, CommonStrings::None, true);
+	{
+		mm.reset();
+		if (sx < 0)
+			mm.scale(-1, 1);
+		if (sy < 0)
+			mm.scale(1, -1);
+	}
+	res = res.transformed(mm);
+	int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor + trect.x(), yCoor + trect.y(), trect.width(), trect.height(), 0, CommonStrings::None, CommonStrings::None, true);
 	PageItem* ite = m_doc->Items->at(z);
 	ite->SetRectFrame();
 	m_doc->setRedrawBounding(ite);
@@ -997,24 +1231,29 @@
 	ite->setFillTransparency(1.0 - state->getFillOpacity());
 	ite->setFillBlendmode(getBlendMode(state));
 	ite->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pdf_XXXXXX.png");
-	ite->tempImageFile->open();
-	QString fileName = getLongPathName(ite->tempImageFile->fileName());
-	ite->tempImageFile->close();
-	ite->isInlineImage = true;
-	res.save(fileName, "PNG");
-	m_doc->LoadPict(fileName, z);
-	ite->setImageScalingMode(false, true);
-	if (sx < 0)
-		ite->setImageFlippedH(true);
-	if (sy > 0)
-		ite->setImageFlippedV(true);
-	m_doc->AdjustItemSize(ite);
-	m_Elements->append(ite);
-	if (m_groupStack.count() != 0)
-	{
-		m_groupStack.top().Items.append(ite);
-		applyMask(ite);
-	}
+	if (ite->tempImageFile->open())
+	{
+		QString fileName = getLongPathName(ite->tempImageFile->fileName());
+		if (!fileName.isEmpty())
+		{
+			ite->tempImageFile->close();
+			ite->isInlineImage = true;
+			res.save(fileName, "PNG");
+			m_doc->LoadPict(fileName, z);
+			ite->setImageScalingMode(false, true);
+			m_doc->AdjustItemSize(ite);
+			m_Elements->append(ite);
+			if (m_groupStack.count() != 0)
+			{
+				m_groupStack.top().Items.append(ite);
+				applyMask(ite);
+			}
+		}
+		else
+			m_doc->Items->removeAll(ite);
+	}
+	else
+		m_doc->Items->removeAll(ite);
 	delete imgStr;
 	delete[] buffer;
 	delete image;
@@ -1024,9 +1263,6 @@
 
 void SlaOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, int *maskColors, GBool inlineImg)
 {
-	double *ctm;
-	ctm = state->getCTM();
-	m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
 	ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
 	imgStr->reset();
 	unsigned int *dest = 0;
@@ -1072,19 +1308,33 @@
 		delete image;
 		return;
 	}
+	double *ctm;
+	ctm = state->getCTM();
 	double xCoor = m_doc->currentPage()->xOffset();
 	double yCoor = m_doc->currentPage()->yOffset();
-	double sx = ctm[0] / width;
-	double sy = ctm[3] / height;
-	if (sx < 0)
-		xCoor = xCoor + ctm[4] - (fabs(sx) * width);
+	QRectF crect = QRectF(0, 0, width, height);
+	m_ctm = QTransform(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, ctm[2] + ctm[4], ctm[3] + ctm[5]);
+	QLineF cline = QLineF(0, 0, width, 0);
+	QLineF tline = m_ctm.map(cline);
+	QRectF trect = m_ctm.mapRect(crect);
+	double sx = m_ctm.m11();
+	double sy = m_ctm.m22();
+	QTransform mm = QTransform(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, 0, 0);
+	if ((mm.type() == QTransform::TxShear) || (mm.type() == QTransform::TxRotate))
+	{
+		mm.reset();
+		mm.rotate(-tline.angle());
+	}
 	else
-		xCoor = xCoor + ctm[4];
-	if (sy < 0)
-		yCoor = yCoor + ctm[5] - (fabs(sy) * height);
-	else
-		yCoor = yCoor + ctm[5];
-	int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor , yCoor, fabs(sx) * width, fabs(sy) * height, 0, CommonStrings::None, CommonStrings::None, true);
+	{
+		mm.reset();
+		if (sx < 0)
+			mm.scale(-1, 1);
+		if (sy < 0)
+			mm.scale(1, -1);
+	}
+	QImage img = image->transformed(mm);
+	int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor + trect.x(), yCoor + trect.y(), trect.width(), trect.height(), 0, CommonStrings::None, CommonStrings::None, true);
 	PageItem* ite = m_doc->Items->at(z);
 	ite->SetRectFrame();
 	m_doc->setRedrawBounding(ite);
@@ -1096,24 +1346,29 @@
 	ite->setFillTransparency(1.0 - state->getFillOpacity());
 	ite->setFillBlendmode(getBlendMode(state));
 	ite->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pdf_XXXXXX.png");
-	ite->tempImageFile->open();
-	QString fileName = getLongPathName(ite->tempImageFile->fileName());
-	ite->tempImageFile->close();
-	ite->isInlineImage = true;
-	image->save(fileName, "PNG");
-	m_doc->LoadPict(fileName, z);
-	ite->setImageScalingMode(false, true);
-	if (sx < 0)
-		ite->setImageFlippedH(true);
-	if (sy > 0)
-		ite->setImageFlippedV(true);
-	m_doc->AdjustItemSize(ite);
-	m_Elements->append(ite);
-	if (m_groupStack.count() != 0)
-	{
-		m_groupStack.top().Items.append(ite);
-		applyMask(ite);
-	}
+	if (ite->tempImageFile->open())
+	{
+		QString fileName = getLongPathName(ite->tempImageFile->fileName());
+		if (!fileName.isEmpty())
+		{
+			ite->tempImageFile->close();
+			ite->isInlineImage = true;
+			img.save(fileName, "PNG");
+			m_doc->LoadPict(fileName, z);
+			ite->setImageScalingMode(false, true);
+			m_doc->AdjustItemSize(ite);
+			m_Elements->append(ite);
+			if (m_groupStack.count() != 0)
+			{
+				m_groupStack.top().Items.append(ite);
+				applyMask(ite);
+			}
+		}
+		else
+			m_doc->Items->removeAll(ite);
+	}
+	else
+		m_doc->Items->removeAll(ite);
 	delete imgStr;
 	delete[] buffer;
 	delete image;
@@ -1436,7 +1691,8 @@
 			m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
 			double xCoor = m_doc->currentPage()->xOffset();
 			double yCoor = m_doc->currentPage()->yOffset();
-			CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
+			int shade = 100;
+			CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
 			FPointArray textPath;
 			textPath.fromQPainterPath(qPath);
 			FPoint wh = textPath.WidthHeight();
@@ -1453,8 +1709,7 @@
 				ite->PoLine = textPath.copy();
 				ite->ClipEdited = true;
 				ite->FrameType = 3;
-				ite->setFillShade(100);
-				ite->setLineShade(100);
+				ite->setFillShade(shade);
 				ite->setFillEvenOdd(false);
 				ite->setFillTransparency(1.0 - state->getFillOpacity());
 				ite->setFillBlendmode(getBlendMode(state));
@@ -1464,11 +1719,12 @@
 				m_doc->AdjustItemSize(ite);
 				if ((render & 3) == 1 || (render & 3) == 2)
 				{
-					CurrColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor());
+					CurrColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &shade);
 					ite->setLineColor(CurrColorStroke);
 					ite->setLineWidth(state->getTransformedLineWidth());
 					ite->setLineTransparency(1.0 - state->getStrokeOpacity());
 					ite->setLineBlendmode(getBlendMode(state));
+					ite->setLineShade(shade);
 				}
 				m_Elements->append(ite);
 				if (m_groupStack.count() != 0)
@@ -1482,9 +1738,187 @@
 	}
 }
 
+GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen)
+{
+//	qDebug() << "beginType3Char";
+	double *ctm;
+	ctm = state->getCTM();
+	QTransform orig_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
+	GfxFont *gfxFont;
+	GfxFontType fontType;
+	if (!(gfxFont = state->getFont()))
+		return gTrue;
+	fontType = gfxFont->getType();
+	if (fontType != fontType3)
+		return gTrue;
+	Ref* fref = gfxFont->getID();
+	QString fRefID = QString("Font_%1_%2").arg(fref->num).arg(code);
+	if (m_Font_Pattern_Map.contains(fRefID))
+	{
+		QLineF cline = QLineF(0, 0, 1, 0);
+		QLineF tline = orig_ctm.map(cline);
+		double xCoor = m_doc->currentPage()->xOffset();
+		double yCoor = m_doc->currentPage()->yOffset();
+		ScPattern pat = m_doc->docPatterns[m_Font_Pattern_Map[fRefID].pattern];
+		QTransform mm;
+		mm.translate(0, -pat.height * tline.length());
+		mm = orig_ctm * mm;
+		int shade = 100;
+		CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
+		int z = 0;
+		if (m_Font_Pattern_Map[fRefID].colored)
+			z = m_doc->itemAdd(PageItem::Symbol, PageItem::Unspecified, xCoor + mm.dx(), yCoor + mm.dy(), pat.width * tline.length(), pat.height * tline.length(), 0, CommonStrings::None, CommonStrings::None, true);
+		else
+			z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + mm.dx(), yCoor + mm.dy(), pat.width * tline.length(), pat.height * tline.length(), 0, CurrColorFill, CommonStrings::None, true);
+		PageItem *b = m_doc->Items->at(z);
+		b->setWidth(pat.width * tline.length());
+		b->setHeight(pat.height * tline.length());
+		b->OldB2 = b->width();
+		b->OldH2 = b->height();
+		m_doc->RotMode(3);
+		m_doc->RotateItem(-tline.angle(), b);
+		m_doc->RotMode(0);
+		b->setFillShade(shade);
+		b->setFillEvenOdd(false);
+		b->setFillTransparency(1.0 - state->getFillOpacity());
+		b->setFillBlendmode(getBlendMode(state));
+		b->setLineEnd(PLineEnd);
+		b->setLineJoin(PLineJoin);
+		b->setTextFlowMode(PageItem::TextFlowDisabled);
+		if (m_Font_Pattern_Map[fRefID].colored)
+			b->setPattern(m_Font_Pattern_Map[fRefID].pattern);
+		else
+		{
+			b->setFillShade(shade);
+			b->setPatternMask(m_Font_Pattern_Map[fRefID].pattern);
+			b->setMaskTransform(b->width() / pat.width * 100, b->height() / pat.height * 100, 0, 0, 0, 0, 0);
+			b->setMaskType(3);
+		}
+		m_Elements->append(b);
+		if (m_groupStack.count() != 0)
+		{
+			m_groupStack.top().Items.append(b);
+		}
+		return gTrue;
+	}
+	else
+	{
+		F3Entry f3e;
+		f3e.ctm = orig_ctm;
+		f3e.glyphRef = fRefID;
+		f3e.colored = false;
+		m_F3Stack.push(f3e);
+		ctm = state->getTextMat();
+		state->setCTM(ctm[0], ctm[1], ctm[2], ctm[3], 0, 0);
+		pushGroup();
+		return gFalse;
+	}
+}
+
+void SlaOutputDev::endType3Char(GfxState *state)
+{
+//	qDebug() << "endType3Char";
+	double *ctm;
+	ctm = state->getCTM();
+	groupEntry gElements = m_groupStack.pop();
+	tmpSel->clear();
+	if (gElements.Items.count() > 0)
+	{
+		for (int dre = 0; dre < gElements.Items.count(); ++dre)
+		{
+			tmpSel->addItem(gElements.Items.at(dre), true);
+			m_Elements->removeAll(gElements.Items.at(dre));
+		}
+		PageItem *ite = m_doc->groupObjectsSelection(tmpSel);
+		ite->setFillTransparency(1.0 - state->getFillOpacity());
+		ite->setFillBlendmode(getBlendMode(state));
+		m_doc->m_Selection->addItem(ite, true);
+		m_doc->itemSelection_FlipV();
+		m_doc->m_Selection->clear();
+		ScPattern pat = ScPattern();
+		pat.setDoc(m_doc);
+		m_doc->DoDrawing = true;
+		pat.pattern = ite->DrawObj_toImage(qMax(ite->width(), ite->height()));
+		pat.xoffset = 0;
+		pat.yoffset = 0;
+		m_doc->DoDrawing = false;
+		pat.width = ite->width();
+		pat.height = ite->height();
+		pat.items.append(ite);
+		m_doc->Items->removeAll(ite);
+		QString id = QString("Pattern_from_PDF_%1T").arg(m_doc->docPatterns.count() + 1);
+		m_doc->addPattern(id, pat);
+		tmpSel->clear();
+		if (m_F3Stack.count() > 0)
+		{
+			F3Entry f3e = m_F3Stack.pop();
+			state->setCTM(f3e.ctm.m11(), f3e.ctm.m12(), f3e.ctm.m21(), f3e.ctm.m22(), f3e.ctm.dx(), f3e.ctm.dy());
+			QLineF cline = QLineF(0, 0, 1, 0);
+			QLineF tline = f3e.ctm.map(cline);
+			double xCoor = m_doc->currentPage()->xOffset();
+			double yCoor = m_doc->currentPage()->yOffset();
+			QTransform mm;
+			mm.translate(0, -pat.height * tline.length());
+			mm = f3e.ctm * mm;
+			int shade = 100;
+			CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
+			int z = 0;
+			if (f3e.colored)
+				z = m_doc->itemAdd(PageItem::Symbol, PageItem::Unspecified, xCoor + mm.dx(), yCoor + mm.dy(), pat.width * tline.length(), pat.height * tline.length(), 0, CommonStrings::None, CommonStrings::None, true);
+			else
+				z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + mm.dx(), yCoor + mm.dy(), pat.width * tline.length(), pat.height * tline.length(), 0, CurrColorFill, CommonStrings::None, true);
+			PageItem *b = m_doc->Items->at(z);
+			b->setWidth(pat.width * tline.length());
+			b->setHeight(pat.height * tline.length());
+			b->OldB2 = b->width();
+			b->OldH2 = b->height();
+			m_doc->RotMode(3);
+			m_doc->RotateItem(-tline.angle(), b);
+			m_doc->RotMode(0);
+			b->setFillEvenOdd(false);
+			b->setFillTransparency(1.0 - state->getFillOpacity());
+			b->setFillBlendmode(getBlendMode(state));
+			b->setLineEnd(PLineEnd);
+			b->setLineJoin(PLineJoin);
+			b->setTextFlowMode(PageItem::TextFlowDisabled);
+			if (f3e.colored)
+				b->setPattern(id);
+			else
+			{
+				b->setFillShade(shade);
+				b->setPatternMask(id);
+				b->setMaskTransform(b->width() / pat.width * 100, b->height() / pat.height * 100, 0, 0, 0, 0, 0);
+				b->setMaskType(3);
+			}
+			m_Elements->append(b);
+			if (m_groupStack.count() != 0)
+			{
+				m_groupStack.top().Items.append(b);
+			}
+			F3GlyphEntry gid;
+			gid.colored = f3e.colored;
+			gid.pattern = id;
+			m_Font_Pattern_Map.insert(f3e.glyphRef, gid);
+		}
+	}
+}
+
+void SlaOutputDev::type3D0(GfxState * /*state*/, double /*wx*/, double /*wy*/)
+{
+//	qDebug() << "type3D0";
+	if (m_F3Stack.count() > 0)
+		m_F3Stack.top().colored = true;
+}
+
+void SlaOutputDev::type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury)
+{
+//	qDebug() << "type3D1";
+	if (m_F3Stack.count() > 0)
+		m_F3Stack.top().colored = false;
+}
+
 void SlaOutputDev::beginTextObject(GfxState *state)
 {
-//	qDebug() << "Begin Text Object";
 	pushGroup();
 }
 
@@ -1523,13 +1957,19 @@
 	}
 }
 
-QString SlaOutputDev::getColor(GfxColorSpace *color_space, GfxColor *color)
+QString SlaOutputDev::getColor(GfxColorSpace *color_space, GfxColor *color, int *shade)
 {
 	QString fNam;
 	QString namPrefix = "FromPDF";
 	ScColor tmp;
 	tmp.setSpotColor(false);
 	tmp.setRegistrationColor(false);
+	*shade = 100;
+	if (m_F3Stack.count() > 0)
+	{
+		if (!m_F3Stack.top().colored)
+			return "Black";
+	}
 	if ((color_space->getMode() == csDeviceRGB) || (color_space->getMode() == csCalRGB))
 	{
 		GfxRGB rgb;
@@ -1571,6 +2011,7 @@
 		tmp.setSpotColor(true);
 		QString nam = QString(((GfxSeparationColorSpace*)color_space)->getName()->getCString());
 		fNam = m_doc->PageColors.tryAddColor(nam, tmp);
+		*shade = qRound(colToDbl(color->c[0]) * 100);
 	}
 	else
 	{
@@ -1747,6 +2188,14 @@
 			}
 		}
 	}
+	// Code for updating our Progressbar, needs to be called this way, as we have no
+	// possibility to get the current fileposition.
+	updateGUICounter++;
+	if (updateGUICounter > 20)
+	{
+		qApp->processEvents();
+		updateGUICounter = 0;
+	}
 }
 
 void SlaOutputDev::pushGroup(QString maskName, GBool forSoftMask, GBool alpha, bool inverted)

Modified: branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.h
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.h (original)
+++ branches/ScribusOIF/scribus/plugins/import/pdf/slaoutput.h Wed Aug 10 22:39:40 2011
@@ -99,26 +99,26 @@
 	virtual GBool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) { return (shading->getExtend0() == shading->getExtend1()); }
 	virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax);
 	virtual GBool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) { return (shading->getExtend0() == shading->getExtend1()); }
-	virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) { qDebug() << "triangle shaded fill"; return gTrue; }
+	virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading);
 	virtual GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading);
 	//----- path clipping
 	virtual void clip(GfxState *state);
 	virtual void eoClip(GfxState *state);
-	//----- text drawing
-	virtual void beginTextObject(GfxState *state);
 	virtual GBool deviceHasTextClip(GfxState *state) { return gFalse; }
-	virtual void endTextObject(GfxState *state);
-	virtual void drawChar(GfxState *state, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, double /*originX*/, double /*originY*/, CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/);
 
   // If current colorspace is pattern,
   // does this device support text in pattern colorspace?
-	virtual GBool supportTextCSPattern(GfxState *state) {
-	  return state->getFillColorSpace()->getMode() == csPattern; }
+	virtual GBool supportTextCSPattern(GfxState *state)
+	{
+		return state->getFillColorSpace()->getMode() == csPattern;
+	}
 
   // If current colorspace is pattern,
   // need this device special handling for masks in pattern colorspace?
-	virtual GBool fillMaskCSPattern(GfxState * state) {
-	  return state->getFillColorSpace()->getMode() == csPattern; }
+	virtual GBool fillMaskCSPattern(GfxState * state)
+	{
+		return state->getFillColorSpace()->getMode() == csPattern;
+	}
 
 	virtual void endMaskClip(GfxState *state) { qDebug() << "End Mask Clip"; }
 
@@ -126,9 +126,7 @@
 	virtual void beginMarkedContent(char *name, Dict *properties);
 	virtual void endMarkedContent(GfxState *state);
 	//----- image drawing
-	virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
-				 int width, int height, GBool invert, GBool interpolate,
-				 GBool inlineImg)  { qDebug() << "Draw Image Mask"; }
+	virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool interpolate, GBool inlineImg);
 	virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, int *maskColors, GBool inlineImg);
 	virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
 				   int width, int height,
@@ -154,12 +152,20 @@
 	virtual void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/);
 	virtual void clearSoftMask(GfxState * /*state*/);
 
-	virtual void updateFillColor(GfxState *state);
+//	virtual void updateFillColor(GfxState *state);
 	virtual void updateFont(GfxState *state);
+	//----- text drawing
+	virtual void beginTextObject(GfxState *state);
+	virtual void endTextObject(GfxState *state);
+	virtual void drawChar(GfxState *state, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, double /*originX*/, double /*originY*/, CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/);
+	virtual GBool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, CharCode /*code*/, Unicode * /*u*/, int /*uLen*/);
+	virtual void endType3Char(GfxState * /*state*/);
+	virtual void type3D0(GfxState * /*state*/, double /*wx*/, double /*wy*/);
+	virtual void type3D1(GfxState * /*state*/, double /*wx*/, double /*wy*/, double /*llx*/, double /*lly*/, double /*urx*/, double /*ury*/);
 
 private:
 	void getPenState(GfxState *state);
-	QString getColor(GfxColorSpace *color_space, GfxColor *color);
+	QString getColor(GfxColorSpace *color_space, GfxColor *color, int *shade);
 	QString convertPath(GfxPath *path);
 	int getBlendMode(GfxState *state);
 	void applyMask(PageItem *ite);
@@ -195,12 +201,26 @@
 	QList<PageItem*> *m_Elements;
 	QStringList *m_importedColors;
 	QTransform m_ctm;
+	struct F3Entry
+	{
+		QTransform ctm;
+		QString glyphRef;
+		bool colored;
+	};
+	QStack<F3Entry> m_F3Stack;
+	struct F3GlyphEntry
+	{
+		QString pattern;
+		bool colored;
+	};
+	QMap<QString, F3GlyphEntry> m_Font_Pattern_Map;
 	int grStackDepth;
 	int layerNum;
 	int currentLayer;
 	int importerFlags;
 	bool firstPage;
 	int pagecount;
+	int updateGUICounter;
 	XRef *xref;		// xref table for current document
 	Catalog *catalog;
 	SplashFontEngine *m_fontEngine;

Modified: branches/ScribusOIF/scribus/plugins/import/shape/importshape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/shape/importshape.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/shape/importshape.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/shape/importshape.cpp Wed Aug 10 22:39:40 2011
@@ -56,6 +56,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage ShapePlug::readThumbnail(QString fName)

Modified: branches/ScribusOIF/scribus/plugins/import/sml/importsml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/sml/importsml.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/sml/importsml.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/sml/importsml.cpp Wed Aug 10 22:39:40 2011
@@ -54,6 +54,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage SmlPlug::readThumbnail(QString fName)

Modified: branches/ScribusOIF/scribus/plugins/import/wpg/importwpg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/wpg/importwpg.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/wpg/importwpg.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/wpg/importwpg.cpp Wed Aug 10 22:39:40 2011
@@ -422,6 +422,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage WpgPlug::readThumbnail(QString fName)

Modified: branches/ScribusOIF/scribus/plugins/import/xar/importxar.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/xar/importxar.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/xar/importxar.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/xar/importxar.cpp Wed Aug 10 22:39:40 2011
@@ -64,6 +64,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 bool XarPlug::readColors(const QString& fNameIn, ColorList &colors)

Modified: branches/ScribusOIF/scribus/plugins/import/xfig/importxfig.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/import/xfig/importxfig.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/xfig/importxfig.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/xfig/importxfig.cpp Wed Aug 10 22:39:40 2011
@@ -56,6 +56,7 @@
 	m_Doc=doc;
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
 }
 
 QImage XfigPlug::readThumbnail(QString fName)

Modified: branches/ScribusOIF/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/svgexplugin/svgexplugin.cpp Wed Aug 10 22:39:40 2011
@@ -429,6 +429,10 @@
 				obc.appendChild(cl);
 				globalDefs.appendChild(obc);
 				ob.setAttribute("clip-path", "url(#Clip"+IToStr(ClipCount)+")");
+				if (Item->fillRule)
+					ob.setAttribute("clip-rule", "evenodd");
+				else
+					ob.setAttribute("clip-rule", "nonzero");
 				ClipCount++;
 				for (int em = 0; em < Item->groupItemList.count(); ++em)
 				{
@@ -2184,23 +2188,28 @@
 QString SVGExPlug::SetClipPath(FPointArray *ite, bool closed)
 {
 	QString tmp = "";
-	FPoint np, np1, np2, np3;
+	FPoint np, np1, np2, np3, np4, firstP;
 	bool nPath = true;
+	bool first = true;
 	if (ite->size() > 3)
 	{
 		for (uint poi=0; poi<ite->size()-3; poi += 4)
 		{
 			if (ite->point(poi).x() > 900000)
 			{
-				tmp += "Z ";
 				nPath = true;
 				continue;
 			}
 			if (nPath)
 			{
 				np = ite->point(poi);
+				if ((!first) && (closed) && (np4 == firstP))
+					tmp += "Z ";
 				tmp += QString("M%1 %2 ").arg(np.x()).arg(np.y());
 				nPath = false;
+				first = false;
+				firstP = np;
+				np4 = np;
 			}
 			np = ite->point(poi);
 			np1 = ite->point(poi+1);
@@ -2210,6 +2219,7 @@
 				tmp += QString("L%1 %2 ").arg(np3.x()).arg(np3.y());
 			else
 				tmp += QString("C%1 %2 %3 %4 %5 %6 ").arg(np1.x()).arg(np1.y()).arg(np2.x()).arg(np2.y()).arg(np3.x()).arg(np3.y());
+			np4 = np3;
 		}
 	}
 	if (closed)

Modified: branches/ScribusOIF/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/pslib.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pslib.cpp (original)
+++ branches/ScribusOIF/scribus/pslib.cpp Wed Aug 10 22:39:40 2011
@@ -2603,7 +2603,7 @@
 				PS_save();
 				SetClipPath(&c->PoLine);
 				PS_closepath();
-				PS_clip(true);
+				PS_clip(c->fillRule);
 				if (c->imageFlippedH())
 				{
 					PS_translate(c->width(), 0);
@@ -2632,7 +2632,7 @@
 			PS_save();
 			SetClipPath(&c->PoLine);
 			PS_closepath();
-			PS_clip(true);
+			PS_clip(c->fillRule);
 			if (c->imageFlippedH())
 			{
 				PS_translate(c->width(), 0);
@@ -4812,24 +4812,28 @@
 
 void PSLib::SetClipPath(FPointArray *c, bool poly)
 {
-	FPoint np, np1, np2, np3;
+	FPoint np, np1, np2, np3, np4, firstP;
 	bool nPath = true;
+	bool first = true;
 	if (c->size() > 3)
 	{
 		for (uint poi=0; poi<c->size()-3; poi += 4)
 		{
 			if (c->point(poi).x() > 900000)
 			{
-				if (poly)
-					PS_closepath();
 				nPath = true;
 				continue;
 			}
 			if (nPath)
 			{
 				np = c->point(poi);
+				if ((!first) && (poly) && (np4 == firstP))
+					PS_closepath();
 				PS_moveto(np.x(), -np.y());
 				nPath = false;
+				first = false;
+				firstP = np;
+				np4 = np;
 			}
 			np = c->point(poi);
 			np1 = c->point(poi+1);
@@ -4839,10 +4843,7 @@
 				PS_lineto(np3.x(), -np3.y());
 			else
 				PS_curve(np1.x(), -np1.y(), np2.x(), -np2.y(), np3.x(), -np3.y());
-/*			np = c->point(poi+1);
-			np1 = c->point(poi+3);
-			np2 = c->point(poi+2);
-			PS_curve(np.x(), -np.y(), np1.x(), -np1.y(), np2.x(), -np2.y()); */
+			np4 = np3;
 		}
 	}
 }

Modified: branches/ScribusOIF/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/scpainter.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scpainter.cpp (original)
+++ branches/ScribusOIF/scribus/scpainter.cpp Wed Aug 10 22:39:40 2011
@@ -88,6 +88,7 @@
 	if (clipArray != NULL)
 		la.groupClip = *clipArray;
 	la.data = cairo_get_group_target(m_cr);
+	la.fillRule = m_fillRule;
 	cairo_push_group(m_cr);
 /*	if (clipArray != NULL)
 	{
@@ -119,11 +120,16 @@
 	mask_gradientSkew = la.mask_gradientSkew;
 	mask_gradient = la.mask_gradient;
 	m_maskPattern = la.maskPattern;
+	m_fillRule = la.fillRule;
 	if (la.pushed)
 	{
 		cairo_pop_group_to_source (m_cr);
 		if (la.groupClip.size() != 0)
 		{
+			if( m_fillRule )
+				cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_EVEN_ODD);
+			else
+				cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_WINDING);
 			setupPolygon(&la.groupClip);
 			setClipPath();
 		}
@@ -169,6 +175,7 @@
 	mask_gradientSkew = la.mask_gradientSkew;
 	mask_gradient = la.mask_gradient;
 	m_maskPattern = la.maskPattern;
+	m_fillRule = la.fillRule;
 	if (la.pushed)
 	{
 		if ((m_blendMode != 0) && (Layers.count() != 0))
@@ -361,6 +368,10 @@
 		cairo_pop_group_to_source (m_cr);
 		if (la.groupClip.size() != 0)
 		{
+			if( m_fillRule )
+				cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_EVEN_ODD);
+			else
+				cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_WINDING);
 			setupPolygon(&la.groupClip);
 			setClipPath();
 		}
@@ -1787,7 +1798,7 @@
 {
 	bool nPath = true;
 	bool first = true;
-	FPoint np, np1, np2, np3, np4;
+	FPoint np, np1, np2, np3, np4, firstP;
 	if (points->size() > 3)
 	{
 		newPath();
@@ -1801,9 +1812,10 @@
 			if (nPath)
 			{
 				np = points->point(poi);
-				if ((!first) && (closed))
+				if ((!first) && (closed) && (np4 == firstP))
 					cairo_close_path( m_cr );
     			cairo_move_to( m_cr, np.x(), np.y());
+				firstP = np;
 				nPath = false;
 				first = false;
 				np4 = np;

Modified: branches/ScribusOIF/scribus/scpainter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/scpainter.h
==============================================================================
--- branches/ScribusOIF/scribus/scpainter.h (original)
+++ branches/ScribusOIF/scribus/scpainter.h Wed Aug 10 22:39:40 2011
@@ -142,6 +142,7 @@
 		ScPattern *maskPattern;
 		FPointArray groupClip;
 		bool pushed;
+		bool fillRule;
 	};
 	cairo_pattern_t *getMaskPattern();
 	cairo_surface_t *imageMask;

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Wed Aug 10 22:39:40 2011
@@ -391,8 +391,8 @@
 		scrActions["SaveAsDocumentTemplate"]->setEnabled(false);
 
 	connect(ScCore->fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecentFromWatcher(QString)));
-	connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&)));
-	connect(this, SIGNAL(TextEffects(int)), propertiesPalette, SLOT(setStil(int)));
+//	connect(this, SIGNAL(TextStyle(const ParagraphStyle&)), propertiesPalette, SLOT(updateStyle(const ParagraphStyle&)));
+//	connect(this, SIGNAL(TextEffects(int)), propertiesPalette, SLOT(setStil(int)));
 	connect(ClipB, SIGNAL(dataChanged()), this, SLOT(ClipChange()));
 //	connect(ClipB, SIGNAL(selectionChanged()), this, SLOT(ClipChange()));
 	setAcceptDrops(true);

Modified: branches/ScribusOIF/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/scribusdoc.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribusdoc.cpp (original)
+++ branches/ScribusOIF/scribus/scribusdoc.cpp Wed Aug 10 22:39:40 2011
@@ -8222,29 +8222,19 @@
 	if (tmpSelection.count() != 0)
 		itemSelection_DeleteItem(&tmpSelection);
 	tmpSelection.clear();
-	QList<PageItem*> allItems;
 	for (int b = 0; b < DocItems.count(); ++b)
 	{
 		PageItem* currItem = DocItems.at(b);
-		if (currItem->isGroup())
-			allItems = currItem->getItemList();
-		else
-			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			currItem = allItems.at(ii);
-			if (currItem->LayerID == l)
-			{
-				if (dl)
-				{
-					tmpSelection.addItem(currItem);
-					currItem->setLocked(false);
-				}
-				else
-					currItem->setLayer(newLayerID);
-			}
-		}
-		allItems.clear();
+		if (currItem->LayerID == l)
+		{
+			if (dl)
+			{
+				tmpSelection.addItem(currItem);
+				currItem->setLocked(false);
+			}
+			else
+				currItem->setLayer(newLayerID);
+		}
 	}
 	if (tmpSelection.count() != 0)
 		itemSelection_DeleteItem(&tmpSelection);
@@ -11110,7 +11100,7 @@
 	DoDrawing = false;
 	view()->updatesOn(false);
 	m_Selection->delaySignalsOn();
-	m_ScMW->setScriptRunning(true);
+//	m_ScMW->setScriptRunning(true);
 	if (mdData.type==0) // Copy and offset or set a gap
 	{
 		double dH = mdData.copyShiftGapH / docUnitRatio;
@@ -11131,6 +11121,7 @@
 		m_View->Deselect(true);
 		for (int i=0; i<mdData.copyCount; ++i)
 		{
+			m_View->Deselect(true);
 			m_ScMW->slotEditPaste();
 			for (int b=0; b<m_Selection->count(); ++b)
 			{
@@ -11200,7 +11191,7 @@
 	DoDrawing = true;
 	m_Selection->delaySignalsOff();
 	view()->updatesOn(true);
-	m_ScMW->setScriptRunning(false);
+//	m_ScMW->setScriptRunning(false);
 	//FIXME: stop using m_View
 	m_View->Deselect(true);
 	view()->DrawNew();
@@ -12282,7 +12273,10 @@
 	{
 		currItem = itemSelection->itemAt(c);
 		int d = Items->indexOf(currItem);
-		groupItem->groupItemList.append(Items->takeAt(d));
+		if (d >= 0)
+			groupItem->groupItemList.append(Items->takeAt(d));
+		else
+			groupItem->groupItemList.append(currItem);
 	}
 	groupItem->asGroupFrame()->adjustXYPosition();
 	renumberItemsInListOrder();
@@ -12333,7 +12327,10 @@
 	{
 		currItem = itemList.at(c);
 		int d = Items->indexOf(currItem);
-		groupItem->groupItemList.append(Items->takeAt(d));
+		if (d >= 0)
+			groupItem->groupItemList.append(Items->takeAt(d));
+		else
+			groupItem->groupItemList.append(currItem);
 		currItem->gXpos = currItem->xPos() - minx;
 		currItem->gYpos = currItem->yPos() - miny;
 		currItem->gWidth = maxx - minx;
@@ -12373,7 +12370,10 @@
 	{
 		currItem = itemList.at(c);
 		int d = Items->indexOf(currItem);
-		groupItem->groupItemList.append(Items->takeAt(d));
+		if (d >= 0)
+			groupItem->groupItemList.append(Items->takeAt(d));
+		else
+			groupItem->groupItemList.append(currItem);
 		currItem->gXpos = currItem->xPos() - groupItem->xPos();
 		currItem->gYpos = currItem->yPos() - groupItem->yPos();
 		currItem->gWidth = maxx - minx;

Modified: branches/ScribusOIF/scribus/third_party/pgf/BitStream.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/BitStream.h
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/BitStream.h (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/BitStream.h Wed Aug 10 22:39:40 2011
@@ -1,26 +1,31 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2006-06-04 22:05:59 +0200 (So, 04 Jun 2006) $
  * $Revision: 229 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file Bitstream.h
+/// @brief PGF bit-stream operations
+/// @author C. Stamm
+
 #ifndef PGF_BITSTREAM_H
 #define PGF_BITSTREAM_H
 
@@ -31,13 +36,14 @@
 //static const WordWidthLog = 5;
 static const UINT32 Filled = 0xFFFFFFFF;
 
-#define MAKEU64(a, b) ((UINT64) (((UINT32) (a)) | ((UINT64) ((UINT32) (b))) << 32)) 
- 
+/// @brief Make 64 bit unsigned integer from two 32 bit unsigned integers
+#define MAKEU64(a, b) ((UINT64) (((UINT32) (a)) | ((UINT64) ((UINT32) (b))) << 32))
+
 // these procedures have to be inlined because of performance reasons
 
 //////////////////////////////////////////////////////////////////////
 /// Set one bit of a bit stream to 1
-/// @param stream A bit stream composed of unsigned integer arrays
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 inline void SetBit(UINT32* stream, UINT32 pos) {
 	stream[pos >> WordWidthLog] |= (1 << (pos%WordWidth));
@@ -45,15 +51,15 @@
 
 //////////////////////////////////////////////////////////////////////
 /// Set one bit of a bit stream to 0
-/// @param stream A bit stream composed of unsigned integer arrays
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 inline void ClearBit(UINT32* stream, UINT32 pos) {
-	stream[pos >> WordWidthLog] &= ~(1 << (pos%WordWidth)); 
+	stream[pos >> WordWidthLog] &= ~(1 << (pos%WordWidth));
 }
 
 //////////////////////////////////////////////////////////////////////
 /// Return one bit of a bit stream
-/// @param stream A bit stream composed of unsigned integer arrays
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 /// @return bit at position pos of bit stream stream
 inline bool GetBit(UINT32* stream, UINT32 pos)  {
@@ -62,10 +68,11 @@
 }
 
 //////////////////////////////////////////////////////////////////////
-/// Compare k-bit binary representation of stream at postition pos with val
-/// @param stream A bit stream composed of unsigned integer arrays
+/// Compare k-bit binary representation of stream at position pos with val
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 /// @param k Number of bits to compare
+/// @param val Value to compare with
 /// @return true if equal
 inline bool CompareBitBlock(UINT32* stream, UINT32 pos, UINT32 k, UINT32 val) {
 	const UINT32 iLoInt = pos >> WordWidthLog;
@@ -87,33 +94,35 @@
 }
 
 //////////////////////////////////////////////////////////////////////
-/// Store k-bit binary representation of val in stream at postition pos
-/// @param stream A bit stream composed of unsigned integer arrays
-/// @param pos A valid zero-based position in the bit stream
+/// Store k-bit binary representation of val in stream at position pos
+/// @param stream A bit stream stored in array of unsigned integers
+/// @param pos A valid zero-based position in the bit stream
+/// @param val Value to store in stream at position pos
 /// @param k Number of bits of integer representation of val
 inline void SetValueBlock(UINT32* stream, UINT32 pos, UINT32 val, UINT32 k) {
+	const UINT32 offset = pos%WordWidth;
 	const UINT32 iLoInt = pos >> WordWidthLog;
 	const UINT32 iHiInt = (pos + k - 1) >> WordWidthLog;
 	ASSERT(iLoInt <= iHiInt);
-	const UINT32 loMask = Filled << (pos%WordWidth);
+	const UINT32 loMask = Filled << offset;
 	const UINT32 hiMask = Filled >> (WordWidth - 1 - ((pos + k - 1)%WordWidth));
 
 	if (iLoInt == iHiInt) {
 		// fits into one integer
-		stream[iLoInt] &= ~(loMask & hiMask);
-		stream[iLoInt] |= val << (pos%WordWidth);
+		stream[iLoInt] &= ~(loMask & hiMask); // clear bits
+		stream[iLoInt] |= val << offset; // write value
 	} else {
 		// must be splitted over integer boundary
-		stream[iLoInt] &= ~loMask;
-		stream[iLoInt] |= val << (pos%WordWidth);
-		stream[iHiInt] &= ~hiMask;
-		stream[iHiInt] |= val >> (WordWidth - (pos%WordWidth));
+		stream[iLoInt] &= ~loMask; // clear bits
+		stream[iLoInt] |= val << offset; // write lower part of value
+		stream[iHiInt] &= ~hiMask; // clear bits
+		stream[iHiInt] |= val >> (WordWidth - offset); // write higher part of value
 	}
 }
 
 //////////////////////////////////////////////////////////////////////
 /// Read k-bit number from stream at position pos
-/// @param stream A bit stream composed of unsigned integer arrays
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 /// @param k Number of bits to read: 1 <= k <= 32
 inline UINT32 GetValueBlock(UINT32* stream, UINT32 pos, UINT32 k) {
@@ -122,7 +131,7 @@
 	const UINT32 iHiInt = (pos + k - 1) >> WordWidthLog;		// integer of last bit
 	const UINT32 loMask = Filled << (pos%WordWidth);
 	const UINT32 hiMask = Filled >> (WordWidth - 1 - ((pos + k - 1)%WordWidth));
-	
+
 	if (iLoInt == iHiInt) {
 		// inside integer boundary
 		count = stream[iLoInt] & (loMask & hiMask);
@@ -140,7 +149,7 @@
 
 //////////////////////////////////////////////////////////////////////
 /// Clear block of size at least len at position pos in stream
-/// @param stream A bit stream composed of unsigned integer arrays
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 /// @param len Number of bits set to 0
 inline void ClearBitBlock(UINT32* stream, UINT32 pos, UINT32 len) {
@@ -164,7 +173,7 @@
 
 //////////////////////////////////////////////////////////////////////
 /// Set block of size at least len at position pos in stream
-/// @param stream A bit stream composed of unsigned integer arrays
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 /// @param len Number of bits set to 1
 inline void SetBitBlock(UINT32* stream, UINT32 pos, UINT32 len) {
@@ -190,25 +199,24 @@
 //////////////////////////////////////////////////////////////////////
 /// Returns the distance to the next 1 in stream at position pos.
 /// If no 1 is found within len bits, then len is returned.
-/// @param stream A bit stream composed of unsigned integer arrays
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 /// @param len size of search area (in bits)
 /// return The distance to the next 1 in stream at position pos
 inline UINT32 SeekBitRange(UINT32* stream, UINT32 pos, UINT32 len) {
 	UINT32 count = 0;
-	UINT32 wordPos = pos >> WordWidthLog;
 	UINT32 testMask = 1 << (pos%WordWidth);
-	UINT32* word = stream + wordPos;
+	UINT32* word = stream + (pos >> WordWidthLog);
 
 	while (((*word & testMask) == 0) && (count < len)) {
-		count++; 
+		count++;
 		testMask <<= 1;
 		if (!testMask) {
 			word++; testMask = 1;
 
 			// fast steps if all bits in a word are zero
 			while ((count + WordWidth <= len) && (*word == 0)) {
-				word++; 
+				word++;
 				count += WordWidth;
 			}
 		}
@@ -220,28 +228,24 @@
 //////////////////////////////////////////////////////////////////////
 /// Returns the distance to the next 0 in stream at position pos.
 /// If no 0 is found within len bits, then len is returned.
-/// @param stream A bit stream composed of unsigned integer arrays
+/// @param stream A bit stream stored in array of unsigned integers
 /// @param pos A valid zero-based position in the bit stream
 /// @param len size of search area (in bits)
 /// return The distance to the next 0 in stream at position pos
 inline UINT32 SeekBit1Range(UINT32* stream, UINT32 pos, UINT32 len) {
 	UINT32 count = 0;
-	UINT32  wordPos = pos >> WordWidthLog;
-	UINT32  bitPos  = pos%WordWidth;
-	UINT32 testMask = 1 << bitPos;
-
-	while (((stream[wordPos] & testMask) != 0) && (count < len)) {
-		ASSERT(bitPos < WordWidth);
-		count++; 
-		bitPos++;
-		if (bitPos < WordWidth) {
-			testMask <<= 1;
-		} else {
-			wordPos++; bitPos = 0; testMask = 1;
-
-			// fast steps if all bits in a word are zero
-			while ((count + WordWidth <= len) && (stream[wordPos] == Filled)) {
-				wordPos++; 
+	UINT32 testMask = 1 << (pos%WordWidth);
+	UINT32* word = stream + (pos >> WordWidthLog);
+
+	while (((*word & testMask) != 0) && (count < len)) {
+		count++;
+		testMask <<= 1;
+		if (!testMask) {
+			word++; testMask = 1;
+
+			// fast steps if all bits in a word are one
+			while ((count + WordWidth <= len) && (*word == Filled)) {
+				word++;
 				count += WordWidth;
 			}
 		}
@@ -250,13 +254,12 @@
 }
 
 //////////////////////////////////////////////////////////////////////
-/// Compute position to beginning of the next 32-bit word
-/// @param pos Current bit stream position
-/// @return Position of next 32-bit word
+/// Compute bit position of the next 32-bit word
+/// @param pos current bit stream position
+/// @return bit position of next 32-bit word
 inline UINT32 AlignWordPos(UINT32 pos) {
-//	return (pos%WordWidth) ? pos + (WordWidth - pos%WordWidth) : pos;
-//	return pos + (WordWidth - pos%WordWidth)%WordWidth;
-	return ((pos + WordWidth - 1) >> WordWidthLog) << WordWidthLog;
+//	return ((pos + WordWidth - 1) >> WordWidthLog) << WordWidthLog;
+	return (pos + WordWidth - 1) & WordMask;
 }
 
 //////////////////////////////////////////////////////////////////////

Modified: branches/ScribusOIF/scribus/third_party/pgf/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/CMakeLists.txt
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/CMakeLists.txt (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/CMakeLists.txt Wed Aug 10 22:39:40 2011
@@ -7,7 +7,7 @@
         Decoder.cpp
         Encoder.cpp
         PGFimage.cpp
-        Stream.cpp
+        PGFstream.cpp
         Subband.cpp
         WaveletTransform.cpp
        )

Modified: branches/ScribusOIF/scribus/third_party/pgf/Decoder.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/Decoder.cpp
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/Decoder.cpp (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/Decoder.cpp Wed Aug 10 22:39:40 2011
@@ -1,27 +1,33 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2006-06-04 22:05:59 +0200 (So, 04 Jun 2006) $
  * $Revision: 229 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file Decoder.cpp
+/// @brief PGF decoder class implementation
+/// @author C. Stamm, R. Spuler
+
 #include "Decoder.h"
+
 #ifdef TRACE
 	#include <stdio.h>
 #endif
@@ -47,50 +53,67 @@
 //                   m_value	[BufferSize]
 //                      |
 //                   subband
-//  
+//
 
 // Constants
 #define CodeBufferBitLen		(BufferSize*WordWidth)	// max number of bits in m_codeBuffer
-
-/////////////////////////////////////////////////////////////////////
-// Default Constructor
-CDecoder::CDecoder(CPGFStream* stream /*= NULL */) 
-: m_stream(stream), m_startPos(0), m_encodedHeaderLength(0), m_valuePos(0), m_bufferIsAvailable(false)
-#ifdef __PGFROISUPPORT__
-, m_roi(false)
-#endif
-{
-}
 
 /////////////////////////////////////////////////////////////////////
 // Constructor
 // Read pre-header, header, and levelLength
-// throws IOException
-CDecoder::CDecoder(CPGFStream* stream, PGFPreHeader& preHeader, PGFHeader& header, PGFPostHeader& postHeader, UINT32*& levelLength) THROW_
-: m_stream(stream), m_startPos(0), m_encodedHeaderLength(0), m_valuePos(0), m_bufferIsAvailable(false)
+// It might throw an IOException.
+CDecoder::CDecoder(CPGFStream* stream, PGFPreHeader& preHeader, PGFHeader& header, PGFPostHeader& postHeader, UINT32*& levelLength, bool useOMP /*= true*/) THROW_
+: m_stream(stream)
+, m_startPos(0)
+, m_streamSizeEstimation(0)
+, m_encodedHeaderLength(0)
+, m_currentBlockIndex(0)
+, m_macroBlocksAvailable(0)
 #ifdef __PGFROISUPPORT__
 , m_roi(false)
 #endif
 {
 	ASSERT(m_stream);
 
-	int count;
+	int count, expected;
+
+	// set number of threads
+#ifdef LIBPGF_USE_OPENMP
+	m_macroBlockLen = omp_get_num_procs();
+#else
+	m_macroBlockLen = 1;
+#endif
+
+	if (useOMP && m_macroBlockLen > 1) {
+#ifdef LIBPGF_USE_OPENMP
+		omp_set_num_threads(m_macroBlockLen);
+#endif
+
+		// create macro block array
+		m_macroBlocks = new CMacroBlock*[m_macroBlockLen];
+		for (int i=0; i < m_macroBlockLen; i++) m_macroBlocks[i] = new CMacroBlock(this);
+	} else {
+		m_macroBlocks = 0;
+		m_currentBlock = new CMacroBlock(this);
+	}
 
 	// store current stream position
 	m_startPos = m_stream->GetPos();
 
 	// read magic and version
-	count = MagicVersionSize;
+	count = expected = MagicVersionSize;
 	m_stream->Read(&count, &preHeader);
+	if (count != expected) ReturnWithError(MissingData);
 
 	// read header size
 	if (preHeader.version & Version6) {
 		// 32 bit header size since version 6
-		count = 4;
+		count = expected = 4;
 	} else {
-		count = 2;
+		count = expected = 2;
 	}
 	m_stream->Read(&count, ((UINT8*)&preHeader) + MagicVersionSize);
+	if (count != expected) ReturnWithError(MissingData);
 
 	// make sure the values are correct read
 	preHeader.hSize = __VAL(preHeader.hSize);
@@ -102,8 +125,10 @@
 	}
 
 	// read file header
-	count = (preHeader.hSize < HeaderSize) ? preHeader.hSize : HeaderSize;
+	count = expected = (preHeader.hSize < HeaderSize) ? preHeader.hSize : HeaderSize;
 	m_stream->Read(&count, &header);
+	if (count != expected) ReturnWithError(MissingData);
+
 	// make sure the values are correct read
 	header.height = __VAL(UINT32(header.height));
 	header.width = __VAL(UINT32(header.width));
@@ -122,9 +147,9 @@
 			if (header.mode == ImageModeIndexedColor) {
 				ASSERT(size >= ColorTableSize);
 				// read color table
-				count = ColorTableSize;
+				count = expected = ColorTableSize;
 				m_stream->Read(&count, postHeader.clut);
-				ASSERT(count == ColorTableSize);
+				if (count != expected) ReturnWithError(MissingData);
 				size -= count;
 			}
 
@@ -134,9 +159,9 @@
 				postHeader.userData = new UINT8[postHeader.userDataLen];
 
 				// read user data
-				count = postHeader.userDataLen;
+				count = expected = postHeader.userDataLen;
 				m_stream->Read(&count, postHeader.userData);
-				ASSERT(count == size);
+				if (count != expected) ReturnWithError(MissingData);
 			}
 		}
 
@@ -145,16 +170,22 @@
 		if (!levelLength) ReturnWithError(InsufficientMemory);
 
 		// read levelLength
-		count = header.nLevels*WordBytes;
+		count = expected = header.nLevels*WordBytes;
 		m_stream->Read(&count, levelLength);
-
-#ifdef PGF_USE_BIG_ENDIAN 
+		if (count != expected) ReturnWithError(MissingData);
+
+#ifdef PGF_USE_BIG_ENDIAN
 		// make sure the values are correct read
-		count /= WordBytes;
-		for (int i=0; i < count; i++) {
+		for (int i=0; i < header.nLevels; i++) {
 			levelLength[i] = __VAL(levelLength[i]);
 		}
 #endif
+
+		// compute the total size in bytes; keep attention: level length information is optional
+		for (int i=0; i < header.nLevels; i++) {
+			m_streamSizeEstimation += levelLength[i];
+		}
+
 	}
 
 	// store current stream position
@@ -164,6 +195,12 @@
 /////////////////////////////////////////////////////////////////////
 // Destructor
 CDecoder::~CDecoder() {
+	if (m_macroBlocks) {
+		for (int i=0; i < m_macroBlockLen; i++) delete m_macroBlocks[i];
+		delete[] m_macroBlocks;
+	} else {
+		delete m_currentBlock;
+	}
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -199,17 +236,16 @@
 	const div_t hh = div(height, LinBlockSize);
 	const int ws = pitch - LinBlockSize;
 	const int wr = pitch - ww.rem;
-	int x, y, i, j;
 	int pos, base = startPos, base2;
 
 	// main height
-	for (i=0; i < hh.quot; i++) {
+	for (int i=0; i < hh.quot; i++) {
 		// main width
 		base2 = base;
-		for (j=0; j < ww.quot; j++) {
+		for (int j=0; j < ww.quot; j++) {
 			pos = base2;
-			for (y=0; y < LinBlockSize; y++) {
-				for (x=0; x < LinBlockSize; x++) {
+			for (int y=0; y < LinBlockSize; y++) {
+				for (int x=0; x < LinBlockSize; x++) {
 					DequantizeValue(band, pos, quantParam);
 					pos++;
 				}
@@ -219,8 +255,8 @@
 		}
 		// rest of width
 		pos = base2;
-		for (y=0; y < LinBlockSize; y++) {
-			for (x=0; x < ww.rem; x++) {
+		for (int y=0; y < LinBlockSize; y++) {
+			for (int x=0; x < ww.rem; x++) {
 				DequantizeValue(band, pos, quantParam);
 				pos++;
 			}
@@ -228,13 +264,13 @@
 			base += pitch;
 		}
 	}
-	// main width 
+	// main width
 	base2 = base;
-	for (j=0; j < ww.quot; j++) {
+	for (int j=0; j < ww.quot; j++) {
 		// rest of height
 		pos = base2;
-		for (y=0; y < hh.rem; y++) {
-			for (x=0; x < LinBlockSize; x++) {
+		for (int y=0; y < hh.rem; y++) {
+			for (int x=0; x < LinBlockSize; x++) {
 				DequantizeValue(band, pos, quantParam);
 				pos++;
 			}
@@ -244,9 +280,9 @@
 	}
 	// rest of height
 	pos = base2;
-	for (y=0; y < hh.rem; y++) {
+	for (int y=0; y < hh.rem; y++) {
 		// rest of width
-		for (x=0; x < ww.rem; x++) {
+		for (int x=0; x < ww.rem; x++) {
 			DequantizeValue(band, pos, quantParam);
 			pos++;
 		}
@@ -259,7 +295,7 @@
 // LH and HH are interleaved in the codestream and must be split
 // Deccoding and dequantization of HL and LH Band (interleaved) using partitioning scheme
 // partitions the plane in squares of side length InterBlockSize
-// throws IOException
+// It might throw an IOException.
 void CDecoder::DecodeInterleaved(CWaveletTransform* wtChannel, int level, int quantParam) THROW_ {
 	CSubband* hlBand = wtChannel->GetSubband(level, HL);
 	CSubband* lhBand = wtChannel->GetSubband(level, LH);
@@ -269,7 +305,6 @@
 	const int hlwr = hlBand->GetWidth() - hlW.rem;
 	const int lhws = lhBand->GetWidth() - InterBlockSize;
 	const int lhwr = lhBand->GetWidth() - hlW.rem;
-	int x, y, i, j;
 	int hlPos, lhPos;
 	int hlBase = 0, lhBase = 0, hlBase2, lhBase2;
 
@@ -284,15 +319,15 @@
 	if (quantParam < 0) quantParam = 0;
 
 	// main height
-	for (i=0; i < lhH.quot; i++) {
+	for (int i=0; i < lhH.quot; i++) {
 		// main width
 		hlBase2 = hlBase;
 		lhBase2 = lhBase;
-		for (j=0; j < hlW.quot; j++) {
+		for (int j=0; j < hlW.quot; j++) {
 			hlPos = hlBase2;
 			lhPos = lhBase2;
-			for (y=0; y < InterBlockSize; y++) {
-				for (x=0; x < InterBlockSize; x++) {
+			for (int y=0; y < InterBlockSize; y++) {
+				for (int x=0; x < InterBlockSize; x++) {
 					DequantizeValue(hlBand, hlPos, quantParam);
 					DequantizeValue(lhBand, lhPos, quantParam);
 					hlPos++;
@@ -307,8 +342,8 @@
 		// rest of width
 		hlPos = hlBase2;
 		lhPos = lhBase2;
-		for (y=0; y < InterBlockSize; y++) {
-			for (x=0; x < hlW.rem; x++) {
+		for (int y=0; y < InterBlockSize; y++) {
+			for (int x=0; x < hlW.rem; x++) {
 				DequantizeValue(hlBand, hlPos, quantParam);
 				DequantizeValue(lhBand, lhPos, quantParam);
 				hlPos++;
@@ -324,15 +359,15 @@
 			lhBase += lhBand->GetWidth();
 		}
 	}
-	// main width 
+	// main width
 	hlBase2 = hlBase;
 	lhBase2 = lhBase;
-	for (j=0; j < hlW.quot; j++) {
+	for (int j=0; j < hlW.quot; j++) {
 		// rest of height
 		hlPos = hlBase2;
 		lhPos = lhBase2;
-		for (y=0; y < lhH.rem; y++) {
-			for (x=0; x < InterBlockSize; x++) {
+		for (int y=0; y < lhH.rem; y++) {
+			for (int x=0; x < InterBlockSize; x++) {
 				DequantizeValue(hlBand, hlPos, quantParam);
 				DequantizeValue(lhBand, lhPos, quantParam);
 				hlPos++;
@@ -347,9 +382,9 @@
 	// rest of height
 	hlPos = hlBase2;
 	lhPos = lhBase2;
-	for (y=0; y < lhH.rem; y++) {
+	for (int y=0; y < lhH.rem; y++) {
 		// rest of width
-		for (x=0; x < hlW.rem; x++) {
+		for (int x=0; x < hlW.rem; x++) {
 			DequantizeValue(hlBand, hlPos, quantParam);
 			DequantizeValue(lhBand, lhPos, quantParam);
 			hlPos++;
@@ -367,7 +402,7 @@
 	if (hlBand->GetHeight() > lhBand->GetHeight()) {
 		// total width
 		hlPos = hlBase;
-		for (j=0; j < hlBand->GetWidth(); j++) {
+		for (int j=0; j < hlBand->GetWidth(); j++) {
 			DequantizeValue(hlBand, hlPos, quantParam);
 			hlPos++;
 		}
@@ -383,137 +418,208 @@
 
 //////////////////////////////////////////////////////////////////////
 /// Dequantization of a single value at given position in subband.
-/// If encoded data is available, then stores dequantized band value into 
+/// If encoded data is available, then stores dequantized band value into
 /// buffer m_value at position m_valuePos.
 /// Otherwise reads encoded data buffer and decodes it.
 /// @param band A subband
 /// @param bandPos A valid position in subband band
 /// @param quantParam The quantization parameter
 void CDecoder::DequantizeValue(CSubband* band, UINT32 bandPos, int quantParam) {
-	if (!m_bufferIsAvailable) {
+	if (!m_macroBlocksAvailable) {
 		DecodeBuffer();
-	}
-	band->SetData(bandPos, m_value[m_valuePos] << quantParam);
-	m_valuePos++;
-	if (m_valuePos == BufferSize) {
-		m_bufferIsAvailable = false;
-	}
-}
-
-///////////////////////////////////////////////////////
-// Read next block from stream and decode into buffer
-// Decoding scheme: <wordLen>(16 bits) [ ROI ] data
-//		ROI	  ::= <bufferSize>(15 bits) <eofTile>(1 bit)
-// throws IOException
-void CDecoder::DecodeBuffer() THROW_ {
+		ASSERT(m_currentBlock);
+		ASSERT(m_currentBlock->m_valuePos == 0);
+		ASSERT(m_macroBlocksAvailable);
+	}
+	band->SetData(bandPos, m_currentBlock->m_value[m_currentBlock->m_valuePos] << quantParam);
+	m_currentBlock->m_valuePos++;
+	if (m_currentBlock->m_valuePos == BufferSize) {
+		// current block has been read
+		m_macroBlocksAvailable--;
+		if (m_macroBlocksAvailable)
+			m_currentBlock = m_macroBlocks[++m_currentBlockIndex];
+	}
+}
+
+//////////////////////////////////////////////////////////////////////
+// Read next block from stream and store it in the given block
+// It might throw an IOException.
+void CDecoder::ReadMacroBlock(CMacroBlock* block) THROW_ {
+	ASSERT(block);
+
 	UINT16 wordLen;
 	ROIBlockHeader h(BufferSize);
-	int count;
+	int count, expected;
 
 #ifdef TRACE
-	UINT32 filePos = (UINT32)m_stream->GetPos();
-	printf("%d\n", filePos);
+	//UINT32 filePos = (UINT32)m_stream->GetPos();
+	//printf("DecodeBuffer: %d\n", filePos);
 #endif
 
 	// read wordLen
-	count = sizeof(UINT16);
-	m_stream->Read(&count, &wordLen); ASSERT(count == sizeof(UINT16));
+	count = expected = sizeof(UINT16);
+	m_stream->Read(&count, &wordLen);
+	if (count != expected) ReturnWithError(MissingData);
 	wordLen = __VAL(wordLen);
-	ASSERT(wordLen <= BufferSize);
+	if (wordLen > BufferSize)
+		ReturnWithError(FormatCannotRead);
 
 #ifdef __PGFROISUPPORT__
 	// read ROIBlockHeader
 	if (m_roi) {
-		m_stream->Read(&count, &h.val); ASSERT(count == sizeof(UINT16));
-		
+		m_stream->Read(&count, &h.val);
+		if (count != expected) ReturnWithError(MissingData);
+
 		// convert ROIBlockHeader
 		h.val = __VAL(h.val);
 	}
 #endif
+	// save header
+	block->m_header = h;
 
 	// read data
-	count = wordLen*WordBytes;
-	m_stream->Read(&count, m_codeBuffer);
-
-#ifdef PGF_USE_BIG_ENDIAN 
+	count = expected = wordLen*WordBytes;
+	m_stream->Read(&count, block->m_codeBuffer);
+	if (count != expected) ReturnWithError(MissingData);
+
+#ifdef PGF_USE_BIG_ENDIAN
 	// convert data
 	count /= WordBytes;
 	for (int i=0; i < count; i++) {
-		m_codeBuffer[i] = __VAL(m_codeBuffer[i]);
+		block->m_codeBuffer[i] = __VAL(block->m_codeBuffer[i]);
 	}
 #endif
 
 #ifdef __PGFROISUPPORT__
-	ASSERT(m_roi && h.bufferSize <= BufferSize || h.bufferSize == BufferSize);
+	ASSERT(m_roi && h.rbh.bufferSize <= BufferSize || h.rbh.bufferSize == BufferSize);
 #else
-	ASSERT(h.bufferSize == BufferSize);
-#endif
-	BitplaneDecode(h.bufferSize);
-
-	// data is available
-	m_bufferIsAvailable = true;
-	m_valuePos = 0;
-}
-
-///////////////////////////////////////////////////////
-// Read next block from stream but don't decode into buffer
+	ASSERT(h.rbh.bufferSize == BufferSize);
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////
+// Read next block from stream but don't decode into macro block
 // Encoding scheme: <wordLen>(16 bits) [ ROI ] data
 //		ROI	  ::= <bufferSize>(15 bits) <eofTile>(1 bit)
-// throws IOException
-void CDecoder::SkipBuffer() THROW_ {
+// It might throw an IOException.
+void CDecoder::SkipTileBuffer() THROW_ {
+	// check if pre-decoded data is available
+	if (m_macroBlocksAvailable) {
+		// current block is not used
+		m_macroBlocksAvailable--;
+		if (m_macroBlocksAvailable)
+			m_currentBlock = m_macroBlocks[++m_currentBlockIndex];
+		return;
+	}
+
 	UINT16 wordLen;
-	int count;
+	int count, expected;
 
 	// read wordLen
-	count = sizeof(UINT16);
-	m_stream->Read(&count, &wordLen); ASSERT(count == sizeof(UINT16));
+	count = expected = sizeof(wordLen);
+	m_stream->Read(&count, &wordLen);
+	if (count != expected) ReturnWithError(MissingData);
 	wordLen = __VAL(wordLen);
 	ASSERT(wordLen <= BufferSize);
 
 #ifdef __PGFROISUPPORT__
 	if (m_roi) {
 		// skip ROIBlockHeader
-		m_stream->SetPos(FSFromCurrent, count);
+		m_stream->SetPos(FSFromCurrent, sizeof(ROIBlockHeader));
 	}
 #endif
 
 	// skip data
 	m_stream->SetPos(FSFromCurrent, wordLen*WordBytes);
+}
+
+//////////////////////////////////////////////////////////////////////
+// Read next block from stream and decode into macro block
+// It might throw an IOException.
+void CDecoder::DecodeTileBuffer() THROW_ {
+	if (m_macroBlocksAvailable) {
+		// current block has been read
+		m_macroBlocksAvailable--;
+		if (m_macroBlocksAvailable)
+			m_currentBlock = m_macroBlocks[++m_currentBlockIndex];
+	} else {
+		DecodeBuffer();
+		ASSERT(m_currentBlock);
+		ASSERT(m_currentBlock->m_valuePos == 0);
+		ASSERT(m_macroBlocksAvailable);
+	}
+}
+
+//////////////////////////////////////////////////////////////////////
+// Read next block from stream and decode into macro block
+// Decoding scheme: <wordLen>(16 bits) [ ROI ] data
+//		ROI	  ::= <bufferSize>(15 bits) <eofTile>(1 bit)
+// It might throw an IOException.
+void CDecoder::DecodeBuffer() THROW_ {
+	ASSERT(m_macroBlocksAvailable == 0);
+
+	// macro block management
+	if (m_macroBlockLen == 1) {
+		ASSERT(m_currentBlock);
+		ReadMacroBlock(m_currentBlock);
+		m_currentBlock->BitplaneDecode();
+		m_macroBlocksAvailable = 1;
+	} else {
+		for (int i=0; i < m_macroBlockLen; i++) {
+			// read sequentially several blocks
+			try {
+				ReadMacroBlock(m_macroBlocks[i]);
+				m_macroBlocksAvailable++;
+			} catch(const IOException &ex) {
+				if (ex.error == MissingData) {
+					break; // no further levels available
+				} else {
+					throw;
+				}
+			}
+		}
+
+		// decode in parallel
+		#pragma omp parallel for default(shared) //no declared exceptions in next block
+		for (int i=0; i < m_macroBlocksAvailable; i++) {
+			m_macroBlocks[i]->BitplaneDecode();
+		}
+
+		m_currentBlockIndex = 0;
+		m_currentBlock = m_macroBlocks[m_currentBlockIndex];
+	}
 }
 
 //////////////////////////////////////////////////////////////////////
 // Decode block into buffer of given size using bit plane coding.
 // A buffer contains bufferLen UINT32 values, thus, bufferSize bits per bit plane.
-// Following coding scheme is used: 
-//		Buffer		::= <nPlanes>(5 bits) foreach(plane i): Plane[i]  
+// Following coding scheme is used:
+//		Buffer		::= <nPlanes>(5 bits) foreach(plane i): Plane[i]
 //		Plane[i]	::= [ Sig1 | Sig2 ] [DWORD alignment] refBits
-//		Sig1		::= 1 <codeLen>(15 bits) codedSigAndSignBits 
-//		Sig2		::= 0 <sigLen>(15 bits) [Sign1 | Sign2 ] sigBits 
+//		Sig1		::= 1 <codeLen>(15 bits) codedSigAndSignBits
+//		Sig2		::= 0 <sigLen>(15 bits) [Sign1 | Sign2 ] sigBits
 //		Sign1		::= 1 <codeLen>(15 bits) [DWORD alignment] codedSignBits
 //		Sign2		::= 0 <signLen>(15 bits) [DWORD alignment] signBits
-void CDecoder::BitplaneDecode(UINT32 bufferSize) {
-	ASSERT(bufferSize <= BufferSize);
-	const UINT32 bufferLen = AlignWordPos(bufferSize)/WordWidth;
-
-	UINT32 nPlanes, k;
-	UINT32 codePos = 0, codeLen, sigLen, sigPos, signLen, wordPos;
-	int    plane;
-	UINT32 sigBits[BufferLen];
-	UINT32 signBits[BufferLen];
-	UINT32 planeMask;
+void CDecoder::CMacroBlock::BitplaneDecode() {
+	UINT32 bufferSize = m_header.rbh.bufferSize; ASSERT(bufferSize <= BufferSize);
+
+	UINT32 nPlanes;
+	UINT32 codePos = 0, codeLen, sigLen, sigPos, signLen, signPos;
+	DataT planeMask;
 
 	// clear significance vector
-	for (k=0; k < bufferLen; k++) {
-		m_sigFlagVector[k] = 0;
-	}
-
-	// clear buffer
-	for (k=0; k < bufferSize; k++) {
+	for (UINT32 k=0; k < bufferSize; k++) {
+		m_sigFlagVector[k] = false;
+	}
+	m_sigFlagVector[bufferSize] = true; // sentinel
+
+	// clear output buffer
+	for (UINT32 k=0; k < BufferSize; k++) {
 		m_value[k] = 0;
 	}
 
 	// read number of bit planes
-	nPlanes = GetValueBlock(m_codeBuffer, 0, MaxBitPlanesLog); 
+	nPlanes = GetValueBlock(m_codeBuffer, 0, MaxBitPlanesLog);
 	codePos += MaxBitPlanesLog;
 
 	// loop through all bit planes
@@ -521,31 +627,25 @@
 	ASSERT(0 < nPlanes && nPlanes <= MaxBitPlanes + 1);
 	planeMask = 1 << (nPlanes - 1);
 
-	for (plane = nPlanes - 1; plane >= 0; plane--) {
+	for (int plane = nPlanes - 1; plane >= 0; plane--) {
 		// read RL code
 		if (GetBit(m_codeBuffer, codePos)) {
 			// RL coding of sigBits is used
 			codePos++;
 
 			// read codeLen
-			codeLen = GetValueBlock(m_codeBuffer, codePos, RLblockSizeLen);
-
-			// run-length decode significant bits and signs from m_codeBuffer and store them to sigBits
-			ASSERT(codeLen < (1 << RLblockSizeLen)); 
-			m_codePos = codePos + RLblockSizeLen;
-			sigLen = RLDSigsAndSigns(bufferSize, codeLen, sigBits, signBits); ASSERT(sigLen <= bufferSize);
-			//printf("%d\n", sigLen);
-
-			// adjust code buffer position
-			codePos += RLblockSizeLen + codeLen;
-			codePos = AlignWordPos(codePos); ASSERT(codePos < CodeBufferBitLen);
-
+			codeLen = GetValueBlock(m_codeBuffer, codePos, RLblockSizeLen); ASSERT(codeLen < (1 << RLblockSizeLen));
+
+			// position of encoded sigBits and signBits
+			sigPos = codePos + RLblockSizeLen; ASSERT(sigPos < CodeBufferBitLen);
+
+			// refinement bits
+			codePos = AlignWordPos(sigPos + codeLen); ASSERT(codePos < CodeBufferBitLen);
+
+			// run-length decode significant bits and signs from m_codeBuffer and
 			// read refinement bits from m_codeBuffer and compose bit plane
-			sigLen = ComposeBitplane(bufferSize, planeMask, sigBits, &m_codeBuffer[codePos >> WordWidthLog], signBits);
-
-			// adjust code buffer position
-			codePos += bufferSize - sigLen;
-			codePos = AlignWordPos(codePos); ASSERT(codePos < CodeBufferBitLen);
+			sigLen = ComposeBitplaneRLD(bufferSize, planeMask, sigPos, &m_codeBuffer[codePos >> WordWidthLog]);
+
 		} else {
 			// no RL coding is used
 			codePos++;
@@ -561,76 +661,73 @@
 
 				// read codeLen
 				codeLen = GetValueBlock(m_codeBuffer, codePos, RLblockSizeLen);
-				codePos += RLblockSizeLen;
-
-				// RL decode signBits
-				m_codePos = codePos;
-				signLen = RLDSigns(bufferSize, codeLen, signBits);
-
-				// adjust code buffer position
-				codePos += codeLen;
-				codePos = AlignWordPos(codePos); ASSERT(codePos < CodeBufferBitLen);
+
+				// sign bits
+				signPos = codePos + RLblockSizeLen; ASSERT(signPos < CodeBufferBitLen);
+
+				// significant bits
+				sigPos = AlignWordPos(signPos + codeLen); ASSERT(sigPos < CodeBufferBitLen);
+
+				// refinement bits
+				codePos = AlignWordPos(sigPos + sigLen); ASSERT(codePos < CodeBufferBitLen);
+
+				// read significant and refinement bitset from m_codeBuffer
+				sigLen = ComposeBitplaneRLD(bufferSize, planeMask, &m_codeBuffer[sigPos >> WordWidthLog], &m_codeBuffer[codePos >> WordWidthLog], &m_codeBuffer[signPos >> WordWidthLog]);
+
 			} else {
 				// RL coding of signBits was not efficient and therefore not used
 				codePos++;
 
 				// read signLen
-				signLen = GetValueBlock(m_codeBuffer, codePos, RLblockSizeLen); ASSERT(signLen <= bufferSize);
-				
-				// adjust code buffer position
-				codePos += RLblockSizeLen; 
-				codePos = AlignWordPos(codePos); ASSERT(codePos < CodeBufferBitLen);
-
-				// read signBits
-				wordPos = codePos >> WordWidthLog; ASSERT(0 <= wordPos && wordPos < BufferSize);
-				signLen = AlignWordPos(signLen) >> WordWidthLog;
-				for (k=0; k < signLen; k++) {
-					signBits[k] = m_codeBuffer[wordPos];
-					wordPos++;
-				}
-
-				// adjust code buffer position
-				codePos = wordPos << WordWidthLog; ASSERT(codePos < CodeBufferBitLen);
-			}
-
-			sigPos = codePos; // position of sigBits
-			codePos += sigLen;
-
-			codePos = AlignWordPos(codePos);
-			ASSERT(codePos < CodeBufferBitLen);
-
-			// read significant and refinement bitset from m_codeBuffer
-			sigLen = ComposeBitplane(bufferSize, planeMask, &m_codeBuffer[sigPos >> WordWidthLog], &m_codeBuffer[codePos >> WordWidthLog], signBits);
-			
-			// adjust code buffer position
-			codePos += bufferSize - sigLen;
-			codePos = AlignWordPos(codePos);
-		}
+				signLen = AlignWordPos(GetValueBlock(m_codeBuffer, codePos, RLblockSizeLen)); ASSERT(signLen <= bufferSize);
+
+				// sign bits
+				signPos = AlignWordPos(codePos + RLblockSizeLen); ASSERT(signPos < CodeBufferBitLen);
+
+				// significant bits
+				sigPos = signPos + signLen; ASSERT(sigPos < CodeBufferBitLen);
+
+				// refinement bits
+				codePos = AlignWordPos(sigPos + sigLen); ASSERT(codePos < CodeBufferBitLen);
+
+				// read significant and refinement bitset from m_codeBuffer
+				sigLen = ComposeBitplane(bufferSize, planeMask, &m_codeBuffer[sigPos >> WordWidthLog], &m_codeBuffer[codePos >> WordWidthLog], &m_codeBuffer[signPos >> WordWidthLog]);
+			}
+		}
+
+		// start of next chunk
+		codePos = AlignWordPos(codePos + bufferSize - sigLen); ASSERT(codePos < CodeBufferBitLen);
+
+		// next plane
 		planeMask >>= 1;
 	}
+
+	m_valuePos = 0;
 }
 
 ////////////////////////////////////////////////////////////////////
 // Reconstruct bitplane from significant bitset and refinement bitset
 // returns length [bits] of sigBits
-// input:  sigBits, refBits
+// input:  sigBits, refBits, signBits
 // output: m_value
-UINT32 CDecoder::ComposeBitplane(UINT32 bufferSize, UINT32 planeMask, UINT32* sigBits, UINT32* refBits, UINT32* signBits) {
+UINT32 CDecoder::CMacroBlock::ComposeBitplane(UINT32 bufferSize, DataT planeMask, UINT32* sigBits, UINT32* refBits, UINT32* signBits) {
 	ASSERT(sigBits);
 	ASSERT(refBits);
 	ASSERT(signBits);
 
 	UINT32 valPos = 0, signPos = 0, refPos = 0;
-	UINT32 sigPos = 0, sigEnd, sigRunLen;
+	UINT32 sigPos = 0, sigEnd;
 	UINT32 zerocnt;
 
 	while (valPos < bufferSize) {
-		// search next 1 in m_sigFlagVector
-		sigRunLen = SeekBitRange(m_sigFlagVector, valPos, bufferSize - valPos);
-
-		// search 1's in sigBits[valuePos..valuePos+sigRunLen)
+		// search next 1 in m_sigFlagVector using searching with sentinel
+		sigEnd = valPos;
+		while(!m_sigFlagVector[sigEnd]) { sigEnd++; }
+		sigEnd -= valPos;
+		sigEnd += sigPos;
+
+		// search 1's in sigBits[sigPos..sigEnd)
 		// these 1's are significant bits
-		sigEnd = sigPos + sigRunLen;
 		while (sigPos < sigEnd) {
 			// search 0's
 			zerocnt = SeekBitRange(sigBits, sigPos, sigEnd - sigPos);
@@ -641,13 +738,11 @@
 				SetBitAtPos(valPos, planeMask);
 
 				// copy sign bit
-				SetSign(valPos, GetBit(signBits, signPos)); 
-				signPos++;
+				SetSign(valPos, GetBit(signBits, signPos++));
 
 				// update significance flag vector
-				SetBit(m_sigFlagVector, valPos);
-				sigPos++; 
-				valPos++;
+				m_sigFlagVector[valPos++] = true;
+				sigPos++;
 			}
 		}
 		// refinement bit
@@ -668,135 +763,228 @@
 	return sigPos;
 }
 
-//////////////////////////////////////////////////////////////////////
-// Adaptive run-Length decoder for significant bits with a lot of zeros and sign bits.
-// Returns length of sigBits.
+////////////////////////////////////////////////////////////////////
+// Reconstruct bitplane from significant bitset and refinement bitset
+// returns length [bits] of decoded significant bits
+// input:  RL encoded sigBits and signBits in m_codeBuffer, refBits
+// output: m_value
+// RLE:
 // - Decode run of 2^k zeros by a single 0.
 // - Decode run of count 0's followed by a 1 with codeword: 1<count>x
 // - x is 0: if a positive sign has been stored, otherwise 1
-// - Read each bit from m_codeBuffer[m_codePos] and increment m_codePos.
-UINT32 CDecoder::RLDSigsAndSigns(UINT32 bufferSize, UINT32 codeLen, UINT32* sigBits, UINT32* signBits) {
-	ASSERT(sigBits);
-	ASSERT(signBits);
-	ASSERT(m_codePos < CodeBufferBitLen);
-	const UINT32 inEndPos = m_codePos + codeLen; ASSERT(inEndPos < CodeBufferBitLen);
-
+// - Read each bit from m_codeBuffer[codePos] and increment codePos.
+UINT32 CDecoder::CMacroBlock::ComposeBitplaneRLD(UINT32 bufferSize, DataT planeMask, UINT32 codePos, UINT32* refBits) {
+	ASSERT(refBits);
+
+	UINT32 valPos = 0, refPos = 0;
+	UINT32 sigPos = 0, sigEnd;
 	UINT32 k = 3;
 	UINT32 runlen = 1 << k; // = 2^k
-	UINT32 count = 0;
-	UINT32 sigPos = 0, signPos = 0;
-
-	ASSERT(inEndPos < CodeBufferBitLen);
-	while (m_codePos < inEndPos) {
-		if (GetBit(m_codeBuffer, m_codePos)) {
-			m_codePos++;
-			
-			// extract counter and generate zero run of length count
-			if (k > 0) {
-				// extract counter
-				count = GetValueBlock(m_codeBuffer, m_codePos, k); 
-				m_codePos += k;
-				if (count > 0) {
-					ClearBitBlock(sigBits, sigPos, count); 
-					sigPos += count;
+	UINT32 count = 0, rest = 0;
+	bool set1 = false;
+
+	while (valPos < bufferSize) {
+		// search next 1 in m_sigFlagVector using searching with sentinel
+		sigEnd = valPos;
+		while(!m_sigFlagVector[sigEnd]) { sigEnd++; }
+		sigEnd -= valPos;
+		sigEnd += sigPos;
+
+		while (sigPos < sigEnd) {
+			if (rest || set1) {
+				// rest of last run
+				sigPos += rest;
+				valPos += rest;
+				rest = 0;
+			} else {
+				// decode significant bits
+				if (GetBit(m_codeBuffer, codePos++)) {
+					// extract counter and generate zero run of length count
+					if (k > 0) {
+						// extract counter
+						count = GetValueBlock(m_codeBuffer, codePos, k);
+						codePos += k;
+						if (count > 0) {
+							sigPos += count;
+							valPos += count;
+						}
+
+						// adapt k (half run-length interval)
+						k--;
+						runlen >>= 1;
+					}
+
+					set1 = true;
+
+				} else {
+					// generate zero run of length 2^k
+					sigPos += runlen;
+					valPos += runlen;
+
+					// adapt k (double run-length interval)
+					if (k < WordWidth) {
+						k++;
+						runlen <<= 1;
+					}
 				}
 			}
-			// write 1 bit
-			if (sigPos < bufferSize) {
-				SetBit(sigBits, sigPos); sigPos++;
-			}
-
-			// get sign bit
-			if (GetBit(m_codeBuffer, m_codePos)) {
-				SetBit(signBits, signPos);
+
+			if (sigPos < sigEnd) {
+				if (set1) {
+					set1 = false;
+
+					// write 1 bit
+					SetBitAtPos(valPos, planeMask);
+
+					// set sign bit
+					SetSign(valPos, GetBit(m_codeBuffer, codePos++));
+
+					// update significance flag vector
+					m_sigFlagVector[valPos++] = true;
+					sigPos++;
+				}
 			} else {
-				ClearBit(signBits, signPos);
-			}
-			signPos++; m_codePos++;
-
-			// adapt k (half run-length interval)
-			if (k > 0) {
-				k--;
-				runlen >>= 1;
-			}
-		} else {
-			m_codePos++;
-			// generate zero run of length 2^k
-			//ASSERT(sigPos + runlen <= BufferSize);
-			ClearBitBlock(sigBits, sigPos, runlen); 
-			sigPos += runlen;
-
-			// adapt k (double run-length interval)
-			if (k < WordWidth) {
-				k++;
-				runlen <<= 1;
-			}
-		}
-	}
+				rest = sigPos - sigEnd;
+				sigPos = sigEnd;
+				valPos -= rest;
+			}
+
+		}
+
+		// refinement bit
+		if (valPos < bufferSize) {
+			// write one refinement bit
+			if (GetBit(refBits, refPos)) {
+				SetBitAtPos(valPos, planeMask);
+			}
+			refPos++;
+			valPos++;
+		}
+	}
+	ASSERT(sigPos <= bufferSize);
+	ASSERT(refPos <= bufferSize);
+	ASSERT(valPos == bufferSize);
+
 	return sigPos;
 }
 
-/////////////////////////////////////////////////////
-// Adaptive run-length decoder.
-// Returns signLen in bits.
-// decodes codeLen bits from m_codeBuffer at m_codePos
+////////////////////////////////////////////////////////////////////
+// Reconstruct bitplane from significant bitset, refinement bitset, and RL encoded sign bits
+// returns length [bits] of sigBits
+// input:  sigBits, refBits, RL encoded signBits
+// output: m_value
+// RLE:
 // decode run of 2^k 1's by a single 1
 // decode run of count 1's followed by a 0 with codeword: 0<count>
-// output is stored in signBits
-UINT32 CDecoder::RLDSigns(UINT32 bufferSize, UINT32 codeLen, UINT32* signBits) {
+UINT32 CDecoder::CMacroBlock::ComposeBitplaneRLD(UINT32 bufferSize, DataT planeMask, UINT32* sigBits, UINT32* refBits, UINT32* signBits) {
+	ASSERT(sigBits);
+	ASSERT(refBits);
 	ASSERT(signBits);
-	ASSERT(0 <= m_codePos && m_codePos < CodeBufferBitLen);
-	const UINT32 inEndPos = m_codePos + codeLen; ASSERT(inEndPos < CodeBufferBitLen);
-
+
+	UINT32 valPos = 0, signPos = 0, refPos = 0;
+	UINT32 sigPos = 0, sigEnd;
+	UINT32 zerocnt, count = 0;
 	UINT32 k = 0;
 	UINT32 runlen = 1 << k; // = 2^k
-	UINT32 count = 0, signPos = 0;
-
-	while (m_codePos < inEndPos) {
-		if (GetBit(m_codeBuffer, m_codePos)) {
-			m_codePos++;
-			// generate 1's run of length 2^k
-			SetBitBlock(signBits, signPos, runlen); 
-			signPos += runlen;
-			
-			// adapt k (double run-length interval)
-			if (k < WordWidth) {
-				k++; 
-				runlen <<= 1;
-			}
-		} else {
-			m_codePos++;
-			// extract counter and generate zero run of length count
-			if (k > 0) {
-				// extract counter
-				count = GetValueBlock(m_codeBuffer, m_codePos, k); 
-				m_codePos += k;
-				if (count > 0) {
-					SetBitBlock(signBits, signPos, count); 
-					signPos += count;
+	bool signBit = false;
+	bool zeroAfterRun = false;
+
+	while (valPos < bufferSize) {
+		// search next 1 in m_sigFlagVector using searching with sentinel
+		sigEnd = valPos;
+		while(!m_sigFlagVector[sigEnd]) { sigEnd++; }
+		sigEnd -= valPos;
+		sigEnd += sigPos;
+
+		// search 1's in sigBits[sigPos..sigEnd)
+		// these 1's are significant bits
+		while (sigPos < sigEnd) {
+			// search 0's
+			zerocnt = SeekBitRange(sigBits, sigPos, sigEnd - sigPos);
+			sigPos += zerocnt;
+			valPos += zerocnt;
+			if (sigPos < sigEnd) {
+				// write bit to m_value
+				SetBitAtPos(valPos, planeMask);
+
+				// check sign bit
+				if (count == 0) {
+					// all 1's have been set
+					if (zeroAfterRun) {
+						// finish the run with a 0
+						signBit = false;
+						zeroAfterRun = false;
+					} else {
+						// decode next sign bit
+						if (GetBit(signBits, signPos++)) {
+							// generate 1's run of length 2^k
+							count = runlen - 1;
+							signBit = true;
+
+							// adapt k (double run-length interval)
+							if (k < WordWidth) {
+								k++;
+								runlen <<= 1;
+							}
+						} else {
+							// extract counter and generate 1's run of length count
+							if (k > 0) {
+								// extract counter
+								count = GetValueBlock(signBits, signPos, k);
+								signPos += k;
+
+								// adapt k (half run-length interval)
+								k--;
+								runlen >>= 1;
+							}
+							if (count > 0) {
+								count--;
+								signBit = true;
+								zeroAfterRun = true;
+							} else {
+								signBit = false;
+							}
+						}
+					}
+				} else {
+					ASSERT(count > 0);
+					ASSERT(signBit);
+					count--;
 				}
-			}
-			if (signPos < bufferSize) {
-				ClearBit(signBits, signPos); 
-				signPos++;
-			}
-			
-			// adapt k (half run-length interval)
-			if (k > 0) {
-				k--; 
-				runlen >>= 1;
-			}
-		}
-	}
-	return signPos;
+
+				// copy sign bit
+				SetSign(valPos, signBit);
+
+				// update significance flag vector
+				m_sigFlagVector[valPos++] = true;
+				sigPos++;
+			}
+		}
+
+		// refinement bit
+		if (valPos < bufferSize) {
+			// write one refinement bit
+			if (GetBit(refBits, refPos)) {
+				SetBitAtPos(valPos, planeMask);
+			}
+			refPos++;
+			valPos++;
+		}
+	}
+	ASSERT(sigPos <= bufferSize);
+	ASSERT(refPos <= bufferSize);
+	ASSERT(signPos <= bufferSize);
+	ASSERT(valPos == bufferSize);
+
+	return sigPos;
 }
 
 ////////////////////////////////////////////////////////////////////
 #ifdef TRACE
 void CDecoder::DumpBuffer() {
-	printf("\nDump\n");
-	for (int i=0; i < BufferSize; i++) {
-		printf("%d", m_value[i]);
-	}
+	//printf("\nDump\n");
+	//for (int i=0; i < BufferSize; i++) {
+	//	printf("%d", m_value[i]);
+	//}
 }
 #endif //TRACE

Modified: branches/ScribusOIF/scribus/third_party/pgf/Decoder.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/Decoder.h
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/Decoder.h (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/Decoder.h Wed Aug 10 22:39:40 2011
@@ -1,34 +1,38 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2006-06-04 22:05:59 +0200 (So, 04 Jun 2006) $
  * $Revision: 229 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file Decoder.h
+/// @brief PGF decoder class
+/// @author C. Stamm, R. Spuler
+
 #ifndef PGF_DECODER_H
 #define PGF_DECODER_H
 
-#include "PGFtypes.h"
+#include "PGFstream.h"
 #include "BitStream.h"
 #include "Subband.h"
 #include "WaveletTransform.h"
-#include "Stream.h"
 
 /////////////////////////////////////////////////////////////////////
 // Constants
@@ -37,13 +41,41 @@
 /////////////////////////////////////////////////////////////////////
 /// PGF decoder class.
 /// @author C. Stamm, R. Spuler
+/// @brief PGF decoder
 class CDecoder {
+	//////////////////////////////////////////////////////////////////////
+	/// PGF decoder macro block class.
+	/// @author C. Stamm, I. Bauersachs
+	/// @brief A macro block is a decoding unit of fixed size (uncoded)
+	class CMacroBlock {
+	public:
+		CMacroBlock(CDecoder *decoder)
+		: m_header(0)
+        , m_valuePos(0)
+		, m_decoder(decoder)
+		{
+			ASSERT(m_decoder);
+		}
+
+		void  BitplaneDecode();						// several macro blocks can be encoded in parallel
+
+		ROIBlockHeader m_header;					// block header
+		DataT  m_value[BufferSize];					// output buffer of values with index m_valuePos
+		UINT32 m_codeBuffer[BufferSize];			// input buffer for encoded bitstream
+		UINT32 m_valuePos;							// current position in m_value
+
+	private:
+		UINT32 ComposeBitplane(UINT32 bufferSize, DataT planeMask, UINT32* sigBits, UINT32* refBits, UINT32* signBits);
+		UINT32 ComposeBitplaneRLD(UINT32 bufferSize, DataT planeMask, UINT32 sigPos, UINT32* refBits);
+		UINT32 ComposeBitplaneRLD(UINT32 bufferSize, DataT planeMask, UINT32* sigBits, UINT32* refBits, UINT32* signBits);
+		void  SetBitAtPos(UINT32 pos, DataT planeMask)			{ (m_value[pos] >= 0) ? m_value[pos] |= planeMask : m_value[pos] -= planeMask; }
+		void  SetSign(UINT32 pos, bool sign)					{ m_value[pos] = -m_value[pos]*sign + m_value[pos]*(!sign); }
+
+		CDecoder *m_decoder;						// outer class
+		bool m_sigFlagVector[BufferSize+1];			// see paper from Malvar, Fast Progressive Wavelet Coder
+	};
+
 public:
-	/////////////////////////////////////////////////////////////////////
-	/// Constructor: Initialize PGF stream and buffer position.
-	/// @param stream A PGF stream or NULL
-	CDecoder(CPGFStream* stream = NULL);
-
 	/////////////////////////////////////////////////////////////////////
 	/// Constructor: Read pre-header, header, and levelLength at current stream position.
 	/// It might throw an IOException.
@@ -52,7 +84,8 @@
 	/// @param header [out] A PGF header
 	/// @param postHeader [out] A PGF post-header
 	/// @param levelLength The location of the levelLength array. The array is allocated in this method. The caller has to delete this array.
-	CDecoder(CPGFStream* stream, PGFPreHeader& preHeader, PGFHeader& header, PGFPostHeader& postHeader, UINT32*& levelLength) THROW_; // throws IOException
+	/// @param useOMP If true, then the decoder will use multi-threading based on openMP
+	CDecoder(CPGFStream* stream, PGFPreHeader& preHeader, PGFHeader& header, PGFPostHeader& postHeader, UINT32*& levelLength, bool useOMP = true) THROW_; // throws IOException
 
 	/////////////////////////////////////////////////////////////////////
 	/// Destructor
@@ -90,7 +123,7 @@
 	void SetStreamPosToStart() THROW_				{ ASSERT(m_stream); m_stream->SetPos(FSFromStart, m_startPos); }
 
 	////////////////////////////////////////////////////////////////////
-	/// Reset stream position to beginning of PGF pre header
+	/// Reset stream position to beginning of data block
 	void SetStreamPosToData() THROW_				{ ASSERT(m_stream); m_stream->SetPos(FSFromStart, m_startPos + m_encodedHeaderLength); }
 
 	////////////////////////////////////////////////////////////////////
@@ -113,16 +146,21 @@
 	/// @return The number of bytes copied to the target buffer
 	UINT32 ReadEncodedData(UINT8* target, UINT32 len) const THROW_;
 
+	/////////////////////////////////////////////////////////////////////
+	/// Reads stream and decodes tile buffer
+	/// It might throw an IOException.
+	void DecodeBuffer() THROW_;
+
 #ifdef __PGFROISUPPORT__
 	/////////////////////////////////////////////////////////////////////
 	/// Reads stream and decodes tile buffer
 	/// It might throw an IOException.
-	void DecodeTileBuffer() THROW_ 	{ ASSERT(m_valuePos >= 0 && m_valuePos <= BufferSize); DecodeBuffer(); }
+	void DecodeTileBuffer() THROW_;
 
 	/////////////////////////////////////////////////////////////////////
 	/// Resets stream position to next tile.
 	/// It might throw an IOException.
-	void SkipTileBuffer() THROW_	{ ASSERT(m_valuePos >= 0 && m_valuePos <= BufferSize); SkipBuffer(); }
+	void SkipTileBuffer() THROW_;
 
 	/////////////////////////////////////////////////////////////////////
 	/// Enables region of interest (ROI) status.
@@ -134,30 +172,19 @@
 #endif
 
 private:
-	void  BitplaneDecode(UINT32 bufferSize);
-	UINT32 RLDSigsAndSigns(UINT32 bufferSize, UINT32 codeLen, UINT32* sigBits, UINT32* signBits);
-	UINT32 RLDSigns(UINT32 bufferSize, UINT32 codeLen, UINT32* signBits);
-	UINT32 ComposeBitplane(UINT32 bufferSize, UINT32 planeMask, UINT32* sigBits, UINT32* refBits, UINT32* signBits);
-	void  DecodeBuffer() THROW_; // throws IOException
-	void  SetBitAtPos(UINT32 pos, UINT32 planeMask)			{ (m_value[pos] >= 0) ? m_value[pos] |= planeMask : m_value[pos] -= planeMask; }
-	void  SetSign(UINT32 pos, bool sign)					{ m_value[pos] = -m_value[pos]*sign + m_value[pos]*(!sign); }
-	//void  SetSign(UINT32 pos, bool sign)					{ if (sign && m_value[pos] >= 0) m_value[pos] = -m_value[pos]; }
-	void  SkipBuffer() THROW_; //throws IOException
+	void ReadMacroBlock(CMacroBlock* block) THROW_; // throws IOException
 
-protected:
 	CPGFStream *m_stream;						// input pgf stream
 	UINT64 m_startPos;							// stream position at the beginning of the PGF pre header
+	UINT64 m_streamSizeEstimation;				// estimation of stream size
 	UINT32 m_encodedHeaderLength;				// stream offset from startPos to the beginning of the data part (highest level)
 
-	DataT  m_value[BufferSize];					// buffer of values with index m_valuePos
-	UINT32 m_codeBuffer[BufferSize];			// buffer for encoded bitstream
+	CMacroBlock **m_macroBlocks;				// array of macroblocks
+	int m_currentBlockIndex;					// index of current macro block
+	int	m_macroBlockLen;						// array length
+	int	m_macroBlocksAvailable;					// number of decoded macro blocks
+	CMacroBlock *m_currentBlock;				// current macro block (used by main thread)
 
-	UINT32 m_sigFlagVector[BufferLen];			// see paper from Malvar, Fast Progressive Wavelet Coder
-
-	UINT32 m_valuePos;							// current position in m_value
-	UINT32 m_codePos;							// current bit position in m_codeBuffer
-
-	bool   m_bufferIsAvailable;					// buffer contains needed coefficients
 #ifdef __PGFROISUPPORT__
 	bool   m_roi;								// true: ensures region of interest (ROI) decoding
 #endif

Modified: branches/ScribusOIF/scribus/third_party/pgf/Encoder.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/Encoder.cpp
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/Encoder.cpp (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/Encoder.cpp Wed Aug 10 22:39:40 2011
@@ -1,27 +1,33 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2007-02-03 13:04:21 +0100 (Sa, 03 Feb 2007) $
  * $Revision: 280 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file Encoder.cpp
+/// @brief PGF encoder class implementation
+/// @author C. Stamm, R. Spuler
+
 #include "Encoder.h"
+
 #ifdef TRACE
 	#include <stdio.h>
 #endif
@@ -47,7 +53,7 @@
 //                m_codeBuffer  (for each plane: RLcodeLength (16 bit), RLcoded sigBits + m_sign, refBits)
 //                      |
 //                    file      (for each buffer: packedLength (16 bit), packed bits)
-//  
+//
 
 // Constants
 #define CodeBufferBitLen		(BufferSize*WordWidth)		// max number of bits in m_codeBuffer
@@ -56,13 +62,15 @@
 //////////////////////////////////////////////////////
 // Constructor
 // Write pre-header, header, postHeader, and levelLength.
-// Throws IOException
+// It might throw an IOException.
 // preHeader and header must not be references, because on BigEndian platforms they are modified
-CEncoder::CEncoder(CPGFStream* stream, PGFPreHeader preHeader, PGFHeader header, const PGFPostHeader& postHeader, UINT32*& levelLength) THROW_
+CEncoder::CEncoder(CPGFStream* stream, PGFPreHeader preHeader, PGFHeader header, const PGFPostHeader& postHeader, UINT32*& levelLength, bool useOMP /*= true*/) THROW_
 : m_stream(stream)
 , m_startPosition(0)
-, m_valuePos(0)
-, m_maxAbsValue(0)
+, m_currLevelIndex(0)
+, m_nLevels(header.nLevels)
+, m_favorSpeed(false)
+, m_forceWriting(false)
 #ifdef __PGFROISUPPORT__
 , m_roi(false)
 #endif
@@ -71,6 +79,28 @@
 
 	int count;
 
+	// set number of threads
+#ifdef LIBPGF_USE_OPENMP
+	m_macroBlockLen = omp_get_num_procs();
+#else
+	m_macroBlockLen = 1;
+#endif
+
+	if (useOMP && m_macroBlockLen > 1) {
+#ifdef LIBPGF_USE_OPENMP
+		omp_set_num_threads(m_macroBlockLen);
+#endif
+
+		// create macro block array
+		m_macroBlocks = new CMacroBlock*[m_macroBlockLen];
+		for (int i=0; i < m_macroBlockLen; i++) m_macroBlocks[i] = new CMacroBlock(this);
+		m_lastMacroBlock = 0;
+		m_currentBlock = m_macroBlocks[m_lastMacroBlock++];
+	} else {
+		m_macroBlocks = 0;
+		m_currentBlock = new CMacroBlock(this);
+	}
+
 	// save file position
 	m_startPosition = m_stream->GetPos();
 
@@ -97,28 +127,27 @@
 		m_stream->Write(&count, postHeader.userData);
 	}
 
-	m_currLevelIndex = 0;
-	m_isLevelEncoded = false;
-
 	// renew levelLength
 	delete[] levelLength;
-	levelLength = new UINT32[header.nLevels];
+	levelLength = new UINT32[m_nLevels];
 	if (!levelLength) ReturnWithError(InsufficientMemory);
-	for (UINT8 l = 0; l < header.nLevels; l++) levelLength[l] = 0;
+	for (UINT8 l = 0; l < m_nLevels; l++) levelLength[l] = 0;
 	m_levelLength = levelLength;
 
 	// write dummy levelLength
 	m_levelLengthPos = m_stream->GetPos();
-	count = header.nLevels*WordBytes;
+	count = m_nLevels*WordBytes;
 	m_stream->Write(&count, m_levelLength);
 
 	// save current file position
-	m_currPosition = m_stream->GetPos();
+	SetBufferStartPos();
 }
 
 //////////////////////////////////////////////////////
 // Destructor
-CEncoder::~CEncoder() {	
+CEncoder::~CEncoder() {
+	delete m_currentBlock;
+	delete[] m_macroBlocks;
 }
 
 /////////////////////////////////////////////////////////////////////
@@ -138,17 +167,16 @@
 	const div_t ww = div(width, LinBlockSize);
 	const int ws = pitch - LinBlockSize;
 	const int wr = pitch - ww.rem;
-	int x, y, i, j;
 	int pos, base = startPos, base2;
 
 	// main height
-	for (i=0; i < hh.quot; i++) {
+	for (int i=0; i < hh.quot; i++) {
 		// main width
 		base2 = base;
-		for (j=0; j < ww.quot; j++) {
+		for (int j=0; j < ww.quot; j++) {
 			pos = base2;
-			for (y=0; y < LinBlockSize; y++) {
-				for (x=0; x < LinBlockSize; x++) {
+			for (int y=0; y < LinBlockSize; y++) {
+				for (int x=0; x < LinBlockSize; x++) {
 					WriteValue(band, pos);
 					pos++;
 				}
@@ -158,8 +186,8 @@
 		}
 		// rest of width
 		pos = base2;
-		for (y=0; y < LinBlockSize; y++) {
-			for (x=0; x < ww.rem; x++) {
+		for (int y=0; y < LinBlockSize; y++) {
+			for (int x=0; x < ww.rem; x++) {
 				WriteValue(band, pos);
 				pos++;
 			}
@@ -167,13 +195,13 @@
 			base += pitch;
 		}
 	}
-	// main width 
+	// main width
 	base2 = base;
-	for (j=0; j < ww.quot; j++) {
+	for (int j=0; j < ww.quot; j++) {
 		// rest of height
 		pos = base2;
-		for (y=0; y < hh.rem; y++) {
-			for (x=0; x < LinBlockSize; x++) {
+		for (int y=0; y < hh.rem; y++) {
+			for (int x=0; x < LinBlockSize; x++) {
 				WriteValue(band, pos);
 				pos++;
 			}
@@ -183,9 +211,9 @@
 	}
 	// rest of height
 	pos = base2;
-	for (y=0; y < hh.rem; y++) {
+	for (int y=0; y < hh.rem; y++) {
 		// rest of width
-		for (x=0; x < ww.rem; x++) {
+		for (int x=0; x < ww.rem; x++) {
 			WriteValue(band, pos);
 			pos++;
 		}
@@ -194,48 +222,43 @@
 }
 
 //////////////////////////////////////////////////////
-// Pad buffer with zeros, encode buffer, write levelLength into header
-// Return number of bytes written into stream
-// Throws IOException
-UINT32 CEncoder::Flush() THROW_ {
-	UINT32 retValue;
-
-#ifdef __PGFROISUPPORT__
-	if (!m_roi) {
-#endif
-		// pad buffer with zeros
-		while (m_valuePos < BufferSize) {
-			m_value[m_valuePos] = 0; 
-			m_valuePos++;
-		}
-#ifdef __PGFROISUPPORT__
-	}
-#endif
+/// Pad buffer with zeros and encode buffer.
+/// It might throw an IOException.
+void CEncoder::Flush() THROW_ {
+	// pad buffer with zeros
+	memset(&(m_currentBlock->m_value[m_currentBlock->m_valuePos]), 0, (BufferSize - m_currentBlock->m_valuePos)*DataTSize);
+	m_currentBlock->m_valuePos = BufferSize;
 
 	// encode buffer
-	EncodeBuffer(ROIBlockHeader(m_valuePos, true));
-
-	retValue = UINT32(m_stream->GetPos() - m_startPosition);
+	m_forceWriting = true;	// makes sure that the following EncodeBuffer is really written into the stream
+	EncodeBuffer(ROIBlockHeader(m_currentBlock->m_valuePos, true));
+}
+
+//////////////////////////////////////////////////////
+/// Write levelLength into header.
+/// @return number of bytes written into stream
+/// It might throw an IOException.
+UINT32 CEncoder::WriteLevelLength() THROW_ {
+	UINT64 curPos = m_stream->GetPos();
+	UINT32 retValue = UINT32(curPos - m_startPosition);
 
 	if (m_levelLength) {
 		// append levelLength to file, directly after post-header
-		UINT64 curPos = m_stream->GetPos();
-
 		// set file pos to levelLength
 		m_stream->SetPos(FSFromStart, m_levelLengthPos);
-#ifdef PGF_USE_BIG_ENDIAN 
+	#ifdef PGF_USE_BIG_ENDIAN
 		UINT32 levelLength;
 		int count = WordBytes;
-		
+
 		for (int i=0; i < m_currLevelIndex; i++) {
 			levelLength = __VAL(UINT32(m_levelLength[i]));
 			m_stream->Write(&count, &levelLength);
 		}
-#else
+	#else
 		int count = m_currLevelIndex*WordBytes;
-		
+
 		m_stream->Write(&count, m_levelLength);
-#endif //PGF_USE_BIG_ENDIAN 
+	#endif //PGF_USE_BIG_ENDIAN
 
 		// restore file position
 		m_stream->SetPos(FSFromStart, curPos);
@@ -247,313 +270,409 @@
 /////////////////////////////////////////////////////////////////////
 // Stores band value from given position bandPos into buffer m_value at position m_valuePos
 // If buffer is full encode it to file
-// Throws IOException
+// It might throw an IOException.
 void CEncoder::WriteValue(CSubband* band, int bandPos) THROW_ {
-	if (m_valuePos == BufferSize) {
+	if (m_currentBlock->m_valuePos == BufferSize) {
 		EncodeBuffer(ROIBlockHeader(BufferSize, false));
 	}
-	m_value[m_valuePos] = band->GetData(bandPos);
-	UINT32 v = abs(m_value[m_valuePos]);
-	if (v > m_maxAbsValue) m_maxAbsValue = v;
-	m_valuePos++;
-}
-
-///////////////////////////////////////////////////////
+	DataT val = m_currentBlock->m_value[m_currentBlock->m_valuePos++] = band->GetData(bandPos);
+	UINT32 v = abs(val);
+	if (v > m_currentBlock->m_maxAbsValue) m_currentBlock->m_maxAbsValue = v;
+}
+
+/////////////////////////////////////////////////////////////////////
+// Write encoded macro block into stream.
+// It might throw an IOException.
+void CEncoder::WriteMacroBlock(CMacroBlock* block) THROW_ {
+	ASSERT(block);
+
+	ROIBlockHeader h = block->m_header;
+	UINT16 wordLen = UINT16(NumberOfWords(block->m_codePos)); ASSERT(wordLen <= BufferSize);
+	int count = sizeof(UINT16);
+
+#ifdef TRACE
+	//UINT32 filePos = (UINT32)m_stream->GetPos();
+	//printf("EncodeBuffer: %d\n", filePos);
+#endif
+
+#ifdef PGF_USE_BIG_ENDIAN
+	// write wordLen
+	UINT16 wl = __VAL(wordLen);
+	m_stream->Write(&count, &wl); ASSERT(count == sizeof(UINT16));
+
+#ifdef __PGFROISUPPORT__
+	// write ROIBlockHeader
+	if (m_roi) {
+		h.val = __VAL(h.val);
+		m_stream->Write(&count, &h.val); ASSERT(count == sizeof(UINT16));
+	}
+#endif // __PGFROISUPPORT__
+
+	// convert data
+	for (int i=0; i < wordLen; i++) {
+		m_codeBuffer[i] = __VAL(m_codeBuffer[i]);
+	}
+#else
+	// write wordLen
+	m_stream->Write(&count, &wordLen); ASSERT(count == sizeof(UINT16));
+
+#ifdef __PGFROISUPPORT__
+	// write ROIBlockHeader
+	if (m_roi) {
+		m_stream->Write(&count, &h.val); ASSERT(count == sizeof(UINT16));
+	}
+#endif // __PGFROISUPPORT__
+#endif // PGF_USE_BIG_ENDIAN
+
+	// write encoded data into stream
+	count = wordLen*WordBytes;
+	m_stream->Write(&count, block->m_codeBuffer);
+
+	// store levelLength
+	if (m_levelLength) {
+		// store level length
+		// EncodeBuffer has been called after m_lastLevelIndex has been updated
+		m_levelLength[m_currLevelIndex] += ComputeBufferLength();
+		m_currLevelIndex = block->m_lastLevelIndex + 1;
+
+	}
+
+	// prepare for next buffer
+	SetBufferStartPos();
+
+	// reset values
+	block->m_valuePos = 0;
+	block->m_maxAbsValue = 0;
+}
+
+/////////////////////////////////////////////////////////////////////
 // Encode buffer and write data into stream.
 // h contains buffer size and flag indicating end of tile.
 // Encoding scheme: <wordLen>(16 bits) [ ROI ] data
 //		ROI	  ::= <bufferSize>(15 bits) <eofTile>(1 bit)
-// Throws IOException
+// It might throw an IOException.
 void CEncoder::EncodeBuffer(ROIBlockHeader h) THROW_ {
+	ASSERT(m_currentBlock);
 #ifdef __PGFROISUPPORT__
-	ASSERT(m_roi && h.bufferSize <= BufferSize || h.bufferSize == BufferSize);
+	ASSERT(m_roi && h.rbh.bufferSize <= BufferSize || h.rbh.bufferSize == BufferSize);
 #else
-	ASSERT(h.bufferSize == BufferSize);
+	ASSERT(h.rbh.bufferSize == BufferSize);
 #endif
-
-	UINT32 codeLen = BitplaneEncode(h.bufferSize);
-	UINT16 wordLen = UINT16(AlignWordPos(codeLen)/WordWidth);
-	ASSERT(wordLen <= BufferSize);
-	
-	int count = sizeof(UINT16);
-
-#ifdef PGF_USE_BIG_ENDIAN 
-	// write wordLen
-	UINT16 wordLen2 = __VAL(wordLen);
-	m_stream->Write(&count, &wordLen2);
-
-	#ifdef __PGFROISUPPORT__
-		// write ROIBlockHeader
-		if (m_roi) {
-			h.val = __VAL(h.val);
-			m_stream->Write(&count, &h.val); ASSERT(count == sizeof(UINT16));
-		}
-	#endif // __PGFROISUPPORT__
-
-	// convert data
-	for (int i=0; i < wordLen; i++) {
-		m_codeBuffer[i] = __VAL(m_codeBuffer[i]);
-	}
-#else
-	// write wordLen
-	m_stream->Write(&count, &wordLen); ASSERT(count == sizeof(UINT16));
-
-	#ifdef __PGFROISUPPORT__
-		// write ROIBlockHeader
-		if (m_roi) {
-			m_stream->Write(&count, &h.val); ASSERT(count == sizeof(UINT16));
-		}
-	#endif // __PGFROISUPPORT__
-#endif // PGF_USE_BIG_ENDIAN 
-
-	// write data
-	count = wordLen*WordBytes;
-	m_stream->Write(&count, m_codeBuffer);
-
-	// store levelLength
-	if (m_levelLength && m_isLevelEncoded) {
-		m_isLevelEncoded = false;
-		UINT64 streamPos = m_stream->GetPos();
-		ASSERT(streamPos - m_currPosition <= UINT_MAX);
-		m_levelLength[m_currLevelIndex++] = UINT32(streamPos - m_currPosition);
-		m_currPosition = streamPos;
-	}
-
-	// reset values
-	m_valuePos = 0;
-	m_maxAbsValue = 0;
+	m_currentBlock->m_header = h;
+
+	// macro block management
+	if (m_macroBlockLen == 1) {
+		m_currentBlock->BitplaneEncode();
+		WriteMacroBlock(m_currentBlock);
+	} else {
+		// save last level index
+		int lastLevelIndex = m_currentBlock->m_lastLevelIndex;
+
+		if (m_forceWriting || m_lastMacroBlock == m_macroBlockLen) {
+			// encode macro blocks
+			/*
+			volatile OSError error = NoError;
+			#pragma omp parallel for ordered default(shared)
+			for (int i=0; i < m_lastMacroBlock; i++) {
+				if (error == NoError) {
+					m_macroBlocks[i]->BitplaneEncode();
+					#pragma omp ordered
+					{
+						try {
+							WriteMacroBlock(m_macroBlocks[i]);
+						} catch (IOException& e) {
+							error = e.error;
+						}
+						delete m_macroBlocks[i]; m_macroBlocks[i] = 0;
+					}
+				}
+			}
+			if (error != NoError) ReturnWithError(error);
+			*/
+			#pragma omp parallel for default(shared) //no declared exceptions in next block
+			for (int i=0; i < m_lastMacroBlock; i++) {
+				m_macroBlocks[i]->BitplaneEncode();
+			}
+			for (int i=0; i < m_lastMacroBlock; i++) {
+				WriteMacroBlock(m_macroBlocks[i]);
+			}
+
+			// prepare for next round
+			m_forceWriting = false;
+			m_lastMacroBlock = 0;
+		}
+		// re-initialize macro block
+		m_currentBlock = m_macroBlocks[m_lastMacroBlock++];
+		m_currentBlock->Init(lastLevelIndex);
+	}
 }
 
 ////////////////////////////////////////////////////////
 // Encode buffer of given size using bit plane coding.
 // A buffer contains bufferLen UINT32 values, thus, bufferSize bits per bit plane.
-// Following coding scheme is used: 
-//		Buffer		::= <nPlanes>(5 bits) foreach(plane i): Plane[i]  
+// Following coding scheme is used:
+//		Buffer		::= <nPlanes>(5 bits) foreach(plane i): Plane[i]
 //		Plane[i]	::= [ Sig1 | Sig2 ] [DWORD alignment] refBits
-//		Sig1		::= 1 <codeLen>(15 bits) codedSigAndSignBits 
-//		Sig2		::= 0 <sigLen>(15 bits) [Sign1 | Sign2 ] sigBits 
+//		Sig1		::= 1 <codeLen>(15 bits) codedSigAndSignBits
+//		Sig2		::= 0 <sigLen>(15 bits) [Sign1 | Sign2 ] sigBits
 //		Sign1		::= 1 <codeLen>(15 bits) [DWORD alignment] codedSignBits
 //		Sign2		::= 0 <signLen>(15 bits) [DWORD alignment] signBits
-// returns number of bits in m_codeBuffer
-UINT32 CEncoder::BitplaneEncode(UINT32 bufferSize) {
-	ASSERT(bufferSize <= BufferSize);
-	const UINT32 bufferLen = AlignWordPos(bufferSize)/WordWidth;
-
+void CEncoder::CMacroBlock::BitplaneEncode() {
 	UINT8	nPlanes;
-	UINT32	sigLen, codeLen = 0, codePos = 0, wordPos, refLen, signLen, k;
-	int     plane;
-	UINT32  sigBits[BufferLen];
-	UINT32  refBits[BufferLen];
-	UINT32  signBits[BufferLen];
+	UINT32	sigLen, codeLen = 0, wordPos, refLen, signLen;
+	UINT32  sigBits[BufferLen] = { 0 };
+	UINT32  refBits[BufferLen] = { 0 };
+	UINT32  signBits[BufferLen] = { 0 };
 	UINT32  planeMask;
+	UINT32	bufferSize = m_header.rbh.bufferSize; ASSERT(bufferSize <= BufferSize);
 	bool	useRL;
+	//const UINT32 bufferLen = NumberOfWords(m_bufferSize);
+
+#ifdef TRACE
+	//printf("which thread: %d\n", omp_get_thread_num());
+#endif
 
 	// clear significance vector
-	for (k=0; k < bufferLen; k++) {
-		m_sigFlagVector[k] = 0;
-	}
+	for (UINT32 k=0; k < bufferSize; k++) {
+		m_sigFlagVector[k] = false;
+	}
+	m_sigFlagVector[bufferSize] = true; // sentinel
+
+	// clear output buffer
+	for (UINT32 k=0; k < bufferSize; k++) {
+		m_codeBuffer[k] = 0;
+	}
+	m_codePos = 0;
 
 	// compute number of bit planes and split buffer into separate bit planes
 	nPlanes = NumberOfBitplanes();
 
 	// write number of bit planes to m_codeBuffer
 	SetValueBlock(m_codeBuffer, 0, nPlanes, MaxBitPlanesLog);
-	codePos += MaxBitPlanesLog;
+	m_codePos += MaxBitPlanesLog;
 
 	// loop through all bit planes
 	if (nPlanes == 0) nPlanes = MaxBitPlanes + 1;
 	planeMask = 1 << (nPlanes - 1);
 
-	for (plane = nPlanes - 1; plane >= 0; plane--) {
+	for (int plane = nPlanes - 1; plane >= 0; plane--) {
 		// clear significant bitset
-		for (k=0; k < bufferLen; k++) {
+		for (UINT32 k=0; k < BufferLen; k++) {
 			sigBits[k] = 0;
 		}
 
 		// split bitplane in significant bitset and refinement bitset
-		sigLen = DecomposeBitplane(bufferSize, planeMask, sigBits, refBits, signBits, signLen);
-
-		if (sigLen > 0) {
-			useRL = true;
-			// run-length encode significant bits and signs and append them to the m_codeBuffer
-			m_codePos = codePos + RLblockSizeLen + 1; 
-			codeLen = RLESigsAndSigns(sigBits, sigLen, signBits, signLen);
+		sigLen = DecomposeBitplane(bufferSize, planeMask, m_codePos + RLblockSizeLen + 1, sigBits, refBits, signBits, signLen, codeLen);
+
+		if (sigLen > 0 && codeLen <= MaxCodeLen && codeLen < AlignWordPos(sigLen) + AlignWordPos(signLen) + 2*RLblockSizeLen) {
+			// set RL code bit
+			SetBit(m_codeBuffer, m_codePos++);
+
+			// write length codeLen to m_codeBuffer
+			SetValueBlock(m_codeBuffer, m_codePos, codeLen, RLblockSizeLen);
+			m_codePos += RLblockSizeLen + codeLen;
 		} else {
-			useRL = false;
-		}
-
-		if (useRL && codeLen <= MaxCodeLen && codeLen < AlignWordPos(sigLen) + AlignWordPos(signLen) + 2*RLblockSizeLen) {
-			// set RL code bit
-			SetBit(m_codeBuffer, codePos);
-			codePos++;
-
-			// write length codeLen to m_codeBuffer
-			SetValueBlock(m_codeBuffer, codePos, codeLen, RLblockSizeLen);
-			codePos += RLblockSizeLen + codeLen;
-		} else {
-			#ifdef TRACE
-			printf("new\n");
-			for (UINT32 i=0; i < bufferSize; i++) {
-				printf("%s", (GetBit(sigBits, i)) ? "1" : "_");
-				if (i%120 == 119) printf("\n");
-			}
-			printf("\n");
-			#endif // TRACE
+		#ifdef TRACE
+			//printf("new\n");
+			//for (UINT32 i=0; i < bufferSize; i++) {
+			//	printf("%s", (GetBit(sigBits, i)) ? "1" : "_");
+			//	if (i%120 == 119) printf("\n");
+			//}
+			//printf("\n");
+		#endif // TRACE
 
 			// run-length coding wasn't efficient enough
 			// we don't use RL coding for sigBits
-			ClearBit(m_codeBuffer, codePos);
-			codePos++;
+			ClearBit(m_codeBuffer, m_codePos++);
 
 			// write length sigLen to m_codeBuffer
-			ASSERT(sigLen <= MaxCodeLen); 
-			SetValueBlock(m_codeBuffer, codePos, sigLen, RLblockSizeLen);
-			codePos += RLblockSizeLen;
-
-			// overwrite m_codeBuffer
-			if (signLen > 0) {
+			ASSERT(sigLen <= MaxCodeLen);
+			SetValueBlock(m_codeBuffer, m_codePos, sigLen, RLblockSizeLen);
+			m_codePos += RLblockSizeLen;
+
+			if (m_encoder->m_favorSpeed || signLen == 0) {
+				useRL = false;
+			} else {
+				// overwrite m_codeBuffer
 				useRL = true;
 				// run-length encode m_sign and append them to the m_codeBuffer
-				m_codePos = codePos + RLblockSizeLen + 1;
-				codeLen = RLESigns(signBits, signLen);
-			} else {
-				useRL = false;
+				codeLen = RLESigns(m_codePos + RLblockSizeLen + 1, signBits, signLen);
 			}
 
 			if (useRL && codeLen <= MaxCodeLen && codeLen < signLen) {
 				// RL encoding of m_sign was efficient
 				// write RL code bit
-				SetBit(m_codeBuffer, codePos);
-				codePos++;
-				
+				SetBit(m_codeBuffer, m_codePos++);
+
 				// write codeLen to m_codeBuffer
-				SetValueBlock(m_codeBuffer, codePos, codeLen, RLblockSizeLen);
-
-				// adjust code buffer position
-				codePos += codeLen + RLblockSizeLen;
-				codePos = AlignWordPos(codePos);
+				SetValueBlock(m_codeBuffer, m_codePos, codeLen, RLblockSizeLen);
 
 				// compute position of sigBits
-				wordPos = codePos >> WordWidthLog;
+				wordPos = NumberOfWords(m_codePos + codeLen + RLblockSizeLen);
 				ASSERT(0 <= wordPos && wordPos < BufferSize);
 			} else {
 				// RL encoding of signBits wasn't efficient
 				// clear RL code bit
-				ClearBit(m_codeBuffer, codePos);
-				codePos++;
+				ClearBit(m_codeBuffer, m_codePos++);
 
 				// write signLen to m_codeBuffer
-				ASSERT(signLen <= MaxCodeLen); 
-				SetValueBlock(m_codeBuffer, codePos, signLen, RLblockSizeLen);
-				codePos += RLblockSizeLen;
+				ASSERT(signLen <= MaxCodeLen);
+				SetValueBlock(m_codeBuffer, m_codePos, signLen, RLblockSizeLen);
 
 				// write signBits to m_codeBuffer
-				codePos = AlignWordPos(codePos);
-				wordPos = codePos >> WordWidthLog;
+				wordPos = NumberOfWords(m_codePos + RLblockSizeLen);
 				ASSERT(0 <= wordPos && wordPos < BufferSize);
-				codeLen = AlignWordPos(signLen) >> WordWidthLog;
-
-				for (k=0; k < codeLen; k++) {
-					m_codeBuffer[wordPos] = signBits[k];
-					wordPos++;
+				codeLen = NumberOfWords(signLen);
+
+				for (UINT32 k=0; k < codeLen; k++) {
+					m_codeBuffer[wordPos++] = signBits[k];
 				}
-				
+
 			}
 
 			// write sigBits
 			ASSERT(0 <= wordPos && wordPos < BufferSize);
-			refLen = AlignWordPos(sigLen) >> WordWidthLog;
-
-			for (k=0; k < refLen; k++) {
-				m_codeBuffer[wordPos] = sigBits[k];
-				wordPos++;
-			}
-			codePos = wordPos << WordWidthLog;
+			refLen = NumberOfWords(sigLen);
+
+			for (UINT32 k=0; k < refLen; k++) {
+				m_codeBuffer[wordPos++] = sigBits[k];
+			}
+			m_codePos = wordPos << WordWidthLog;
 		}
 
 		// append refinement bitset (aligned to word boundary)
-		codePos = AlignWordPos(codePos);
-		wordPos = codePos >> WordWidthLog;
+		wordPos = NumberOfWords(m_codePos);
 		ASSERT(0 <= wordPos && wordPos < BufferSize);
-		refLen = AlignWordPos(bufferSize - sigLen)/WordWidth;
-
-		for (k=0; k < refLen; k++) {
-			m_codeBuffer[wordPos] = refBits[k];
-			wordPos++;
-		}
-		codePos = wordPos << WordWidthLog;
+		refLen = NumberOfWords(bufferSize - sigLen);
+
+		for (UINT32 k=0; k < refLen; k++) {
+			m_codeBuffer[wordPos++] = refBits[k];
+		}
+		m_codePos = wordPos << WordWidthLog;
 		planeMask >>= 1;
 	}
-	ASSERT(0 <= codePos && codePos <= CodeBufferBitLen);
-	return codePos;
+	ASSERT(0 <= m_codePos && m_codePos <= CodeBufferBitLen);
 }
 
 //////////////////////////////////////////////////////////
 // Split bitplane of length bufferSize into significant and refinement bitset
 // returns length [bits] of significant bits
-// input:  m_value
-// output: sigBits, refBits, signBits, signLen [bits]
-UINT32 CEncoder::DecomposeBitplane(UINT32 bufferSize, UINT32 planeMask, UINT32* sigBits, UINT32* refBits, UINT32* signBits, UINT32& signLen) {
+// input:  bufferSize, planeMask, codePos
+// output: sigBits, refBits, signBits, signLen [bits], codeLen [bits]
+// RLE
+// - Encode run of 2^k zeros by a single 0.
+// - Encode run of count 0's followed by a 1 with codeword: 1<count>x
+// - x is 0: if a positive sign is stored, otherwise 1
+// - Store each bit in m_codeBuffer[codePos] and increment codePos.
+UINT32 CEncoder::CMacroBlock::DecomposeBitplane(UINT32 bufferSize, UINT32 planeMask, UINT32 codePos, UINT32* sigBits, UINT32* refBits, UINT32* signBits, UINT32& signLen, UINT32& codeLen) {
 	ASSERT(sigBits);
 	ASSERT(refBits);
 	ASSERT(signBits);
-
-	UINT32 sigRunLen;
+	ASSERT(codePos < CodeBufferBitLen);
+
 	UINT32 sigPos = 0;
 	UINT32 valuePos = 0, valueEnd;
 	UINT32 refPos = 0;
 
+	// set output value
 	signLen = 0;
 
+	// prepare RLE of Sigs and Signs
+	const UINT32 outStartPos = codePos;
+	UINT32 k = 3;
+	UINT32 runlen = 1 << k; // = 2^k
+	UINT32 count = 0;
+
 	while (valuePos < bufferSize) {
-		// search next 1 in m_sigFlagVector
-		sigRunLen = SeekBitRange(m_sigFlagVector, valuePos, bufferSize - valuePos);
-
-		// search 1's in m_value[plane][valuePos..valuePos+sigRunLen)
+		// search next 1 in m_sigFlagVector using searching with sentinel
+		valueEnd = valuePos;
+		while(!m_sigFlagVector[valueEnd]) { valueEnd++; }
+
+		// search 1's in m_value[plane][valuePos..valueEnd)
 		// these 1's are significant bits
-		valueEnd = valuePos + sigRunLen;
 		while (valuePos < valueEnd) {
-			// search 0's
-			while (valuePos < valueEnd && !GetBitAtPos(valuePos, planeMask)) {
-				valuePos++;
+			if (GetBitAtPos(valuePos, planeMask)) {
+				// RLE encoding
+				// encode run of count 0's followed by a 1
+				// with codeword: 1<count>(signBits[signPos])
+				SetBit(m_codeBuffer, codePos++);
+				if (k > 0) {
+					SetValueBlock(m_codeBuffer, codePos, count, k);
+					codePos += k;
+
+					// adapt k (half the zero run-length)
+					k--;
+					runlen >>= 1;
+				}
+
+				// copy and write sign bit
+				if (m_value[valuePos] < 0) {
+					SetBit(signBits, signLen++);
+					SetBit(m_codeBuffer, codePos++);
+				} else {
+					ClearBit(signBits, signLen++);
+					ClearBit(m_codeBuffer, codePos++);
+				}
+
+				// write a 1 to sigBits
+				SetBit(sigBits, sigPos++);
+
+				// update m_sigFlagVector
+				m_sigFlagVector[valuePos] = true;
+
+				// prepare for next run
+				count = 0;
+			} else {
+				// RLE encoding
+				count++;
+				if (count == runlen) {
+					// encode run of 2^k zeros by a single 0
+					ClearBit(m_codeBuffer, codePos++);
+					// adapt k (double the zero run-length)
+					if (k < WordWidth) {
+						k++;
+						runlen <<= 1;
+					}
+
+					// prepare for next run
+					count = 0;
+				}
+
 				// write 0 to sigBits
 				sigPos++;
 			}
-			if (valuePos < valueEnd) {
-				// write a 1 to sigBits
-				SetBit(sigBits, sigPos); 
-				sigPos++;
-
-				// copy the sign bit
-				if (m_value[valuePos] < 0) {
-					SetBit(signBits, signLen);
-				} else {
-					ClearBit(signBits, signLen);
-				}
-				signLen++;
-
-				// update m_sigFlagVector
-				SetBit(m_sigFlagVector, valuePos);
-				valuePos++;
-			}
+			valuePos++;
 		}
 		// refinement bit
 		if (valuePos < bufferSize) {
 			// write one refinement bit
-			if (GetBitAtPos(valuePos, planeMask)) {
+			if (GetBitAtPos(valuePos++, planeMask)) {
 				SetBit(refBits, refPos);
 			} else {
 				ClearBit(refBits, refPos);
 			}
 			refPos++;
-			valuePos++;
-		}
-	}
+		}
+	}
+	// RLE encoding of the rest of the plane
+	// encode run of count 0's followed by a 1
+	// with codeword: 1<count>(signBits[signPos])
+	SetBit(m_codeBuffer, codePos++);
+	if (k > 0) {
+		SetValueBlock(m_codeBuffer, codePos, count, k);
+		codePos += k;
+	}
+	// write dmmy sign bit
+	SetBit(m_codeBuffer, codePos++);
+
+	// write word filler zeros
 
 	ASSERT(sigPos <= bufferSize);
 	ASSERT(refPos <= bufferSize);
 	ASSERT(signLen <= bufferSize);
 	ASSERT(valuePos == bufferSize);
+	ASSERT(codePos >= outStartPos && codePos < CodeBufferBitLen);
+	codeLen = codePos - outStartPos;
 
 	return sigPos;
 }
@@ -561,7 +680,7 @@
 
 ///////////////////////////////////////////////////////
 // Compute number of bit planes needed
-UINT8 CEncoder::NumberOfBitplanes() {
+UINT8 CEncoder::CMacroBlock::NumberOfBitplanes() {
 	UINT8 cnt = 0;
 
 	// determine number of bitplanes for max value
@@ -579,84 +698,18 @@
 	}
 }
 
-////////////////////////////////////////////////////////
-// Adaptive run-Length encoder for significant bits with a lot of zeros and sign bits.
-// sigLen and signLen are in bits
-// Returns length of output in bits.
-// - Encode run of 2^k zeros by a single 0.
-// - Encode run of count 0's followed by a 1 with codeword: 1<count>x
-// - x is 0: if a positive sign is stored, otherwise 1
-// - Store each bit in m_codeBuffer[m_codePos] and increment m_codePos.
-UINT32 CEncoder::RLESigsAndSigns(UINT32* sigBits, UINT32 sigLen, UINT32* signBits, UINT32 signLen) {
-	ASSERT(sigBits);
-	ASSERT(signBits);
-	ASSERT(m_codePos < CodeBufferBitLen);
-	ASSERT(0 < sigLen && sigLen <= BufferSize);
-	ASSERT(signLen <= BufferSize);
-
-	const UINT32 outStartPos = m_codePos;
-
-	UINT32 k = 3;
-	UINT32 runlen = 1 << k; // = 2^k
-	UINT32 count = 0;
-	UINT32 sigPos = 0, signPos = 0;
-
-	while (sigPos < sigLen) {
-		// search next 1 in sigBits starting at position sigPos
-		count = SeekBitRange(sigBits, sigPos, __min(runlen, sigLen - sigPos));
-		// count 0's found
-		if (count == runlen) {
-			// encode run of 2^k zeros by a single 0
-			sigPos += count; 
-			ClearBit(m_codeBuffer, m_codePos); m_codePos++;
-			// adapt k (double the zero run-length)
-			if (k < WordWidth) {
-				k++;
-				runlen <<= 1;
-			}
-		} else {
-			// encode run of count 0's followed by a 1
-			// with codeword: 1<count>(signBits[signPos])
-			sigPos += count + 1;
-			SetBit(m_codeBuffer, m_codePos); 
-			m_codePos++;
-			if (k > 0) {
-				SetValueBlock(m_codeBuffer, m_codePos, count, k);
-				m_codePos += k;
-			}
-			// sign bit
-			if (GetBit(signBits, signPos)) {
-				SetBit(m_codeBuffer, m_codePos);
-			} else {
-				ClearBit(m_codeBuffer, m_codePos);
-			}
-			signPos++; m_codePos++;
-
-			// adapt k (half the zero run-length)
-			if (k > 0) {
-				k--; 
-				runlen >>= 1;
-			}
-		}
-	}
-	ASSERT(sigPos == sigLen || sigPos == sigLen + 1);
-	ASSERT(signPos == signLen || signPos == signLen + 1);
-	ASSERT(m_codePos >= outStartPos && m_codePos < CodeBufferBitLen);
-	return m_codePos - outStartPos;
-}
-
 //////////////////////////////////////////////////////
 // Adaptive Run-Length encoder for long sequences of ones.
 // Returns length of output in bits.
 // - Encode run of 2^k ones by a single 1.
 // - Encode run of count 1's followed by a 0 with codeword: 0<count>.
-// - Store each bit in m_codeBuffer[m_codePos] and increment m_codePos.
-UINT32 CEncoder::RLESigns(UINT32* signBits, UINT32 signLen) {
+// - Store each bit in m_codeBuffer[codePos] and increment codePos.
+UINT32 CEncoder::CMacroBlock::RLESigns(UINT32 codePos, UINT32* signBits, UINT32 signLen) {
 	ASSERT(signBits);
-	ASSERT(0 <= m_codePos && m_codePos < CodeBufferBitLen);
+	ASSERT(0 <= codePos && codePos < CodeBufferBitLen);
 	ASSERT(0 < signLen && signLen <= BufferSize);
-	
-	const UINT32  outStartPos = m_codePos;
+
+	const UINT32  outStartPos = codePos;
 	UINT32 k = 0;
 	UINT32 runlen = 1 << k; // = 2^k
 	UINT32 count = 0;
@@ -668,42 +721,42 @@
 		// count 1's found
 		if (count == runlen) {
 			// encode run of 2^k ones by a single 1
-			signPos += count; 
-			SetBit(m_codeBuffer, m_codePos); m_codePos++;
+			signPos += count;
+			SetBit(m_codeBuffer, codePos++);
 			// adapt k (double the 1's run-length)
 			if (k < WordWidth) {
-				k++; 
+				k++;
 				runlen <<= 1;
 			}
 		} else {
 			// encode run of count 1's followed by a 0
 			// with codeword: 0(count)
 			signPos += count + 1;
-			ClearBit(m_codeBuffer, m_codePos); m_codePos++;
+			ClearBit(m_codeBuffer, codePos++);
 			if (k > 0) {
-				SetValueBlock(m_codeBuffer, m_codePos, count, k);
-				m_codePos += k;
+				SetValueBlock(m_codeBuffer, codePos, count, k);
+				codePos += k;
 			}
 			// adapt k (half the 1's run-length)
 			if (k > 0) {
-				k--; 
+				k--;
 				runlen >>= 1;
 			}
 		}
 	}
 	ASSERT(signPos == signLen || signPos == signLen + 1);
-	ASSERT(m_codePos >= outStartPos && m_codePos < CodeBufferBitLen);
-	return m_codePos - outStartPos;
+	ASSERT(codePos >= outStartPos && codePos < CodeBufferBitLen);
+	return codePos - outStartPos;
 }
 
 //////////////////////////////////////////////////////
 #ifdef TRACE
 void CEncoder::DumpBuffer() const {
-	printf("\nDump\n");
-	for (UINT32 i=0; i < BufferSize; i++) {
-		printf("%d", m_value[i]);
-	}
-	printf("\n");
+	//printf("\nDump\n");
+	//for (UINT32 i=0; i < BufferSize; i++) {
+	//	printf("%d", m_value[i]);
+	//}
+	//printf("\n");
 }
 #endif //TRACE
 

Modified: branches/ScribusOIF/scribus/third_party/pgf/Encoder.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/Encoder.h
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/Encoder.h (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/Encoder.h Wed Aug 10 22:39:40 2011
@@ -1,34 +1,38 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2006-06-04 22:05:59 +0200 (So, 04 Jun 2006) $
  * $Revision: 229 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file Encoder.h
+/// @brief PGF encoder class
+/// @author C. Stamm, R. Spuler
+
 #ifndef PGF_ENCODER_H
 #define PGF_ENCODER_H
 
-#include "PGFtypes.h"
+#include "PGFstream.h"
 #include "BitStream.h"
 #include "Subband.h"
 #include "WaveletTransform.h"
-#include "Stream.h"
 
 /////////////////////////////////////////////////////////////////////
 // Constants
@@ -36,8 +40,49 @@
 
 /////////////////////////////////////////////////////////////////////
 /// PGF encoder class.
-/// @author C. Stamm, R. Spuler
+/// @author C. Stamm
+/// @brief PGF encoder
 class CEncoder {
+	//////////////////////////////////////////////////////////////////////
+	/// PGF encoder macro block class.
+	/// @author C. Stamm, I. Bauersachs
+	/// @brief A macro block is an encoding unit of fixed size (uncoded)
+	class CMacroBlock {
+	public:
+		CMacroBlock(CEncoder *encoder)
+		: m_header(0)
+        , m_encoder(encoder)
+		{
+			ASSERT(m_encoder);
+			Init(-1);
+		}
+
+		DataT	m_value[BufferSize];				// input buffer of values with index m_valuePos
+		UINT32	m_codeBuffer[BufferSize];			// output buffer for encoded bitstream
+
+		ROIBlockHeader m_header;					// block header
+		UINT32	m_valuePos;							// current buffer position
+		UINT32	m_maxAbsValue;						// maximum absolute coefficient in each buffer
+		UINT32	m_codePos;							// current position in encoded bitstream
+		int		m_lastLevelIndex;					// index of last encoded level: [0, nLevels); used because a level-end can occur before a buffer is full
+
+		void Init(int lastLevelIndex) {				// initialize for reusage
+			m_valuePos = 0;
+			m_maxAbsValue = 0;
+			m_codePos = 0;
+			m_lastLevelIndex = lastLevelIndex;
+		}
+		void BitplaneEncode();						// several macro blocks can be encoded in parallel
+	private:
+		UINT32 RLESigns(UINT32 codePos, UINT32* signBits, UINT32 signLen);
+		UINT32 DecomposeBitplane(UINT32 bufferSize, UINT32 planeMask, UINT32 codePos, UINT32* sigBits, UINT32* refBits, UINT32* signBits, UINT32& signLen, UINT32& codeLen);
+		UINT8  NumberOfBitplanes();
+		bool   GetBitAtPos(UINT32 pos, UINT32 planeMask) const	{ return (abs(m_value[pos]) & planeMask) > 0; }
+
+		CEncoder *m_encoder;						// encoder instance
+		bool	m_sigFlagVector[BufferSize+1];		// see paper from Malvar, Fast Progressive Wavelet Coder
+	};
+
 public:
 	/////////////////////////////////////////////////////////////////////
 	/// Write pre-header, header, postHeader, and levelLength.
@@ -47,17 +92,27 @@
 	/// @param header An already filled in PGF header
 	/// @param postHeader [in] A already filled in PGF post header (containing color table, user data, ...)
 	/// @param levelLength A reference to an integer array, large enough to save the relative file positions of all PGF levels
-	CEncoder(CPGFStream* stream, PGFPreHeader preHeader, PGFHeader header, const PGFPostHeader& postHeader, UINT32*& levelLength) THROW_; // throws IOException
+	/// @param useOMP If true, then the encoder will use multi-threading based on openMP
+	CEncoder(CPGFStream* stream, PGFPreHeader preHeader, PGFHeader header, const PGFPostHeader& postHeader, UINT32*& levelLength, bool useOMP = true) THROW_; // throws IOException
 
 	/////////////////////////////////////////////////////////////////////
 	/// Destructor
 	~CEncoder();
 
 	/////////////////////////////////////////////////////////////////////
-	/// Pad buffer with zeros, encode buffer, write levelLength into header
-	/// Return number of bytes written into stream
+	/// Encoder favors speed over compression size
+	void FavorSpeedOverSize() { m_favorSpeed = true; }
+
+	/////////////////////////////////////////////////////////////////////
+	/// Pad buffer with zeros and encode buffer.
 	/// It might throw an IOException.
-	UINT32 Flush() THROW_;
+	void Flush() THROW_;
+
+	/////////////////////////////////////////////////////////////////////
+	/// Write levelLength into header.
+	/// @return number of bytes written into stream
+	/// It might throw an IOException.
+	UINT32 WriteLevelLength() THROW_;
 
 	/////////////////////////////////////////////////////////////////////
 	/// Partitions a rectangular region of a given subband.
@@ -72,10 +127,9 @@
 	void Partition(CSubband* band, int width, int height, int startPos, int pitch) THROW_;
 
 	/////////////////////////////////////////////////////////////////////
-	/// Set or clear flag. The flag must be set to true as soon a wavelet
-	/// transform level is encoded.
-	/// @param b A flag value
-	void SetLevelIsEncoded(bool b) { m_isLevelEncoded = b; }
+	/// Informs the encoder about the encoded level.
+	/// @param currentLevel encoded level [0, nLevels)
+	void SetEncodedLevel(int currentLevel) { ASSERT(currentLevel >= 0); m_currentBlock->m_lastLevelIndex = m_nLevels - currentLevel - 1; m_forceWriting = true; }
 
 	/////////////////////////////////////////////////////////////////////
 	/// Write a single value into subband at given position.
@@ -84,11 +138,25 @@
 	/// @param bandPos A valid position in subband band
 	void WriteValue(CSubband* band, int bandPos) THROW_;
 
+	/////////////////////////////////////////////////////////////////////
+	/// Compute stream length of header.
+	/// @return header length
+	UINT32 ComputeHeaderLength() const { return UINT32(m_bufferStartPos - m_startPosition); }
+
+	/////////////////////////////////////////////////////////////////////
+	/// Compute stream length of encoded buffer.
+	/// @return encoded buffer length
+	UINT32 ComputeBufferLength() const { return UINT32(m_stream->GetPos() - m_bufferStartPos); }
+
+	/////////////////////////////////////////////////////////////////////
+	/// Save current stream position as beginning of current level.
+	void SetBufferStartPos() { m_bufferStartPos = m_stream->GetPos(); }
+
 #ifdef __PGFROISUPPORT__
 	/////////////////////////////////////////////////////////////////////
 	/// Encodes tile buffer and writes it into stream
 	/// It might throw an IOException.
-	void EncodeTileBuffer() THROW_	{ ASSERT(m_valuePos >= 0 && m_valuePos <= BufferSize); EncodeBuffer(ROIBlockHeader(m_valuePos, true)); }
+	void EncodeTileBuffer() THROW_	{ ASSERT(m_currentBlock && m_currentBlock->m_valuePos >= 0 && m_currentBlock->m_valuePos <= BufferSize); EncodeBuffer(ROIBlockHeader(m_currentBlock->m_valuePos, true)); }
 
 	/////////////////////////////////////////////////////////////////////
 	/// Enables region of interest (ROI) status.
@@ -100,32 +168,24 @@
 #endif
 
 private:
-	UINT32 BitplaneEncode(UINT32 bufferSize);
-	UINT32 RLESigsAndSigns(UINT32* sigBits, UINT32 sigLen, UINT32* signBits, UINT32 signLen);
-	UINT32 RLESigns(UINT32* signBits, UINT32 signLen);
-	UINT32 DecomposeBitplane(UINT32 bufferSize, UINT32 planeMask, UINT32* sigBits, UINT32* refBits, UINT32* signBits, UINT32& signLen);
-	UINT8 NumberOfBitplanes();
-	bool  GetBitAtPos(UINT32 pos, UINT32 planeMask) const	{ return (abs(m_value[pos]) & planeMask) > 0; }	
-	void  EncodeBuffer(ROIBlockHeader h) THROW_; // throws IOException
+	void EncodeBuffer(ROIBlockHeader h) THROW_; // throws IOException
+	void WriteMacroBlock(CMacroBlock* block) THROW_; // throws IOException
 
-protected:
 	CPGFStream *m_stream;
 	UINT64	m_startPosition;					// file position of PGF start (PreHeader)
 	UINT64  m_levelLengthPos;					// file position of Metadata
-	UINT64  m_currPosition;						// Already accumulated size from lower levels
-	
-	DataT	m_value[BufferSize];				// buffer of values with index m_valuePos
-	UINT32	m_codeBuffer[BufferSize];			// buffer for encoded bitstream
+	UINT64  m_bufferStartPos;					// file position of encoded buffer
 
-	UINT32	m_sigFlagVector[BufferLen];			// see paper from Malvar, Fast Progressive Wavelet Coder
-
-	UINT32	m_valuePos;							// current buffer position
-	UINT32	m_codePos;							// current bit position in m_codeBuffer
-	UINT32	m_maxAbsValue;						// maximum absolute coefficient in each buffer
+	CMacroBlock **m_macroBlocks;				// array of macroblocks
+	int		m_macroBlockLen;					// array length
+	int		m_lastMacroBlock;					// array index of the last created macro block
+	CMacroBlock *m_currentBlock;				// current macro block (used by main thread)
 
 	UINT32* m_levelLength;						// temporary saves the level index
 	int     m_currLevelIndex;					// counts where (=index) to save next value
-	bool    m_isLevelEncoded;					// Already enough data available to set level-block-size
+	UINT8	m_nLevels;							// number of levels
+	bool	m_favorSpeed;						// favor speed over size
+	bool	m_forceWriting;						// all macro blocks have to be written into the stream
 #ifdef __PGFROISUPPORT__
 	bool	m_roi;								// true: ensures region of interest (ROI) encoding
 #endif

Modified: branches/ScribusOIF/scribus/third_party/pgf/PGFimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/PGFimage.cpp
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/PGFimage.cpp (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/PGFimage.cpp Wed Aug 10 22:39:40 2011
@@ -1,30 +1,36 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2007-02-03 13:04:21 +0100 (Sa, 03 Feb 2007) $
  * $Revision: 280 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file PGFimage.cpp
+/// @brief PGF image class implementation
+/// @author C. Stamm
+
 #include "PGFimage.h"
 #include "Decoder.h"
 #include "Encoder.h"
 #include <cmath>
+#include <cstring>
 
 #define YUVoffset4		8				// 2^3
 #define YUVoffset6		32				// 2^5
@@ -47,8 +53,21 @@
 
 //////////////////////////////////////////////////////////////////////
 // Standard constructor: It is used to create a PGF instance for opening and reading.
-CPGFImage::CPGFImage() 
-: m_decoder(0), m_levelLength(0), m_quant(0), m_downsample(false), m_cb(0), m_cbArg(0)
+CPGFImage::CPGFImage()
+: m_decoder(0)
+, m_encoder(0)
+, m_levelLength(0)
+, m_quant(0)
+, m_downsample(false)
+, m_favorSpeedOverSize(false)
+, m_useOMPinEncoder(true)
+, m_useOMPinDecoder(true)
+#ifdef __PGFROISUPPORT__
+, m_levelwise(true)
+, m_streamReinitialized(false)
+#endif
+, m_cb(0)
+, m_cbArg(0)
 {
 
 	// init preHeader
@@ -89,6 +108,7 @@
 	}
 	delete[] m_postHeader.userData; m_postHeader.userData = 0; m_postHeader.userDataLen = 0;
 	delete[] m_levelLength; m_levelLength = 0;
+	delete m_encoder; m_encoder = NULL;
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -106,19 +126,12 @@
 void CPGFImage::Open(CPGFStream *stream) THROW_ {
 	ASSERT(stream);
 
-	m_decoder = new CDecoder(stream, m_preHeader, m_header, m_postHeader, m_levelLength);
+	m_decoder = new CDecoder(stream, m_preHeader, m_header, m_postHeader, m_levelLength, m_useOMPinDecoder);
 	if (!m_decoder) ReturnWithError(InsufficientMemory);
+	ASSERT(m_decoder);
 
 	if (m_header.nLevels > MaxLevel) ReturnWithError(FormatCannotRead);
 
-	Init();
-
-	ASSERT(m_decoder);
-}
-
-////////////////////////////////////////////////////////////
-// Initialize an open pgf file
-void CPGFImage::Init() THROW_ {
 	// set current level
 	m_currentLevel = m_header.nLevels;
 
@@ -126,7 +139,64 @@
 	m_width[0] = m_header.width;
 	m_height[0] = m_header.height;
 
-	// set or correct image mode
+	// complete header
+	CompleteHeader();
+
+	// interpret quant parameter
+	if (m_header.quality > DownsampleThreshold &&
+		(m_header.mode == ImageModeRGBColor ||
+		 m_header.mode == ImageModeRGBA ||
+		 m_header.mode == ImageModeRGB48 ||
+		 m_header.mode == ImageModeCMYKColor ||
+		 m_header.mode == ImageModeCMYK64 ||
+		 m_header.mode == ImageModeLabColor ||
+		 m_header.mode == ImageModeLab48)) {
+		m_downsample = true;
+		m_quant = m_header.quality - 1;
+	} else {
+		m_downsample = false;
+		m_quant = m_header.quality;
+	}
+
+	// set channel dimensions (chrominance is subsampled by factor 2)
+	if (m_downsample) {
+		for (int i=1; i < m_header.channels; i++) {
+			m_width[i] = (m_width[0] + 1)/2;
+			m_height[i] = (m_height[0] + 1)/2;
+		}
+	} else {
+		for (int i=1; i < m_header.channels; i++) {
+			m_width[i] = m_width[0];
+			m_height[i] = m_height[0];
+		}
+	}
+
+	if (m_header.nLevels > 0) {
+		// init wavelet subbands
+		for (int i=0; i < m_header.channels; i++) {
+			m_wtChannel[i] = new CWaveletTransform(m_width[i], m_height[i], m_header.nLevels);
+			if (!m_wtChannel[i]) ReturnWithError(InsufficientMemory);
+		}
+	} else {
+		// very small image: we don't use DWT and encoding
+
+		// read channels
+		for (int c=0; c < m_header.channels; c++) {
+			const UINT32 size = m_width[c]*m_height[c];
+			m_channel[c] = new DataT[size];
+
+			// read channel data from stream
+			for (UINT32 i=0; i < size; i++) {
+				int count = DataTSize;
+				stream->Read(&count, &m_channel[c][i]);
+				if (count != DataTSize) ReturnWithError(MissingData);
+			}
+		}
+	}
+}
+
+////////////////////////////////////////////////////////////
+void CPGFImage::CompleteHeader() {
 	if (m_header.mode == ImageModeUnknown) {
 		// undefined mode
 		switch(m_header.bpp) {
@@ -139,7 +209,48 @@
 		case 48: m_header.mode = ImageModeRGB48; break;
 		default: m_header.mode = ImageModeRGBColor; break;
 		}
-	} else if (m_header.mode == ImageModeRGBColor && m_header.bpp == 32) {
+	}
+	if (!m_header.bpp) {
+		// undefined bpp
+		switch(m_header.mode) {
+		case ImageModeBitmap:
+			m_header.bpp = 1;
+			break;
+		case ImageModeIndexedColor:
+		case ImageModeGrayScale:
+			m_header.bpp = 8;
+			break;
+		case ImageModeRGB12:
+			m_header.bpp = 12;
+			break;
+		case ImageModeRGB16:
+		case ImageModeGray16:
+			m_header.bpp = 16;
+			break;
+		case ImageModeRGBColor:
+		case ImageModeLabColor:
+			m_header.bpp = 24;
+			break;
+		case ImageModeRGBA:
+		case ImageModeCMYKColor:
+	#ifdef __PGF32SUPPORT__
+		case ImageModeGray31:
+	#endif
+			m_header.bpp = 32;
+			break;
+		case ImageModeRGB48:
+		case ImageModeLab48:
+			m_header.bpp = 48;
+			break;
+		case ImageModeCMYK64:
+			m_header.bpp = 64;
+			break;
+		default:
+			ASSERT(false);
+			m_header.bpp = 24;
+		}
+	}
+	if (m_header.mode == ImageModeRGBColor && m_header.bpp == 32) {
 		// change mode
 		m_header.mode = ImageModeRGBA;
 	}
@@ -159,12 +270,14 @@
 	// set number of channels
 	if (!m_header.channels) {
 		switch(m_header.mode) {
-		case ImageModeBitmap: 
+		case ImageModeBitmap:
 		case ImageModeIndexedColor:
 		case ImageModeGrayScale:
 		case ImageModeGray16:
+	#ifdef __PGF32SUPPORT__
 		case ImageModeGray31:
-			m_header.channels = 1; 
+	#endif
+			m_header.channels = 1;
 			break;
 		case ImageModeRGBColor:
 		case ImageModeRGB12:
@@ -179,53 +292,11 @@
 		case ImageModeCMYK64:
 			m_header.channels = 4;
 			break;
-		}
-	}
-
-	// interprete quant parameter
-	if (m_header.quality > DownsampleThreshold && 
-		(m_header.mode == ImageModeRGBColor || 
-		 m_header.mode == ImageModeRGBA || 
-		 m_header.mode == ImageModeRGB48 || 
-		 m_header.mode == ImageModeCMYKColor || 
-		 m_header.mode == ImageModeCMYK64 || 
-		 m_header.mode == ImageModeLabColor || 
-		 m_header.mode == ImageModeLab48)) {
-		m_downsample = true;
-		m_quant = m_header.quality - 1;
-	} else {
-		m_downsample = false;
-		m_quant = m_header.quality;
-	}
-
-	// set channel dimensions (chrominance is subsampled by factor 2)
-	if (m_downsample) {
-		for (int i=1; i < m_header.channels; i++) {
-			m_width[i] = (m_width[0] + 1)/2;
-			m_height[i] = (m_height[0] + 1)/2;
-		}
-	} else {
-		for (int i=1; i < m_header.channels; i++) {
-			m_width[i] = m_width[0];
-			m_height[i] = m_height[0];
-		}
-	}
-
-	// init wavelet subbands
-	for (int i=0; i < m_header.channels; i++) {
-		m_wtChannel[i] = new CWaveletTransform(m_width[i], m_height[i], m_header.nLevels);
-		if (!m_wtChannel[i]) ReturnWithError(InsufficientMemory);
-	}
-
-	// set background
-	/*
-	if (m_header.mode == ImageModeRGBA &&
-		(m_header.background.rgbtBlue != DefaultBGColor ||
-		m_header.background.rgbtGreen != DefaultBGColor ||
-		m_header.background.rgbtRed != DefaultBGColor)) {
-		m_backgroundSet = true;
-	}
-	*/
+		default:
+			ASSERT(false);
+			m_header.channels = 3;
+		}
+	}
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -235,6 +306,49 @@
 const UINT8* CPGFImage::GetUserData(UINT32& size) const {
 	size = m_postHeader.userDataLen;
 	return m_postHeader.userData;
+}
+
+//////////////////////////////////////////////////////////////////////
+/// After you've written a PGF image, you can call this method followed by GetBitmap/GetYUV
+/// to get a quick reconstruction (coded -> decoded image).
+/// @param level The image level of the resulting image in the internal image buffer.
+void CPGFImage::Reconstruct(int level /*= 0*/) {
+	if (m_header.nLevels == 0) {
+		// image didn't use wavelet transform
+		if (level == 0) {
+			for (int i=0; i < m_header.channels; i++) {
+				ASSERT(m_wtChannel[i]);
+				m_channel[i] = m_wtChannel[i]->GetSubband(0, LL)->GetBuffer();
+			}
+		}
+	} else {
+		int currentLevel = m_header.nLevels;
+
+		if (ROIisSupported()) {
+			// enable ROI reading
+			SetROI(PGFRect(0, 0, m_header.width, m_header.height));
+		}
+
+		while (currentLevel > level) {
+			for (int i=0; i < m_header.channels; i++) {
+				ASSERT(m_wtChannel[i]);
+				// dequantize subbands
+				if (currentLevel == m_header.nLevels) {
+					// last level also has LL band
+					m_wtChannel[i]->GetSubband(currentLevel, LL)->Dequantize(m_quant);
+				}
+				m_wtChannel[i]->GetSubband(currentLevel, HL)->Dequantize(m_quant);
+				m_wtChannel[i]->GetSubband(currentLevel, LH)->Dequantize(m_quant);
+				m_wtChannel[i]->GetSubband(currentLevel, HH)->Dequantize(m_quant);
+
+				// inverse transform from m_wtChannel to m_channel
+				m_wtChannel[i]->InverseTransform(currentLevel, &m_width[i], &m_height[i], &m_channel[i]);
+				ASSERT(m_channel[i]);
+			}
+
+			currentLevel--;
+		}
+	}
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -252,7 +366,6 @@
 void CPGFImage::Read(int level /*= 0*/, CallbackPtr cb /*= NULL*/, void *data /*=NULL*/) THROW_ {
 	ASSERT((level >= 0 && level < m_header.nLevels) || m_header.nLevels == 0); // m_header.nLevels == 0: image didn't use wavelet transform
 	ASSERT(m_decoder);
-	int i;
 
 #ifdef __PGFROISUPPORT__
 	if (ROIisSupported() && m_header.nLevels > 0) {
@@ -264,24 +377,23 @@
 #endif
 
 	if (m_header.nLevels == 0) {
-		// image didn't use wavelet transform
-		for (i=0; i < m_header.channels; i++) {
-			ASSERT(m_wtChannel[i]);
-			// decode file and write stream to m_channel
-			m_wtChannel[i]->GetSubband(0, LL)->PlaceTile(*m_decoder, m_quant);
-			m_channel[i] = m_wtChannel[i]->GetSubband(0, LL)->GetBuffer();
+		if (level == 0) {
+			// the data has already been read during open
+			// now update progress
+			if (cb) {
+				if ((*cb)(1.0, true, data)) ReturnWithError(EscapePressed);
+			}
 		}
 	} else {
 		const int levelDiff = m_currentLevel - level;
-		double p, percent = pow(0.25, levelDiff);
+		double percent = pow(0.25, levelDiff);
 
 		// encoding scheme without ROI
 		while (m_currentLevel > level) {
-			p = percent;
-			for (i=0; i < m_header.channels; i++) {
+			for (int i=0; i < m_header.channels; i++) {
 				ASSERT(m_wtChannel[i]);
 				// decode file and write stream to m_wtChannel
-				if (m_currentLevel == m_header.nLevels) { 
+				if (m_currentLevel == m_header.nLevels) {
 					// last level also has LL band
 					m_wtChannel[i]->GetSubband(m_currentLevel, LL)->PlaceTile(*m_decoder, m_quant);
 				}
@@ -294,17 +406,15 @@
 					m_decoder->DecodeInterleaved(m_wtChannel[i], m_currentLevel, m_quant);
 				}
 				m_wtChannel[i]->GetSubband(m_currentLevel, HH)->PlaceTile(*m_decoder, m_quant);
-
+			}
+
+			#pragma omp parallel for default(shared)
+			for (int i=0; i < m_header.channels; i++) {
 				// inverse transform from m_wtChannel to m_channel
 				m_wtChannel[i]->InverseTransform(m_currentLevel, &m_width[i], &m_height[i], &m_channel[i]);
 				ASSERT(m_channel[i]);
-
-				// now update progress
-				if (i < m_header.channels - 1 && cb) {
-					percent += 3*p/m_header.channels;
-					(*cb)(percent, false, data);
-				}
-			}
+			}
+
 			// set new level: must be done before refresh callback
 			m_currentLevel--;
 
@@ -313,96 +423,17 @@
 
 			// now update progress
 			if (cb) {
-				percent += 3*p/m_header.channels;
+				percent += 3*percent;
 				if ((*cb)(percent, true, data)) ReturnWithError(EscapePressed);
 			}
 		}
 	}
-}
-
-//////////////////////////////////////////////////////////////////////
-/// After you've written a PGF image, you can call this method followed by GetBitmap/GetYUV
-/// to get a quick reconstruction (coded -> decoded image).
-void CPGFImage::Reconstruct() THROW_ {
-	int i;
-
-	if (m_header.nLevels == 0) {
-		// image didn't use wavelet transform
-		for (i=0; i < m_header.channels; i++) {
-			ASSERT(m_wtChannel[i]);
-			m_channel[i] = m_wtChannel[i]->GetSubband(0, LL)->GetBuffer();
-		}
-	} else {
-		int currentLevel = m_header.nLevels;
-
-		// old encoding scheme without ROI
-		while (currentLevel > 0) {
-			for (i=0; i < m_header.channels; i++) {
-				ASSERT(m_wtChannel[i]);
-				// dequantize subbands
-				if (currentLevel == m_header.nLevels) { 
-					// last level also has LL band
-					m_wtChannel[i]->GetSubband(currentLevel, LL)->Dequantize(m_quant, currentLevel);
-				}
-				m_wtChannel[i]->GetSubband(currentLevel, HL)->Dequantize(m_quant, currentLevel);
-				m_wtChannel[i]->GetSubband(currentLevel, LH)->Dequantize(m_quant, currentLevel);
-				m_wtChannel[i]->GetSubband(currentLevel, HH)->Dequantize(m_quant, currentLevel);
-
-				// inverse transform from m_wtChannel to m_channel
-				m_wtChannel[i]->InverseTransform(currentLevel, &m_width[i], &m_height[i], &m_channel[i]);
-				ASSERT(m_channel[i]);
-			}
-			// now we have to refresh the display
-			if (m_cb) m_cb(m_cbArg);
-
-			currentLevel--;
-		}
-	}
+
+	// automatically closing
+	if (m_currentLevel == 0) Close();
 }
 
 #ifdef __PGFROISUPPORT__
-//////////////////////////////////////////////////////////////////////
-/// Compute ROIs for each channel and each level
-/// @param rect rectangular region of interest (ROI)
-void CPGFImage::SetROI(PGFRect rect) {
-	ASSERT(m_decoder);
-	ASSERT(ROIisSupported());
-
-	// store ROI for a later call of GetBitmap
-	m_roi = rect;
-
-	// enable ROI decoding
-	m_decoder->SetROI();
-
-	// enlarge ROI because of border artefacts
-	const UINT32 dx = FilterWidth/2*(1 << m_currentLevel);
-	const UINT32 dy = FilterHeight/2*(1 << m_currentLevel);
-
-	if (rect.left < dx) rect.left = 0;
-	else rect.left -= dx;
-	if (rect.top < dy) rect.top = 0;
-	else rect.top -= dy;
-	rect.right += dx;
-	if (rect.right > m_header.width) rect.right = m_header.width;
-	rect.bottom += dy;
-	if (rect.bottom > m_header.height) rect.bottom = m_header.height;
-
-	// prepare wavelet channels for using ROI
-	ASSERT(m_wtChannel[0]);
-	m_wtChannel[0]->SetROI(rect);
-	if (m_downsample && m_header.channels > 1) {
-		// all further channels are downsampled, therefore downsample ROI
-		rect.left >>= 1;
-		rect.top >>= 1;
-		rect.right >>= 1;
-		rect.bottom >>= 1;
-	}
-	for (int i=1; i < m_header.channels; i++) {
-		ASSERT(m_wtChannel[i]);
-		m_wtChannel[i]->SetROI(rect);
-	}
-}
-
 //////////////////////////////////////////////////////////////////////
 /// Read a rectangular region of interest of a PGF image at current stream position.
 /// The origin of the coordinate axis is the top-left corner of the image.
@@ -415,7 +446,6 @@
 void CPGFImage::Read(PGFRect& rect, int level /*= 0*/, CallbackPtr cb /*= NULL*/, void *data /*=NULL*/) THROW_ {
 	ASSERT((level >= 0 && level < m_header.nLevels) || m_header.nLevels == 0); // m_header.nLevels == 0: image didn't use wavelet transform
 	ASSERT(m_decoder);
-	int i;
 
 	if (m_header.nLevels == 0 || !ROIisSupported()) {
 		rect.left = rect.top = 0;
@@ -426,8 +456,8 @@
 		// new encoding scheme supporting ROI
 		ASSERT(rect.left < m_header.width && rect.top < m_header.height);
 		const int levelDiff = m_currentLevel - level;
-		double p, percent = pow(0.25, levelDiff);
-		
+		double percent = pow(0.25, levelDiff);
+
 		// check level difference
 		if (levelDiff <= 0) {
 			// it is a new read call, probably with a new ROI
@@ -438,13 +468,12 @@
 		// check rectangle
 		if (rect.right == 0 || rect.right > m_header.width) rect.right = m_header.width;
 		if (rect.bottom == 0 || rect.bottom > m_header.height) rect.bottom = m_header.height;
-		
+
 		// enable ROI decoding and reading
 		SetROI(rect);
 
 		while (m_currentLevel > level) {
-			p = percent;
-			for (i=0; i < m_header.channels; i++) {
+			for (int i=0; i < m_header.channels; i++) {
 				ASSERT(m_wtChannel[i]);
 
 				// get number of tiles and tile indices
@@ -471,17 +500,15 @@
 						}
 					}
 				}
-
+			}
+
+			#pragma omp parallel for default(shared)
+			for (int i=0; i < m_header.channels; i++) {
 				// inverse transform from m_wtChannel to m_channel
 				m_wtChannel[i]->InverseTransform(m_currentLevel, &m_width[i], &m_height[i], &m_channel[i]);
 				ASSERT(m_channel[i]);
-
-				// now update progress
-				if (i < m_header.channels - 1 && cb) {
-					percent += 3*p/m_header.channels;
-					(*cb)(percent, false, data);
-				}
-			}
+			}
+
 			// set new level: must be done before refresh callback
 			m_currentLevel--;
 
@@ -490,20 +517,67 @@
 
 			// now update progress
 			if (cb) {
-				percent += 3*p/m_header.channels;
+				percent += 3*percent;
 				if ((*cb)(percent, true, data)) ReturnWithError(EscapePressed);
 			}
 		}
 	}
-}
-#endif
+
+	// automatically closing
+	if (m_currentLevel == 0) Close();
+}
+
+//////////////////////////////////////////////////////////////////////
+/// Compute ROIs for each channel and each level
+/// @param rect rectangular region of interest (ROI)
+void CPGFImage::SetROI(PGFRect rect) {
+	ASSERT(m_decoder);
+	ASSERT(ROIisSupported());
+
+	// store ROI for a later call of GetBitmap
+	m_roi = rect;
+
+	// enable ROI decoding
+	m_decoder->SetROI();
+
+	// enlarge ROI because of border artefacts
+	const UINT32 dx = FilterWidth/2*(1 << m_currentLevel);
+	const UINT32 dy = FilterHeight/2*(1 << m_currentLevel);
+
+	if (rect.left < dx) rect.left = 0;
+	else rect.left -= dx;
+	if (rect.top < dy) rect.top = 0;
+	else rect.top -= dy;
+	rect.right += dx;
+	if (rect.right > m_header.width) rect.right = m_header.width;
+	rect.bottom += dy;
+	if (rect.bottom > m_header.height) rect.bottom = m_header.height;
+
+	// prepare wavelet channels for using ROI
+	ASSERT(m_wtChannel[0]);
+	m_wtChannel[0]->SetROI(rect);
+	if (m_downsample && m_header.channels > 1) {
+		// all further channels are downsampled, therefore downsample ROI
+		rect.left >>= 1;
+		rect.top >>= 1;
+		rect.right >>= 1;
+		rect.bottom >>= 1;
+	}
+	for (int i=1; i < m_header.channels; i++) {
+		ASSERT(m_wtChannel[i]);
+		m_wtChannel[i]->SetROI(rect);
+	}
+}
+
+#endif // __PGFROISUPPORT__
 
 //////////////////////////////////////////////////////////////////////
 /// Return the length of all encoded headers in bytes.
+/// Precondition: The PGF image has been opened with a call of Open(...).
 /// @return The length of all encoded headers in bytes
-UINT32 CPGFImage::GetEncodedHeaderLength() const { 
-	ASSERT(m_decoder); 
-	return m_decoder->GetEncodedHeaderLength(); 
+UINT32 CPGFImage::GetEncodedHeaderLength() const {
+	ASSERT(m_decoder);
+	return m_decoder->GetEncodedHeaderLength();
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -532,14 +606,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////
-/// Reset stream position to beginning of PGF pre header
+/// Reset stream position to start of PGF pre-header
 void CPGFImage::ResetStreamPos() THROW_ {
 	ASSERT(m_decoder);
-	return m_decoder->SetStreamPosToStart(); 
+	return m_decoder->SetStreamPosToStart();
 }
 
 //////////////////////////////////////////////////////////////////////
-/// Reads the data of an encoded PGF level and copies it to a target buffer 
+/// Reads the data of an encoded PGF level and copies it to a target buffer
 /// without decoding.
 /// Precondition: The PGF image has been opened with a call of Open(...).
 /// It might throw an IOException.
@@ -577,82 +651,15 @@
 //////////////////////////////////////////////////////////////////
 // Set background of an RGB image with transparency channel or reset to default background.
 // @param bg A pointer to a background color or NULL (reset to default background)
-void CPGFImage::SetBackground(const RGBTRIPLE* bg) { 
-	if (bg) { 
-		m_header.background = *bg; 
-//		m_backgroundSet = true; 
+void CPGFImage::SetBackground(const RGBTRIPLE* bg) {
+	if (bg) {
+		m_header.background = *bg;
+//		m_backgroundSet = true;
 	} else {
 		m_header.background.rgbtBlue = DefaultBGColor;
 		m_header.background.rgbtGreen = DefaultBGColor;
 		m_header.background.rgbtRed = DefaultBGColor;
 //		m_backgroundSet = false;
-	}
-}
-
-//////////////////////////////////////////////////////////////////////
-/// Set PGF header and user data.
-/// Precondition: The PGF image has been closed with Close(...) or never opened with Open(...).
-/// It might throw an IOException.
-/// @param header A valid and already filled in PGF header structure
-/// @param flags A combination of additional version flags
-/// @param userData A user-defined memory block
-/// @param userDataLength The size of user-defined memory block in bytes
-void CPGFImage::SetHeader(const PGFHeader& header, BYTE flags /*=0*/, UINT8* userData /*= 0*/, UINT32 userDataLength /*= 0*/) THROW_ {
-	ASSERT(!m_decoder);	// current image must be closed
-	ASSERT(header.quality <= MaxQuality);
-	int i;
-
-	// init preHeader
-	memcpy(m_preHeader.magic, Magic, 3);
-	m_preHeader.version = PGFVersion | flags;
-	m_preHeader.hSize = HeaderSize;
-
-	// copy header
-	memcpy(&m_header, &header, HeaderSize);
-
-	// misuse background value to store bits per channel
-	BYTE bpc = m_header.bpp/m_header.channels;
-	if (bpc > 8) {
-		if (bpc > 31) bpc = 31;
-		m_header.background.rgbtBlue = bpc;
-	}
-
-	// check for downsample
-	if (m_header.quality > DownsampleThreshold &&  (m_header.mode == ImageModeRGBColor || 
-													m_header.mode == ImageModeRGBA || 
-													m_header.mode == ImageModeRGB48 || 
-													m_header.mode == ImageModeCMYKColor || 
-													m_header.mode == ImageModeCMYK64 || 
-													m_header.mode == ImageModeLabColor || 
-													m_header.mode == ImageModeLab48)) {
-		m_downsample = true;
-		m_quant = m_header.quality - 1;
-	} else {
-		m_downsample = false;
-		m_quant = m_header.quality;
-	}
-
-	// update header size and copy user data
-	if (m_header.mode == ImageModeIndexedColor) {
-		m_preHeader.hSize += ColorTableSize;
-	}
-	if (userDataLength && userData) {
-		m_postHeader.userData = new UINT8[userDataLength];
-		m_postHeader.userDataLen = userDataLength;
-		memcpy(m_postHeader.userData, userData, userDataLength);
-		m_preHeader.hSize += userDataLength;
-	}
-
-	// allocate channels
-	for (i=0; i < m_header.channels; i++) {
-		// set current width and height
-		m_width[i] = m_header.width;
-		m_height[i] = m_header.height;
-
-		// allocate channels
-		ASSERT(!m_channel[i]);
-		m_channel[i] = new DataT[m_header.width*m_header.height];
-		if (!m_channel[i]) ReturnWithError(InsufficientMemory);
 	}
 }
 
@@ -680,6 +687,7 @@
 	BYTE bpc = m_header.bpp/m_header.channels;
 
 	if (bpc > 8) {
+		// see also GetMaxValue()
 		return m_header.background.rgbtBlue;
 	} else {
 		return bpc;
@@ -749,7 +757,7 @@
 			loPos += 2; hiPos += 2;
 			sampledPos++;
 		}
-		if (oddW) { 
+		if (oddW) {
 			buff[sampledPos] = (buff[loPos] + buff[hiPos]) >> 1;
 			loPos++; hiPos++;
 			sampledPos++;
@@ -773,27 +781,21 @@
 }
 
 //////////////////////////////////////////////////////////////////////
-/// Compute and return number of levels. During PGF::Write the return
-/// value of this method is used in case the parameter levels is not a
-/// positive value. 
-/// A PGF image is structered in levels, numbered between 0 and Levels() - 1.
-/// Each level can be seen as a single image, containing the same content
-/// as all other levels, but in a different size (width, height).
-/// The image size at level i is double the size (width, height) of the image at level i+1.
-/// The image at level 0 contains the original size.
-/// @param width Original image width
-/// @param height Original image height
-/// @return Number of PGF levels
-BYTE CPGFImage::ComputeLevels(UINT32 width, UINT32 height) {
+void CPGFImage::ComputeLevels() {
 	const int maxThumbnailWidth = 20*FilterWidth;
-	const int m = __min(width, height);
-	int s = m, levels = 1;
-
-	// compute a good value depending on the size of the image
-	while (s > maxThumbnailWidth) {
-		levels++;
-		s = s/2;
-	}
+	const int m = __min(m_header.width, m_header.height);
+	int s = m;
+
+	if (m_header.nLevels < 1 || m_header.nLevels > MaxLevel) {
+		m_header.nLevels = 1;
+		// compute a good value depending on the size of the image
+		while (s > maxThumbnailWidth) {
+			m_header.nLevels++;
+			s = s/2;
+		}
+	}
+
+	int levels = m_header.nLevels; // we need a signed value during level reduction
 
 	// reduce number of levels if the image size is smaller than FilterWidth*2^levels
 	s = FilterWidth*(1 << levels);	// must be at least the double filter size because of subsampling
@@ -801,11 +803,248 @@
 		levels--;
 		s = s/2;
 	}
-	if (levels > MaxLevel) levels = MaxLevel;
-	if (levels < 0) levels = 0;
-	ASSERT(0 <= levels && levels <= MaxLevel);
-	
-	return (BYTE)levels;
+	if (levels > MaxLevel) m_header.nLevels = MaxLevel;
+	else if (levels < 0) m_header.nLevels = 0;
+	else m_header.nLevels = (UINT8)levels;
+
+	ASSERT(0 <= m_header.nLevels && m_header.nLevels <= MaxLevel);
+}
+
+//////////////////////////////////////////////////////////////////////
+/// Set PGF header and user data.
+/// Precondition: The PGF image has been closed with Close(...) or never opened with Open(...).
+/// It might throw an IOException.
+/// @param header A valid and already filled in PGF header structure
+/// @param flags A combination of additional version flags
+/// @param userData A user-defined memory block
+/// @param userDataLength The size of user-defined memory block in bytes
+void CPGFImage::SetHeader(const PGFHeader& header, BYTE flags /*=0*/, UINT8* userData /*= 0*/, UINT32 userDataLength /*= 0*/) THROW_ {
+	ASSERT(!m_decoder);	// current image must be closed
+	ASSERT(header.quality <= MaxQuality);
+	int i;
+
+	// init state
+#ifdef __PGFROISUPPORT__
+	m_levelwise = true;
+	m_streamReinitialized = false;
+#endif
+
+	// init preHeader
+	memcpy(m_preHeader.magic, Magic, 3);
+	m_preHeader.version = PGFVersion | flags;
+	m_preHeader.hSize = HeaderSize;
+
+	// copy header
+	memcpy(&m_header, &header, HeaderSize);
+
+	// complete header
+	CompleteHeader();
+
+	// check and set number of levels
+	ComputeLevels();
+
+	// misuse background value to store bits per channel
+	BYTE bpc = m_header.bpp/m_header.channels;
+	if (bpc > 8) {
+		if (bpc > 31) bpc = 31;
+		m_header.background.rgbtBlue = bpc;
+	}
+
+	// check for downsample
+	if (m_header.quality > DownsampleThreshold &&  (m_header.mode == ImageModeRGBColor ||
+													m_header.mode == ImageModeRGBA ||
+													m_header.mode == ImageModeRGB48 ||
+													m_header.mode == ImageModeCMYKColor ||
+													m_header.mode == ImageModeCMYK64 ||
+													m_header.mode == ImageModeLabColor ||
+													m_header.mode == ImageModeLab48)) {
+		m_downsample = true;
+		m_quant = m_header.quality - 1;
+	} else {
+		m_downsample = false;
+		m_quant = m_header.quality;
+	}
+
+	// update header size and copy user data
+	if (m_header.mode == ImageModeIndexedColor) {
+		m_preHeader.hSize += ColorTableSize;
+	}
+	if (userDataLength && userData) {
+		m_postHeader.userData = new UINT8[userDataLength];
+		m_postHeader.userDataLen = userDataLength;
+		memcpy(m_postHeader.userData, userData, userDataLength);
+		m_preHeader.hSize += userDataLength;
+	}
+
+	// allocate channels
+	for (i=0; i < m_header.channels; i++) {
+		// set current width and height
+		m_width[i] = m_header.width;
+		m_height[i] = m_header.height;
+
+		// allocate channels
+		ASSERT(!m_channel[i]);
+		m_channel[i] = new DataT[m_header.width*m_header.height];
+		if (!m_channel[i]) ReturnWithError(InsufficientMemory);
+	}
+}
+
+//////////////////////////////////////////////////////////////////
+// Create wavelet transform channels and encoder.
+// Call this method before your first call of Write(int level), but after SetHeader().
+// Don't use this method when you call Write().
+// It might throw an IOException.
+// @param stream A PGF stream
+// @return The number of bytes written into stream.
+UINT32 CPGFImage::WriteHeader(CPGFStream* stream) THROW_ {
+	ASSERT(m_header.nLevels <= MaxLevel);
+	ASSERT(m_header.quality <= MaxQuality); // quality is already initialized
+
+	if (m_header.nLevels > 0) {
+		volatile OSError error = NoError; // volatile prevents optimizations
+		// create new wt channels
+		#pragma omp parallel for default(shared)
+		for (int i=0; i < m_header.channels; i++) {
+			DataT *temp = NULL;
+			if (error == NoError) {
+				if (m_wtChannel[i]) {
+					ASSERT(m_channel[i]);
+					// copy m_channel to temp
+					int size = m_height[i]*m_width[i];
+					temp = new DataT[size];
+					if (temp) {
+						memcpy(temp, m_channel[i], size*DataTSize);
+						delete m_wtChannel[i];	// also deletes m_channel
+					} else {
+						error = InsufficientMemory;
+					}
+				}
+				if (temp) m_channel[i] = temp;
+				m_wtChannel[i] = new CWaveletTransform(m_width[i], m_height[i], m_header.nLevels, m_channel[i]);
+				if (m_wtChannel[i]) {
+					// wavelet subband decomposition
+					for (int l=0; l < m_header.nLevels; l++) {
+						m_wtChannel[i]->ForwardTransform(l);
+					}
+				} else {
+					delete temp;
+					error = InsufficientMemory;
+				}
+			}
+		}
+		if (error != NoError) ReturnWithError(error);
+
+		m_currentLevel = m_header.nLevels;
+
+	#ifdef __PGFROISUPPORT__
+		if (m_levelwise) {
+			m_preHeader.version |= PGFROI;
+		}
+	#endif
+
+		// create encoder and eventually write headers and levelLength
+		m_encoder = new CEncoder(stream, m_preHeader, m_header, m_postHeader, m_levelLength, m_useOMPinEncoder);
+		if (m_favorSpeedOverSize) m_encoder->FavorSpeedOverSize();
+
+	#ifdef __PGFROISUPPORT__
+		if (ROIisSupported()) {
+			// new encoding scheme supporting ROI
+			m_encoder->SetROI();
+		}
+	#endif
+
+		// return number of written bytes
+		return m_encoder->ComputeHeaderLength();
+
+	} else {
+		// very small image: we don't use DWT and encoding
+
+		// create encoder and eventually write headers and levelLength
+		m_encoder = new CEncoder(stream, m_preHeader, m_header, m_postHeader, m_levelLength, m_useOMPinEncoder);
+
+		// write channels
+		for (int c=0; c < m_header.channels; c++) {
+			const UINT32 size = m_width[c]*m_height[c];
+
+			// write channel data into stream
+			for (UINT32 i=0; i < size; i++) {
+				int count = DataTSize;
+				stream->Write(&count, &m_channel[c][i]);
+			}
+		}
+
+		// write level lengths
+		UINT32 nBytes = m_encoder->WriteLevelLength(); // return written bytes inclusive header
+
+		// delete encoder
+		delete m_encoder; m_encoder = NULL;
+
+		// return number of written bytes
+		return nBytes;
+	}
+}
+
+//////////////////////////////////////////////////////////////////
+// Encode and write next level of a PGF image at current stream position.
+// A PGF image is structered in levels, numbered between 0 and Levels() - 1.
+// Each level can be seen as a single image, containing the same content
+// as all other levels, but in a different size (width, height).
+// The image size at level i is double the size (width, height) of the image at level i+1.
+// The image at level 0 contains the original size.
+// It might throw an IOException.
+void CPGFImage::WriteLevel() THROW_ {
+	ASSERT(m_encoder);
+	ASSERT(m_currentLevel > 0);
+	ASSERT(m_header.nLevels > 0);
+
+#ifdef __PGFROISUPPORT__
+	if (ROIisSupported()) {
+		const int lastChannel = m_header.channels - 1;
+
+		for (int i=0; i < m_header.channels; i++) {
+			m_wtChannel[i]->SetROI();
+
+			// get number of tiles and tile indices
+			const UINT32 nTiles = m_wtChannel[i]->GetNofTiles(m_currentLevel);
+			const UINT32 lastTile = nTiles - 1;
+
+			if (m_currentLevel == m_header.nLevels) {
+				// last level also has LL band
+				ASSERT(nTiles == 1);
+				m_wtChannel[i]->GetSubband(m_currentLevel, LL)->ExtractTile(*m_encoder, m_quant);
+				m_encoder->EncodeTileBuffer();
+			}
+			for (UINT32 tileY=0; tileY < nTiles; tileY++) {
+				for (UINT32 tileX=0; tileX < nTiles; tileX++) {
+					m_wtChannel[i]->GetSubband(m_currentLevel, HL)->ExtractTile(*m_encoder, m_quant, true, tileX, tileY);
+					m_wtChannel[i]->GetSubband(m_currentLevel, LH)->ExtractTile(*m_encoder, m_quant, true, tileX, tileY);
+					m_wtChannel[i]->GetSubband(m_currentLevel, HH)->ExtractTile(*m_encoder, m_quant, true, tileX, tileY);
+					if (i == lastChannel && tileY == lastTile && tileX == lastTile) {
+						// all necessary data are buffered. next call of EncodeBuffer will write the last piece of data of the current level.
+						m_encoder->SetEncodedLevel(--m_currentLevel);
+					}
+					m_encoder->EncodeTileBuffer();
+				}
+			}
+		}
+	} else
+#endif
+	{
+		for (int i=0; i < m_header.channels; i++) {
+			ASSERT(m_wtChannel[i]);
+			if (m_currentLevel == m_header.nLevels) {
+				// last level also has LL band
+				m_wtChannel[i]->GetSubband(m_currentLevel, LL)->ExtractTile(*m_encoder, m_quant);
+			}
+			//encoder.EncodeInterleaved(m_wtChannel[i], m_currentLevel, m_quant); // until version 4
+			m_wtChannel[i]->GetSubband(m_currentLevel, HL)->ExtractTile(*m_encoder, m_quant); // since version 5
+			m_wtChannel[i]->GetSubband(m_currentLevel, LH)->ExtractTile(*m_encoder, m_quant); // since version 5
+			m_wtChannel[i]->GetSubband(m_currentLevel, HH)->ExtractTile(*m_encoder, m_quant);
+		}
+
+		// all necessary data are buffered. next call of EncodeBuffer will write the last piece of data of the current level.
+		m_encoder->SetEncodedLevel(--m_currentLevel);
+	}
 }
 
 //////////////////////////////////////////////////////////////////
@@ -818,148 +1057,129 @@
 // Precondition: the PGF image contains a valid header (see also SetHeader(...)).
 // It might throw an IOException.
 // @param stream A PGF stream
-// @param levels The positive number of levels used in layering or 0 meaning a useful number of levels is computed.
-// @param cb A pointer to a callback procedure. The procedure is called after reading a single level. If cb returns true, then it stops proceeding.
 // @param nWrittenBytes [in-out] The number of bytes written into stream are added to the input value.
+// @param cb A pointer to a callback procedure. The procedure is called after writing a single level. If cb returns true, then it stops proceeding.
 // @param data Data Pointer to C++ class container to host callback procedure.
-void CPGFImage::Write(CPGFStream* stream, int levels /* = 0*/, CallbackPtr cb /*= NULL*/, UINT32* nWrittenBytes /*= NULL*/, void *data /*=NULL*/) THROW_ {
+void CPGFImage::Write(CPGFStream* stream, UINT32* nWrittenBytes /*= NULL*/, CallbackPtr cb /*= NULL*/, void *data /*=NULL*/) THROW_ {
 	ASSERT(stream);
 	ASSERT(m_preHeader.hSize);
-	int i;
-	UINT32 nBytes = 0;
-	DataT *temp;
-
-	// check and set number of levels
-	if (levels < 1) {
-		levels = m_header.nLevels = ComputeLevels(m_header.width, m_header.height);
+
+#ifdef __PGFROISUPPORT__
+	// don't use level-wise writing
+	m_levelwise = false;
+#endif
+
+	// create wavelet transform channels and encoder
+	WriteHeader(stream);
+
+	int levels = m_header.nLevels;
+	double percent = pow(0.25, levels - 1);
+
+	if (levels == 0) {
+		// data has been written in WriteHeader
+		// now update progress
+		if (cb) {
+			if ((*cb)(1, true, data)) ReturnWithError(EscapePressed);
+		}
 	} else {
-		if (levels > MaxLevel) levels = MaxLevel;
-		m_header.nLevels = levels;
-	}
-	ASSERT(m_header.nLevels <= MaxLevel);
-	ASSERT(m_header.quality <= MaxQuality); // quality is already initialized
-
-	// create new wt channels
-	for (i=0; i < m_header.channels; i++) {
-		temp = NULL;
-		if (m_wtChannel[i]) {
-			ASSERT(m_channel[i]);
-			// copy m_channel to temp
-			int size = m_height[i]*m_width[i];
-			temp = new DataT[size]; 
-			if (!temp) ReturnWithError(InsufficientMemory);
-			memcpy(temp, m_channel[i], size*sizeof(INT16));
-			delete m_wtChannel[i];	// also deletes m_channel
-		}
-		if (temp) m_channel[i] = temp;
-		m_wtChannel[i] = new CWaveletTransform(m_width[i], m_height[i], levels, m_channel[i]);
-		if (!m_wtChannel[i]) {
-			delete temp;
-			ReturnWithError(InsufficientMemory);
-		}
-
-		// wavelet subband decomposition 
-		for (m_currentLevel=0; m_currentLevel < levels; m_currentLevel++) {
-			m_wtChannel[i]->ForwardTransform(m_currentLevel);
-		}
-	}
-	double percent = pow(0.25, levels - 1);
-
-	// open encoder and eventually write headers and levelLength
-	CEncoder encoder(stream, m_preHeader, m_header, m_postHeader, m_levelLength);
-
-	if (levels > 0) {
 		// encode quantized wavelet coefficients and write to PGF file
 		// encode subbands, higher levels first
 		// color channels are interleaved
 
+		// encode all levels
+		for (m_currentLevel = levels; m_currentLevel > 0; ) {
+			WriteLevel(); // decrements m_currentLevel
+
+			// now update progress
+			if (cb) {
+				percent *= 4;
+				if ((*cb)(percent, true, data)) ReturnWithError(EscapePressed);
+			}
+		}
+
+		// flush encoder and write level lengths
+		m_encoder->Flush();
+		UINT32 nBytes = m_encoder->WriteLevelLength(); // inclusive header
+
+		// delete encoder
+		delete m_encoder; m_encoder = NULL;
+
+		// return written bytes
+		if (nWrittenBytes) *nWrittenBytes += nBytes;
+	}
+
+	ASSERT(!m_encoder);
+}
+
 #ifdef __PGFROISUPPORT__
-		if (ROIisSupported()) {
-			// new encoding scheme supporting ROI
-			encoder.SetROI();
-
-			for (m_currentLevel = (UINT8)levels; m_currentLevel > 0; m_currentLevel--) {
-				for (i=0; i < m_header.channels; i++) {
-					m_wtChannel[i]->SetROI();
-
-					// get number of tiles and tile indices
-					const UINT32 nTiles = m_wtChannel[i]->GetNofTiles(m_currentLevel);
-
-					if (m_currentLevel == levels) {
-						ASSERT(nTiles == 1);
-						m_wtChannel[i]->GetSubband(m_currentLevel, LL)->ExtractTile(encoder, m_quant);
-						encoder.EncodeTileBuffer();
-					}
-					for (UINT32 tileY=0; tileY < nTiles; tileY++) {
-						for (UINT32 tileX=0; tileX < nTiles; tileX++) {
-							m_wtChannel[i]->GetSubband(m_currentLevel, HL)->ExtractTile(encoder, m_quant, true, tileX, tileY);
-							m_wtChannel[i]->GetSubband(m_currentLevel, LH)->ExtractTile(encoder, m_quant, true, tileX, tileY);
-							m_wtChannel[i]->GetSubband(m_currentLevel, HH)->ExtractTile(encoder, m_quant, true, tileX, tileY);
-							encoder.EncodeTileBuffer();
-						}
-					}
-				}
-
-				// all necessary data of a level is buffered!
-				encoder.SetLevelIsEncoded(true);
-
-				// now update progress
-				if (cb) {
-					percent *= 4;
-					if ((*cb)(percent, true, data)) ReturnWithError(EscapePressed);
-				}
-			}
-		} else 
-#endif
-		{
-			// encoding scheme without ROI
-			m_currentLevel = (UINT8)levels;
-			for (i=0; i < m_header.channels; i++) {
-				m_wtChannel[i]->GetSubband(m_currentLevel, LL)->ExtractTile(encoder, m_quant);
-				//encoder.EncodeInterleaved(m_wtChannel[i], m_currentLevel, m_quant); // until version 4
-				m_wtChannel[i]->GetSubband(m_currentLevel, HL)->ExtractTile(encoder, m_quant); // since version 5
-				m_wtChannel[i]->GetSubband(m_currentLevel, LH)->ExtractTile(encoder, m_quant); // since version 5
-				m_wtChannel[i]->GetSubband(m_currentLevel, HH)->ExtractTile(encoder, m_quant);
-			}
-			// all necessary data buffered!
-			encoder.SetLevelIsEncoded(true);
-			m_currentLevel--;
-
-			for (; m_currentLevel > 0; m_currentLevel--) {
-				for (i=0; i < m_header.channels; i++) {
-					//encoder.EncodeInterleaved(m_wtChannel[i], m_currentLevel, m_quant); // until version 4
-					m_wtChannel[i]->GetSubband(m_currentLevel, HL)->ExtractTile(encoder, m_quant); // since version 5
-					m_wtChannel[i]->GetSubband(m_currentLevel, LH)->ExtractTile(encoder, m_quant); // since version 5
-					m_wtChannel[i]->GetSubband(m_currentLevel, HH)->ExtractTile(encoder, m_quant);
-				}
-				// all necessary data of a level buffered!
-				encoder.SetLevelIsEncoded(true);
-
-				// now update progress
-				if (cb) {
-					percent *= 4;
-					if ((*cb)(percent, true, data)) ReturnWithError(EscapePressed);
-				}
-			}
-		}
-	} else {
-		// write untransformed m_channel
-		for (i=0; i < m_header.channels; i++) {
-			m_wtChannel[i]->GetSubband(0, LL)->ExtractTile(encoder, m_quant);
-		}
-	}
-	
-	// flush encoder
-	nBytes = encoder.Flush();
-	if (nWrittenBytes) *nWrittenBytes += nBytes;
-}
+//////////////////////////////////////////////////////////////////
+// Encode and write down to given level at current stream position.
+// A PGF image is structered in levels, numbered between 0 and Levels() - 1.
+// Each level can be seen as a single image, containing the same content
+// as all other levels, but in a different size (width, height).
+// The image size at level i is double the size (width, height) of the image at level i+1.
+// The image at level 0 contains the original size.
+// Precondition: the PGF image contains a valid header (see also SetHeader(...)) and WriteHeader() has been called before Write().
+// The ROI encoding scheme is used.
+// It might throw an IOException.
+// @param level The image level of the resulting image in the internal image buffer.
+// @param cb A pointer to a callback procedure. The procedure is called after writing a single level. If cb returns true, then it stops proceeding.
+// @param data Data Pointer to C++ class container to host callback procedure.
+// @return The number of bytes written into stream.
+UINT32 CPGFImage::Write(int level, CallbackPtr cb /*= NULL*/, void *data /*=NULL*/) THROW_ {
+	ASSERT(m_header.nLevels > 0);
+	ASSERT(0 <= level && level < m_header.nLevels);
+	ASSERT(m_encoder);
+	ASSERT(ROIisSupported());
+
+	// prepare for next level: save current file position, because the stream might have been reinitialized
+	UINT32 diff = m_encoder->ComputeBufferLength();
+	if (diff) {
+		m_streamReinitialized = true;
+		m_encoder->SetBufferStartPos();
+	}
+
+	const int levelDiff = m_currentLevel - level;
+	double percent = pow(0.25, levelDiff);
+	UINT32 nWrittenBytes = 0;
+	int levelIndex = m_header.nLevels - 1 - m_currentLevel;
+
+	// encoding scheme with ROI
+	while (m_currentLevel > level) {
+		levelIndex++;
+
+		WriteLevel();
+
+		if (m_levelLength) nWrittenBytes += m_levelLength[levelIndex];
+
+		// now update progress
+		if (cb) {
+			percent *= 4;
+			if ((*cb)(percent, true, data)) ReturnWithError(EscapePressed);
+		}
+	}
+
+	// automatically closing
+	if (m_currentLevel == 0) {
+		if (!m_streamReinitialized) {
+			// don't write level lengths, if the stream position changed inbetween two Write operations
+			m_encoder->WriteLevelLength();
+		}
+		// delete encoder
+		delete m_encoder; m_encoder = NULL;
+	}
+
+	return nWrittenBytes;
+}
+#endif // __PGFROISUPPORT__
+
 
 //////////////////////////////////////////////////////////////////
 // Check for valid import image mode.
 // @param mode Image mode
 // @return True if an image of given mode can be imported with ImportBitmap(...)
 bool CPGFImage::ImportIsSupported(BYTE mode) {
-	size_t size = sizeof(DataT);
+	size_t size = DataTSize;
 
 	if (size >= 2) {
 		switch(mode) {
@@ -1057,7 +1277,7 @@
 			ASSERT(m_header.channels == 1);
 			ASSERT(m_header.bpp == 1);
 			ASSERT(bpp == 1);
-			
+
 			const UINT32 w2 = (m_header.width + 7)/8;
 			DataT* y = m_channel[0]; ASSERT(y);
 
@@ -1070,7 +1290,7 @@
 				for (UINT32 w=0; w < w2; w++) {
 					y[yPos++] = buff[w] - YUVoffset8;
 				}
-				buff += pitch;	
+				buff += pitch;
 			}
 		}
 		break;
@@ -1099,7 +1319,7 @@
 					cnt += channels;
 					yPos++;
 				}
-				buff += pitch;	
+				buff += pitch;
 			}
 		}
 		break;
@@ -1113,7 +1333,7 @@
 			UINT16 *buff16 = (UINT16 *)buff;
 			const int pitch16 = pitch/2;
 			const int channels = bpp/16; ASSERT(channels >= m_header.channels);
-			const int yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
+			const DataT yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
 
 			for (UINT32 h=0; h < m_header.height; h++) {
 				if (cb) {
@@ -1164,7 +1384,7 @@
 					cnt += channels;
 				}
 				buff += pitch;
-			}	
+			}
 		}
 		break;
 	case ImageModeRGB48:
@@ -1176,7 +1396,7 @@
 			UINT16 *buff16 = (UINT16 *)buff;
 			const int pitch16 = pitch/2;
 			const int channels = bpp/16; ASSERT(channels >= m_header.channels);
-			const int yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
+			const DataT yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
 
 			DataT* y = m_channel[0]; ASSERT(y);
 			DataT* u = m_channel[1]; ASSERT(u);
@@ -1202,7 +1422,7 @@
 					cnt += channels;
 				}
 				buff16 += pitch16;
-			}	
+			}
 		}
 		break;
 	case ImageModeRGBA:
@@ -1238,7 +1458,7 @@
 					cnt += channels;
 				}
 				buff += pitch;
-			}	
+			}
 		}
 		break;
 	case ImageModeCMYK64:
@@ -1250,8 +1470,8 @@
 			UINT16 *buff16 = (UINT16 *)buff;
 			const int pitch16 = pitch/2;
 			const int channels = bpp/16; ASSERT(channels >= m_header.channels);
-			const int yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
-			
+			const DataT yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
+
 			DataT* y = m_channel[0]; ASSERT(y);
 			DataT* u = m_channel[1]; ASSERT(u);
 			DataT* v = m_channel[2]; ASSERT(v);
@@ -1277,20 +1497,22 @@
 					cnt += channels;
 				}
 				buff16 += pitch16;
-			}	
+			}
 		}
 		break;
+#ifdef __PGF32SUPPORT__
 	case ImageModeGray31:
 		{
 			ASSERT(m_header.channels == 1);
 			ASSERT(m_header.bpp == 32);
 			ASSERT(bpp == 32);
+			ASSERT(DataTSize == sizeof(UINT32));
 
 			DataT* y = m_channel[0]; ASSERT(y);
 
 			UINT32 *buff32 = (UINT32 *)buff;
 			const int pitch32 = pitch/4;
-			const int yuvOffset31 = 1 << (UsedBitsPerChannel() - 1);
+			const DataT yuvOffset31 = 1 << (UsedBitsPerChannel() - 1);
 
 			for (UINT32 h=0; h < m_header.height; h++) {
 				if (cb) {
@@ -1306,6 +1528,7 @@
 			}
 		}
 		break;
+#endif
 	case ImageModeRGB12:
 		{
 			ASSERT(m_header.channels == 3);
@@ -1351,7 +1574,7 @@
 					yPos++;
 				}
 				buff += pitch;
-			}	
+			}
 		}
 		break;
 	case ImageModeRGB16:
@@ -1359,7 +1582,7 @@
 			ASSERT(m_header.channels == 3);
 			ASSERT(m_header.bpp == 16);
 			ASSERT(bpp == 16);
-			
+
 			DataT* y = m_channel[0]; ASSERT(y);
 			DataT* u = m_channel[1]; ASSERT(u);
 			DataT* v = m_channel[2]; ASSERT(v);
@@ -1374,7 +1597,7 @@
 					percent += dP;
 				}
 				for (UINT32 w=0; w < m_header.width; w++) {
-					rgb = buff16[w]; 
+					rgb = buff16[w];
 					r = (rgb & 0xF800) >> 10;	// highest 5 bits
 					g = (rgb & 0x07E0) >> 5;	// middle 6 bits
 					b = (rgb & 0x001F) << 1;	// lowest 5 bits
@@ -1386,7 +1609,7 @@
 				}
 
 				buff16 += pitch16;
-			}	
+			}
 		}
 		break;
 	default:
@@ -1396,7 +1619,7 @@
 
 //////////////////////////////////////////////////////////////////
 // Get image data in interleaved format: (ordering of RGB data is BGR[A])
-// Upsampling, YUV to RGB transform and interleaving are done here to reduce the number 
+// Upsampling, YUV to RGB transform and interleaving are done here to reduce the number
 // of passes over the data.
 // The absolute value of pitch is the number of bytes of an image row of the given image buffer.
 // If pitch is negative, then the image buffer must point to the last row of a bottom-up image (first byte on last row).
@@ -1423,8 +1646,8 @@
 	const PGFRect& roi = (ROIisSupported()) ? m_wtChannel[0]->GetROI(m_currentLevel) : PGFRect(0, 0, w, h); // roi is usually larger than m_roi
 	const PGFRect levelRoi(LevelWidth(m_roi.left, m_currentLevel), LevelHeight(m_roi.top, m_currentLevel), LevelWidth(m_roi.Width(), m_currentLevel), LevelHeight(m_roi.Height(), m_currentLevel));
 	ASSERT(w == roi.Width() && h == roi.Height());
-	ASSERT(roi.left <= levelRoi.left && levelRoi.right <= roi.right); 
-	ASSERT(roi.top <= levelRoi.top && levelRoi.bottom <= roi.bottom); 
+	ASSERT(roi.left <= levelRoi.left && levelRoi.right <= roi.right);
+	ASSERT(roi.top <= levelRoi.top && levelRoi.bottom <= roi.bottom);
 
 	if (ROIisSupported() && (levelRoi.Width() < w || levelRoi.Height() < h)) {
 		// ROI is used -> create a temporary image buffer for roi
@@ -1505,7 +1728,7 @@
 			ASSERT(m_header.channels >= 1);
 			ASSERT(m_header.bpp == m_header.channels*16);
 
-			const int yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
+			const DataT yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
 			const int shift = UsedBitsPerChannel() - 8;
 			int cnt, channels;
 
@@ -1533,12 +1756,12 @@
 			} else {
 				ASSERT(bpp%8 == 0);
 				channels = bpp/8; ASSERT(channels >= m_header.channels);
-				
+
 				for (i=0; i < h; i++) {
 					cnt = 0;
 					for (j=0; j < w; j++) {
 						for (int c=0; c < m_header.channels; c++) {
-							buff[cnt + channelMap[c]] = Clamp16(m_channel[c][yPos] + yuvOffset16) >> shift;
+							buff[cnt + channelMap[c]] = UINT8(Clamp16(m_channel[c][yPos] + yuvOffset16) >> shift);
 						}
 						cnt += channels;
 						yPos++;
@@ -1564,8 +1787,8 @@
 			DataT* u = m_channel[1]; ASSERT(u);
 			DataT* v = m_channel[2]; ASSERT(v);
 			UINT8 *buffg = &buff[channelMap[1]],
-				*buffu = &buff[channelMap[2]],
-				*buffv = &buff[channelMap[0]];
+				  *buffr = &buff[channelMap[2]],
+				  *buffb = &buff[channelMap[0]];
 			UINT8 g;
 			int cnt, channels = bpp/8;
 			if(m_downsample){
@@ -1578,15 +1801,15 @@
 						vAvg = v[sampledPos];
 						// Yuv
 						buffg[cnt] = g = Clamp(y[yPos] + YUVoffset8 - ((uAvg + vAvg ) >> 2)); // must be logical shift operator
-						buffu[cnt] = Clamp(uAvg + g);
-						buffv[cnt] = Clamp(vAvg + g);
+						buffr[cnt] = Clamp(uAvg + g);
+						buffb[cnt] = Clamp(vAvg + g);
 						yPos++;
 						cnt += channels;
 						if (j%2) sampledPos++;
 					}
+					buffb += pitch;
 					buffg += pitch;
-					buffu += pitch;
-					buffv += pitch;
+					buffr += pitch;
 					if (wOdd) sampledPos++;
 					if (cb) {
 						percent += dP;
@@ -1601,14 +1824,14 @@
 						vAvg = v[yPos];
 						// Yuv
 						buffg[cnt] = g = Clamp(y[yPos] + YUVoffset8 - ((uAvg + vAvg ) >> 2)); // must be logical shift operator
-						buffu[cnt] = Clamp(uAvg + g);
-						buffv[cnt] = Clamp(vAvg + g);
+						buffr[cnt] = Clamp(uAvg + g);
+						buffb[cnt] = Clamp(vAvg + g);
 						yPos++;
 						cnt += channels;
 					}
+					buffb += pitch;
 					buffg += pitch;
-					buffu += pitch;
-					buffv += pitch;
+					buffr += pitch;
 
 					if (cb) {
 						percent += dP;
@@ -1623,7 +1846,7 @@
 			ASSERT(m_header.channels == 3);
 			ASSERT(m_header.bpp == 48);
 
-			const int yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
+			const DataT yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
 			const int shift = UsedBitsPerChannel() - 8;
 
 			DataT* y = m_channel[0]; ASSERT(y);
@@ -1653,7 +1876,7 @@
 						buff16[cnt + channelMap[1]] = g = Clamp16(y[yPos] + yuvOffset16 - ((uAvg + vAvg ) >> 2)); // must be logical shift operator
 						buff16[cnt + channelMap[2]] = Clamp16(uAvg + g);
 						buff16[cnt + channelMap[0]] = Clamp16(vAvg + g);
-						yPos++; 
+						yPos++;
 						cnt += channels;
 						if (j%2) sampledPos++;
 					}
@@ -1683,10 +1906,10 @@
 						}
 						// Yuv
 						g = Clamp16(y[yPos] + yuvOffset16 - ((uAvg + vAvg ) >> 2)); // must be logical shift operator
-						buff[cnt + channelMap[1]] = g >> shift; 
-						buff[cnt + channelMap[2]] = Clamp16(uAvg + g) >> shift;
-						buff[cnt + channelMap[0]] = Clamp16(vAvg + g) >> shift;
-						yPos++; 
+						buff[cnt + channelMap[1]] = UINT8(g >> shift);
+						buff[cnt + channelMap[2]] = UINT8(Clamp16(uAvg + g) >> shift);
+						buff[cnt + channelMap[0]] = UINT8(Clamp16(vAvg + g) >> shift);
+						yPos++;
 						cnt += channels;
 						if (j%2) sampledPos++;
 					}
@@ -1725,7 +1948,7 @@
 						vAvg = b[yPos];
 					}
 					buff[cnt + channelMap[0]] = Clamp(l[yPos] + YUVoffset8);
-					buff[cnt + channelMap[1]] = Clamp(uAvg + YUVoffset8); 
+					buff[cnt + channelMap[1]] = Clamp(uAvg + YUVoffset8);
 					buff[cnt + channelMap[2]] = Clamp(vAvg + YUVoffset8);
 					cnt += channels;
 					yPos++;
@@ -1746,7 +1969,7 @@
 			ASSERT(m_header.channels == 3);
 			ASSERT(m_header.bpp == m_header.channels*16);
 
-			const int yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
+			const DataT yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
 			const int shift = UsedBitsPerChannel() - 8;
 
 			DataT* l = m_channel[0]; ASSERT(l);
@@ -1802,9 +2025,9 @@
 							uAvg = a[yPos];
 							vAvg = b[yPos];
 						}
-						buff[cnt + channelMap[0]] = Clamp16(l[yPos] + yuvOffset16) >> shift;
-						buff[cnt + channelMap[1]] = Clamp16(uAvg + yuvOffset16) >> shift;
-						buff[cnt + channelMap[2]] = Clamp16(vAvg + yuvOffset16) >> shift;
+						buff[cnt + channelMap[0]] = UINT8(Clamp16(l[yPos] + yuvOffset16) >> shift);
+						buff[cnt + channelMap[1]] = UINT8(Clamp16(uAvg + yuvOffset16) >> shift);
+						buff[cnt + channelMap[2]] = UINT8(Clamp16(vAvg + yuvOffset16) >> shift);
 						cnt += channels;
 						yPos++;
 						if (j%2) sampledPos++;
@@ -1853,7 +2076,7 @@
 					buff[cnt + channelMap[2]] = Clamp(uAvg + g);
 					buff[cnt + channelMap[0]] = Clamp(vAvg + g);
 					buff[cnt + channelMap[3]] = aAvg;
-					yPos++; 
+					yPos++;
 					cnt += channels;
 					if (j%2) sampledPos++;
 				}
@@ -1867,12 +2090,12 @@
 			}
 			break;
 		}
-	case ImageModeCMYK64: 
+	case ImageModeCMYK64:
 		{
 			ASSERT(m_header.channels == 4);
 			ASSERT(m_header.bpp == 64);
 
-			const int yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
+			const DataT yuvOffset16 = 1 << (UsedBitsPerChannel() - 1);
 			const int shift = UsedBitsPerChannel() - 8;
 
 			DataT* y = m_channel[0]; ASSERT(y);
@@ -1906,7 +2129,7 @@
 						buff16[cnt + channelMap[2]] = Clamp16(uAvg + g);
 						buff16[cnt + channelMap[0]] = Clamp16(vAvg + g);
 						buff16[cnt + channelMap[3]] = aAvg;
-						yPos++; 
+						yPos++;
 						cnt += channels;
 						if (j%2) sampledPos++;
 					}
@@ -1938,11 +2161,11 @@
 						}
 						// Yuv
 						g = Clamp16(y[yPos] + yuvOffset16 - ((uAvg + vAvg ) >> 2)); // must be logical shift operator
-						buff[cnt + channelMap[1]] = g >> shift; 
-						buff[cnt + channelMap[2]] = Clamp16(uAvg + g) >> shift;
-						buff[cnt + channelMap[0]] = Clamp16(vAvg + g) >> shift;
-						buff[cnt + channelMap[3]] = aAvg >> shift;
-						yPos++; 
+						buff[cnt + channelMap[1]] = UINT8(g >> shift);
+						buff[cnt + channelMap[2]] = UINT8(Clamp16(uAvg + g) >> shift);
+						buff[cnt + channelMap[0]] = UINT8(Clamp16(vAvg + g) >> shift);
+						buff[cnt + channelMap[3]] = UINT8(aAvg >> shift);
+						yPos++;
 						cnt += channels;
 						if (j%2) sampledPos++;
 					}
@@ -1957,6 +2180,7 @@
 			}
 			break;
 		}
+#ifdef __PGF32SUPPORT__
 	case ImageModeGray31:
 		{
 			ASSERT(m_header.channels == 1);
@@ -1984,10 +2208,10 @@
 				}
 			} else {
 				ASSERT(bpp == 8);
-				
+
 				for (i=0; i < h; i++) {
 					for (j=0; j < w; j++) {
-						buff[j] = Clamp31(y[yPos++] + yuvOffset31) >> shift;
+						buff[j] = UINT8(Clamp31(y[yPos++] + yuvOffset31) >> shift);
 					}
 					buff += pitch;
 
@@ -1997,9 +2221,10 @@
 					}
 				}
 			}
-			break;	
-		}
-	case ImageModeRGB12: 
+			break;
+		}
+#endif
+	case ImageModeRGB12:
 		{
 			ASSERT(m_header.channels == 3);
 			ASSERT(m_header.bpp == m_header.channels*4);
@@ -2020,13 +2245,13 @@
 					vAvg = v[yPos];
 					yval = Clamp4(y[yPos++] + YUVoffset4 - ((uAvg + vAvg ) >> 2)); // must be logical shift operator
 					if (j%2 == 0) {
-						buff[cnt] = Clamp4(vAvg + yval) | (yval << 4);
+						buff[cnt] = UINT8(Clamp4(vAvg + yval) | (yval << 4));
 						cnt++;
 						buff[cnt] = Clamp4(uAvg + yval);
 					} else {
 						buff[cnt] |= Clamp4(vAvg + yval) << 4;
 						cnt++;
-						buff[cnt] = yval | (Clamp4(uAvg + yval) << 4);
+						buff[cnt] = UINT8(yval | (Clamp4(uAvg + yval) << 4));
 						cnt++;
 					}
 				}
@@ -2039,7 +2264,7 @@
 			}
 			break;
 		}
-	case ImageModeRGB16: 
+	case ImageModeRGB16:
 		{
 			ASSERT(m_header.channels == 3);
 			ASSERT(m_header.bpp == 16);
@@ -2097,7 +2322,7 @@
 		delete[] buffStart;
 	}
 #endif
-}			
+}
 
 //////////////////////////////////////////////////////////////////////
 /// Get YUV image data in interleaved format: (ordering is YUV[A])
@@ -2118,12 +2343,11 @@
 	const UINT32 w = m_width[0];
 	const UINT32 h = m_height[0];
 	const bool wOdd = (1 == w%2);
-	const int bits = m_header.bpp/m_header.channels;
-	const int dataBits = sizeof(DataT)*8; ASSERT(dataBits == 16 || dataBits == 32);
-	const int pitch2 = pitch/sizeof(DataT);
+	const int dataBits = DataTSize*8; ASSERT(dataBits == 16 || dataBits == 32);
+	const int pitch2 = pitch/DataTSize;
 	const int yuvOffset = (dataBits == 16) ? YUVoffset8 : YUVoffset16;
 	const double dP = 1.0/h;
-	
+
 	int defMap[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; ASSERT(sizeof(defMap)/sizeof(defMap[0]) == MaxChannels);
 	if (channelMap == NULL) channelMap = defMap;
 	int sampledPos = 0, yPos = 0;
@@ -2131,8 +2355,7 @@
 	double percent = 0;
 	UINT32 i, j;
 
-	if (m_header.channels == 3) { 
-		ASSERT(m_header.bpp == m_header.channels*bits);
+	if (m_header.channels == 3) {
 		ASSERT(bpp%dataBits == 0);
 
 		DataT* y = m_channel[0]; ASSERT(y);
@@ -2155,7 +2378,7 @@
 				buff[cnt + channelMap[0]] = y[yPos];
 				buff[cnt + channelMap[1]] = uAvg;
 				buff[cnt + channelMap[2]] = vAvg;
-				yPos++; 
+				yPos++;
 				cnt += channels;
 				if (j%2) sampledPos++;
 			}
@@ -2197,7 +2420,7 @@
 				buff[cnt + channelMap[1]] = uAvg;
 				buff[cnt + channelMap[2]] = vAvg;
 				buff[cnt + channelMap[3]] = aAvg;
-				yPos++; 
+				yPos++;
 				cnt += channels;
 				if (j%2) sampledPos++;
 			}
@@ -2229,9 +2452,8 @@
 void CPGFImage::ImportYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[] /*= NULL*/, CallbackPtr cb /*= NULL*/, void *data /*=NULL*/) THROW_ {
 	ASSERT(buff);
 	const double dP = 1.0/m_header.height;
-	const int bits = m_header.bpp/m_header.channels;
-	const int dataBits = sizeof(DataT)*8; ASSERT(dataBits == 16 || dataBits == 32);
-	const int pitch2 = pitch/sizeof(DataT);
+	const int dataBits = DataTSize*8; ASSERT(dataBits == 16 || dataBits == 32);
+	const int pitch2 = pitch/DataTSize;
 	const int yuvOffset = (dataBits == 16) ? YUVoffset8 : YUVoffset16;
 
 	int yPos = 0, cnt = 0;
@@ -2241,7 +2463,6 @@
 	if (channelMap == NULL) channelMap = defMap;
 
 	if (m_header.channels == 3)	{
-		ASSERT(m_header.bpp == m_header.channels*bits);
 		ASSERT(bpp%dataBits == 0);
 
 		DataT* y = m_channel[0]; ASSERT(y);
@@ -2264,9 +2485,8 @@
 				cnt += channels;
 			}
 			buff += pitch2;
-		}	
+		}
 	} else if (m_header.channels == 4) {
-		ASSERT(m_header.bpp == m_header.channels*bits);
 		ASSERT(bpp%dataBits == 0);
 
 		DataT* y = m_channel[0]; ASSERT(y);
@@ -2291,7 +2511,7 @@
 				cnt += channels;
 			}
 			buff += pitch2;
-		}	
+		}
 	}
 
 	if (m_downsample) {

Modified: branches/ScribusOIF/scribus/third_party/pgf/PGFimage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/PGFimage.h
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/PGFimage.h (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/PGFimage.h Wed Aug 10 22:39:40 2011
@@ -1,41 +1,56 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2007-02-03 13:04:21 +0100 (Sa, 03 Feb 2007) $
  * $Revision: 280 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file PGFimage.h
+/// @brief PGF image class
+/// @author C. Stamm
+
 #ifndef PGF_PGFIMAGE_H
 #define PGF_PGFIMAGE_H
 
-#include "PGFtypes.h"
-#include "Stream.h"
+#include "PGFstream.h"
 
 class CDecoder;
+class CEncoder;
 class CWaveletTransform;
 
 //////////////////////////////////////////////////////////////////////
-/// PGF image class.
+/// PGF image class is the main class. You always need a PGF object
+/// for encoding or decoding image data.
+/// Decoding:
+///		pgf.Open(...)
+///		pgf.Read(...)
+///		pgf.GetBitmap(...)
+/// Encoding:
+///		pgf.SetHeader(...)
+///		pgf.ImportBitmap(...)
+///		pgf.Write(...)
 /// @author C. Stamm, R. Spuler
+/// @brief PGF main class
 class CPGFImage {
 public:
-	
+
 	//////////////////////////////////////////////////////////////////////
 	/// Standard constructor: It is used to create a PGF instance for opening and reading.
 	CPGFImage();
@@ -45,11 +60,25 @@
 	virtual ~CPGFImage();
 
 	//////////////////////////////////////////////////////////////////////
+	/// Close PGF image after opening and reading.
+	/// Destructor calls this method during destruction.
+	virtual void Close();
+
+	//////////////////////////////////////////////////////////////////////
+	/// Destroy internal data structures.
+	/// Destructor calls this method during destruction.
+	virtual void Destroy();
+
+	//////////////////////////////////////////////////////////////////////
 	/// Open a PGF image at current stream position: read pre-header, header, and ckeck image type.
 	/// Precondition: The stream has been opened for reading.
 	/// It might throw an IOException.
 	/// @param stream A PGF stream
 	void Open(CPGFStream* stream) THROW_;
+
+	//////////////////////////////////////////////////////////////////////
+	/// Returns true if the PGF has been opened and not closed.
+	bool IsOpen() const	{ return m_decoder != NULL; }
 
 	//////////////////////////////////////////////////////////////////////
 	/// Read and decode some levels of a PGF image at current stream position.
@@ -60,7 +89,7 @@
 	/// The image at level 0 contains the original size.
 	/// Precondition: The PGF image has been opened with a call of Open(...).
 	/// It might throw an IOException.
-	/// @param level The image level of the resulting image in the internal image buffer.
+	/// @param level [0, nLevels) The image level of the resulting image in the internal image buffer.
 	/// @param cb A pointer to a callback procedure. The procedure is called after reading a single level. If cb returns true, then it stops proceeding.
 	/// @param data Data Pointer to C++ class container to host callback procedure.
 	void Read(int level = 0, CallbackPtr cb = NULL, void *data = NULL) THROW_;
@@ -72,7 +101,7 @@
 	/// All coordinates are measured in pixels.
 	/// It might throw an IOException.
 	/// @param rect [inout] Rectangular region of interest (ROI). The rect might be cropped.
-	/// @param level The image level of the resulting image in the internal image buffer.
+	/// @param level [0, nLevels) The image level of the resulting image in the internal image buffer.
 	/// @param cb A pointer to a callback procedure. The procedure is called after reading a single level. If cb returns true, then it stops proceeding.
 	/// @param data Data Pointer to C++ class container to host callback procedure.
 	void Read(PGFRect& rect, int level = 0, CallbackPtr cb = NULL, void *data = NULL) THROW_;
@@ -88,28 +117,19 @@
 	//////////////////////////////////////////////////////////////////////
 	/// After you've written a PGF image, you can call this method followed by GetBitmap/GetYUV
 	/// to get a quick reconstruction (coded -> decoded image).
-	void Reconstruct() THROW_;
-
-	//////////////////////////////////////////////////////////////////////
-	/// Close PGF image after opening and reading.
-	/// Destructor calls this method during destruction.
-	void Close();
-
-	//////////////////////////////////////////////////////////////////////
-	/// Destroy internal data structures.
-	/// Destructor calls this method during destruction.
-	void Destroy();
+	/// @param level The image level of the resulting image in the internal image buffer.
+	void Reconstruct(int level = 0);
 
 	//////////////////////////////////////////////////////////////////////
 	/// Get image data in interleaved format: (ordering of RGB data is BGR[A])
-	/// Upsampling, YUV to RGB transform and interleaving are done here to reduce the number 
+	/// Upsampling, YUV to RGB transform and interleaving are done here to reduce the number
 	/// of passes over the data.
 	/// The absolute value of pitch is the number of bytes of an image row of the given image buffer.
 	/// If pitch is negative, then the image buffer must point to the last row of a bottom-up image (first byte on last row).
 	/// if pitch is positive, then the image buffer must point to the first row of a top-down image (first byte).
 	/// The sequence of output channels in the output image buffer does not need to be the same as provided by PGF. In case of different sequences you have to
 	/// provide a channelMap of size of expected channels (depending on image mode). For example, PGF provides a channel sequence BGR in RGB color mode.
-	/// If your provided image buffer expects a channel sequence ARGB, then the channelMap looks like { 3, 2, 1 }.
+	/// If your provided image buffer expects a channel sequence ARGB, then the channelMap looks like { 3, 2, 1, 0 }.
 	/// It might throw an IOException.
 	/// @param pitch The number of bytes of a row of the image buffer.
 	/// @param buff An image buffer.
@@ -144,7 +164,7 @@
 	/// If pitch is positive, then buff points to the first row of a top-down image (first byte).
 	/// The sequence of input channels in the input image buffer does not need to be the same as expected from PGF. In case of different sequences you have to
 	/// provide a channelMap of size of expected channels (depending on image mode). For example, PGF expects in RGB color mode a channel sequence BGR.
-	/// If your provided image buffer contains a channel sequence ARGB, then the channelMap looks like { 3, 2, 1 }.
+	/// If your provided image buffer contains a channel sequence ARGB, then the channelMap looks like { 3, 2, 1, 0 }.
 	/// It might throw an IOException.
 	/// @param pitch The number of bytes of a row of the image buffer.
 	/// @param buff An image buffer.
@@ -179,13 +199,53 @@
 	/// The image size at level i is double the size (width, height) of the image at level i+1.
 	/// The image at level 0 contains the original size.
 	/// Precondition: the PGF image contains a valid header (see also SetHeader(...)).
+	/// Please note: the earlier parameter nLevels has now to be set with SetHeader. Either specify the number of levels
+	/// or use the value 0 for automatic setting.
 	/// It might throw an IOException.
 	/// @param stream A PGF stream
-	/// @param levels The positive number of levels used in layering or 0 meaning a useful number of levels is computed.
-	/// @param cb A pointer to a callback procedure. The procedure is called after reading a single level. If cb returns true, then it stops proceeding.
 	/// @param nWrittenBytes [in-out] The number of bytes written into stream are added to the input value.
-	/// @param data Data Pointer to C++ class container to host callback procedure.
-	void Write(CPGFStream* stream, int levels = 0, CallbackPtr cb = NULL, UINT32* nWrittenBytes = NULL, void *data = NULL) THROW_;
+	/// @param cb A pointer to a callback procedure. The procedure is called after writing a single level. If cb returns true, then it stops proceeding.
+	/// @param data Data Pointer to C++ class container to host callback procedure.
+	void Write(CPGFStream* stream, UINT32* nWrittenBytes = NULL, CallbackPtr cb = NULL, void *data = NULL) THROW_;
+
+	//////////////////////////////////////////////////////////////////
+	/// Create wavelet transform channels and encoder.
+	/// Call this method before your first call of Write(int level), but after SetHeader().
+	/// Don't use this method when you call Write().
+	/// It might throw an IOException.
+	/// @param stream A PGF stream
+	/// @return The number of bytes written into stream.
+	UINT32 WriteHeader(CPGFStream* stream) THROW_;
+
+#ifdef __PGFROISUPPORT__
+	//////////////////////////////////////////////////////////////////
+	/// Encode and write down to given level at current stream position.
+	/// A PGF image is structered in levels, numbered between 0 and Levels() - 1.
+	/// Each level can be seen as a single image, containing the same content
+	/// as all other levels, but in a different size (width, height).
+	/// The image size at level i is double the size (width, height) of the image at level i+1.
+	/// The image at level 0 contains the original size.
+	/// Precondition: the PGF image contains a valid header (see also SetHeader(...)) and
+	/// WriteHeader() has been called before Write().
+	/// The ROI encoding scheme is used.
+	/// It might throw an IOException.
+	/// @param level [0, nLevels) The image level of the resulting image in the internal image buffer.
+	/// @param cb A pointer to a callback procedure. The procedure is called after writing a single level. If cb returns true, then it stops proceeding.
+	/// @param data Data Pointer to C++ class container to host callback procedure.
+	/// @return The number of bytes written into stream.
+	UINT32 Write(int level, CallbackPtr cb = NULL, void *data = NULL) THROW_;
+#endif
+
+	/////////////////////////////////////////////////////////////////////
+	/// Configures the encoder.
+	/// @param useOMP Use parallel threading with Open MP during encoding. Default value: true. Influences the encoding only if the codec has been compiled with OpenMP support.
+	/// @param favorSpeedOverSize Favors encoding speed over compression ratio. Default value: false
+	void ConfigureEncoder(bool useOMP = true, bool favorSpeedOverSize = false) { m_useOMPinEncoder = useOMP; m_favorSpeedOverSize = favorSpeedOverSize; }
+
+	/////////////////////////////////////////////////////////////////////
+	/// Configures the encoder.
+	/// @param useOMP Use parallel threading with Open MP during decoding. Default value: true. Influences the decoding only if the codec has been compiled with OpenMP support.
+	void ConfigureDecoder(bool useOMP = true) { m_useOMPinDecoder = useOMP; }
 
 	//////////////////////////////////////////////////////////////////////
 	/// Set background of an RGB image with transparency channel or reset to default background.
@@ -285,17 +345,19 @@
 
 	//////////////////////////////////////////////////////////////////////
 	/// Return the length of all encoded headers in bytes.
+	/// Precondition: The PGF image has been opened with a call of Open(...).
 	/// @return The length of all encoded headers in bytes
 	UINT32 GetEncodedHeaderLength() const;
 
 	//////////////////////////////////////////////////////////////////////
 	/// Return the length of an encoded PGF level in bytes.
+	/// Precondition: The PGF image has been opened with a call of Open(...).
 	/// @param level The image level
 	/// @return The length of a PGF level in bytes
 	UINT32 GetEncodedLevelLength(int level) const					{ ASSERT(level >= 0 && level < m_header.nLevels); return m_levelLength[m_header.nLevels - level - 1]; }
 
 	////////////////////////////////////////////////////////////////////
-	/// Reset stream position to beginning of PGF pre header
+	/// Reset stream position to start of PGF pre-header
 	void ResetStreamPos() THROW_;
 
 	//////////////////////////////////////////////////////////////////////
@@ -308,7 +370,7 @@
 	UINT32 ReadEncodedHeader(UINT8* target, UINT32 targetLen) const THROW_;
 
 	//////////////////////////////////////////////////////////////////////
-	/// Reads the data of an encoded PGF level and copies it to a target buffer 
+	/// Reads the data of an encoded PGF level and copies it to a target buffer
 	/// without decoding.
 	/// Precondition: The PGF image has been opened with a call of Open(...).
 	/// It might throw an IOException.
@@ -335,7 +397,7 @@
 	//////////////////////////////////////////////////////////////////////
 	/// Return bits per channel.
 	/// @return Bits per channel
-	BYTE ChannelDepth() const										{ return sizeof(DataT)*8; }
+	BYTE ChannelDepth() const										{ return DataTSize*8; }
 
 	//////////////////////////////////////////////////////////////////////
 	/// Return image width of channel 0 at given level in pixels.
@@ -352,14 +414,14 @@
 	UINT32 Height(int level = 0) const								{ ASSERT(level >= 0); return LevelHeight(m_header.height, level); }
 
 	//////////////////////////////////////////////////////////////////////
-	/// Return current image level. 
+	/// Return current image level.
 	/// Since Read(...) can be used to read each image level separately, it is
 	/// helpful to know the current level. The current level immediately after Open(...) is Levels().
 	/// @return Current image level
-	BYTE Level() const												{ return m_currentLevel; }
-
-	//////////////////////////////////////////////////////////////////////
-	/// Return the number of image levels. 
+	BYTE Level() const												{ return (BYTE)m_currentLevel; }
+
+	//////////////////////////////////////////////////////////////////////
+	/// Return the number of image levels.
 	/// @return Number of image levels
 	BYTE Levels() const												{ return m_header.nLevels; }
 
@@ -374,7 +436,7 @@
 	/// An image of type RGB contains 3 image channels (B, G, R).
 	/// @return Number of image channels
 	BYTE Channels() const											{ return m_header.channels; }
-	
+
 	//////////////////////////////////////////////////////////////////////
 	/// Return the image mode.
 	/// An image mode is a predefined constant value (see also PGFtypes.h) compatible with Adobe Photoshop.
@@ -391,7 +453,7 @@
 	//////////////////////////////////////////////////////////////////////
 	/// Return true if the pgf image supports Region Of Interest (ROI).
 	/// @return true if the pgf image supports ROI.
-	bool ROIisSupported() const										{ return (m_preHeader.version & PGFROI) != 0; }
+	bool ROIisSupported() const										{ return (m_preHeader.version & PGFROI) == PGFROI; }
 
 	//////////////////////////////////////////////////////////////////////
 	/// Returns highest supported version
@@ -419,44 +481,38 @@
 	/// @return Image level height in pixels
 	static UINT32 LevelHeight(UINT32 height, int level)				{ ASSERT(level >= 0); UINT32 h = (height >> level); return ((h << level) == height) ? h : h + 1; }
 
-	//////////////////////////////////////////////////////////////////////
-	/// Compute and return number of levels. During PGF::Write the return
-	/// value of this method is used in case the parameter levels is not a
-	/// positive value. 
-	/// A PGF image is structered in levels, numbered between 0 and Levels() - 1.
-	/// Each level can be seen as a single image, containing the same content
-	/// as all other levels, but in a different size (width, height).
-	/// The image size at level i is double the size (width, height) of the image at level i+1.
-	/// The image at level 0 contains the original size.
-	/// @param width Original image width
-	/// @param height Original image height
-	/// @return Number of PGF levels
-	static BYTE ComputeLevels(UINT32 width, UINT32 height);
-
 protected:
 	CWaveletTransform* m_wtChannel[MaxChannels];	// wavelet transformed color channels
 	DataT* m_channel[MaxChannels];					// untransformed channels in YUV format
-	CDecoder* m_decoder;
+	CDecoder* m_decoder;			// PGF decoder
+	CEncoder* m_encoder;			// PGF encoder
 	UINT32* m_levelLength;			// length of each level in bytes; first level starts immediately after this array
 	UINT32 m_width[MaxChannels];	// width of each channel at current level
 	UINT32 m_height[MaxChannels];	// height of each channel at current level
 	PGFPreHeader m_preHeader;		// PGF pre header
 	PGFHeader m_header;				// PGF file header
 	PGFPostHeader m_postHeader;		// PGF post header
-	BYTE m_currentLevel;			// transform level of current image
+	int m_currentLevel;				// transform level of current image
 	BYTE m_quant;					// quantization parameter
 	bool m_downsample;				// chrominance channels are downsampled
+	bool m_favorSpeedOverSize;		// favor encoding speed over compression ratio
+	bool m_useOMPinEncoder;			// use Open MP in encoder
+	bool m_useOMPinDecoder;			// use Open MP in decoder
 #ifdef __PGFROISUPPORT__
+	bool m_levelwise;				// write level-wise (only used with WriteNextLevel)
+	bool m_streamReinitialized;		// stream has been reinitialized
 	PGFRect m_roi;					// region of interest
 #endif
 
-private:	
+private:
 	RefreshCB m_cb;					// pointer to refresh callback procedure
 	void *m_cbArg;					// refresh callback argument
 
+	void ComputeLevels();
+	void CompleteHeader();
 	void RgbToYuv(int pitch, UINT8* rgbBuff, BYTE bpp, int channelMap[], CallbackPtr cb, void *data) THROW_;
 	void Downsample(int nChannel);
-	void Init() THROW_;
+	void WriteLevel() THROW_;
 
 #ifdef __PGFROISUPPORT__
 	void SetROI(PGFRect rect);
@@ -468,16 +524,16 @@
 	}
 	UINT8 Clamp4(DataT v) const {
 		if (v & 0xFFFFFFF0) return (v < 0) ? (UINT8)0: (UINT8)15; else return (UINT8)v;
-	}	
+	}
 	UINT16 Clamp6(DataT v) const {
 		if (v & 0xFFFFFFC0) return (v < 0) ? (UINT16)0: (UINT16)63; else return (UINT16)v;
-	}	
+	}
 	UINT16 Clamp16(DataT v) const {
 		if (v & 0xFFFF0000) return (v < 0) ? (UINT16)0: (UINT16)65535; else return (UINT16)v;
-	}	
+	}
 	UINT32 Clamp31(DataT v) const {
 		if (v < 0) return 0; else return (UINT32)v;
-	}	
+	}
 };
 
 #endif //PGF_PGFIMAGE_H

Modified: branches/ScribusOIF/scribus/third_party/pgf/PGFplatform.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/PGFplatform.h
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/PGFplatform.h (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/PGFplatform.h Wed Aug 10 22:39:40 2011
@@ -1,52 +1,56 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2007-06-12 19:27:47 +0200 (Di, 12 Jun 2007) $
  * $Revision: 307 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file PGFplatform.h
+/// @brief PGF platform specific definitions
+/// @author C. Stamm
+
 #ifndef PGF_PGFPLATFORM_H
 #define PGF_PGFPLATFORM_H
 
 #include <cassert>
-#include <cmath> 
-#include <cstdlib> 
-
-//-------------------------------------------------------------------------------
-// Taken from lcms2 header.
-// Try to detect big endian platforms. This list can be endless, so only some checks are performed over here.
-//-------------------------------------------------------------------------------
-
+#include <cmath>
+#include <cstdlib>
+
+//-------------------------------------------------------------------------------
+// Endianess detection taken from lcms2 header.
+// This list can be endless, so only some checks are performed over here.
+//-------------------------------------------------------------------------------
 #if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
-# define PGF_USE_BIG_ENDIAN 1
-#endif
-
-#if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(__sparc__)
-# define PGF_USE_BIG_ENDIAN 1
+#define PGF_USE_BIG_ENDIAN 1
+#endif
+
+#if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(__sparc) || defined(__sparc__)
+#define PGF_USE_BIG_ENDIAN 1
 #endif
 
 #if defined(__ppc__) || defined(__s390__) || defined(__s390x__)
-# define PGF_USE_BIG_ENDIAN 1
+#define PGF_USE_BIG_ENDIAN 1
 #endif
 
 #ifdef TARGET_CPU_PPC
-# define PGF_USE_BIG_ENDIAN 1
+#define PGF_USE_BIG_ENDIAN 1
 #endif
 
 //-------------------------------------------------------------------------------
@@ -68,15 +72,16 @@
 //-------------------------------------------------------------------------------
 #define WordWidth			32					// WordBytes*8
 #define WordWidthLog		5					// ld of WordWidth
+#define WordMask			0xFFFFFFE0			// least WordWidthLog bits are zero
 #define WordBytes			4					// sizeof(UINT32)
 #define WordBytesLog		2					// ld of WordBytes
 
 //-------------------------------------------------------------------------------
 // Macros
 //-------------------------------------------------------------------------------
-#define DWWIDTH(bytes)		((((bytes) + WordBytes - 1) >> WordBytesLog) << WordBytesLog)	// aligns scanline width in bytes to DWORD value
-#define DWWIDTHBITS(bits)	((((bits) + WordWidth - 1) >> WordWidthLog) << WordBytesLog)	// aligns scanline width in bits to DWORD value
-#define DWWIDTHREST(bytes)	((WordBytes - (bytes)%WordBytes)%WordBytes)						// DWWIDTHBITS(bytes*8) - bytes
+//#define DWWIDTH(bytes)		((((bytes) + WordBytes - 1) >> WordBytesLog) << WordBytesLog)	// aligns scanline width in bytes to DWORD value
+//#define DWWIDTHBITS(bits)	((((bits) + WordWidth - 1) >> WordWidthLog) << WordBytesLog)	// aligns scanline width in bits to DWORD value
+//#define DWWIDTHREST(bytes)	((WordBytes - (bytes)%WordBytes)%WordBytes)						// DWWIDTHBITS(bytes*8) - bytes
 
 //-------------------------------------------------------------------------------
 // Min-Max macros
@@ -137,10 +142,10 @@
 #include <windows.h>
 #include <ole2.h>
 
-#endif // _MFC_VER 
-//-------------------------------------------------------------------------------
-
-#define DllExport   __declspec( dllexport ) 
+#endif // _MFC_VER
+//-------------------------------------------------------------------------------
+
+#define DllExport   __declspec( dllexport )
 
 //-------------------------------------------------------------------------------
 // unsigned number type definitions
@@ -152,8 +157,8 @@
 typedef	unsigned int		UINT32;
 typedef unsigned long       DWORD;
 typedef unsigned long       ULONG;
-typedef unsigned __int64	UINT64; 
-typedef unsigned __int64	ULONGLONG; 
+typedef unsigned __int64	UINT64;
+typedef unsigned __int64	ULONGLONG;
 
 //-------------------------------------------------------------------------------
 // signed number type definitions
@@ -183,9 +188,9 @@
 	#ifdef _DEBUG
 		#define ASSERT(x)	assert(x)
 	#else
-		#if defined(__GNUC__) 
-			#define ASSERT(ignore)((void) 0) 
-		#elif _MSC_VER >= 1300 
+		#if defined(__GNUC__)
+			#define ASSERT(ignore)((void) 0)
+		#elif _MSC_VER >= 1300
 			#define ASSERT		__noop
 		#else
 			#define ASSERT ((void)0)
@@ -232,12 +237,13 @@
 #define InsufficientMemory	0x20000001			// memory allocation wasn't successfull
 #define EndOfMemory			0x20000002			// like end-of-file (EOF) for memory stream
 #define EscapePressed		0x20000003			// user break by ESC
-#define WrongVersion		0x20000004			// wrong pgf version 
+#define WrongVersion		0x20000004			// wrong pgf version
 #define FormatCannotRead	0x20000005			// wrong data file format
 #define ImageTooSmall		0x20000006			// image is too small
 #define ZlibError			0x20000007			// error in zlib functions
 #define ColorTableError		0x20000008			// errors related to color table size
 #define PNGError			0x20000009			// errors in png functions
+#define MissingData			0x2000000A			// expected data cannot be read
 
 //-------------------------------------------------------------------------------
 // methods
@@ -312,35 +318,43 @@
 // Apple OSX
 //-------------------------------------------------------------------------------
 #ifdef __APPLE__
-#define __POSIX__ 
+#define __POSIX__
 #endif // __APPLE__
 
 
 //-------------------------------------------------------------------------------
-// LINUX / GLIBC
+// LINUX
 //-------------------------------------------------------------------------------
 #if defined(__linux__) || defined(__GLIBC__)
 #define __POSIX__
-#endif /* __linux__ */
+#endif // __linux__ or __GLIBC__
+
+
+//-------------------------------------------------------------------------------
+// SOLARIS
+//-------------------------------------------------------------------------------
+#ifdef __sun
+#define __POSIX__
+#endif // __sun
 
 
 //-------------------------------------------------------------------------------
 // NetBSD
 //-------------------------------------------------------------------------------
 #ifdef __NetBSD__
-#ifndef __POSIX__ 
-#define __POSIX__ 
-#endif 
-
-#ifndef off64_t 
-#define off64_t off_t 
-#endif 
-
-#ifndef lseek64 
-#define lseek64 lseek 
-#endif 
-
-#endif /* __NetBSD__ */
+#ifndef __POSIX__
+#define __POSIX__
+#endif
+
+#ifndef off64_t
+#define off64_t off_t
+#endif
+
+#ifndef lseek64
+#define lseek64 lseek
+#endif
+
+#endif // __NetBSD__
 
 
 //-------------------------------------------------------------------------------
@@ -383,7 +397,7 @@
 // other types
 //-------------------------------------------------------------------------------
 typedef int					OSError;
-typedef int					HANDLE;	
+typedef int					HANDLE;
 typedef unsigned long		ULONG_PTR;
 typedef void*				PVOID;
 typedef char*				LPTSTR;
@@ -430,8 +444,8 @@
 //-------------------------------------------------------------------------------
 // methods
 //-------------------------------------------------------------------------------
-/* The MulDiv function multiplies two 32-bit values and then divides the 64-bit 
- * result by a third 32-bit value. The return value is rounded up or down to 
+/* The MulDiv function multiplies two 32-bit values and then divides the 64-bit
+ * result by a third 32-bit value. The return value is rounded up or down to
  * the nearest integer.
  * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/muldiv.asp
  * */
@@ -451,7 +465,7 @@
 	#ifdef _DEBUG
 		#define ASSERT(x)	assert(x)
 	#else
-		#define ASSERT(x)	
+		#define ASSERT(x)
 	#endif //_DEBUG
 #endif //ASSERT
 
@@ -487,12 +501,13 @@
 #define InsufficientMemory		0x2001			// memory allocation wasn't successfull
 #define EndOfMemory				0x2002			// like end-of-file (EOF) for memory stream
 #define EscapePressed			0x2003			// user break by ESC
-#define WrongVersion			0x2004			// wrong pgf version 
+#define WrongVersion			0x2004			// wrong pgf version
 #define FormatCannotRead		0x2005			// wrong data file format
 #define ImageTooSmall			0x2006			// image is too small
 #define ZlibError				0x2007			// error in zlib functions
 #define ColorTableError			0x2008			// errors related to color table size
 #define PNGError				0x2009			// errors in png functions
+#define MissingData				0x200A			// expected data cannot be read
 
 //-------------------------------------------------------------------------------
 // methods
@@ -558,7 +573,7 @@
 //-------------------------------------------------------------------------------
 //	Big Endian
 //-------------------------------------------------------------------------------
-#ifdef PGF_USE_BIG_ENDIAN 
+#ifdef PGF_USE_BIG_ENDIAN
 
 #ifndef _lrotl
 	#define _lrotl(x,n)	(((x) << ((UINT32)(n))) | ((x) >> (32 - (UINT32)(n))))
@@ -568,30 +583,61 @@
 	return ((wX & 0xFF00) >> 8) | ((wX & 0x00FF) << 8);
 }
 
-__inline UINT32 ByteSwap(UINT32 dwX) { 
-#ifdef _X86_     
-	_asm mov eax, dwX     
+__inline UINT32 ByteSwap(UINT32 dwX) {
+#ifdef _X86_
+	_asm mov eax, dwX
 	_asm bswap eax
-	_asm mov dwX, eax      
-	return dwX; 
-#else     
-	return _lrotl(((dwX & 0xFF00FF00) >> 8) | ((dwX & 0x00FF00FF) << 8), 16); 
-#endif 
+	_asm mov dwX, eax
+	return dwX;
+#else
+	return _lrotl(((dwX & 0xFF00FF00) >> 8) | ((dwX & 0x00FF00FF) << 8), 16);
+#endif
 }
 
 #if defined WIN32
-__inline UINT64 ByteSwap(UINT64 ui64) { 
+__inline UINT64 ByteSwap(UINT64 ui64) {
 	return _byteswap_uint64(ui64);
 }
 #endif
 
 #define __VAL(x) ByteSwap(x)
 
-#else //PGF_USE_BIG_ENDIAN 
+#else //PGF_USE_BIG_ENDIAN
 
 	#define __VAL(x) (x)
 
-#endif //PGF_USE_BIG_ENDIAN 
- 
+#endif //PGF_USE_BIG_ENDIAN
+
+// NOTE: Use LIBPGF_DISABLE_OPENMP to disable OpenMP support in whole libpgf
+#ifndef LIBPGF_DISABLE_OPENMP
+
+// OpenMP rules (inspired from libraw project)
+#if defined (_OPENMP)
+
+#if defined(WIN32)
+# if defined (_MSC_VER) && (_MSC_VER >= 1500)
+// VS2008 SP1 and VS2010+ : OpenMP works OK
+#   define LIBPGF_USE_OPENMP
+#elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER >=910)
+//  Have not tested on 9.x and 10.x, but Intel documentation claims OpenMP 2.5 support in 9.1
+#   define LIBPGF_USE_OPENMP
+#else
+#  undef LIBPGF_USE_OPENMP
+#endif
+// Not Win32
+# elif (defined(__APPLE__) || defined(__MACOSX__)) && defined(_REENTRANT)
+#   undef LIBPGF_USE_OPENMP
+# else
+#   define LIBPGF_USE_OPENMP
+# endif
+
+#endif // defined (_OPENMP)
+
+#endif // ifndef LIBPGF_DISABLE_OPENMP
+
+#ifdef LIBPGF_USE_OPENMP
+#include <omp.h>
+#endif
+
 
 #endif //PGF_PGFPLATFORM_H

Modified: branches/ScribusOIF/scribus/third_party/pgf/PGFtypes.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/PGFtypes.h
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/PGFtypes.h (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/PGFtypes.h Wed Aug 10 22:39:40 2011
@@ -1,25 +1,30 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2007-06-11 10:56:17 +0200 (Mo, 11 Jun 2007) $
  * $Revision: 299 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
+
+//////////////////////////////////////////////////////////////////////
+/// @file PGFtypes.h
+/// @brief PGF definitions
+/// @author C. Stamm
 
 #ifndef PGF_PGFTYPES_H
 #define PGF_PGFTYPES_H
@@ -40,8 +45,10 @@
 // Version 6:	modified data structure PGFPreHeader: hSize (header size) is now a UINT32 instead of a UINT16 (backward compatibility assured)
 //
 //-------------------------------------------------------------------------------
-#define PGFCodecVersion		"6.09.44"			// Major number
+#define PGFCodecVersion		"6.11.24"			// Major number
 												// Minor number: Year (2) Week (2)
+
+#define PGFCodecVersionID   0x061124            // Codec version ID to use for API check in client implementation
 
 //-------------------------------------------------------------------------------
 //	Image constants
@@ -56,27 +63,27 @@
 // version flags
 #define Version2			2					// data structure PGFHeader of major version 2
 #ifdef __PGF32SUPPORT__
-#define PGF32				4					// 32 bit values are used -> allows at maximum 31 bits
-#else
-#define PGF32				0					// 16 bit values are used -> allows at maximum 15 bits
+	#define PGF32			4					// 32 bit values are used -> allows at maximum 31 bits
+#else
+	#define PGF32			0					// 16 bit values are used -> allows at maximum 15 bits
 #endif
 #define PGFROI				8					// supports Regions Of Interest
 #define Version5			16					// new coding scheme since major version 5
-#define Version6			32					// new HeaderSize: 32 bits instead of 16 bits 
+#define Version6			32					// new HeaderSize: 32 bits instead of 16 bits
 // version numbers
 #define PGFVersion			(Version2 | Version5 | Version6 | PGF32)	// current standard version
 
 //-------------------------------------------------------------------------------
 //	Coder constants
 //-------------------------------------------------------------------------------
-#define BufferSize			16384				// must be a multiple of WordWidth: RLblockSizeLen = 15
+#define BufferSize			16384				// must be a multiple of WordWidth
 #define RLblockSizeLen		15					// block size length (< 16): ld(BufferSize) < RLblockSizeLen <= 2*ld(BufferSize)
 #define LinBlockSize		8					// side length of a coefficient block in a HH or LL subband
 #define InterBlockSize		4					// side length of a coefficient block in a HL or LH subband
 #ifdef __PGF32SUPPORT__
-#define MaxBitPlanes		31					// maximum number of bit planes of m_value: 32 minus sign bit
-#else
-#define MaxBitPlanes		15					// maximum number of bit planes of m_value: 16 minus sign bit
+	#define MaxBitPlanes	31					// maximum number of bit planes of m_value: 32 minus sign bit
+#else
+	#define MaxBitPlanes	15					// maximum number of bit planes of m_value: 16 minus sign bit
 #endif
 #define MaxBitPlanesLog		5					// number of bits to code the maximum number of bit planes (in 32 or 16 bit mode)
 #define MaxQuality			MaxBitPlanes		// maximum quality
@@ -95,6 +102,7 @@
 /////////////////////////////////////////////////////////////////////
 /// PGF magic and version (part of PGF pre-header)
 /// @author C. Stamm
+/// @brief PGF identification and version
 struct PGFMagicVersion {
 	char magic[3];				// PGF identification = "PGF"
 	UINT8 version;				// PGF version
@@ -102,16 +110,18 @@
 };
 
 /////////////////////////////////////////////////////////////////////
-/// PGF pre-header
-/// @author C. Stamm
+/// PGF pre-header defined header length and PGF identification and version
+/// @author C. Stamm
+/// @brief PGF pre-header
 struct PGFPreHeader : PGFMagicVersion {
 	UINT32 hSize;				// total size of PGFHeader, [ColorTable], and [UserData] in bytes
 	// total: 8 Bytes
 };
 
 /////////////////////////////////////////////////////////////////////
-/// PGF header
-/// @author C. Stamm
+/// PGF header contains image information
+/// @author C. Stamm
+/// @brief PGF header
 struct PGFHeader {
 	UINT32 width;
 	UINT32 height;
@@ -125,8 +135,9 @@
 };
 
 /////////////////////////////////////////////////////////////////////
-/// PGF post-header is optional
-/// @author C. Stamm
+/// PGF post-header is optional. It contains color table and user data
+/// @author C. Stamm
+/// @brief Optional PGF post-header
 struct PGFPostHeader {
 	RGBQUAD clut[ColorTableLen];// color table for indexed color images
 	UINT8 *userData;			// user data of size userDataLen
@@ -134,8 +145,9 @@
 };
 
 /////////////////////////////////////////////////////////////////////
-/// ROI block header (used in ROI coding scheme)
-/// @author C. Stamm
+/// ROI block header is used with ROI coding scheme. It contains block size and tile end flag
+/// @author C. Stamm
+/// @brief Block header used with ROI coding scheme
 union ROIBlockHeader {
 	/// Constructor
 	/// @param v Buffer size
@@ -143,10 +155,11 @@
 	/// Constructor
 	/// @param size Buffer size
 	/// @param end 0/1 Flag; 1: last part of a tile
-	ROIBlockHeader(UINT32 size, bool end)	{ ASSERT(size < (1 << RLblockSizeLen)); bufferSize = size; tileEnd = end; }
+	ROIBlockHeader(UINT32 size, bool end)	{ ASSERT(size < (1 << RLblockSizeLen)); rbh.bufferSize = size; rbh.tileEnd = end; }
 
 	UINT16 val;
-	struct {
+	/// @brief Named ROI block header (part of the union)
+	struct RBH {
 #ifdef PGF_USE_BIG_ENDIAN
 		UINT16 tileEnd   :				1;	// 1: last part of a tile
 		UINT16 bufferSize: RLblockSizeLen;	// number of uncoded UINT32 values in a block
@@ -154,15 +167,16 @@
 		UINT16 bufferSize: RLblockSizeLen;	// number of uncoded UINT32 values in a block
 		UINT16 tileEnd   :				1;	// 1: last part of a tile
 #endif // PGF_USE_BIG_ENDIAN
-	};
+	} rbh;
 	// total: 2 Bytes
 };
 
 #pragma pack()
 
 /////////////////////////////////////////////////////////////////////
-/// PGF i/o exception structure
-/// @author C. Stamm
+/// PGF I/O exception
+/// @author C. Stamm
+/// @brief PGF exception
 struct IOException {
 	/// Standard constructor
 	IOException() : error(NoError) {}
@@ -176,6 +190,7 @@
 /////////////////////////////////////////////////////////////////////
 /// Rectangle
 /// @author C. Stamm
+/// @brief Rectangle
 struct PGFRect {
 	/// Standard constructor
 	PGFRect() : left(0), top(0), right(0), bottom(0) {}
@@ -190,7 +205,7 @@
 	UINT32 Width() const					{ return right - left; }
 	/// @return Rectangle height
 	UINT32 Height() const					{ return bottom - top; }
-	
+
 	/// Test if point (x,y) is inside this rectangle
 	/// @param x Point coordinate x
 	/// @param y Point coordinate y
@@ -215,5 +230,6 @@
 #define PreHeaderSize		sizeof(PGFPreHeader)
 #define HeaderSize			sizeof(PGFHeader)
 #define ColorTableSize		ColorTableLen*sizeof(RGBQUAD)
+#define DataTSize			sizeof(DataT)
 
 #endif //PGF_PGFTYPES_H

Modified: branches/ScribusOIF/scribus/third_party/pgf/Subband.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/Subband.cpp
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/Subband.cpp (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/Subband.cpp Wed Aug 10 22:39:40 2011
@@ -1,26 +1,31 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2006-06-04 22:05:59 +0200 (So, 04 Jun 2006) $
  * $Revision: 229 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file Subband.cpp
+/// @brief PGF wavelet subband class implementation
+/// @author C. Stamm
+
 #include "Subband.h"
 #include "Encoder.h"
 #include "Decoder.h"
@@ -29,7 +34,7 @@
 // Default constructor
 CSubband::CSubband() : m_size(0), m_data(0)
 #ifdef __PGFROISUPPORT__
-, m_ROIs(0), m_dataWidth(0) 
+, m_ROIs(0), m_dataWidth(0)
 #endif
 {
 }
@@ -43,8 +48,6 @@
 /////////////////////////////////////////////////////////////////////
 // Initialize subband parameters
 void CSubband::Initialize(UINT32 width, UINT32 height, int level, Orientation orient) {
-	ASSERT(!m_data);
-
 	m_width = width;
 	m_height = height;
 	m_size = m_width*m_height;
@@ -53,6 +56,7 @@
 	m_data = 0;
 	m_dataPos = 0;
 #ifdef __PGFROISUPPORT__
+	m_ROIs = 0;
 	m_dataWidth = width;
 #endif
 }
@@ -144,8 +148,7 @@
 /// A scalar quantization (with dead-zone) is used. A large quantization value
 /// results in strong quantization and therefore in big quality loss.
 /// @param quantParam A quantization parameter (larger or equal to 0)
-/// @param level Level
-void CSubband::Dequantize(int quantParam, int /*level*/) {
+void CSubband::Dequantize(int quantParam) {
 	if (m_orientation == LL) {
 		quantParam -= m_level + 1;
 	} else if (m_orientation == HH) {
@@ -181,7 +184,7 @@
 
 		// write values into buffer using partitiong scheme
 		encoder.Partition(this, w, h, xPos + yPos*m_width, m_width);
-	} else 
+	} else
 #endif
 	{
 		// write values into buffer using partitiong scheme
@@ -220,7 +223,7 @@
 
 		// read values into buffer using partitiong scheme
 		decoder.Partition(this, quantParam, w, h, (xPos - roi.left) + (yPos - roi.top)*m_dataWidth, m_dataWidth);
-	} else 
+	} else
 #endif
 	{
 		// read values into buffer using partitiong scheme
@@ -244,7 +247,7 @@
 	// band = HH, w = 30, ldTiles = 2 -> 4 tiles in a row/column
 	// --> tile widths
 	// 8 7 8 7
-	// 
+	//
 	// tile partitioning scheme
 	// 0 1 2 3
 	// 4 5 6 7

Modified: branches/ScribusOIF/scribus/third_party/pgf/Subband.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/Subband.h
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/Subband.h (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/Subband.h Wed Aug 10 22:39:40 2011
@@ -1,26 +1,31 @@
 /*
- * The Progressive Graphics File; http://www.libpgf.org 
- * 
+ * The Progressive Graphics File; http://www.libpgf.org
+ *
  * $Date: 2006-06-04 22:05:59 +0200 (So, 04 Jun 2006) $
  * $Revision: 229 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+//////////////////////////////////////////////////////////////////////
+/// @file Subband.h
+/// @brief PGF wavelet subband class
+/// @author C. Stamm
+
 #ifndef PGF_SUBBAND_H
 #define PGF_SUBBAND_H
 
@@ -33,6 +38,7 @@
 //////////////////////////////////////////////////////////////////////
 /// PGF wavelet channel subband class.
 /// @author C. Stamm, R. Spuler
+/// @brief Wavelet channel class
 class CSubband {
 	friend class CWaveletTransform;
 
@@ -87,8 +93,7 @@
 	/// A scalar quantization (with dead-zone) is used. A large quantization value
 	/// results in strong quantization and therefore in big quality loss.
 	/// @param quantParam A quantization parameter (larger or equal to 0)
-	/// @level Level
-	void Dequantize(int quantParam, int level);
+	void Dequantize(int quantParam);
 
 	//////////////////////////////////////////////////////////////////////
 	/// Store wavelet coefficient in subband at given position.
@@ -121,7 +126,7 @@
 	/// Return width of this subband.
 	/// @return Width of this subband (in pixels)
 	int GetWidth() const				{ return m_width; }
-	
+
 	//////////////////////////////////////////////////////////////////////
 	/// Return orientation of this subband.
 	/// LL LH

Modified: branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.cpp
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.cpp (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.cpp Wed Aug 10 22:39:40 2011
@@ -1,25 +1,30 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2006-05-18 16:03:32 +0200 (Do, 18 Mai 2006) $
  * $Revision: 194 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
+
+//////////////////////////////////////////////////////////////////////
+/// @file WaveletTransform.cpp
+/// @brief PGF wavelet transform class implementation
+/// @author C. Stamm
 
 #include "WaveletTransform.h"
 
@@ -32,9 +37,9 @@
 // @param height The height of the original image (at level 0) in pixels
 // @param levels The number of levels (>= 0)
 // @param data Input data of subband LL at level 0
-CWaveletTransform::CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT* data) : 
+CWaveletTransform::CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT* data) :
 #ifdef __PGFROISUPPORT__
-m_ROIs(levels + 1), 
+m_ROIs(levels + 1),
 #endif
 m_nLevels(levels + 1), m_subband(0) {
 	ASSERT(m_nLevels > 0 && m_nLevels <= MaxLevel + 1);
@@ -167,7 +172,7 @@
 		// left border handling
 		src[1] -= ((src[0] + src[2] + c1) >> 1);
 		src[0] += ((src[1] + c1) >> 1);
-		
+
 		// middle part
 		for (; i < width-1; i += 2) {
 			src[i] -= ((src[i-1] + src[i+1] + c1) >> 1);
@@ -233,7 +238,7 @@
 	const UINT32 height = destBand->GetHeight();
 	UINT32 row0, row1, row2, row3, i, k, origin = 0;
 
-	// allocate memory for the results of the inverse transform 
+	// allocate memory for the results of the inverse transform
 	destBand->AllocMemory();
 	DataT* dest = destBand->GetBuffer();
 
@@ -345,7 +350,7 @@
 		if (destHeight & 1) {
 			MallatToLinear(srcLevel, &dest[row0], 0, destWidth);
 			InverseRow(&dest[row0], destWidth);
-		} 
+		}
 	}
 
 	// free memory of the current srcLevel
@@ -398,17 +403,18 @@
 	UINT32 i;
 
 	if (hiRow) {
-		#ifdef __PGFROISUPPORT__
-			UINT32 llPos, hlPos, lhPos, hhPos;
-
-			if (wquot < ll.BufferWidth()) {
-				// save current src buffer positions
-				llPos = ll.GetBuffPos(); 
-				hlPos = hl.GetBuffPos(); 
-				lhPos = lh.GetBuffPos(); 
-				hhPos = hh.GetBuffPos(); 
-			}
-		#endif
+	#ifdef __PGFROISUPPORT__
+		const bool storePos = wquot < ll.BufferWidth();
+		UINT32 llPos = 0, hlPos = 0, lhPos = 0, hhPos = 0;
+
+		if (storePos) {
+			// save current src buffer positions
+			llPos = ll.GetBuffPos();
+			hlPos = hl.GetBuffPos();
+			lhPos = lh.GetBuffPos();
+			hhPos = hh.GetBuffPos();
+		}
+	#endif
 
 		for (i=0; i < wquot; i++) {
 			*loRow++ = ll.ReadBuffer();// first access, than increment
@@ -422,26 +428,27 @@
 			*hiRow++ = lh.ReadBuffer();// first access, than increment
 		}
 
-		#ifdef __PGFROISUPPORT__
-			if (wquot < ll.BufferWidth()) {
-				// increment src buffer positions
-				ll.IncBuffRow(llPos); 
-				hl.IncBuffRow(hlPos); 
-				lh.IncBuffRow(lhPos); 
-				hh.IncBuffRow(hhPos); 
-			}
-		#endif
+	#ifdef __PGFROISUPPORT__
+		if (storePos) {
+			// increment src buffer positions
+			ll.IncBuffRow(llPos);
+			hl.IncBuffRow(hlPos);
+			lh.IncBuffRow(lhPos);
+			hh.IncBuffRow(hhPos);
+		}
+	#endif
 
 	} else {
-		#ifdef __PGFROISUPPORT__
-			UINT32 llPos, hlPos;
-
-			if (wquot < ll.BufferWidth()) {
-				// save current src buffer positions
-				llPos = ll.GetBuffPos(); 
-				hlPos = hl.GetBuffPos(); 
-			}
-		#endif
+	#ifdef __PGFROISUPPORT__
+		const bool storePos = wquot < ll.BufferWidth();
+		UINT32 llPos = 0, hlPos = 0;
+
+		if (storePos) {
+			// save current src buffer positions
+			llPos = ll.GetBuffPos();
+			hlPos = hl.GetBuffPos();
+		}
+	#endif
 
 		for (i=0; i < wquot; i++) {
 			*loRow++ = ll.ReadBuffer();// first access, than increment
@@ -449,13 +456,13 @@
 		}
 		if (wrem) *loRow++ = ll.ReadBuffer();
 
-		#ifdef __PGFROISUPPORT__
-			if (wquot < ll.BufferWidth()) {
-				// increment src buffer positions
-				ll.IncBuffRow(llPos); 
-				hl.IncBuffRow(hlPos); 
-			}
-		#endif
+	#ifdef __PGFROISUPPORT__
+		if (storePos) {
+			// increment src buffer positions
+			ll.IncBuffRow(llPos);
+			hl.IncBuffRow(hlPos);
+		}
+	#endif
 	}
 }
 
@@ -510,7 +517,7 @@
 /////////////////////////////////////////////////////////////////////
 void CROIs::CreateROIs() {
 	if (!m_ROIs) {
-		// create ROIs 
+		// create ROIs
 		m_ROIs = new PGFRect[m_nLevels];
 	}
 }
@@ -518,7 +525,7 @@
 /////////////////////////////////////////////////////////////////////
 void CROIs::CreateIndices() {
 	if (!m_indices) {
-		// create tile indices 
+		// create tile indices
 		m_indices = new PGFRect[m_nLevels];
 	}
 }

Modified: branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.h
==============================================================================
--- branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.h (original)
+++ branches/ScribusOIF/scribus/third_party/pgf/WaveletTransform.h Wed Aug 10 22:39:40 2011
@@ -1,25 +1,30 @@
 /*
  * The Progressive Graphics File; http://www.libpgf.org
- * 
+ *
  * $Date: 2006-05-18 16:03:32 +0200 (Do, 18 Mai 2006) $
  * $Revision: 194 $
- * 
+ *
  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
+
+//////////////////////////////////////////////////////////////////////
+/// @file WaveletTransform.h
+/// @brief PGF wavelet transform class
+/// @author C. Stamm
 
 #ifndef PGF_WAVELETTRANSFORM_H
 #define PGF_WAVELETTRANSFORM_H
@@ -36,6 +41,7 @@
 //////////////////////////////////////////////////////////////////////
 /// PGF ROI and tile support. This is a helper class for CWaveletTransform.
 /// @author C. Stamm
+/// @brief ROI and tile support
 class CROIs {
 	friend class CWaveletTransform;
 
@@ -82,6 +88,7 @@
 //////////////////////////////////////////////////////////////////////
 /// PGF wavelet transform class.
 /// @author C. Stamm, R. Spuler
+/// @brief PGF wavelet transform
 class CWaveletTransform {
 	friend class CSubband;
 
@@ -97,7 +104,7 @@
 	//////////////////////////////////////////////////////////////////////
 	/// Destructor
 	~CWaveletTransform() { Destroy(); }
-	
+
 	//////////////////////////////////////////////////////////////////////
 	/// Compute fast forward wavelet transform of LL subband at given level and
 	/// stores result on all 4 subbands of level + 1.
@@ -121,7 +128,7 @@
 		ASSERT(level >= 0 && level < m_nLevels);
 		return &m_subband[level][orientation];
 	}
-	
+
 #ifdef __PGFROISUPPORT__
 	//////////////////////////////////////////////////////////////////////
 	/// Compute and store ROIs for each level
@@ -150,9 +157,9 @@
 #endif // __PGFROISUPPORT__
 
 private:
-	void Destroy() { delete[] m_subband; m_subband = 0; 
+	void Destroy() { delete[] m_subband; m_subband = 0;
 		#ifdef __PGFROISUPPORT__
-		m_ROIs.Destroy(); 
+		m_ROIs.Destroy();
 		#endif
 	}
 	void InitSubbands(UINT32 width, UINT32 height, DataT* data);
@@ -166,7 +173,7 @@
 #endif //__PGFROISUPPORT__
 
 	int			m_nLevels;						// number of transform levels: one more than the number of level in PGFimage
-	CSubband	(*m_subband)[NSubbands];		// quadtree of subbands: LL HL												
+	CSubband	(*m_subband)[NSubbands];		// quadtree of subbands: LL HL
 												//                       LH HH
 };
 

Modified: branches/ScribusOIF/scribus/ui/about.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/about.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/about.cpp (original)
+++ branches/ScribusOIF/scribus/ui/about.cpp Wed Aug 10 22:39:40 2011
@@ -112,8 +112,8 @@
 	buildID = new QLabel( tab );
 	buildID->setAlignment(Qt::AlignCenter);
 	buildID->setTextInteractionFlags(Qt::TextSelectableByMouse);
-	QString BUILD_DAY = "30";
-	QString BUILD_MONTH = CommonStrings::july;
+	QString BUILD_DAY = "4";
+	QString BUILD_MONTH = CommonStrings::august;
 	QString BUILD_YEAR = "2011";
 	QString BUILD_TIME = "";
 	QString BUILD_TZ = "";
@@ -331,7 +331,7 @@
 		result = tr("Previous Translation Contributors:");
 	else
 	{
-		std::cout << "please add the untranslated title \"" << qPrintable(title) << "\" to About::trAuthorTitle()" << std::endl;
+		std::cout << "please add the untranslated title \"" << qPrintable(title) << "\" to About::trTranslationTitle()" << std::endl;
 		result = title;
 	}
 	return result;

Modified: branches/ScribusOIF/scribus/ui/fontcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/fontcombo.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/fontcombo.cpp (original)
+++ branches/ScribusOIF/scribus/ui/fontcombo.cpp Wed Aug 10 22:39:40 2011
@@ -106,7 +106,6 @@
 	otfFont = loadIcon("font_otf16.png");
 	psFont = loadIcon("font_type1_16.png");
 	substFont = loadIcon("font_subst16.png");
-	currDoc = 0;
 	fontComboLayout = new QGridLayout(this);
 	fontComboLayout->setMargin(0);
 	fontComboLayout->setSpacing(0);
@@ -124,6 +123,7 @@
 	fontComboLayout->addWidget(fontFamily,0,col);
 	fontStyle = new ScComboBox(this);
 	fontComboLayout->addWidget(fontStyle,1,col);
+	isForAnnotation = true;  // this is merely to ensure that the list is rebuilt
 	RebuildList(0);
 	connect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
 	connect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
@@ -192,10 +192,13 @@
 
 void FontComboH::setCurrentFont(QString f)
 {
+	QString family = prefsManager->appPrefs.fontPrefs.AvailFonts[f].family();
+	QString style = prefsManager->appPrefs.fontPrefs.AvailFonts[f].style();
+	// If we already have the correct font+style, nothing to do
+	if ((fontFamily->currentText() == family) && (fontStyle->currentText() == style))
+		return;
 	disconnect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
 	disconnect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
-	QString family = prefsManager->appPrefs.fontPrefs.AvailFonts[f].family();
-	QString style = prefsManager->appPrefs.fontPrefs.AvailFonts[f].style();
 	setCurrentComboItem(fontFamily, family);
 	fontStyle->clear();
 	QStringList slist = prefsManager->appPrefs.fontPrefs.AvailFonts.fontMap[family];
@@ -225,7 +228,12 @@
 
 void FontComboH::RebuildList(ScribusDoc *currentDoc, bool forAnnotation, bool forSubstitute)
 {
+	// if we already have the proper fonts loaded, we need to do nothing
+	if ((currDoc == currentDoc) && (forAnnotation == isForAnnotation) && (isForSubstitute == forSubstitute))
+		return;
 	currDoc = currentDoc;
+	isForAnnotation = forAnnotation;
+	isForSubstitute = forSubstitute;
 	disconnect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
 	disconnect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
 	fontFamily->clear();

Modified: branches/ScribusOIF/scribus/ui/fontcombo.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/fontcombo.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/fontcombo.h (original)
+++ branches/ScribusOIF/scribus/ui/fontcombo.h Wed Aug 10 22:39:40 2011
@@ -89,6 +89,7 @@
 	QLabel *fontStyleLabel;
 	PrefsManager* prefsManager;
 	ScribusDoc *currDoc;
+	bool isForAnnotation, isForSubstitute;
 	QPixmap ttfFont;
 	QPixmap otfFont;
 	QPixmap psFont;

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp Wed Aug 10 22:39:40 2011
@@ -96,6 +96,8 @@
 
 	connect(customShape  , SIGNAL(FormSel(int, int, qreal *)), this, SLOT(handleNewShape(int, int, qreal *)));
 	connect(editShape, SIGNAL(clicked())                 , this, SLOT(handleShapeEdit()));
+	connect(evenOdd    , SIGNAL(clicked())                 , this, SLOT(handleFillRule()) );
+	connect(nonZero    , SIGNAL(clicked())                 , this, SLOT(handleFillRule()) );
 	connect(transPalWidget , SIGNAL(editGradient())            , this, SLOT(handleGradientEdit()));
 	connect(transPalWidget , SIGNAL(NewSpecial(double, double, double, double, double, double, double, double, double, double)), this, SLOT(handleSpecialGradient(double, double, double, double, double, double, double, double )));
 }
@@ -283,6 +285,8 @@
 	m_item->patternFlip(mirrorX, mirrorY);
 
 	transPalWidget->setCurrentItem(m_item);
+	nonZero->setChecked(!m_item->fillRule);
+	evenOdd->setChecked(m_item->fillRule);
 
 	if ((m_item->isGroup()) && (!m_item->isSingleSel))
 	{
@@ -553,6 +557,15 @@
 	}
 }
 
+void PropertiesPalette_Group::handleFillRule()
+{
+	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	m_item->fillRule = evenOdd->isChecked();
+	m_item->update();
+	emit DocChanged();
+}
+
 void PropertiesPalette_Group::handleShapeEdit()
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -627,4 +640,4 @@
 	transPalWidget->blockSignals(true);
 	transPalWidget->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
 	transPalWidget->blockSignals(false);
-}
+}

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_group.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/propertiespalette_group.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_group.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_group.h Wed Aug 10 22:39:40 2011
@@ -76,6 +76,7 @@
 	void handleTextFlow();
 	void handleNewShape(int f, int c, qreal *vals);
 
+	void handleFillRule();
 	void handleShapeEdit();
 	void handleShapeEditEnded();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_groupbase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/propertiespalette_groupbase.ui
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_groupbase.ui (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_groupbase.ui Wed Aug 10 22:39:40 2011
@@ -6,14 +6,14 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>300</width>
-    <height>250</height>
+    <width>212</width>
+    <height>387</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout_3">
    <property name="spacing">
     <number>2</number>
    </property>
@@ -77,7 +77,150 @@
      <property name="flat">
       <bool>true</bool>
      </property>
-     <layout class="QVBoxLayout" name="verticalLayout_3">
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <property name="spacing">
+       <number>2</number>
+      </property>
+      <property name="margin">
+       <number>2</number>
+      </property>
+      <item>
+       <widget class="QToolButton" name="textFlowDisabled">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Disabled</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+        <property name="autoExclusive">
+         <bool>true</bool>
+        </property>
+        <property name="toolButtonStyle">
+         <enum>Qt::ToolButtonTextBesideIcon</enum>
+        </property>
+        <attribute name="buttonGroup">
+         <string>textFlowBtnGroup</string>
+        </attribute>
+       </widget>
+      </item>
+      <item>
+       <widget class="QToolButton" name="textFlowUsesFrameShape">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Use &Frame Shape</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+        <property name="autoExclusive">
+         <bool>true</bool>
+        </property>
+        <property name="toolButtonStyle">
+         <enum>Qt::ToolButtonTextBesideIcon</enum>
+        </property>
+        <attribute name="buttonGroup">
+         <string>textFlowBtnGroup</string>
+        </attribute>
+       </widget>
+      </item>
+      <item>
+       <widget class="QToolButton" name="textFlowUsesBoundingBox">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Use &Bounding Box</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+        <property name="autoExclusive">
+         <bool>true</bool>
+        </property>
+        <property name="toolButtonStyle">
+         <enum>Qt::ToolButtonTextBesideIcon</enum>
+        </property>
+        <attribute name="buttonGroup">
+         <string>textFlowBtnGroup</string>
+        </attribute>
+       </widget>
+      </item>
+      <item>
+       <widget class="QToolButton" name="textFlowUsesContourLine">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>&Use Contour Line</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+        <property name="autoExclusive">
+         <bool>true</bool>
+        </property>
+        <property name="toolButtonStyle">
+         <enum>Qt::ToolButtonTextBesideIcon</enum>
+        </property>
+        <attribute name="buttonGroup">
+         <string>textFlowBtnGroup</string>
+        </attribute>
+       </widget>
+      </item>
+      <item>
+       <widget class="QToolButton" name="textFlowUsesImageClipping">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Use Image Clip Path</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+        <property name="autoExclusive">
+         <bool>true</bool>
+        </property>
+        <property name="toolButtonStyle">
+         <enum>Qt::ToolButtonTextBesideIcon</enum>
+        </property>
+        <attribute name="buttonGroup">
+         <string>textFlowBtnGroup</string>
+        </attribute>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="fillRuleGroup">
+     <property name="title">
+      <string>Fill Rule</string>
+     </property>
+     <property name="flat">
+      <bool>true</bool>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_3">
       <property name="spacing">
        <number>5</number>
       </property>
@@ -85,150 +228,77 @@
        <number>2</number>
       </property>
       <item>
-       <widget class="QToolButton" name="textFlowDisabled">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Disabled</string>
-        </property>
-        <property name="checkable">
-         <bool>true</bool>
-        </property>
-        <property name="autoExclusive">
-         <bool>true</bool>
-        </property>
-        <property name="toolButtonStyle">
-         <enum>Qt::ToolButtonTextBesideIcon</enum>
-        </property>
-        <attribute name="buttonGroup">
-         <string>textFlowBtnGroup</string>
-        </attribute>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="textFlowUsesFrameShape">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Use &Frame Shape</string>
-        </property>
-        <property name="checkable">
-         <bool>true</bool>
-        </property>
-        <property name="autoExclusive">
-         <bool>true</bool>
-        </property>
-        <property name="toolButtonStyle">
-         <enum>Qt::ToolButtonTextBesideIcon</enum>
-        </property>
-        <attribute name="buttonGroup">
-         <string>textFlowBtnGroup</string>
-        </attribute>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="textFlowUsesBoundingBox">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Use &Bounding Box</string>
-        </property>
-        <property name="checkable">
-         <bool>true</bool>
-        </property>
-        <property name="autoExclusive">
-         <bool>true</bool>
-        </property>
-        <property name="toolButtonStyle">
-         <enum>Qt::ToolButtonTextBesideIcon</enum>
-        </property>
-        <attribute name="buttonGroup">
-         <string>textFlowBtnGroup</string>
-        </attribute>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="textFlowUsesContourLine">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>&Use Contour Line</string>
-        </property>
-        <property name="checkable">
-         <bool>true</bool>
-        </property>
-        <property name="autoExclusive">
-         <bool>true</bool>
-        </property>
-        <property name="toolButtonStyle">
-         <enum>Qt::ToolButtonTextBesideIcon</enum>
-        </property>
-        <attribute name="buttonGroup">
-         <string>textFlowBtnGroup</string>
-        </attribute>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="textFlowUsesImageClipping">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Use Image Clip Path</string>
-        </property>
-        <property name="checkable">
-         <bool>true</bool>
-        </property>
-        <property name="autoExclusive">
-         <bool>true</bool>
-        </property>
-        <property name="toolButtonStyle">
-         <enum>Qt::ToolButtonTextBesideIcon</enum>
-        </property>
-        <attribute name="buttonGroup">
-         <string>textFlowBtnGroup</string>
-        </attribute>
-       </widget>
-      </item>
-      <item>
-       <widget class="QGroupBox" name="transparencyGroup">
-        <property name="title">
-         <string>Transparency</string>
-        </property>
-        <property name="flat">
-         <bool>true</bool>
-        </property>
-        <layout class="QVBoxLayout" name="verticalLayout_4">
-         <property name="spacing">
-          <number>2</number>
-         </property>
-         <property name="margin">
-          <number>2</number>
-         </property>
-         <item>
-          <widget class="Tpalette" name="transPalWidget" native="true"/>
-         </item>
-        </layout>
-       </widget>
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>10</width>
+          <height>10</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="evenOdd">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Even-Odd</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="nonZero">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Non Zero</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_3">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>10</width>
+          <height>10</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="transparencyGroup">
+     <property name="title">
+      <string>Transparency</string>
+     </property>
+     <property name="flat">
+      <bool>true</bool>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_4">
+      <property name="spacing">
+       <number>2</number>
+      </property>
+      <property name="margin">
+       <number>2</number>
+      </property>
+      <item>
+       <widget class="Tpalette" name="transPalWidget" native="true"/>
       </item>
      </layout>
     </widget>

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp Wed Aug 10 22:39:40 2011
@@ -954,11 +954,11 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning() || !m_haveDoc || !m_haveItem)
 		return;
-	if( radioFlop == 0)
+	if( radioFlop == PropertyWidget_Flop::RealHeightID)
 		m_item->setFirstLineOffset(FLOPRealGlyphHeight);
-	else if( radioFlop == 1)
+	else if( radioFlop == PropertyWidget_Flop::FontAscentID)
 		m_item->setFirstLineOffset(FLOPFontAscent);
-	else if( radioFlop == 2)
+	else if( radioFlop == PropertyWidget_Flop::LineSpacingID)
 		m_item->setFirstLineOffset(FLOPLineSpacing);
 	m_item->update();
 	emit DocChanged();

Modified: branches/ScribusOIF/scribus/ui/propertywidget_flop.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/propertywidget_flop.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_flop.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_flop.cpp Wed Aug 10 22:39:40 2011
@@ -20,6 +20,10 @@
 	layout()->setAlignment( Qt::AlignTop );
 	
 	flopRealHeight->setChecked(true);
+
+	flopGroup->setId(flopRealHeight,  RealHeightID);
+    flopGroup->setId(flopFontAscent,  FontAscentID);
+    flopGroup->setId(flopLineSpacing, LineSpacingID);
 
 	languageChange();
 }

Modified: branches/ScribusOIF/scribus/ui/propertywidget_flop.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/propertywidget_flop.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_flop.h (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_flop.h Wed Aug 10 22:39:40 2011
@@ -18,6 +18,14 @@
 	Q_OBJECT
 
 public:
+
+	enum FlopButtonID
+    {
+        RealHeightID  = 0,
+        FontAscentID  = 1,
+        LineSpacingID = 2
+    };
+
 	PropertyWidget_Flop(QWidget* parent);
 	~PropertyWidget_Flop() {};
 

Modified: branches/ScribusOIF/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/scribus/ui/storyeditor.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/storyeditor.cpp (original)
+++ branches/ScribusOIF/scribus/ui/storyeditor.cpp Wed Aug 10 22:39:40 2011
@@ -1842,8 +1842,10 @@
 	FillTools->setAllowedAreas(Qt::TopToolBarArea);
 	
 	addToolBar(FileTools);
+	addToolBarBreak();
 	addToolBar(FontTools);
 	addToolBar(AlignTools);
+	addToolBarBreak();
 	addToolBar(StyleTools);
 	addToolBar(StrokeTools);
 	addToolBar(FillTools);

Modified: branches/ScribusOIF/win32/vc9/Scribus-build.vsprops
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/win32/vc9/Scribus-build.vsprops
==============================================================================
--- branches/ScribusOIF/win32/vc9/Scribus-build.vsprops (original)
+++ branches/ScribusOIF/win32/vc9/Scribus-build.vsprops Wed Aug 10 22:39:40 2011
@@ -6,7 +6,7 @@
 	>
 	<UserMacro
 		Name="QT4_DIR"
-		Value="F:\Libraries-vc9\qt-4.6.3"
+		Value="F:\Libraries-vc9\qt-4.7.3"
 	/>
 	<UserMacro
 		Name="BOOST_DIR"
@@ -18,7 +18,7 @@
 	/>
 	<UserMacro
 		Name="FREETYPE_DIR"
-		Value="F:\Libraries-vc9\freetype-2.4.2"
+		Value="F:\Libraries-vc9\freetype-2.4.6"
 	/>
 	<UserMacro
 		Name="ICONV_DIR"
@@ -30,7 +30,7 @@
 	/>
 	<UserMacro
 		Name="LCMS_DIR"
-		Value="F:\Libraries-vc9\lcms-2.0"
+		Value="F:\Libraries-vc9\lcms2-2.2"
 	/>
 	<UserMacro
 		Name="LIBJPEG_DIR"
@@ -46,7 +46,7 @@
 	/>
 	<UserMacro
 		Name="PODOFO_DIR"
-		Value="F:\Libraries-vc9\podofo-0.8.2"
+		Value="F:\Libraries-vc9\podofo-0.9.1"
 	/>
 	<UserMacro
 		Name="LIBXML2_DIR"
@@ -56,4 +56,8 @@
 		Name="PYTHON_DIR"
 		Value="F:\Libraries-vc9\Python-2.7.1"
 	/>
+	<UserMacro
+		Name="POPPLER_DIR"
+		Value="F:\Libraries-vc9\poppler-0.17.1"
+	/>
 </VisualStudioPropertySheet>

Modified: branches/ScribusOIF/win32/vc9/Scribus.sln
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/win32/vc9/Scribus.sln
==============================================================================
--- branches/ScribusOIF/win32/vc9/Scribus.sln (original)
+++ branches/ScribusOIF/win32/vc9/Scribus.sln Wed Aug 10 22:39:40 2011
@@ -34,11 +34,6 @@
 		{B17FCD80-7978-4544-93C4-2FE1AC6FE9F3} = {B17FCD80-7978-4544-93C4-2FE1AC6FE9F3}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "psimport", "psimport\psimport.vcproj", "{6E8FF91A-DD16-4FAB-ACA5-8243453613F3}"
-	ProjectSection(ProjectDependencies) = postProject
-		{B17FCD80-7978-4544-93C4-2FE1AC6FE9F3} = {B17FCD80-7978-4544-93C4-2FE1AC6FE9F3}
-	EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "saveastemplate", "saveastemplate\saveastemplate.vcproj", "{F8CF727B-EF70-43DD-97F3-EDE68E0942D4}"
 	ProjectSection(ProjectDependencies) = postProject
 		{B17FCD80-7978-4544-93C4-2FE1AC6FE9F3} = {B17FCD80-7978-4544-93C4-2FE1AC6FE9F3}
@@ -262,6 +257,11 @@
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smoothpath", "smoothpath\smoothpath.vcproj", "{F3471C52-C0FF-4690-B9BF-9A97A6F2BA2F}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B17FCD80-7978-4544-93C4-2FE1AC6FE9F3} = {B17FCD80-7978-4544-93C4-2FE1AC6FE9F3}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pdfimport", "pdfimport\pdfimport.vcproj", "{F58AF6DE-330F-48F5-97BB-ED2F30401712}"
 	ProjectSection(ProjectDependencies) = postProject
 		{B17FCD80-7978-4544-93C4-2FE1AC6FE9F3} = {B17FCD80-7978-4544-93C4-2FE1AC6FE9F3}
 	EndProjectSection
@@ -296,10 +296,6 @@
 		{BCDD9765-B310-44EB-890A-1704A1D18619}.Debug-cairo|Win32.Build.0 = Debug-cairo|Win32
 		{BCDD9765-B310-44EB-890A-1704A1D18619}.Release-cairo|Win32.ActiveCfg = Release-cairo|Win32
 		{BCDD9765-B310-44EB-890A-1704A1D18619}.Release-cairo|Win32.Build.0 = Release-cairo|Win32
-		{6E8FF91A-DD16-4FAB-ACA5-8243453613F3}.Debug-cairo|Win32.ActiveCfg = Debug-cairo|Win32
-		{6E8FF91A-DD16-4FAB-ACA5-8243453613F3}.Debug-cairo|Win32.Build.0 = Debug-cairo|Win32
-		{6E8FF91A-DD16-4FAB-ACA5-8243453613F3}.Release-cairo|Win32.ActiveCfg = Release-cairo|Win32
-		{6E8FF91A-DD16-4FAB-ACA5-8243453613F3}.Release-cairo|Win32.Build.0 = Release-cairo|Win32
 		{F8CF727B-EF70-43DD-97F3-EDE68E0942D4}.Debug-cairo|Win32.ActiveCfg = Debug-cairo|Win32
 		{F8CF727B-EF70-43DD-97F3-EDE68E0942D4}.Debug-cairo|Win32.Build.0 = Debug-cairo|Win32
 		{F8CF727B-EF70-43DD-97F3-EDE68E0942D4}.Release-cairo|Win32.ActiveCfg = Release-cairo|Win32
@@ -496,6 +492,10 @@
 		{F3471C52-C0FF-4690-B9BF-9A97A6F2BA2F}.Debug-cairo|Win32.Build.0 = Debug-cairo|Win32
 		{F3471C52-C0FF-4690-B9BF-9A97A6F2BA2F}.Release-cairo|Win32.ActiveCfg = Release-cairo|Win32
 		{F3471C52-C0FF-4690-B9BF-9A97A6F2BA2F}.Release-cairo|Win32.Build.0 = Release-cairo|Win32
+		{F58AF6DE-330F-48F5-97BB-ED2F30401712}.Debug-cairo|Win32.ActiveCfg = Debug-cairo|Win32
+		{F58AF6DE-330F-48F5-97BB-ED2F30401712}.Debug-cairo|Win32.Build.0 = Debug-cairo|Win32
+		{F58AF6DE-330F-48F5-97BB-ED2F30401712}.Release-cairo|Win32.ActiveCfg = Release-cairo|Win32
+		{F58AF6DE-330F-48F5-97BB-ED2F30401712}.Release-cairo|Win32.Build.0 = Release-cairo|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Modified: branches/ScribusOIF/win32/vc9/scribus-pgf/scribus-pgf.vcproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/win32/vc9/scribus-pgf/scribus-pgf.vcproj
==============================================================================
--- branches/ScribusOIF/win32/vc9/scribus-pgf/scribus-pgf.vcproj (original)
+++ branches/ScribusOIF/win32/vc9/scribus-pgf/scribus-pgf.vcproj Wed Aug 10 22:39:40 2011
@@ -198,7 +198,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\scribus\third_party\pgf\Stream.cpp"
+				RelativePath="..\..\..\scribus\third_party\pgf\PGFstream.cpp"
 				>
 			</File>
 			<File
@@ -236,11 +236,11 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\scribus\third_party\pgf\PGFstream.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\scribus\third_party\pgf\PGFtypes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\scribus\third_party\pgf\Stream.h"
 				>
 			</File>
 			<File

Modified: branches/ScribusOIF/win32/vc9/win-config.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16781&path=/branches/ScribusOIF/win32/vc9/win-config.h
==============================================================================
--- branches/ScribusOIF/win32/vc9/win-config.h (original)
+++ branches/ScribusOIF/win32/vc9/win-config.h Wed Aug 10 22:39:40 2011
@@ -24,9 +24,6 @@
 
 /* Can we use unicode functions (Windows) */
 #define HAVE_UNICODE 1
-
-/* Define if you have the CoreAudio API */
-#undef HAVE_COREAUDIO
 
 /* Define to 1 if you have the <crt_externs.h> header file. */
 #undef HAVE_CRT_EXTERNS_H
@@ -70,11 +67,14 @@
 /* Define if your system needs _NSGetEnviron to set up the environment */
 #undef HAVE_NSGETENVIRON
 
+/* Define if you have the development files for podofo */
+#define HAVE_PODOFO 1
+
+/* Define if you have the development files for podofo */
+#define HVAE_POPPLER 1
+
 /* Define if you have the development files for python */
 #define HAVE_PYTHON 1
-
-/* Define if you have the development files for podofo */
-#define HAVE_PODOFO 1
 
 /* Python */
 #undef HAVE_PYTHON_23
@@ -137,27 +137,6 @@
 /* Defines if your system has the libxml2 library6 */
 #define HAVE_XML26 1
 
-/* Suffix for lib directories */
-#undef KDELIBSUFF
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
 /* The size of a `char *', as computed by sizeof. */
 #define SIZEOF_CHAR_P 4
 




More information about the scribus-commit mailing list