Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 10211 → Rev 10212

/trunk/Scribus/scribus/printerutil.h
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/formatutils.h
===================================================================
--- trunk/Scribus/scribus/formatutils.h (revision 10211)
+++ trunk/Scribus/scribus/formatutils.h (nonexistent)
@@ -1,79 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-
-//Added by Craig Bradney in July 2007
-//To be used for basic format detection and checking
-//One central place for storing all our extensions we support, etc
-
-#ifndef FORMAT_UTILS_H
-#define FORMAT_UTILS_H
-
-#include <QByteArray>
-#include <QList>
-#include <QMap>
-#include <QString>
-#include <QStringList>
-#include "scribusapi.h"
-
-bool SCRIBUS_API extensionIndicatesEPS(const QString &ext);
-bool SCRIBUS_API extensionIndicatesEPSorPS(const QString &ext);
-bool SCRIBUS_API extensionIndicatesJPEG(const QString &ext);
-bool SCRIBUS_API extensionIndicatesPDF(const QString &ext);
-bool SCRIBUS_API extensionIndicatesPSD(const QString &ext);
-bool SCRIBUS_API extensionIndicatesPattern(const QString &ext);
-bool SCRIBUS_API extensionIndicatesTIFF(const QString &ext);
-
-
-class SCRIBUS_API FormatsManager
-{
- public:
-
- enum scFormatTypes
- {
- TIFF = 1, // TIFF
- PS = 2, // PostScript
- EPS = 4, // Encapsulated PostScript
- JPEG = 8, // JPEG
- PSD = 16, // Photoshop Format
- PDF = 32, // PDF Format
- PAT = 64 // Pattern files
- };
-
- FormatsManager();
- ~FormatsManager();
-
- /**
- * @brief Returns a pointer to the FormatsManager instance
- * @return A pointer to the FormatsManager instance
- */
- static FormatsManager* instance();
- /**
- * @brief Deletes the FormatsManager Instance
- * Must be called when FormatsManager is no longer needed.
- */
- static void deleteInstance();
- void imageFormatSupported(const QString&);
-
- void fileTypeStrings(int type, QString& formatList, QString& formatText, bool lowerCaseOnly=false);
-
- protected:
- QMap<int, QStringList> m_fmts;
- QStringList m_fmtList;
- QList<QByteArray> m_supportedImageFormats;
- void updateSupportedImageFormats(QList<QByteArray>& supportedImageFormats);
-
- private:
- /**
- * @brief The only instance of FormatsManager available.
- *
- * FormatsManager is singleton and the instance can be queried with the method
- * instance().
- */
- static FormatsManager* _instance;
-};
-
-#endif
Index: trunk/Scribus/scribus/cmsutil.cpp
===================================================================
--- trunk/Scribus/scribus/cmsutil.cpp (revision 10211)
+++ trunk/Scribus/scribus/cmsutil.cpp (nonexistent)
@@ -1,54 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#include "cmsutil.h"
-#include <qstring.h>
-
-cmsHTRANSFORM scCmsCreateTransform(cmsHPROFILE Input, DWORD InputFormat,
- cmsHPROFILE Output,DWORD OutputFormat,
- int Intent, DWORD dwFlags)
-{
- cmsHTRANSFORM hTransform = NULL;
- if ( Input == NULL || Output == NULL)
- return NULL;
- dwFlags &= (~cmsFLAGS_GAMUTCHECK);
- dwFlags &= (~cmsFLAGS_SOFTPROOFING);
- QString desc1 = cmsTakeProductDesc(Input);
- QString desc2 = cmsTakeProductDesc(Output);
- if ( desc1 == desc2 )
- dwFlags |= cmsFLAGS_NULLTRANSFORM;
- hTransform = cmsCreateTransform(Input, InputFormat, Output, OutputFormat, Intent, dwFlags);
- return hTransform;
-}
-
-cmsHTRANSFORM scCmsCreateProofingTransform(cmsHPROFILE Input, DWORD InputFormat,
- cmsHPROFILE Output,DWORD OutputFormat,
- cmsHPROFILE Proofing, int Intent,
- int ProofingIntent, DWORD dwFlags)
-{
- cmsHTRANSFORM hTransform = NULL;
- if ( Input == NULL || Output == NULL || Proofing == NULL)
- return NULL;
- QString desc1 = cmsTakeProductDesc(Input);
- QString desc2 = cmsTakeProductDesc(Output);
- QString desc3 = cmsTakeProductDesc(Proofing);
- if ( desc1 != desc3 )
- {
- if( desc2 == desc3 )
- ProofingIntent = INTENT_RELATIVE_COLORIMETRIC;
- hTransform = cmsCreateProofingTransform(Input, InputFormat, Output, OutputFormat, Proofing, Intent,
- ProofingIntent, dwFlags);
- }
- else
- {
- dwFlags &= (~cmsFLAGS_GAMUTCHECK);
- dwFlags &= (~cmsFLAGS_SOFTPROOFING);
- if ( desc1 == desc2 )
- dwFlags |= cmsFLAGS_NULLTRANSFORM;
- hTransform = cmsCreateTransform(Input, InputFormat, Output, OutputFormat, ProofingIntent, dwFlags);
- }
- return hTransform;
-}
/trunk/Scribus/scribus/cmsutil.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/gsutil.h
===================================================================
--- trunk/Scribus/scribus/gsutil.h (revision 10211)
+++ trunk/Scribus/scribus/gsutil.h (nonexistent)
@@ -1,55 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-
-/*!
- * @brief GS utility fucntions
- * Moved functions written or modified by various people over the time from util.cpp
- *
- * @author Craig Bradney
- */
-#ifndef _GSUTIL_H
-#define _GSUTIL_H
-
-#include <qpixmap.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <QMap>
-
-#include "scribusapi.h"
-
-QPixmap SCRIBUS_API LoadPDF(QString fn, int Page, int Size, int *w, int *h);
-/**
- * @brief Call GhostScript synchronously and store output
- *
- * The gs commands are all similar and consist of a few constant
- * arguments, the variable arguments and the end arguments which
- * are also invariant. It will always use -q -dNOPAUSE and
- * will always end with -c showpage -c quit. It also does automatic
- * device selection unless overridden, and uses the user's antialiasing
- * preferences and font search path.
- *
- * Shell metacharacters are not expanded - that includes quotes.
- * @sa System .
- *
- * @param args_in Custom arguments to GhostScript
- * @param device GS device to use (defaults to an image device if omitted)
- */
-int SCRIBUS_API callGS(const QStringList& args_in, const QString device="");
-int SCRIBUS_API callGS(const QString& args_in, const QString device="");
-int SCRIBUS_API convertPS2PS(QString in, QString out, const QStringList& opts, int level);
-bool SCRIBUS_API testGSAvailability( void );
-bool SCRIBUS_API testGSAvailability( const QString& gsPath );
-bool SCRIBUS_API testGSDeviceAvailability( const QString& device );
-/*! \brief Return gs version. If gs couldn't be found or there was a problem parsing output, return false
- (in which case minor and major have undefined values).
- \retval QString version or false on error */
-QString SCRIBUS_API getGSVersion();
-bool SCRIBUS_API getNumericGSVersion(int & major, int & minor);
-bool SCRIBUS_API getNumericGSVersion(const QString& ver, int&major, int& minor);
-QString SCRIBUS_API getGSDefaultExeName(void);
-QMap<int, QString> SCRIBUS_API getGSExePaths(const char* regKey);
-#endif
/trunk/Scribus/scribus/gsutil.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/printerutil.cpp
===================================================================
--- trunk/Scribus/scribus/printerutil.cpp (revision 10211)
+++ trunk/Scribus/scribus/printerutil.cpp (nonexistent)
@@ -1,272 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#include "printerutil.h"
-#include "scconfig.h"
-
-#if defined( HAVE_CUPS )
- #include <cups/cups.h>
-#elif defined(_WIN32)
- #include <windows.h>
- #include <winspool.h>
-#endif
-
-#include <qstringlist.h>
-#include <QDataStream>
-#include <QByteArray>
-#include "util.h"
-#include "scribus.h"
-#include "scribuscore.h"
-
-QStringList PrinterUtil::getPrinterNames()
-{
- QString printerName;
- QStringList printerNames;
-#if defined (HAVE_CUPS)
- cups_dest_t *dests;
- int num_dests = cupsGetDests(&dests);
- for (int pr = 0; pr < num_dests; ++pr)
- {
- printerName = QString(dests[pr].name);
- printerNames.append(printerName);
- }
- cupsFreeDests(num_dests, dests);
-#elif defined(_WIN32)
- DWORD size;
- DWORD numPrinters;
- PRINTER_INFO_2* printerInfos = NULL;
- EnumPrinters ( PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS , NULL, 2, NULL, 0, &size, &numPrinters );
- printerInfos = (PRINTER_INFO_2*) malloc(size);
- if ( EnumPrinters ( PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, 2, (LPBYTE) printerInfos, size, &size, &numPrinters ) )
- {
- for ( uint i = 0; i < numPrinters; i++)
- {
- printerName = printerInfos[i].pPrinterName;
- printerNames.append(printerName);
- }
- printerNames.sort();
- }
- if ( printerInfos) free(printerInfos);
-#else
- QString tmp;
- QString Pcap;
- QStringList wt;
- if (loadText("/etc/printcap", &Pcap))
- {
- QDataStream ts(&Pcap, QIODevice::ReadOnly);
- while(!ts.atEnd())
- {
- tmp = readLinefromDataStream(ts);
- if (tmp.isEmpty())
- continue;
- if ((tmp[0] != '#') && (tmp[0] != ' ') && (tmp[0] != '\n') && (tmp[0] != '\t'))
- {
- tmp = tmp.stripWhiteSpace();
- tmp = tmp.left(tmp.length() - (tmp.right(2) == ":\\" ? 2 : 1));
- wt = QStringList::split("|", tmp);
- printerName = wt[0];
- printerNames.append(printerName);
- }
- }
- }
-#endif
- return printerNames;
-}
-
-#if defined(_WIN32)
-bool PrinterUtil::getDefaultSettings( QString printerName, QByteArray& devModeA )
-{
- bool done;
- uint size;
- QByteArray printer;
- LONG result = IDOK+1;
- Qt::HANDLE handle = NULL;
- printer = printerName.local8Bit();
- // Get the printer handle
- done = OpenPrinter( printer.data(), &handle, NULL );
- if(!done)
- return false;
- // Get size of DEVMODE structure (public + private data)
- size = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), NULL, NULL, 0);
- // Allocate the memory needed by the DEVMODE structure
- devModeA.resize( size );
- // Retrieve printer default settings
- result = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), (DEVMODE*) devModeA.data(), NULL, DM_OUT_BUFFER);
- // Free the printer handle
- ClosePrinter( handle );
- return ( result == IDOK );
-}
-#endif
-
-#if defined(_WIN32)
-bool PrinterUtil::initDeviceSettings( QString printerName, QByteArray& devModeA )
-{
- bool done;
- uint size;
- QByteArray printer;
- LONG result = IDOK+1;
- Qt::HANDLE handle = NULL;
- printer = printerName.local8Bit();
- // Get the printer handle
- done = OpenPrinter( printer.data(), &handle, NULL );
- if(!done)
- return false;
- // Get size of DEVMODE structure (public + private data)
- size = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), NULL, NULL, 0);
- // Compare size with DevMode structure size
- if( devModeA.size() == size )
- {
- // Merge printer settings
- result = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), (DEVMODE*) devModeA.data(), (DEVMODE*) devModeA.data(), DM_IN_BUFFER | DM_OUT_BUFFER);
- }
- else
- {
- // Retrieve default settings
- devModeA.resize( size );
- result = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), (DEVMODE*) devModeA.data(), NULL, DM_OUT_BUFFER);
- }
- done = ( result == IDOK);
- // Free the printer handle
- ClosePrinter( handle );
- return done;
-}
-#endif
-
-bool PrinterUtil::getPrinterMarginValues(const QString& printerName, const QString& pageSize, double& ptsTopMargin, double& ptsBottomMargin, double& ptsLeftMargin, double& ptsRightMargin)
-{
- bool retVal=false;
-#if defined(HAVE_CUPS)
- const char *filename; // tmp PPD filename
- filename=cupsGetPPD(printerName);
- if (filename!=NULL)
- {
- ppd_file_t *ppd; // PPD data
- ppd = ppdOpenFile(filename);
- if (ppd!=NULL)
- {
- ppd_size_t *size; // page size data, null if printer doesnt support selected size
- size = ppdPageSize(ppd, pageSize);
- if (size!=NULL)
- {
- //Store in pts for returning via getNewPrinterMargins in pts
- retVal=true;
- ptsTopMargin=size->length-size->top;
- ptsBottomMargin=size->bottom;
- ptsLeftMargin=size->left;
- ptsRightMargin=size->width-size->right;
- }
- ppdClose(ppd);
- }
- }
-#elif defined(_WIN32)
- DWORD nPaper;
- DWORD nPaperNames;
- typedef char char64[64];
- QByteArray printer = printerName.local8Bit();
- nPaper = DeviceCapabilities( printer.data(), NULL, DC_PAPERS, NULL, NULL );
- nPaperNames = DeviceCapabilities( printer.data(), NULL, DC_PAPERNAMES, NULL, NULL );
- if ( (nPaper > 0) && (nPaperNames > 0) && (nPaper == nPaperNames) )
- {
- int paperIndex = -1;
- DWORD *papers = new DWORD[nPaper];
- char64 *paperNames = new char64[nPaperNames];
- DWORD s1 = DeviceCapabilities( printer.data(), NULL, DC_PAPERS, (LPSTR) papers, NULL );
- DWORD s2 = DeviceCapabilities( printer.data(), NULL, DC_PAPERNAMES, (LPSTR) paperNames, NULL );
- for ( uint i = 0; i < nPaperNames; i++ )
- {
- if ( pageSize == QString(paperNames[i]) )
- {
- paperIndex = i;
- break;
- }
- }
- if ( paperIndex >= 0 )
- {
- Qt::HANDLE handle = NULL;
- if( OpenPrinter( printer.data(), &handle, NULL ) )
- {
- // Retrieve DEVMODE structure for selected device
- uint size = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), NULL, NULL, 0);
- QByteArray devModeA(size);
- DEVMODE* devMode = (DEVMODE*) devModeA.data();
- DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), devMode, NULL, DM_OUT_BUFFER);
- ClosePrinter( handle );
- // Set paper size
- devMode->dmPaperSize = papers[paperIndex];
- // Create device context
- HDC printerDC = CreateDC( NULL, printer.data(), NULL, devMode );
- if( printerDC )
- {
- retVal = true;
- int logPixelsX = GetDeviceCaps( printerDC, LOGPIXELSX );
- int logPixelsY = GetDeviceCaps( printerDC, LOGPIXELSY );
- int physicalOffsetX = GetDeviceCaps( printerDC, PHYSICALOFFSETX );
- int physicalOffsetY = GetDeviceCaps( printerDC, PHYSICALOFFSETY );
- ptsLeftMargin = ptsRightMargin = ( physicalOffsetX / (double) logPixelsX * 72 );
- ptsTopMargin = ptsBottomMargin = ( physicalOffsetY / (double) logPixelsY * 72 );
- DeleteDC(printerDC);
- }
- }
- }
- delete[] papers;
- delete[] paperNames;
- }
-#endif
- return retVal;
-}
-
-//Parameter needed on win32..
-bool PrinterUtil::isPostscriptPrinter( QString printerName)
-{
-#ifdef _WIN32
- HDC dc;
- int escapeCode;
- char technology[MAX_PATH] = {0};
- QByteArray printer = printerName.local8Bit();
-
- // Create the default device context
- dc = CreateDC( NULL, printer.data(), NULL, NULL );
- if ( !dc )
- {
- qWarning( QString("isPostscriptPrinter() failed to create device context for %1").arg(printerName) );
- return false;
- }
- // test if printer support the POSTSCRIPT_PASSTHROUGH escape code
- escapeCode = POSTSCRIPT_PASSTHROUGH;
- if ( ExtEscape( dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&escapeCode, 0, NULL ) > 0 )
- {
- DeleteDC( dc );
- return true;
- }
- // test if printer support the POSTSCRIPT_DATA escape code
- escapeCode = POSTSCRIPT_DATA;
- if ( ExtEscape( dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&escapeCode, 0, NULL ) > 0 )
- {
- DeleteDC( dc );
- return true;
- }
- // try to get postscript support by testing the printer technology
- escapeCode = GETTECHNOLOGY;
- if ( ExtEscape( dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&escapeCode, 0, NULL ) > 0 )
- {
- // if GETTECHNOLOGY is supported, then ... get technology
- if ( ExtEscape( dc, GETTECHNOLOGY, 0, NULL, MAX_PATH, (LPSTR) technology ) > 0 )
- {
- // check technology string for postscript word
- strupr( technology );
- if ( strstr( technology, "POSTSCRIPT" ) )
- {
- DeleteDC( dc );
- return true;
- }
- }
- }
- DeleteDC( dc );
- return false;
-#else
- return true;
-#endif
-}
/trunk/Scribus/scribus/printerutil.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/gsutil.cpp
===================================================================
--- trunk/Scribus/scribus/gsutil.cpp (revision 10211)
+++ trunk/Scribus/scribus/gsutil.cpp (nonexistent)
@@ -1,382 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-/***************************************************************************
- gsutil.cpp - description
- -------------------
- begin : Fri Sep 14 2001
- copyright : (C) 2001 by Franz Schmid
- copyright : (C) 2006- Scribus Team (code moved from util.cpp)
- email : Franz.Schmid@altmuehlnet.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "gsutil.h"
-
-#include <qdir.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qpainter.h>
-#include <QProcess>
-#include <QPixmap>
-#include <QDebug>
-
-#include "scconfig.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include "prefsfile.h"
-#include "prefsmanager.h"
-#include "scpaths.h"
-#include "scribuscore.h"
-
-#include "scribus.h"
-
-#include "util.h"
-
-using namespace std;
-
-
-int callGS(const QStringList& args_in, const QString device)
-{
- QString cmd;
- QStringList args;
- PrefsManager* prefsManager = PrefsManager::instance();
- args.append( "-q" );
- args.append( "-dNOPAUSE" );
- args.append( "-dQUIET" );
- args.append( "-dPARANOIDSAFER" );
- args.append( "-dBATCH" );
- // Choose rendering device
- if (!device.isEmpty())
- args.append( QString("-sDEVICE=%1").arg(device) ); // user specified device
- else if (ScCore->havePNGAlpha() != 0)
- args.append( "-sDEVICE=png16m" );
- else
- args.append( "-sDEVICE=pngalpha" );
- // and antialiasing
- if (prefsManager->appPrefs.gs_AntiAliasText)
- args.append( "-dTextAlphaBits=4" );
- if (prefsManager->appPrefs.gs_AntiAliasGraphics)
- args.append( "-dGraphicsAlphaBits=4" );
-
- // Add any extra font paths being used by Scribus to gs's font search path
- PrefsContext *pc = PrefsManager::instance()->prefsFile->getContext("Fonts");
- PrefsTable *extraFonts = pc->getTable("ExtraFontDirs");
- const char sep = ScPaths::envPathSeparator;
- if (extraFonts->getRowCount() >= 1)
- cmd = QString("-sFONTPATH=%1").arg(QDir::convertSeparators(extraFonts->get(0,0)));
- for (int i = 1; i < extraFonts->getRowCount(); ++i)
- cmd += QString("%1%2").arg(sep).arg(QDir::convertSeparators(extraFonts->get(i,0)));
- if( !cmd.isEmpty() )
- args.append( cmd );
-
- args += args_in;
- args.append("-c");
- args.append("showpage");
-// qDebug(args.join(" "));
- return System( getShortPathName(prefsManager->ghostscriptExecutable()), args );
-}
-
-int callGS(const QString& args_in, const QString device)
-{
- PrefsManager* prefsManager=PrefsManager::instance();
- QString cmd1 = getShortPathName(prefsManager->ghostscriptExecutable());
- cmd1 += " -q -dNOPAUSE -dQUIET -dPARANOIDSAFER -dBATCH";
- // Choose rendering device
- if (!device.isEmpty())
- // user specified device
- cmd1 += " -sDEVICE="+device;
- else if (ScCore->havePNGAlpha() != 0)
- cmd1 += " -sDEVICE=png16m";
- else
- cmd1 += " -sDEVICE=pngalpha";
- // and antialiasing
- if (prefsManager->appPrefs.gs_AntiAliasText)
- cmd1 += " -dTextAlphaBits=4";
- if (prefsManager->appPrefs.gs_AntiAliasGraphics)
- cmd1 += " -dGraphicsAlphaBits=4";
-
- // Add any extra font paths being used by Scribus to gs's font search path
- PrefsContext *pc = PrefsManager::instance()->prefsFile->getContext("Fonts");
- PrefsTable *extraFonts = pc->getTable("ExtraFontDirs");
-#ifndef _WIN32
- if (extraFonts->getRowCount() >= 1)
- cmd1 += QString(" -sFONTPATH='%1'").arg(extraFonts->get(0,0));
- for (int i = 1; i < extraFonts->getRowCount(); ++i)
- cmd1 += QString(":'%1'").arg(extraFonts->get(i,0));
-#else
- if (extraFonts->getRowCount() >= 1)
- cmd1 += QString(" -sFONTPATH=\"%1\"").arg(extraFonts->get(0,0));
- for (int i = 1; i < extraFonts->getRowCount(); ++i)
- cmd1 += QString(";\"%1\"").arg(extraFonts->get(i,0));
-#endif
-
- // then add any user specified args and run gs
- cmd1 += " " + args_in + " -c showpage";
-// qDebug("Calling gs as: %s", cmd1.ascii());
- return system(cmd1.local8Bit());
-}
-
-int convertPS2PS(QString in, QString out, const QStringList& opts, int level)
-{
- PrefsManager* prefsManager=PrefsManager::instance();
- QStringList args;
- args.append( "-q" );
- args.append( "-dQUIET" );
- args.append( "-dNOPAUSE" );
- args.append( "-dPARANOIDSAFER" );
- args.append( "-dBATCH" );
- if( level == 2 )
- {
- int major = 0, minor = 0;
- // ps2write cannot be detected with testGSAvailability()
- // so determine availability according to gs version.
- getNumericGSVersion(major, minor);
- if ((major >=8 && minor >= 53) || major > 8)
- args.append( "-sDEVICE=ps2write" );
- else
- {
- args.append( "-sDEVICE=pswrite" );
- args.append( QString("-dLanguageLevel=%1").arg(level) );
- }
-
- }
- else
- {
- args.append( "-sDEVICE=pswrite" );
- if(level <= 3)
- args.append( QString("-dLanguageLevel=%1").arg(level) );
- }
- args += opts;
- args.append( QString("-sOutputFile=%1").arg(QDir::convertSeparators(out)) );
- args.append( QDir::convertSeparators(in) );
- int ret = System( getShortPathName(prefsManager->ghostscriptExecutable()), args );
- return ret;
-}
-
-bool testGSAvailability( void )
-{
- QStringList args;
- PrefsManager* prefsManager = PrefsManager::instance();
- return testGSAvailability(prefsManager->ghostscriptExecutable());
-}
-
-bool testGSAvailability( const QString& gsPath )
-{
- QStringList args;
- args.append( "-h" );
- QProcess proc;
- proc.start(getShortPathName(gsPath), args);
- if (!proc.waitForStarted(5000))
- return false;
- proc.waitForFinished(5000);
- return (proc.exitCode()==0);
-}
-
-bool testGSDeviceAvailability( const QString& device )
-{
- QStringList args;
- PrefsManager* prefsManager = PrefsManager::instance();
- args.append( QString("-sDEVICE=%1").arg( device ) );
- args.append( "-c" );
- args.append( "quit" );
- QProcess proc;
- proc.start(getShortPathName(prefsManager->ghostscriptExecutable()), args);
- if (!proc.waitForStarted(5000))
- return false;
- proc.waitForFinished(5000);
- return (proc.exitCode()==0);
-}
-
-// Return the GhostScript version string, or QString::null if it couldn't be retrived.
-QString getGSVersion()
-{
- QStringList args;
- args.append(QString("--version").local8Bit());
- QString gsExe = getShortPathName(PrefsManager::instance()->ghostscriptExecutable());
- QProcess proc;
- proc.start(gsExe.local8Bit(), args);
- if (proc.waitForStarted(5000))
- while (!proc.waitForFinished(5000))
- qApp->processEvents();
- QString gsVer;
- if (proc.exitStatus()==QProcess::NormalExit)
- gsVer = proc.readAllStandardOutput();
- return gsVer;
-}
-
-// Return the GhostScript major and minor version numbers.
-bool getNumericGSVersion(int & major, int & minor)
-{
- QString gs_ver_string(getGSVersion());
- return getNumericGSVersion(gs_ver_string, major, minor);
-}
-
-bool getNumericGSVersion(const QString& ver, int& major, int& minor)
-{
- // gs's version string is of the form MAJOR.MINOR, so look for the .
- // then convert to numbers. 7.07 will become (7,7) for example.
- bool success = false;
- major = ver.section('.', 0, 0).toInt(&success);
- if (!success)
- return false;
- minor = ver.section('.', 1, 1).toInt(&success);
- if (!success)
- return false;
- return true;
-}
-
-QString getGSDefaultExeName(void)
-{
- QString gsName;
-#if defined _WIN32
- // Set gsName to its default value
- gsName = "gswin32c.exe";
-
- QMap<int, QString> gplGS = getGSExePaths("SOFTWARE\\GPL Ghostscript");
- QMap<int, QString> afplGS = getGSExePaths("SOFTWARE\\AFPL Ghostscript");
- QMap<int, QString> gsVersions = gplGS.unite(afplGS);
-
- if (gsVersions.isEmpty())
- return gsName;
-
- int currentVer = 0;
- QString gsPath;
- QMap<int, QString>::ConstIterator it, itEnd = gsVersions.constEnd();
- for (it = gsVersions.constBegin(); it != itEnd; ++it)
- {
- int version = it.key();
- if (version > currentVer)
- {
- gsPath = it.data();
- QFileInfo fInfo(gsPath);
- if (fInfo.exists())
- {
- gsName = gsPath;
- currentVer = version;
- }
- }
- }
-#else
- gsName = "gs";
-#endif
- return gsName;
-}
-
-QMap<int, QString> SCRIBUS_API getGSExePaths(const char* regKey)
-{
- QMap<int, QString> gsVersions;
-#if defined _WIN32
- // Try to locate GhostScript thanks to the registry
- DWORD size;
- HKEY hKey1, hKey2;
- DWORD regType = REG_SZ;
- char regVersion[MAX_PATH];
- char regPath[MAX_PATH];
- char gsPath[MAX_PATH];
- QString gsVersion, gsName;
-
- if( RegOpenKey(HKEY_LOCAL_MACHINE, regKey, &hKey1) == ERROR_SUCCESS )
- {
- size = sizeof(regVersion) - 1;
- DWORD keyIndex = 0;
- while ( RegEnumKeyEx(hKey1, keyIndex, regVersion, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS )
- {
- int gsNumericVer, gsMajor, gsMinor;
- strcpy(regPath, regKey);
- strcat(regPath, "\\");
- strcat(regPath, regVersion);
- if (RegOpenKey(HKEY_LOCAL_MACHINE, regPath, &hKey2) == ERROR_SUCCESS)
- {
- size = sizeof(gsPath) - 1;
- if (RegQueryValueEx(hKey2, "GS_DLL", 0, &regType, (LPBYTE) gsPath, &size) == ERROR_SUCCESS)
- {
- // We now have GhostScript dll path, but we want gswin32c.exe
- // Normally gswin32c.exe and gsdll.dll are in the same directory
- if ( getNumericGSVersion(QString(regVersion), gsMajor, gsMinor) )
- {
- gsNumericVer = gsMajor * 1000 + gsMinor;
- gsName = gsPath;
- size = gsName.findRev("\\");
- if (size > 0)
- {
- gsName = gsName.left(size + 1);
- gsName += "gswin32c.exe";
- gsName.replace("\\", "/");
- gsVersions.insert(gsNumericVer, gsName);
- }
- }
- }
- RegCloseKey(hKey2);
- }
- keyIndex++;
- }
- RegCloseKey(hKey1);
- }
-#else
- int gsNumericVer, gsMajor, gsMinor;
- PrefsManager* prefsManager=PrefsManager::instance();
- if (getNumericGSVersion(gsMajor, gsMinor))
- {
- gsNumericVer = gsMajor * 1000 + gsMinor;
- gsVersions.insert(gsNumericVer, prefsManager->ghostscriptExecutable());
- }
-#endif
- return gsVersions;
-}
-
-QPixmap LoadPDF(QString fn, int Page, int Size, int *w, int *h)
-{
- QString tmp, cmd1, cmd2;
- QString pdfFile = QDir::convertSeparators(fn);
- QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
- QPixmap pm;
- int ret = -1;
- tmp.setNum(Page);
- QStringList args;
- args.append("-r72");
-// args.append("-sOutputFile=\""+tmpFile+"\"");
- args.append("-sOutputFile="+tmpFile);
- args.append("-dFirstPage="+tmp);
- args.append("-dLastPage="+tmp);
-// args.append("\""+pdfFile+"\"");
- args.append(pdfFile);
- ret = callGS(args);
- if (ret == 0)
- {
- QImage image;
- image.load(tmpFile);
- unlink(tmpFile);
- QImage im2;
- *h = image.height();
- *w = image.width();
- double sx = image.width() / static_cast<double>(Size);
- double sy = image.height() / static_cast<double>(Size);
- double t = (sy < sx ? sx : sy);
- im2 = image.smoothScale(static_cast<int>(image.width() / t), static_cast<int>(image.height() / t));
- pm.convertFromImage(im2);
- QPainter p;
- p.begin(&pm);
- p.setBrush(Qt::NoBrush);
- p.setPen(Qt::black);
- p.drawRect(0, 0, pm.width(), pm.height());
- p.end();
- im2.detach();
- }
- return pm;
-}
-
-
/trunk/Scribus/scribus/gsutil.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/formatutils.cpp
===================================================================
--- trunk/Scribus/scribus/formatutils.cpp (revision 10211)
+++ trunk/Scribus/scribus/formatutils.cpp (nonexistent)
@@ -1,170 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-
-#include <QImageReader>
-#include <QMapIterator>
-
-#include "formatutils.h"
-
-FormatsManager* FormatsManager::_instance = 0;
-
-FormatsManager::FormatsManager()
-{
- m_fmtList << "TIFF" << "PS" << "EPS" << "JPEG" << "PSD" << "PDF" << "PAT";
-
- m_fmts.insert(FormatsManager::TIFF, QStringList());
- m_fmts.insert(FormatsManager::PS, QStringList());
- m_fmts.insert(FormatsManager::EPS, QStringList());
- m_fmts.insert(FormatsManager::JPEG, QStringList());
- m_fmts.insert(FormatsManager::PSD, QStringList());
- m_fmts.insert(FormatsManager::PDF, QStringList());
- m_fmts.insert(FormatsManager::PAT, QStringList());
-
- m_fmts[FormatsManager::TIFF] << "tif" << "tiff";
- m_fmts[FormatsManager::PS] << "ps";
- m_fmts[FormatsManager::EPS] << "eps" << "epsf" << "epsi";
- m_fmts[FormatsManager::JPEG] << "jpg" << "jpeg";
- m_fmts[FormatsManager::PSD] << "psd";
- m_fmts[FormatsManager::PDF] << "pdf";
- m_fmts[FormatsManager::PAT] << "pat";
-
- m_supportedImageFormats=QImageReader::supportedImageFormats();
- updateSupportedImageFormats(m_supportedImageFormats);
-}
-
-FormatsManager::~FormatsManager()
-{
-}
-
-FormatsManager* FormatsManager::instance()
-{
- if (_instance == 0)
- _instance = new FormatsManager();
-
- return _instance;
-}
-
-void FormatsManager::deleteInstance()
-{
- if (_instance)
- delete _instance;
- _instance = 0;
-}
-
-void FormatsManager::imageFormatSupported(const QString& ext)
-{
-
-}
-
-void FormatsManager::updateSupportedImageFormats(QList<QByteArray>& supportedImageFormats)
-{
- QMapIterator<int, QStringList> it(m_fmts);
- while (it.hasNext())
- {
- it.next();
- QStringListIterator itSL(it.value());
- while (itSL.hasNext())
- {
- QString t(itSL.next());
- supportedImageFormats.append(t.toLocal8Bit());
- }
- }
-}
-
-void FormatsManager::fileTypeStrings(int type, QString& formatList, QString& formatText, bool lowerCaseOnly)
-{
- QString fmtText;
- QString fmtList;
- QMapIterator<int, QStringList> it(m_fmts);
- bool first=true;
- int n=0;
- while (it.hasNext())
- {
- it.next();
- if (type & it.key())
- {
- if (first)
- first=false;
- else
- fmtList += " ";
- QString text=m_fmtList[n] + " (";
- QStringListIterator itSL(it.value());
- while (itSL.hasNext())
- {
- QString t("*." + itSL.next());
- fmtList += t;
- text += t;
- if(!lowerCaseOnly)
- {
- fmtList += " " + t.upper();
- text += " " + t.upper();
- }
- if (itSL.hasNext())
- {
- fmtList += " ";
- text += " ";
- }
- }
- text += ");;";
- fmtText += text;
- }
- ++n;
- }
- formatList+=fmtList;
- formatText+=fmtText;
-}
-
-bool extensionIndicatesPDF(const QString &ext)
-{
-// QStringList strl;
-// strl << "pdf";
-// return strl.contains(ext, Qt::CaseInsensitive);
- return (QString::compare("pdf", ext, Qt::CaseInsensitive) == 0);
-}
-
-bool extensionIndicatesEPS(const QString &ext)
-{
- QStringList strl;
- strl << "eps" << "epsf" << "epsi";
- return strl.contains(ext, Qt::CaseInsensitive);
-}
-
-bool extensionIndicatesEPSorPS(const QString &ext)
-{
- QStringList strl;
- strl << "eps" << "epsf" << "epsi" << "ps";
- return strl.contains(ext, Qt::CaseInsensitive);
-}
-
-bool extensionIndicatesTIFF(const QString &ext)
-{
- QStringList strl;
- strl << "tif" << "tiff";
- return strl.contains(ext, Qt::CaseInsensitive);
-}
-
-bool extensionIndicatesPSD(const QString &ext)
-{
-// QStringList strl;
-// strl << "psd";
-// return strl.contains(ext, Qt::CaseInsensitive);
- return (QString::compare("psd", ext, Qt::CaseInsensitive) == 0);
-}
-
-bool extensionIndicatesJPEG(const QString &ext)
-{
- QStringList strl;
- strl << "jpg" << "jpeg";
- return strl.contains(ext, Qt::CaseInsensitive);
-}
-
-bool extensionIndicatesPattern(const QString &ext)
-{
- QStringList strl;
- strl << "pat";
- return strl.contains(ext, Qt::CaseInsensitive);
-}
Index: trunk/Scribus/scribus/cmsutil.h
===================================================================
--- trunk/Scribus/scribus/cmsutil.h (revision 10211)
+++ trunk/Scribus/scribus/cmsutil.h (nonexistent)
@@ -1,25 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#ifndef CMSUTIL_H
-#define CMSUTIL_H
-
-#include "scconfig.h"
-#include "scribusapi.h"
-#if defined(HAVE_CMS)
-#include CMS_INC
-
-cmsHTRANSFORM scCmsCreateTransform(cmsHPROFILE Input, DWORD InputFormat,
- cmsHPROFILE Output,DWORD OutputFormat,
- int Intent, DWORD dwFlags);
-
-cmsHTRANSFORM scCmsCreateProofingTransform(cmsHPROFILE Input, DWORD InputFormat,
- cmsHPROFILE Output,DWORD OutputFormat,
- cmsHPROFILE Proofing,int Intent,
- int ProofingIntent, DWORD dwFlags);
-
-#endif
-#endif
/trunk/Scribus/scribus/cmsutil.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/scribuscore.cpp
===================================================================
--- trunk/Scribus/scribus/scribuscore.cpp (revision 10211)
+++ trunk/Scribus/scribus/scribuscore.cpp (revision 10212)
@@ -25,20 +25,20 @@
//Added by qt3to4:
#include <QByteArray>
-#include "scribuscore.h"
-//#include "scribuscore.moc"
-#include "util.h"
#include "commonstrings.h"
#include "filewatcher.h"
-#include "gsutil.h"
#include "pluginmanager.h"
#include "prefsmanager.h"
#include "scpaths.h"
+#include "scribusapp.h"
+#include "scribuscore.h"
#include "splash.h"
-#include "scribusapp.h"
#include "undomanager.h"
+#include "util.h"
+#include "util_ghostscript.h"
+
extern ScribusQApp* ScQApp;
#include "cmserrorhandling.h"
/trunk/Scribus/scribus/util_formats.cpp
0,0 → 1,170
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include <QImageReader>
#include <QMapIterator>
 
#include "util_formats.h"
 
FormatsManager* FormatsManager::_instance = 0;
 
FormatsManager::FormatsManager()
{
m_fmtList << "TIFF" << "PS" << "EPS" << "JPEG" << "PSD" << "PDF" << "PAT";
m_fmts.insert(FormatsManager::TIFF, QStringList());
m_fmts.insert(FormatsManager::PS, QStringList());
m_fmts.insert(FormatsManager::EPS, QStringList());
m_fmts.insert(FormatsManager::JPEG, QStringList());
m_fmts.insert(FormatsManager::PSD, QStringList());
m_fmts.insert(FormatsManager::PDF, QStringList());
m_fmts.insert(FormatsManager::PAT, QStringList());
 
m_fmts[FormatsManager::TIFF] << "tif" << "tiff";
m_fmts[FormatsManager::PS] << "ps";
m_fmts[FormatsManager::EPS] << "eps" << "epsf" << "epsi";
m_fmts[FormatsManager::JPEG] << "jpg" << "jpeg";
m_fmts[FormatsManager::PSD] << "psd";
m_fmts[FormatsManager::PDF] << "pdf";
m_fmts[FormatsManager::PAT] << "pat";
m_supportedImageFormats=QImageReader::supportedImageFormats();
updateSupportedImageFormats(m_supportedImageFormats);
}
 
FormatsManager::~FormatsManager()
{
}
 
FormatsManager* FormatsManager::instance()
{
if (_instance == 0)
_instance = new FormatsManager();
 
return _instance;
}
 
void FormatsManager::deleteInstance()
{
if (_instance)
delete _instance;
_instance = 0;
}
 
void FormatsManager::imageFormatSupported(const QString& ext)
{
}
 
void FormatsManager::updateSupportedImageFormats(QList<QByteArray>& supportedImageFormats)
{
QMapIterator<int, QStringList> it(m_fmts);
while (it.hasNext())
{
it.next();
QStringListIterator itSL(it.value());
while (itSL.hasNext())
{
QString t(itSL.next());
supportedImageFormats.append(t.toLocal8Bit());
}
}
}
 
void FormatsManager::fileTypeStrings(int type, QString& formatList, QString& formatText, bool lowerCaseOnly)
{
QString fmtText;
QString fmtList;
QMapIterator<int, QStringList> it(m_fmts);
bool first=true;
int n=0;
while (it.hasNext())
{
it.next();
if (type & it.key())
{
if (first)
first=false;
else
fmtList += " ";
QString text=m_fmtList[n] + " (";
QStringListIterator itSL(it.value());
while (itSL.hasNext())
{
QString t("*." + itSL.next());
fmtList += t;
text += t;
if(!lowerCaseOnly)
{
fmtList += " " + t.upper();
text += " " + t.upper();
}
if (itSL.hasNext())
{
fmtList += " ";
text += " ";
}
}
text += ");;";
fmtText += text;
}
++n;
}
formatList+=fmtList;
formatText+=fmtText;
}
 
bool extensionIndicatesPDF(const QString &ext)
{
// QStringList strl;
// strl << "pdf";
// return strl.contains(ext, Qt::CaseInsensitive);
return (QString::compare("pdf", ext, Qt::CaseInsensitive) == 0);
}
 
bool extensionIndicatesEPS(const QString &ext)
{
QStringList strl;
strl << "eps" << "epsf" << "epsi";
return strl.contains(ext, Qt::CaseInsensitive);
}
 
bool extensionIndicatesEPSorPS(const QString &ext)
{
QStringList strl;
strl << "eps" << "epsf" << "epsi" << "ps";
return strl.contains(ext, Qt::CaseInsensitive);
}
 
bool extensionIndicatesTIFF(const QString &ext)
{
QStringList strl;
strl << "tif" << "tiff";
return strl.contains(ext, Qt::CaseInsensitive);
}
 
bool extensionIndicatesPSD(const QString &ext)
{
// QStringList strl;
// strl << "psd";
// return strl.contains(ext, Qt::CaseInsensitive);
return (QString::compare("psd", ext, Qt::CaseInsensitive) == 0);
}
 
bool extensionIndicatesJPEG(const QString &ext)
{
QStringList strl;
strl << "jpg" << "jpeg";
return strl.contains(ext, Qt::CaseInsensitive);
}
 
bool extensionIndicatesPattern(const QString &ext)
{
QStringList strl;
strl << "pat";
return strl.contains(ext, Qt::CaseInsensitive);
}
/trunk/Scribus/scribus/about.cpp
28,7 → 28,7
#include <cairo.h>
#endif
 
#include "gsutil.h"
#include "util_ghostscript.h"
#include "util_icon.h"
#include "upgradechecker.h"
#include "langmgr.h"
/trunk/Scribus/scribus/util_cms.h
0,0 → 1,25
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef CMSUTIL_H
#define CMSUTIL_H
 
#include "scconfig.h"
#include "scribusapi.h"
#if defined(HAVE_CMS)
#include CMS_INC
 
cmsHTRANSFORM scCmsCreateTransform(cmsHPROFILE Input, DWORD InputFormat,
cmsHPROFILE Output,DWORD OutputFormat,
int Intent, DWORD dwFlags);
 
cmsHTRANSFORM scCmsCreateProofingTransform(cmsHPROFILE Input, DWORD InputFormat,
cmsHPROFILE Output,DWORD OutputFormat,
cmsHPROFILE Proofing,int Intent,
int ProofingIntent, DWORD dwFlags);
 
#endif
#endif
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/prefsmanager.cpp
===================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (revision 10211)
+++ trunk/Scribus/scribus/prefsmanager.cpp (revision 10212)
@@ -46,8 +46,8 @@
#include "scribuscore.h"
#include "scribusstructs.h"
#include "scribuscore.h"
-#include "gsutil.h"
#include "util.h"
+#include "util_ghostscript.h"
#include "werktoolb.h"
/trunk/Scribus/scribus/scimgdataloader_pdf.cpp
6,7 → 6,8
*/
#include <qfile.h>
#include <qfileinfo.h>
#include "gsutil.h"
 
