2000-08-18 17:53:00 +00:00
|
|
|
#ifndef _PSGS_H_
|
|
|
|
#define _PSGS_H_
|
|
|
|
|
2001-06-11 13:40:16 +00:00
|
|
|
#include <ktempfile.h>
|
2000-06-24 04:43:55 +00:00
|
|
|
#include <qstring.h>
|
|
|
|
#include <qintdict.h>
|
|
|
|
#include <qintcache.h>
|
|
|
|
#include <qpixmap.h>
|
2001-06-11 13:40:16 +00:00
|
|
|
#include <qobject.h>
|
2000-06-24 04:43:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
class pageInfo
|
|
|
|
{
|
|
|
|
public:
|
2000-08-18 17:53:00 +00:00
|
|
|
pageInfo(QString _PostScriptString);
|
2000-06-24 04:43:55 +00:00
|
|
|
|
|
|
|
QString *PostScriptString;
|
|
|
|
KTempFile *Gfx;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Maximal number of PostScript-Pages which are held in memory (or on
|
|
|
|
// the disk) for speedup. This should later be made dynamic, maybe
|
|
|
|
// with the possibility of switching on/off.
|
|
|
|
#define PAGES_IN_MEMORY_CACHE 13
|
|
|
|
#define PAGES_IN_DISK_CACHE 101
|
|
|
|
|
|
|
|
|
2001-06-11 13:40:16 +00:00
|
|
|
class ghostscript_interface : public QObject
|
2000-06-24 04:43:55 +00:00
|
|
|
{
|
2001-06-11 13:40:16 +00:00
|
|
|
Q_OBJECT
|
2000-06-24 04:43:55 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
ghostscript_interface(double dpi, int pxlw, int pxlh);
|
|
|
|
~ghostscript_interface();
|
|
|
|
|
|
|
|
void setSize(double dpi, int pxlw, int pxlh);
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
//
|
|
|
|
void setPostScript(int page, QString PostScript);
|
|
|
|
|
|
|
|
// Returns the graphics of the page, if possible. The functions
|
|
|
|
// returns a pointer to a QPixmap, or null. The referred QPixmap
|
|
|
|
// should be deleted after use.
|
|
|
|
QPixmap *graphics(int page);
|
|
|
|
|
|
|
|
QString *PostScriptHeaderString;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void gs_generate_graphics_file(int page, QString filename);
|
|
|
|
QIntDict<pageInfo> *pageList;
|
|
|
|
|
|
|
|
// Chache to store pages which contain PostScript and are therefore
|
|
|
|
// slow to render.
|
|
|
|
QIntCache<QPixmap> *MemoryCache;
|
|
|
|
|
|
|
|
// Chache to store pages which contain PostScript and are therefore
|
|
|
|
// slow to render.
|
|
|
|
QIntCache<KTempFile> *DiskCache;
|
|
|
|
|
|
|
|
double resolution; // in dots per inch
|
|
|
|
int pixel_page_w; // in pixels
|
|
|
|
int pixel_page_h; // in pixels
|
2001-06-11 13:40:16 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
/** Passed through to the top-level kpart. */
|
|
|
|
void setStatusBarText( const QString& );
|
2000-06-24 04:43:55 +00:00
|
|
|
};
|
2000-08-18 17:53:00 +00:00
|
|
|
|
|
|
|
#endif
|