#include "util_ghostscript.h"
#include "scpaths.h"
#include "scribuscore.h"
#include "scimgdataloader_pdf.h"
/trunk/Scribus/scribus/util_printer.cpp
0,0 → 1,272
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "util_printer.h"
#include "scconfig.h"
 
#if defined( HAVE_CUPS )
#include <cups/cups.h>
#elif defined(_WIN32)
#include <windows.h>
#include <winspool.h>
#endif
 
#include <qstringlist.h>
#include <QDataStream>
#include <QByteArray>
#include "util.h"
#include "scribus.h"
#include "scribuscore.h"
 
QStringList PrinterUtil::getPrinterNames()
{
QString printerName;
QStringList printerNames;
#if defined (HAVE_CUPS)
cups_dest_t *dests;
int num_dests = cupsGetDests(&dests);
for (int pr = 0; pr < num_dests; ++pr)
{
printerName = QString(dests[pr].name);
printerNames.append(printerName);
}
cupsFreeDests(num_dests, dests);
#elif defined(_WIN32)
DWORD size;
DWORD numPrinters;
PRINTER_INFO_2* printerInfos = NULL;
EnumPrinters ( PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS , NULL, 2, NULL, 0, &size, &numPrinters );
printerInfos = (PRINTER_INFO_2*) malloc(size);
if ( EnumPrinters ( PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, 2, (LPBYTE) printerInfos, size, &size, &numPrinters ) )
{
for ( uint i = 0; i < numPrinters; i++)
{
printerName = printerInfos[i].pPrinterName;
printerNames.append(printerName);
}
printerNames.sort();
}
if ( printerInfos) free(printerInfos);
#else
QString tmp;
QString Pcap;
QStringList wt;
if (loadText("/etc/printcap", &Pcap))
{
QDataStream ts(&Pcap, QIODevice::ReadOnly);
while(!ts.atEnd())
{
tmp = readLinefromDataStream(ts);
if (tmp.isEmpty())
continue;
if ((tmp[0] != '#') && (tmp[0] != ' ') && (tmp[0] != '\n') && (tmp[0] != '\t'))
{
tmp = tmp.stripWhiteSpace();
tmp = tmp.left(tmp.length() - (tmp.right(2) == ":\\" ? 2 : 1));
wt = QStringList::split("|", tmp);
printerName = wt[0];
printerNames.append(printerName);
}
}
}
#endif
return printerNames;
}
 
#if defined(_WIN32)
bool PrinterUtil::getDefaultSettings( QString printerName, QByteArray& devModeA )
{
bool done;
uint size;
QByteArray printer;
LONG result = IDOK+1;
Qt::HANDLE handle = NULL;
printer = printerName.local8Bit();
// Get the printer handle
done = OpenPrinter( printer.data(), &handle, NULL );
if(!done)
return false;
// Get size of DEVMODE structure (public + private data)
size = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), NULL, NULL, 0);
// Allocate the memory needed by the DEVMODE structure
devModeA.resize( size );
// Retrieve printer default settings
result = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), (DEVMODE*) devModeA.data(), NULL, DM_OUT_BUFFER);
// Free the printer handle
ClosePrinter( handle );
return ( result == IDOK );
}
#endif
 
#if defined(_WIN32)
bool PrinterUtil::initDeviceSettings( QString printerName, QByteArray& devModeA )
{
bool done;
uint size;
QByteArray printer;
LONG result = IDOK+1;
Qt::HANDLE handle = NULL;
printer = printerName.local8Bit();
// Get the printer handle
done = OpenPrinter( printer.data(), &handle, NULL );
if(!done)
return false;
// Get size of DEVMODE structure (public + private data)
size = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), NULL, NULL, 0);
// Compare size with DevMode structure size
if( devModeA.size() == size )
{
// Merge printer settings
result = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), (DEVMODE*) devModeA.data(), (DEVMODE*) devModeA.data(), DM_IN_BUFFER | DM_OUT_BUFFER);
}
else
{
// Retrieve default settings
devModeA.resize( size );
result = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), (DEVMODE*) devModeA.data(), NULL, DM_OUT_BUFFER);
}
done = ( result == IDOK);
// Free the printer handle
ClosePrinter( handle );
return done;
}
#endif
 
bool PrinterUtil::getPrinterMarginValues(const QString& printerName, const QString& pageSize, double& ptsTopMargin, double& ptsBottomMargin, double& ptsLeftMargin, double& ptsRightMargin)
{
bool retVal=false;
#if defined(HAVE_CUPS)
const char *filename; // tmp PPD filename
filename=cupsGetPPD(printerName);
if (filename!=NULL)
{
ppd_file_t *ppd; // PPD data
ppd = ppdOpenFile(filename);
if (ppd!=NULL)
{
ppd_size_t *size; // page size data, null if printer doesnt support selected size
size = ppdPageSize(ppd, pageSize);
if (size!=NULL)
{
//Store in pts for returning via getNewPrinterMargins in pts
retVal=true;
ptsTopMargin=size->length-size->top;
ptsBottomMargin=size->bottom;
ptsLeftMargin=size->left;
ptsRightMargin=size->width-size->right;
}
ppdClose(ppd);
}
}
#elif defined(_WIN32)
DWORD nPaper;
DWORD nPaperNames;
typedef char char64[64];
QByteArray printer = printerName.local8Bit();
nPaper = DeviceCapabilities( printer.data(), NULL, DC_PAPERS, NULL, NULL );
nPaperNames = DeviceCapabilities( printer.data(), NULL, DC_PAPERNAMES, NULL, NULL );
if ( (nPaper > 0) && (nPaperNames > 0) && (nPaper == nPaperNames) )
{
int paperIndex = -1;
DWORD *papers = new DWORD[nPaper];
char64 *paperNames = new char64[nPaperNames];
DWORD s1 = DeviceCapabilities( printer.data(), NULL, DC_PAPERS, (LPSTR) papers, NULL );
DWORD s2 = DeviceCapabilities( printer.data(), NULL, DC_PAPERNAMES, (LPSTR) paperNames, NULL );
for ( uint i = 0; i < nPaperNames; i++ )
{
if ( pageSize == QString(paperNames[i]) )
{
paperIndex = i;
break;
}
}
if ( paperIndex >= 0 )
{
Qt::HANDLE handle = NULL;
if( OpenPrinter( printer.data(), &handle, NULL ) )
{
// Retrieve DEVMODE structure for selected device
uint size = DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), NULL, NULL, 0);
QByteArray devModeA(size);
DEVMODE* devMode = (DEVMODE*) devModeA.data();
DocumentProperties( ScCore->primaryMainWindow()->winId(), handle, printer.data(), devMode, NULL, DM_OUT_BUFFER);
ClosePrinter( handle );
// Set paper size
devMode->dmPaperSize = papers[paperIndex];
// Create device context
HDC printerDC = CreateDC( NULL, printer.data(), NULL, devMode );
if( printerDC )
{
retVal = true;
int logPixelsX = GetDeviceCaps( printerDC, LOGPIXELSX );
int logPixelsY = GetDeviceCaps( printerDC, LOGPIXELSY );
int physicalOffsetX = GetDeviceCaps( printerDC, PHYSICALOFFSETX );
int physicalOffsetY = GetDeviceCaps( printerDC, PHYSICALOFFSETY );
ptsLeftMargin = ptsRightMargin = ( physicalOffsetX / (double) logPixelsX * 72 );
ptsTopMargin = ptsBottomMargin = ( physicalOffsetY / (double) logPixelsY * 72 );
DeleteDC(printerDC);
}
}
}
delete[] papers;
delete[] paperNames;
}
#endif
return retVal;
}
 
//Parameter needed on win32..
bool PrinterUtil::isPostscriptPrinter( QString printerName)
{
#ifdef _WIN32
HDC dc;
int escapeCode;
char technology[MAX_PATH] = {0};
QByteArray printer = printerName.local8Bit();
// Create the default device context
dc = CreateDC( NULL, printer.data(), NULL, NULL );
if ( !dc )
{
qWarning( QString("isPostscriptPrinter() failed to create device context for %1").arg(printerName) );
return false;
}
// test if printer support the POSTSCRIPT_PASSTHROUGH escape code
escapeCode = POSTSCRIPT_PASSTHROUGH;
if ( ExtEscape( dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&escapeCode, 0, NULL ) > 0 )
{
DeleteDC( dc );
return true;
}
// test if printer support the POSTSCRIPT_DATA escape code
escapeCode = POSTSCRIPT_DATA;
if ( ExtEscape( dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&escapeCode, 0, NULL ) > 0 )
{
DeleteDC( dc );
return true;
}
// try to get postscript support by testing the printer technology
escapeCode = GETTECHNOLOGY;
if ( ExtEscape( dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&escapeCode, 0, NULL ) > 0 )
{
// if GETTECHNOLOGY is supported, then ... get technology
if ( ExtEscape( dc, GETTECHNOLOGY, 0, NULL, MAX_PATH, (LPSTR) technology ) > 0 )
{
// check technology string for postscript word
strupr( technology );
if ( strstr( technology, "POSTSCRIPT" ) )
{
DeleteDC( dc );
return true;
}
}
}
DeleteDC( dc );
return false;
#else
return true;
#endif
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/util_ghostscript.h
===================================================================
--- trunk/Scribus/scribus/util_ghostscript.h (nonexistent)
+++ trunk/Scribus/scribus/util_ghostscript.h (revision 10212)
@@ -0,0 +1,55 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+
+/*!
+ * @brief GS utility fucntions
+ * Moved functions written or modified by various people over the time from util.cpp
+ *
+ * @author Craig Bradney
+ */
+#ifndef _GSUTIL_H
+#define _GSUTIL_H
+
+#include <qpixmap.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <QMap>
+
+#include "scribusapi.h"
+
+QPixmap SCRIBUS_API LoadPDF(QString fn, int Page, int Size, int *w, int *h);
+/**
+ * @brief Call GhostScript synchronously and store output
+ *
+ * The gs commands are all similar and consist of a few constant
+ * arguments, the variable arguments and the end arguments which
+ * are also invariant. It will always use -q -dNOPAUSE and
+ * will always end with -c showpage -c quit. It also does automatic
+ * device selection unless overridden, and uses the user's antialiasing
+ * preferences and font search path.
+ *
+ * Shell metacharacters are not expanded - that includes quotes.
+ * @sa System .
+ *
+ * @param args_in Custom arguments to GhostScript
+ * @param device GS device to use (defaults to an image device if omitted)
+ */
+int SCRIBUS_API callGS(const QStringList& args_in, const QString device="");
+int SCRIBUS_API callGS(const QString& args_in, const QString device="");
+int SCRIBUS_API convertPS2PS(QString in, QString out, const QStringList& opts, int level);
+bool SCRIBUS_API testGSAvailability( void );
+bool SCRIBUS_API testGSAvailability( const QString& gsPath );
+bool SCRIBUS_API testGSDeviceAvailability( const QString& device );
+/*! \brief Return gs version. If gs couldn't be found or there was a problem parsing output, return false
+ (in which case minor and major have undefined values).
+ \retval QString version or false on error */
+QString SCRIBUS_API getGSVersion();
+bool SCRIBUS_API getNumericGSVersion(int & major, int & minor);
+bool SCRIBUS_API getNumericGSVersion(const QString& ver, int&major, int& minor);
+QString SCRIBUS_API getGSDefaultExeName(void);
+QMap<int, QString> SCRIBUS_API getGSExePaths(const char* regKey);
+#endif
/trunk/Scribus/scribus/util_ghostscript.h
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/picstatus.cpp
===================================================================
--- trunk/Scribus/scribus/picstatus.cpp (revision 10211)
+++ trunk/Scribus/scribus/picstatus.cpp (revision 10212)
@@ -37,7 +37,6 @@
#include "effectsdialog.h"
#include "extimageprops.h"
#include "filesearch.h"
-#include "formatutils.h"
#include "pageitem.h"
#include "picsearch.h"
#include "picsearchoptions.h"
@@ -44,6 +43,7 @@
#include "scribuscore.h"
#include "scribusdoc.h"
#include "util_color.h"
+#include "util_formats.h"
#include "util_icon.h"
/trunk/Scribus/scribus/scpageoutput.cpp
6,13 → 6,13
*/
#include "scpageoutput.h"
 
#include <QList>
#include <QStack>
#include <QList>
#include "pageitem.h"
 
#include "cmsettings.h"
#include "commonstrings.h"
#include "formatutils.h"
#include "prefsmanager.h"
#include "page.h"
#include "pageitem.h"
#include "pageitem_imageframe.h"
#include "pageitem_line.h"
#include "pageitem_pathtext.h"
19,13 → 19,15
#include "pageitem_polygon.h"
#include "pageitem_polyline.h"
#include "pageitem_textframe.h"
#include "prefsmanager.h"
#include "scfonts.h"
#include "scimage.h"
#include "scribus.h"
#include "scimage.h"
#include "scribusdoc.h"
#include "util.h"
#include "scribusdoc.h"
#include "page.h"
#include "util_formats.h"
 
 
MarksOptions::MarksOptions(void)
{
markOffset = 0.0;
/trunk/Scribus/scribus/pageitem.cpp
41,35 → 41,33
#include <cmath>
#include <cassert>
 
#include "formatutils.h"
#include "scpaths.h"
#include "colorblind.h"
#include "commonstrings.h"
#include "cpalette.h"
#include "guidemanager.h"
#include "mpalette.h"
#include "page.h"
#include "prefsmanager.h"
#include "resourcecollection.h"
#include "sccolorengine.h"
#include "scconfig.h"
#include "scpainter.h"
#include "scpaths.h"
#include "scpattern.h"
#include "scribus.h"
#include "scribusapp.h"
#include "scribuscore.h"
#include "scribusapp.h"
#include "scribusdoc.h"
#include "scribusstructs.h"
#include "scribusdoc.h"
#include "scribuswin.h"
#include "selection.h"
#include "prefsmanager.h"
#include "text/nlsconfig.h"
#include "undomanager.h"
#include "undostate.h"
#include "mpalette.h"
#include "cpalette.h"
#include "commonstrings.h"
#include "scconfig.h"
#include "guidemanager.h"
#include "sccolorengine.h"
#include "resourcecollection.h"
 
#include "util.h"
#include "util_formats.h"
#include "util_math.h"
#include "scpattern.h"
#include "colorblind.h"
 
#include "text/nlsconfig.h"
 
using namespace std;
 
PageItem::PageItem(const PageItem & other)
/trunk/Scribus/scribus/scribusview.cpp
75,21 → 75,18
#endif
#include "scribus.h"
 
#include "util_color.h"
#include "formatutils.h"
 
#include "actionmanager.h"
#include "commonstrings.h"
#include "extimageprops.h"
#include "filewatcher.h"
#include "guidemanager.h"
#include "hruler.h"
#include "hyphenator.h"
#include "insertTable.h"
#include "mpalette.h"
#include "scribusXml.h"
#include "selection.h"
#include "serializer.h"
#include "insertTable.h"
#include "hruler.h"
#include "vruler.h"
#include "filewatcher.h"
#include "undomanager.h"
#include "units.h"
#include "extimageprops.h"
#include "oneclick.h"
#include "page.h"
#include "pageitemattributes.h"
#include "pageitem_imageframe.h"
#include "pageitem_line.h"
#include "pageitem_pathtext.h"
96,29 → 93,33
#include "pageitem_polygon.h"
#include "pageitem_polyline.h"
#include "pageitem_textframe.h"
#include "pageitemattributes.h"
#include "pageselector.h"
#include "scpaths.h"
#include "actionmanager.h"
#include <tiffio.h>
#include CMS_INC
 
#include "scmessagebox.h"
#include "util.h"
#include "story.h"
#include "prefsmanager.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "rulermover.h"
#include "hyphenator.h"
#include "commonstrings.h"
#include "guidemanager.h"
#include "oneclick.h"
#include "text/nlsconfig.h"
#include "scmessagebox.h"
#include "scpaths.h"
#include "scrap.h"
#include "scribusXml.h"
#include "selection.h"
#include "serializer.h"
#include "stencilreader.h"
#include "story.h"
#include "text/nlsconfig.h"
#include "undomanager.h"
#include "units.h"
#include "util.h"
#include "util_color.h"
#include "util_formats.h"
#include "util_icon.h"
#include "util_math.h"
#include "vruler.h"
#include <tiffio.h>
#include CMS_INC
 
 
using namespace std;
 
 
/trunk/Scribus/scribus/util_printer.h
0,0 → 1,75
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef PRINTERUTIL_H
#define PRINTERUTIL_H
 
#include "scribusapi.h"
 
#include <qstring.h>
 
class QStringList;
 
class SCRIBUS_API PrinterUtil
{
public:
PrinterUtil() {};
~PrinterUtil() {};
QStringList static getPrinterNames();
 
#if defined(_WIN32)
/**
* @brief Get the defaults settings for a specified printer (Windows only)
*
* This function retrieve the default settings for a specified
* printer and return true on success
* This function is available only on Windows systems
*
* @param printerName the printer name
* @param devModeA an array which will store the DEVMODE structure with printer settings
* @return true if default settings were successfully retrieved.
*/
static bool getDefaultSettings( QString printerName, QByteArray& devModeA );
/**
* @brief Initialize print options dialog box settings (Windows only)
*
* This function initialize the print options dialog box for a specified
* printer and return true on success
* This function is available only on Windows systems
*
* @param printerName the printer name
* @param devModeA an array storing the DEVMODE structure for the specified printer
* @return true if default settings were successfully retrieved.
*/
static bool initDeviceSettings( QString printerName, QByteArray& devModeA );
#endif
/**
* @brief Get the 4 minimum page margins for a certain paper size on the given printer
*
* @param printerName the printer name
* @param pageSize the page size to get the margins for
* @param ptsTopMargin the page's top margin in points
* @param m_ptsBottomMargin the page's bottom margin in points
* @param m_ptsLeftMargin the page's left margin in points
* @param m_ptsRightMargin the page's right margin in points
\retval bool true on success
*/
static bool getPrinterMarginValues( const QString& printerName, const QString& pageSize, double& ptsTopMargin, double& m_ptsBottomMargin, double& m_ptsLeftMargin, double& m_ptsRightMargin);
/**
* @brief Check if a specified printer supports postscript input
*
* On Windows, the function test postscript support for a specified printer
* and return true if ps is supported
* On non Windows systems, the function always return true
*
* @param printerName the printer name
* @return true is printer support postscript, false otherwise.
*
*/
static bool isPostscriptPrinter( QString printerName );
};
 
#endif // DRUCK_H
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/scribus.cpp
===================================================================
--- trunk/Scribus/scribus/scribus.cpp (revision 10211)
+++ trunk/Scribus/scribus/scribus.cpp (revision 10212)
@@ -70,137 +70,135 @@
#include <signal.h>
#include <string>
-#include "sccombobox.h"
-#include "scribusapp.h"
-#include "scribuscore.h"
-#include "scribus.h"
-#include "formatutils.h"
-#include "newfile.h"
-#include "page.h"
-#include "query.h"
-#include "multipleduplicate.h"
-#include "docinfo.h"
-#include "reformdoc.h"
-#include "serializer.h"
-#include "aligndistribute.h"
-//#include "fmitem.h"
-#include "fontprefs.h"
-#include "prefs.h"
-#include "prefscontext.h"
-#include "prefstable.h"
-#include "pdfopts.h"
-#include "pdflib.h"
-#include "inspage.h"
-#include "delpages.h"
-#include "movepage.h"
-#include "helpbrowser.h"
-#include "scribusXml.h"
#include "about.h"
#include "aboutplugins.h"
-#include "pslib.h"
-#include "druck.h"
-// #include "editformats.h"
-#include "muster.h"
-#include "newtemp.h"
+#include "actionmanager.h"
+#include "aligndistribute.h"
+#include "annot.h"
+#include "annota.h"
#include "applytemplatedialog.h"
-#include "picstatus.h"
-#include "customfdialog.h"
+#include "arrowchooser.h"
+#include "autoform.h"
+#include "bookpalette.h"
+#include "charselect.h"
+#include "checkDocument.h"
#include "cmsprefs.h"
-#include "annot.h"
-#include "annota.h"
-#include "javadocs.h"
+#include "collect4output.h"
+#include "colorcombo.h"
#include "colorm.h"
-#include "mpalette.h"
+#include "commonstrings.h"
#include "cpalette.h"
-#include "bookpalette.h"
-#include "seiten.h"
-#include "layers.h"
-#include "frameedit.h"
-#include "splash.h"
-#include "measurements.h"
-#include "gtgettext.h"
+#include "customfdialog.h"
+#include "delpages.h"
+#include "desaxe/digester.h"
+#include "desaxe/saxXML.h"
+#include "desaxe/simple_actions.h"
+#include "docinfo.h"
+#include "docitemattrprefs.h"
+#include "documentchecker.h"
+#include "documentinformation.h"
+#include "druck.h"
+#include "effectsdialog.h"
#include "fileloader.h"
-#include "arrowchooser.h"
-#include "tabtypography.h"
-#include "tabguides.h"
-#include "tabtools.h"
-#include "undogui.h"
#include "filewatcher.h"
-#include "charselect.h"
-#include "checkDocument.h"
-#include "tabcheckdoc.h"
-#include "tabpdfoptions.h"
-#include "docitemattrprefs.h"
-#include "pageitemattributes.h"
-#include "pageitem_textframe.h"
-#include "pageitem_imageframe.h"
-#include "tocindexprefs.h"
-#include "tocgenerator.h"
-#include "collect4output.h"
+#include "fontcombo.h"
+#include "fontprefs.h"
#include "fpoint.h"
#include "fpointarray.h"
-#include "hysettings.h"
+#include "frameedit.h"
+#include "gtgettext.h"
#include "guidemanager.h"
-#include "mergedoc.h"
-// #include "lineformats.h"
-#include "story.h"
-#include "autoform.h"
-#include "tabmanager.h"
-#include "search.h"
-#include "fontcombo.h"
-#include "colorcombo.h"
-#include "prefsfile.h"
-#include "undomanager.h"
-#include "polygonwidget.h"
-#include "werktoolb.h"
-#include "units.h"
+#include "helpbrowser.h"
#include "hruler.h"
-#include "vruler.h"
-#include "pageselector.h"
-#include "scraction.h"
-#include "menumanager.h"
-#include "undostate.h"
-#include "tree.h"
-#include "scrap.h"
-#include "pluginmanager.h"
-#include "scpaths.h"
-#include "pdfoptions.h"
-#include "actionmanager.h"
-#include "documentinformation.h"
-#include "effectsdialog.h"
-#include "documentchecker.h"
-#include "gsutil.h"
-#include "pagesize.h"
+#include "hyphenator.h"
+#include "hysettings.h"
+#include "imageinfodialog.h"
+#include "insertaframe.h"
+#include "inspage.h"
+#include "javadocs.h"
+#include "langmgr.h"
+#include "layers.h"
#include "loremipsum.h"
#include "marginWidget.h"
#include "margindialog.h"
+#include "measurements.h"
+#include "menumanager.h"
+#include "mergedoc.h"
+#include "movepage.h"
+#include "mpalette.h"
+#include "multipleduplicate.h"
+#include "muster.h"
+#include "newfile.h"
+#include "newtemp.h"
+#include "page.h"
+#include "pageitem_imageframe.h"
+#include "pageitem_textframe.h"
+#include "pageitemattributes.h"
+#include "pagelayout.h"
+#include "pageselector.h"
+#include "pagesize.h"
+#include "patterndialog.h"
+#include "pdflib.h"
+#include "pdfoptions.h"
+#include "pdfopts.h"
+#include "picstatus.h"
+#include "pluginmanager.h"
+#include "plugins/formatidlist.h"
+#include "polygonwidget.h"
+#include "prefs.h"
+#include "prefscontext.h"
+#include "prefsfile.h"
#include "prefsmanager.h"
-#include "pagelayout.h"
-#include "commonstrings.h"
+#include "prefstable.h"
#include "preview.h"
+#include "pslib.h"
+#include "query.h"
+#include "reformdoc.h"
+#include "resourcecollection.h"
+#include "sccolorengine.h"
+#include "sccombobox.h"
+#include "scgtplugin.h"
+#include "scmessagebox.h"
+#include "scpaths.h"
+#include "scraction.h"
+#include "scrap.h"
+#include "scribus.h"
+#include "scribusXml.h"
+#include "scribusapp.h"
+#include "scribuscore.h"
#include "scribuswin.h"
-#include "hyphenator.h"
-#include "scmessagebox.h"
-#include "imageinfodialog.h"
-#include "resourcecollection.h"
+#include "search.h"
+#include "seiten.h"
#include "selection.h"
+#include "serializer.h"
+#include "smlinestyle.h"
+#include "smtextstyles.h"
+#include "splash.h"
+#include "stencilreader.h"
+#include "story.h"
#include "stylemanager.h"
-#include "smlinestyle.h"
+#include "tabcheckdoc.h"
+#include "tabguides.h"
+#include "tabmanager.h"
+#include "tabpdfoptions.h"
+#include "tabtools.h"
+#include "tabtypography.h"
+#include "text/nlsconfig.h"
+#include "tocgenerator.h"
+#include "tocindexprefs.h"
+#include "tree.h"
+#include "undogui.h"
+#include "undomanager.h"
+#include "undostate.h"
+#include "units.h"
#include "util.h"
+#include "util_formats.h"
+#include "util_ghostscript.h"
#include "util_icon.h"
-#include "text/nlsconfig.h"
-#include "plugins/formatidlist.h"
-#include "scgtplugin.h"
-#include "stencilreader.h"
-#include "langmgr.h"
-#include "smtextstyles.h"
-#include "insertaframe.h"
-#include "patterndialog.h"
-#include "sccolorengine.h"
-#include "desaxe/saxXML.h"
-#include "desaxe/digester.h"
-#include "desaxe/simple_actions.h"
+#include "vruler.h"
+#include "werktoolb.h"
+
#if defined(_WIN32)
#include "scwinprint.h"
#include "scdocoutput_ps2.h"
/trunk/Scribus/scribus/colorm.cpp
6,44 → 6,45
*/
#include "colorm.h"
 
#include <QAbstractItemView>
#include <QAction>
#include <QByteArray>
#include <QDataStream>
#include <QDomDocument>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QByteArray>
#include <QList>
#include <QListWidgetItem>
#include <QMenu>
#include <QToolTip>
#include <QMessageBox>
#include <QPixmap>
#include <QPushButton>
#include <QGroupBox>
#include <QToolButton>
#include <QSignalMapper>
#include <QAction>
#include <QList>
#include <QPixmap>
#include <QMessageBox>
#include <QDomDocument>
#include <QDataStream>
#include <QTextStream>
#include <QListWidgetItem>
#include <QAbstractItemView>
#include <QToolButton>
#include <QToolTip>
#include <QVBoxLayout>
 
#include <cstdlib>
 
#include "scconfig.h"
#include "cmykfw.h"
#include "colorlistbox.h"
#include "commonstrings.h"
#include "customfdialog.h"
#include "dcolor.h"
#include "fileloader.h"
#include "formatutils.h"
#include "cmykfw.h"
#include "scribusdoc.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "prefsfile.h"
#include "sccolorengine.h"
#include "scconfig.h"
#include "scpaths.h"
#include "colorlistbox.h"
 
#include "scribusdoc.h"
#include "util.h"
#include "util_formats.h"
#include "util_icon.h"
#include "sccolorengine.h"
 
 
ColorManager::ColorManager(QWidget* parent, ColorList doco, ScribusDoc* doc, QString docColSet, QStringList custColSet)
: QDialog( parent ), EditColors(doc, true), UsedC(doc, true)
{
/trunk/Scribus/scribus/documentchecker.cpp
22,14 → 22,14
***************************************************************************/
 
#include "documentchecker.h"
#include "formatutils.h"
#include "page.h"
#include "pageitem.h"
#include "sclayer.h"
#include "scribusdoc.h"
#include "scribusstructs.h"
#include "scribusdoc.h"
#include "sclayer.h"
#include "page.h"
#include "text/nlsconfig.h"
#include "util.h"
#include "util_formats.h"
 
bool DocumentChecker::checkDocument(ScribusDoc *currDoc)
{
/trunk/Scribus/scribus/pdflib_core.cpp
45,28 → 45,29
#endif
#include "rc4.h"
 
 
#include "bookmwin.h"
#include "bookpalette.h"
#include "commonstrings.h"
#include "formatutils.h"
#include "multiprogressdialog.h"
#include "page.h"
#include "pageitem.h"
#include "bookmwin.h"
#include "pdfoptions.h"
#include "prefscontext.h"
#include "prefsmanager.h"
#include "sccolor.h"
#include "sccolorengine.h"
#include "scfonts.h"
#include "scpaths.h"
#include "scpattern.h"
#include "scribus.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "multiprogressdialog.h"
#include "bookpalette.h"
#include "scfonts.h"
#include "text/nlsconfig.h"
#include "util.h"
#include "util_formats.h"
#include "util_math.h"
#include "prefsmanager.h"
#include "prefscontext.h"
#include "pdfoptions.h"
#include "sccolor.h"
#include "scpattern.h"
#include "sccolorengine.h"
 
#include "text/nlsconfig.h"
 
using namespace std;
 
/trunk/Scribus/scribus/scimgdataloader_ps.cpp
11,13 → 11,13
#include <QDataStream>
#include <QByteArray>
 
#include "formatutils.h"
#include "gsutil.h"
#include "scpaths.h"
#include "scribuscore.h"
#include "scimgdataloader_ps.h"
#include "prefsmanager.h"
#include "util.h"
#include "util_formats.h"
#include "util_ghostscript.h"
#include "util_math.h"
#include "cmsettings.h"
#include "scimage.h"
/trunk/Scribus/scribus/customfdialog.cpp
44,12 → 44,12
 
#include "cmsettings.h"
#include "commonstrings.h"
#include "formatutils.h"
#include "sccombobox.h"
#include "scimage.h"
#include "scribusstructs.h"
#include "util.h"
#include "util_color.h"
#include "util_formats.h"
#include "util_icon.h"
 
 
/trunk/Scribus/scribus/util_ghostscript.cpp
0,0 → 1,382
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
gsutil.cpp - description
-------------------
begin : Fri Sep 14 2001
copyright : (C) 2001 by Franz Schmid
copyright : (C) 2006- Scribus Team (code moved from util.cpp)
email : Franz.Schmid@altmuehlnet.de
***************************************************************************/
 
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
#include "util_ghostscript.h"
 
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qpainter.h>
#include <QProcess>
#include <QPixmap>
#include <QDebug>
 
#include "scconfig.h"
 
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "prefsfile.h"
#include "prefsmanager.h"
#include "scpaths.h"
#include "scribuscore.h"
 
#include "scribus.h"
 
#include "util.h"
 
using namespace std;
 
 
int callGS(const QStringList& args_in, const QString device)
{
QString cmd;
QStringList args;
PrefsManager* prefsManager = PrefsManager::instance();
args.append( "-q" );
args.append( "-dNOPAUSE" );
args.append( "-dQUIET" );
args.append( "-dPARANOIDSAFER" );
args.append( "-dBATCH" );
// Choose rendering device
if (!device.isEmpty())
args.append( QString("-sDEVICE=%1").arg(device) ); // user specified device
else if (ScCore->havePNGAlpha() != 0)
args.append( "-sDEVICE=png16m" );
else
args.append( "-sDEVICE=pngalpha" );
// and antialiasing
if (prefsManager->appPrefs.gs_AntiAliasText)
args.append( "-dTextAlphaBits=4" );
if (prefsManager->appPrefs.gs_AntiAliasGraphics)
args.append( "-dGraphicsAlphaBits=4" );
 
// Add any extra font paths being used by Scribus to gs's font search path
PrefsContext *pc = PrefsManager::instance()->prefsFile->getContext("Fonts");
PrefsTable *extraFonts = pc->getTable("ExtraFontDirs");
const char sep = ScPaths::envPathSeparator;
if (extraFonts->getRowCount() >= 1)
cmd = QString("-sFONTPATH=%1").arg(QDir::convertSeparators(extraFonts->get(0,0)));
for (int i = 1; i < extraFonts->getRowCount(); ++i)
cmd += QString("%1%2").arg(sep).arg(QDir::convertSeparators(extraFonts->get(i,0)));
if( !cmd.isEmpty() )
args.append( cmd );
 
args += args_in;
args.append("-c");
args.append("showpage");
// qDebug(args.join(" "));
return System( getShortPathName(prefsManager->ghostscriptExecutable()), args );
}
 
int callGS(const QString& args_in, const QString device)
{
PrefsManager* prefsManager=PrefsManager::instance();
QString cmd1 = getShortPathName(prefsManager->ghostscriptExecutable());
cmd1 += " -q -dNOPAUSE -dQUIET -dPARANOIDSAFER -dBATCH";
// Choose rendering device
if (!device.isEmpty())
// user specified device
cmd1 += " -sDEVICE="+device;
else if (ScCore->havePNGAlpha() != 0)
cmd1 += " -sDEVICE=png16m";
else
cmd1 += " -sDEVICE=pngalpha";
// and antialiasing
if (prefsManager->appPrefs.gs_AntiAliasText)
cmd1 += " -dTextAlphaBits=4";
if (prefsManager->appPrefs.gs_AntiAliasGraphics)
cmd1 += " -dGraphicsAlphaBits=4";
 
// Add any extra font paths being used by Scribus to gs's font search path
PrefsContext *pc = PrefsManager::instance()->prefsFile->getContext("Fonts");
PrefsTable *extraFonts = pc->getTable("ExtraFontDirs");
#ifndef _WIN32
if (extraFonts->getRowCount() >= 1)
cmd1 += QString(" -sFONTPATH='%1'").arg(extraFonts->get(0,0));
for (int i = 1; i < extraFonts->getRowCount(); ++i)
cmd1 += QString(":'%1'").arg(extraFonts->get(i,0));
#else
if (extraFonts->getRowCount() >= 1)
cmd1 += QString(" -sFONTPATH=\"%1\"").arg(extraFonts->get(0,0));
for (int i = 1; i < extraFonts->getRowCount(); ++i)
cmd1 += QString(";\"%1\"").arg(extraFonts->get(i,0));
#endif
 
// then add any user specified args and run gs
cmd1 += " " + args_in + " -c showpage";
// qDebug("Calling gs as: %s", cmd1.ascii());
return system(cmd1.local8Bit());
}
 
int convertPS2PS(QString in, QString out, const QStringList& opts, int level)
{
PrefsManager* prefsManager=PrefsManager::instance();
QStringList args;
args.append( "-q" );
args.append( "-dQUIET" );
args.append( "-dNOPAUSE" );
args.append( "-dPARANOIDSAFER" );
args.append( "-dBATCH" );
if( level == 2 )
{
int major = 0, minor = 0;
// ps2write cannot be detected with testGSAvailability()
// so determine availability according to gs version.
getNumericGSVersion(major, minor);
if ((major >=8 && minor >= 53) || major > 8)
args.append( "-sDEVICE=ps2write" );
else
{
args.append( "-sDEVICE=pswrite" );
args.append( QString("-dLanguageLevel=%1").arg(level) );
}
}
else
{
args.append( "-sDEVICE=pswrite" );
if(level <= 3)
args.append( QString("-dLanguageLevel=%1").arg(level) );
}
args += opts;
args.append( QString("-sOutputFile=%1").arg(QDir::convertSeparators(out)) );
args.append( QDir::convertSeparators(in) );
int ret = System( getShortPathName(prefsManager->ghostscriptExecutable()), args );
return ret;
}
 
bool testGSAvailability( void )
{
QStringList args;
PrefsManager* prefsManager = PrefsManager::instance();
return testGSAvailability(prefsManager->ghostscriptExecutable());
}
 
bool testGSAvailability( const QString& gsPath )
{
QStringList args;
args.append( "-h" );
QProcess proc;
proc.start(getShortPathName(gsPath), args);
if (!proc.waitForStarted(5000))
return false;
proc.waitForFinished(5000);
return (proc.exitCode()==0);
}
 
bool testGSDeviceAvailability( const QString& device )
{
QStringList args;
PrefsManager* prefsManager = PrefsManager::instance();
args.append( QString("-sDEVICE=%1").arg( device ) );
args.append( "-c" );
args.append( "quit" );
QProcess proc;
proc.start(getShortPathName(prefsManager->ghostscriptExecutable()), args);
if (!proc.waitForStarted(5000))
return false;
proc.waitForFinished(5000);
return (proc.exitCode()==0);
}
 
// Return the GhostScript version string, or QString::null if it couldn't be retrived.
QString getGSVersion()
{
QStringList args;
args.append(QString("--version").local8Bit());
QString gsExe = getShortPathName(PrefsManager::instance()->ghostscriptExecutable());
QProcess proc;
proc.start(gsExe.local8Bit(), args);
if (proc.waitForStarted(5000))
while (!proc.waitForFinished(5000))
qApp->processEvents();
QString gsVer;
if (proc.exitStatus()==QProcess::NormalExit)
gsVer = proc.readAllStandardOutput();
return gsVer;
}
 
// Return the GhostScript major and minor version numbers.
bool getNumericGSVersion(int & major, int & minor)
{
QString gs_ver_string(getGSVersion());
return getNumericGSVersion(gs_ver_string, major, minor);
}
 
bool getNumericGSVersion(const QString& ver, int& major, int& minor)
{
// gs's version string is of the form MAJOR.MINOR, so look for the .
// then convert to numbers. 7.07 will become (7,7) for example.
bool success = false;
major = ver.section('.', 0, 0).toInt(&success);
if (!success)
return false;
minor = ver.section('.', 1, 1).toInt(&success);
if (!success)
return false;
return true;
}
 
QString getGSDefaultExeName(void)
{
QString gsName;
#if defined _WIN32
// Set gsName to its default value
gsName = "gswin32c.exe";
 
QMap<int, QString> gplGS = getGSExePaths("SOFTWARE\\GPL Ghostscript");
QMap<int, QString> afplGS = getGSExePaths("SOFTWARE\\AFPL Ghostscript");
QMap<int, QString> gsVersions = gplGS.unite(afplGS);
 
if (gsVersions.isEmpty())
return gsName;
 
int currentVer = 0;
QString gsPath;
QMap<int, QString>::ConstIterator it, itEnd = gsVersions.constEnd();
for (it = gsVersions.constBegin(); it != itEnd; ++it)
{
int version = it.key();
if (version > currentVer)
{
gsPath = it.data();
QFileInfo fInfo(gsPath);
if (fInfo.exists())
{
gsName = gsPath;
currentVer = version;
}
}
}
#else
gsName = "gs";
#endif
return gsName;
}
 
QMap<int, QString> SCRIBUS_API getGSExePaths(const char* regKey)
{
QMap<int, QString> gsVersions;
#if defined _WIN32
// Try to locate GhostScript thanks to the registry
DWORD size;
HKEY hKey1, hKey2;
DWORD regType = REG_SZ;
char regVersion[MAX_PATH];
char regPath[MAX_PATH];
char gsPath[MAX_PATH];
QString gsVersion, gsName;
 
if( RegOpenKey(HKEY_LOCAL_MACHINE, regKey, &hKey1) == ERROR_SUCCESS )
{
size = sizeof(regVersion) - 1;
DWORD keyIndex = 0;
while ( RegEnumKeyEx(hKey1, keyIndex, regVersion, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS )
{
int gsNumericVer, gsMajor, gsMinor;
strcpy(regPath, regKey);
strcat(regPath, "\\");
strcat(regPath, regVersion);
if (RegOpenKey(HKEY_LOCAL_MACHINE, regPath, &hKey2) == ERROR_SUCCESS)
{
size = sizeof(gsPath) - 1;
if (RegQueryValueEx(hKey2, "GS_DLL", 0, &regType, (LPBYTE) gsPath, &size) == ERROR_SUCCESS)
{
// We now have GhostScript dll path, but we want gswin32c.exe
// Normally gswin32c.exe and gsdll.dll are in the same directory
if ( getNumericGSVersion(QString(regVersion), gsMajor, gsMinor) )
{
gsNumericVer = gsMajor * 1000 + gsMinor;
gsName = gsPath;
size = gsName.findRev("\\");
if (size > 0)
{
gsName = gsName.left(size + 1);
gsName += "gswin32c.exe";
gsName.replace("\\", "/");
gsVersions.insert(gsNumericVer, gsName);
}
}
}
RegCloseKey(hKey2);
}
keyIndex++;
}
RegCloseKey(hKey1);
}
#else
int gsNumericVer, gsMajor, gsMinor;
PrefsManager* prefsManager=PrefsManager::instance();
if (getNumericGSVersion(gsMajor, gsMinor))
{
gsNumericVer = gsMajor * 1000 + gsMinor;
gsVersions.insert(gsNumericVer, prefsManager->ghostscriptExecutable());
}
#endif
return gsVersions;
}
 
QPixmap LoadPDF(QString fn, int Page, int Size, int *w, int *h)
{
QString tmp, cmd1, cmd2;
QString pdfFile = QDir::convertSeparators(fn);
QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
QPixmap pm;
int ret = -1;
tmp.setNum(Page);
QStringList args;
args.append("-r72");
// args.append("-sOutputFile=\""+tmpFile+"\"");
args.append("-sOutputFile="+tmpFile);
args.append("-dFirstPage="+tmp);
args.append("-dLastPage="+tmp);
// args.append("\""+pdfFile+"\"");
args.append(pdfFile);
ret = callGS(args);
if (ret == 0)
{
QImage image;
image.load(tmpFile);
unlink(tmpFile);
QImage im2;
*h = image.height();
*w = image.width();
double sx = image.width() / static_cast<double>(Size);
double sy = image.height() / static_cast<double>(Size);
double t = (sy < sx ? sx : sy);
im2 = image.smoothScale(static_cast<int>(image.width() / t), static_cast<int>(image.height() / t));
pm.convertFromImage(im2);
QPainter p;
p.begin(&pm);
p.setBrush(Qt::NoBrush);
p.setPen(Qt::black);
p.drawRect(0, 0, pm.width(), pm.height());
p.end();
im2.detach();
}
return pm;
}
 
 
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/tabexternaltoolswidget.cpp
===================================================================
--- trunk/Scribus/scribus/tabexternaltoolswidget.cpp (revision 10211)
+++ trunk/Scribus/scribus/tabexternaltoolswidget.cpp (revision 10212)
@@ -26,7 +26,7 @@
#include "tabexternaltoolswidget.h"
#include <QFileDialog>
-#include "gsutil.h"
+#include "util_ghostscript.h"
#include "scpaths.h"
TabExternalToolsWidget::TabExternalToolsWidget(struct ApplicationPrefs *prefsData, QWidget* parent, const char*name)
/trunk/Scribus/scribus/preview.cpp
59,8 → 59,8
#include "scribusdoc.h"
#include "scpaths.h"
#include "pageselector.h"
#include "printerutil.h"
#include "gsutil.h"
#include "util_printer.h"
#include "util_ghostscript.h"
#include "sccolorengine.h"
 
#if defined(_WIN32)
/trunk/Scribus/scribus/navigator.cpp
29,7 → 29,7
#include <QPaintEvent>
#include <QPainter>
#include "scribusview.h"
#include "gsutil.h"
#include "util_ghostscript.h"
 
Navigator::Navigator(QWidget *parent, int Size, int Seite, ScribusView* vie, QString fn) : QLabel(parent)
{
/trunk/Scribus/scribus/scribusdoc.cpp
41,9 → 41,12
#include <QPixmap>
#include <QByteArray>
 
 
 
#include "cmserrorhandling.h"
#include "commonstrings.h"
#include "fileloader.h"
#include "filewatcher.h"
//CBVTD
#include "hruler.h"
#include "hyphenator.h"
#include "layers.h"
59,6 → 62,7
#include "prefsfile.h"
#include "prefsmanager.h"
#include "resourcecollection.h"
#include "sccolorengine.h"
#include "scmessagebox.h"
#include "scpainter.h"
#include "scraction.h"
65,21 → 69,16
#include "scribusXml.h"
#include "selection.h"
#include "story.h"
// #include "tree.h"
#include "text/nlsconfig.h"
#include "undomanager.h"
#include "undostate.h"
#include "units.h"
#include "util.h"
#include "util_cms.h"
#include "util_icon.h"
#include "util_math.h"
#include "commonstrings.h"
#include "sccolorengine.h"
 
#include "text/nlsconfig.h"
 
#include "cmsutil.h"
#include "cmserrorhandling.h"
#include "util_icon.h"
 
static const bool FRAMESELECTION_EDITS_DEFAULTSTYLE = false;
 
ScribusDoc::ScribusDoc() : UndoObject( tr("Document")),
/trunk/Scribus/scribus/util_formats.h
0,0 → 1,79
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
//Added by Craig Bradney in July 2007
//To be used for basic format detection and checking
//One central place for storing all our extensions we support, etc
 
#ifndef _UTIL_FORMATs_H
#define _UTIL_FORMATs_H
 
#include <QByteArray>
#include <QList>
#include <QMap>
#include <QString>
#include <QStringList>
#include "scribusapi.h"
 
bool SCRIBUS_API extensionIndicatesEPS(const QString &ext);
bool SCRIBUS_API extensionIndicatesEPSorPS(const QString &ext);
bool SCRIBUS_API extensionIndicatesJPEG(const QString &ext);
bool SCRIBUS_API extensionIndicatesPDF(const QString &ext);
bool SCRIBUS_API extensionIndicatesPSD(const QString &ext);
bool SCRIBUS_API extensionIndicatesPattern(const QString &ext);
bool SCRIBUS_API extensionIndicatesTIFF(const QString &ext);
 
 
class SCRIBUS_API FormatsManager
{
public:
 
enum scFormatTypes
{
TIFF = 1, // TIFF
PS = 2, // PostScript
EPS = 4, // Encapsulated PostScript
JPEG = 8, // JPEG
PSD = 16, // Photoshop Format
PDF = 32, // PDF Format
PAT = 64 // Pattern files
};
 
FormatsManager();
~FormatsManager();
 
/**
* @brief Returns a pointer to the FormatsManager instance
* @return A pointer to the FormatsManager instance
*/
static FormatsManager* instance();
/**
* @brief Deletes the FormatsManager Instance
* Must be called when FormatsManager is no longer needed.
*/
static void deleteInstance();
void imageFormatSupported(const QString&);
void fileTypeStrings(int type, QString& formatList, QString& formatText, bool lowerCaseOnly=false);
protected:
QMap<int, QStringList> m_fmts;
QStringList m_fmtList;
QList<QByteArray> m_supportedImageFormats;
void updateSupportedImageFormats(QList<QByteArray>& supportedImageFormats);
private:
/**
* @brief The only instance of FormatsManager available.
*
* FormatsManager is singleton and the instance can be queried with the method
* instance().
*/
static FormatsManager* _instance;
};
 
#endif
/trunk/Scribus/scribus/scimage.cpp
10,7 → 10,6
#include "scribuscore.h"
#include "scimgdataloader_gimp.h"
#include "scimgdataloader_jpeg.h"
#include "scimgdataloader_pdf.h"
#include "scimgdataloader_ps.h"
#include "scimgdataloader_psd.h"
#include "scimgdataloader_pdf.h"
23,15 → 22,15
#include <memory>
#include <cassert>
#include CMS_INC
#include "cmsutil.h"
#include "util_cms.h"
#include "commonstrings.h"
#include "exif.h"
#include "formatutils.h"
#include "gsutil.h"
#include "util_ghostscript.h"
#include "rawimage.h"
#include "sccolorengine.h"
#include "util.h"
#include "util_color.h"
#include "util_formats.h"
 
 
using namespace std;
/trunk/Scribus/scribus/plugins/scriptplugin/objprinter.cpp
13,8 → 13,8
#include <qdir.h>
#include <vector>
#include "pslib.h"
#include "gsutil.h"
#include "printerutil.h"
#include "util_ghostscript.h"
#include "util_printer.h"
#include "scribuscore.h"
#include "util.h"
#include "scpaths.h"
/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
5,17 → 5,17
for which a new license (GPL+exception) is in place.
*/
 
#include "../formatidlist.h"
#include "barcodegenerator.h"
//#include "barcodegenerator.moc"
#include "gsutil.h"
#include "util_icon.h"
#include "commonstrings.h"
#include "loadsaveplugin.h"
#include "scpaths.h"
#include "scribus.h"
#include "scpaths.h"
#include "commonstrings.h"
#include "undomanager.h"
#include "loadsaveplugin.h"
#include "../formatidlist.h"
#include "util_ghostscript.h"
#include "util_icon.h"
 
 
#include <QTextStream>
#include <QColorDialog>
 
/trunk/Scribus/scribus/plugins/psimport/importps.cpp
6,7 → 6,6
*/
#include "importps.h"
 
#include "formatutils.h"
#include "scconfig.h"
#include "scribus.h"
#include "scribuscore.h"
22,7 → 21,6
#include <qcursor.h>
#include <qregexp.h>
#include <QStack>
//Added by qt3to4:
#include <QDrag>
#include <QMimeData>
#include <QList>
39,6 → 37,7
#include "undomanager.h"
#include "loadsaveplugin.h"
#include "util.h"
#include "util_formats.h"
#include "util_icon.h"
#include "util_math.h"
 
/trunk/Scribus/scribus/tree.cpp
24,7 → 24,6
#include "actionmanager.h"
#include "util_color.h"
#include "commonstrings.h"
#include "formatutils.h"
#include "mpalette.h"
#include "page.h"
#include "scribus.h"
31,6 → 30,7
#include "selection.h"
#include "undomanager.h"
#include "util.h"
#include "util_formats.h"
#include "util_icon.h"
 
OutlineTreeItem::OutlineTreeItem(OutlineTreeItem* parent, OutlineTreeItem* after) : QTreeWidgetItem(parent, after)
/trunk/Scribus/scribus/pslib.cpp
36,7 → 36,6
#include <QStack>
 
#include "commonstrings.h"
#include "formatutils.h"
#include "scconfig.h"
#include "pluginapi.h"
#include "prefsmanager.h"
47,6 → 46,7
#include "selection.h"
#include <cmath>
#include "util.h"
#include "util_formats.h"
#include "util_math.h"
#include "multiprogressdialog.h"
#include "scribusapp.h"
/trunk/Scribus/scribus/util_cms.cpp
0,0 → 1,54
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "util_cms.h"
#include <QString>
 
cmsHTRANSFORM scCmsCreateTransform(cmsHPROFILE Input, DWORD InputFormat,
cmsHPROFILE Output,DWORD OutputFormat,
int Intent, DWORD dwFlags)
{
cmsHTRANSFORM hTransform = NULL;
if ( Input == NULL || Output == NULL)
return NULL;
dwFlags &= (~cmsFLAGS_GAMUTCHECK);
dwFlags &= (~cmsFLAGS_SOFTPROOFING);
QString desc1 = cmsTakeProductDesc(Input);
QString desc2 = cmsTakeProductDesc(Output);
if ( desc1 == desc2 )
dwFlags |= cmsFLAGS_NULLTRANSFORM;
hTransform = cmsCreateTransform(Input, InputFormat, Output, OutputFormat, Intent, dwFlags);
return hTransform;
}
 
cmsHTRANSFORM scCmsCreateProofingTransform(cmsHPROFILE Input, DWORD InputFormat,
cmsHPROFILE Output,DWORD OutputFormat,
cmsHPROFILE Proofing, int Intent,
int ProofingIntent, DWORD dwFlags)
{
cmsHTRANSFORM hTransform = NULL;
if ( Input == NULL || Output == NULL || Proofing == NULL)
return NULL;
QString desc1 = cmsTakeProductDesc(Input);
QString desc2 = cmsTakeProductDesc(Output);
QString desc3 = cmsTakeProductDesc(Proofing);
if ( desc1 != desc3 )
{
if( desc2 == desc3 )
ProofingIntent = INTENT_RELATIVE_COLORIMETRIC;
hTransform = cmsCreateProofingTransform(Input, InputFormat, Output, OutputFormat, Proofing, Intent,
ProofingIntent, dwFlags);
}
else
{
dwFlags &= (~cmsFLAGS_GAMUTCHECK);
dwFlags &= (~cmsFLAGS_SOFTPROOFING);
if ( desc1 == desc2 )
dwFlags |= cmsFLAGS_NULLTRANSFORM;
hTransform = cmsCreateTransform(Input, InputFormat, Output, OutputFormat, ProofingIntent, dwFlags);
}
return hTransform;
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: trunk/Scribus/scribus/CMakeLists.txt
===================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (revision 10211)
+++ trunk/Scribus/scribus/CMakeLists.txt (revision 10212)
@@ -259,7 +259,6 @@
cmserrorhandling.cpp
cmykfw.cpp
cmsprefs.cpp
- cmsutil.cpp
cmsettings.cpp
collect4output.cpp
colorblind.cpp
@@ -294,7 +293,6 @@
fontcombo.cpp
fontprefs.cpp
fontreplacedialog.cpp
- formatutils.cpp
fparser.cpp
fpointarray.cpp
fpoint.cpp
@@ -301,7 +299,6 @@
fpoptimizer.cpp
frameedit.cpp
gradienteditor.cpp
- gsutil.cpp
gtaction.cpp
gtdialogs.cpp
gtfont.cpp
@@ -386,7 +383,6 @@
prefsmanager.cpp
prefstable.cpp
preview.cpp
- printerutil.cpp
pslib.cpp
query.cpp
rawimage.cpp
@@ -492,9 +488,13 @@
upgradechecker.cpp
useprintermarginsdialog.cpp
util.cpp
+ util_cms.cpp
util_color.cpp
+ util_formats.cpp
+ util_ghostscript.cpp
util_icon.cpp
util_math.cpp
+ util_printer.cpp
vgradient.cpp
vgradientex.cpp
vruler.cpp
Index: trunk/Scribus/scribus/picsearch.cpp
===================================================================
--- trunk/Scribus/scribus/picsearch.cpp (revision 10211)
+++ trunk/Scribus/scribus/picsearch.cpp (revision 10212)
@@ -9,12 +9,12 @@
#include <qpainter.h>
#include "commonstrings.h"
-#include "formatutils.h"
#include "scimage.h"
#include "scpaths.h"
#include "scribusstructs.h"
#include "util.h"
#include "util_color.h"
+#include "util_formats.h"
#include "util_icon.h"