summaryrefslogtreecommitdiffstats
path: root/ktnef/gui/qwmf.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /ktnef/gui/qwmf.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ktnef/gui/qwmf.cpp')
-rw-r--r--ktnef/gui/qwmf.cpp150
1 files changed, 75 insertions, 75 deletions
diff --git a/ktnef/gui/qwmf.cpp b/ktnef/gui/qwmf.cpp
index 6a10cc006..41b908d1c 100644
--- a/ktnef/gui/qwmf.cpp
+++ b/ktnef/gui/qwmf.cpp
@@ -19,12 +19,12 @@
#include <math.h>
#include <assert.h>
-#include <qfileinfo.h>
-#include <qpixmap.h>
-#include <qpainter.h>
-#include <qdatastream.h>
-#include <qapplication.h>
-#include <qbuffer.h>
+#include <tqfileinfo.h>
+#include <tqpixmap.h>
+#include <tqpainter.h>
+#include <tqdatastream.h>
+#include <tqapplication.h>
+#include <tqbuffer.h>
#include <kdebug.h>
bool qwmfDebug = false;
@@ -50,59 +50,59 @@ public:
class WinObjHandle
{
public:
- virtual void apply( QPainter& p ) = 0;
+ virtual void apply( TQPainter& p ) = 0;
};
class WinObjBrushHandle: public WinObjHandle
{
public:
- virtual void apply( QPainter& p );
- QBrush brush;
+ virtual void apply( TQPainter& p );
+ TQBrush brush;
virtual ~WinObjBrushHandle() {};
};
class WinObjPenHandle: public WinObjHandle
{
public:
- virtual void apply( QPainter& p );
- QPen pen;
+ virtual void apply( TQPainter& p );
+ TQPen pen;
virtual ~WinObjPenHandle() {};
};
class WinObjPatternBrushHandle: public WinObjHandle
{
public:
- virtual void apply( QPainter& p );
- QBrush brush;
- QPixmap image;
+ virtual void apply( TQPainter& p );
+ TQBrush brush;
+ TQPixmap image;
virtual ~WinObjPatternBrushHandle() {};
};
class WinObjFontHandle: public WinObjHandle
{
public:
- virtual void apply( QPainter& p );
- QFont font;
+ virtual void apply( TQPainter& p );
+ TQFont font;
int rotation;
virtual ~WinObjFontHandle() {};
};
-void WinObjBrushHandle::apply( QPainter& p )
+void WinObjBrushHandle::apply( TQPainter& p )
{
p.setBrush( brush );
}
-void WinObjPenHandle::apply( QPainter& p )
+void WinObjPenHandle::apply( TQPainter& p )
{
p.setPen( pen );
}
-void WinObjPatternBrushHandle::apply( QPainter& p )
+void WinObjPatternBrushHandle::apply( TQPainter& p )
{
p.setBrush( brush );
}
-void WinObjFontHandle::apply( QPainter& p )
+void WinObjFontHandle::apply( TQPainter& p )
{
p.setFont( font );
}
@@ -130,34 +130,34 @@ QWinMetaFile::~QWinMetaFile()
//-----------------------------------------------------------------------------
-bool QWinMetaFile::load( const QString &filename )
+bool QWinMetaFile::load( const TQString &filename )
{
- QFile file( filename );
+ TQFile file( filename );
if ( !file.exists() )
{
- kdDebug() << "File " << QFile::encodeName(filename) << " does not exist" << endl;
+ kdDebug() << "File " << TQFile::encodeName(filename) << " does not exist" << endl;
return false;
}
if ( !file.open( IO_ReadOnly ) )
{
- kdDebug() << "Cannot open file " << QFile::encodeName(filename) << endl;
+ kdDebug() << "Cannot open file " << TQFile::encodeName(filename) << endl;
return false;
}
- QByteArray ba = file.readAll();
+ TQByteArray ba = file.readAll();
file.close();
- QBuffer buffer( ba );
+ TQBuffer buffer( ba );
buffer.open( IO_ReadOnly );
return load( buffer );
}
//-----------------------------------------------------------------------------
-bool QWinMetaFile::load( QBuffer &buffer )
+bool QWinMetaFile::load( TQBuffer &buffer )
{
- QDataStream st;
+ TQDataStream st;
WmfEnhMetaHeader eheader;
WmfMetaHeader header;
WmfPlaceableHeader pheader;
@@ -174,7 +174,7 @@ bool QWinMetaFile::load( QBuffer &buffer )
mFirstCmd = NULL;
st.setDevice( &buffer );
- st.setByteOrder( QDataStream::LittleEndian ); // Great, I love Qt !
+ st.setByteOrder( TQDataStream::LittleEndian ); // Great, I love Qt !
//----- Read placeable metafile header
st >> pheader.key;
@@ -329,7 +329,7 @@ bool QWinMetaFile::load( QBuffer &buffer )
//-----------------------------------------------------------------------------
-bool QWinMetaFile::paint( const QPaintDevice* aTarget, bool absolute )
+bool QWinMetaFile::paint( const TQPaintDevice* aTarget, bool absolute )
{
int idx, i;
WmfCmd* cmd;
@@ -365,7 +365,7 @@ bool QWinMetaFile::paint( const QPaintDevice* aTarget, bool absolute )
( this->*metaFuncTab[ idx ].method )( cmd->numParm, cmd->parm );
if ( QWMF_DEBUG ) {
- QString str = "", param;
+ TQString str = "", param;
if ( metaFuncTab[ idx ].name == NULL ) {
str += "UNKNOWN ";
}
@@ -384,8 +384,8 @@ bool QWinMetaFile::paint( const QPaintDevice* aTarget, bool absolute )
}
}
/*
- // TODO: cleanup this code when QPicture::setBoundingBox() is possible in KOClipart (QT31)
- // because actually QPicture::boundingBox() != mBBox()
+ // TODO: cleanup this code when TQPicture::setBoundingBox() is possible in KOClipart (QT31)
+ // because actually TQPicture::boundingBox() != mBBox()
mWindowsCoord += 1;
if ( mWindowsCoord == 2 ) {
kdDebug() << "DRAW ANGLES " << endl;
@@ -405,7 +405,7 @@ bool QWinMetaFile::paint( const QPaintDevice* aTarget, bool absolute )
void QWinMetaFile::setWindowOrg( long, short* parm )
{
if ( mAbsoluteCoord ) {
- QRect r = mPainter.window();
+ TQRect r = mPainter.window();
mPainter.setWindow( parm[ 1 ], parm[ 0 ], r.width(), r.height() );
}
else {
@@ -425,12 +425,12 @@ void QWinMetaFile::setWindowExt( long, short* parm )
{
// negative value allowed for width and height : QABS() forbidden
if ( mAbsoluteCoord ) {
- QRect r = mPainter.window();
+ TQRect r = mPainter.window();
mPainter.setWindow( r.left(), r.top(), parm[ 1 ], parm[ 0 ] );
}
else {
if ( (parm[ 0 ] != 0) && (parm[ 1 ] != 0) ) {
- QRect r = mPainter.window();
+ TQRect r = mPainter.window();
double dx = mInternalWorldMatrix.dx();
double dy = mInternalWorldMatrix.dy();
double sx = mInternalWorldMatrix.m11();
@@ -479,7 +479,7 @@ void QWinMetaFile::ellipse( long, short* parm )
//-----------------------------------------------------------------------------
void QWinMetaFile::polygon( long, short* parm )
{
- QPointArray* pa;
+ TQPointArray* pa;
pa = pointArray( parm[ 0 ], &parm[ 1 ] );
mPainter.drawPolygon( *pa, mWinding );
@@ -489,24 +489,24 @@ void QWinMetaFile::polygon( long, short* parm )
//-----------------------------------------------------------------------------
void QWinMetaFile::polyPolygon( long, short* parm )
{
- QRegion region;
+ TQRegion region;
int i, j, startPolygon;
mPainter.save();
// define clipping region
- QRect win = bbox();
+ TQRect win = bbox();
startPolygon = 1+parm[ 0 ];
for ( i=0 ; i < parm[ 0 ] ; i++ ) {
- QPointArray pa1( parm[ 1+i ] );
+ TQPointArray pa1( parm[ 1+i ] );
for ( j=0 ; j < parm[ 1+i ] ; j++) {
pa1.setPoint ( j, parm[ startPolygon ], parm[ startPolygon+1 ] );
startPolygon += 2;
}
- QRegion r( pa1 );
+ TQRegion r( pa1 );
region = region.eor( r );
}
- mPainter.setClipRegion( region, QPainter::CoordPainter );
+ mPainter.setClipRegion( region, TQPainter::CoordPainter );
// fill polygons
mPainter.fillRect( win.left(), win.top(), win.width(), win.height(), mPainter.brush() );
@@ -516,7 +516,7 @@ void QWinMetaFile::polyPolygon( long, short* parm )
mPainter.setClipping( false );
mPainter.setBrush( Qt::NoBrush );
- QPointArray* pa;
+ TQPointArray* pa;
int idxPolygon = 1 + parm[ 0 ];
for ( i=0 ; i < parm[ 0 ] ; i++ ) {
pa = pointArray( parm[ 1+i ], &parm[ idxPolygon ] );
@@ -532,7 +532,7 @@ void QWinMetaFile::polyPolygon( long, short* parm )
//-----------------------------------------------------------------------------
void QWinMetaFile::polyline( long, short* parm )
{
- QPointArray* pa;
+ TQPointArray* pa;
pa = pointArray( parm[ 0 ], &parm[ 1 ] );
mPainter.drawPolyline( *pa );
@@ -628,7 +628,7 @@ void QWinMetaFile::setBkMode( long, short* parm )
//-----------------------------------------------------------------------------
void QWinMetaFile::setPixel( long, short* parm )
{
- QPen pen = mPainter.pen();
+ TQPen pen = mPainter.pen();
mPainter.setPen( color( parm ) );
mPainter.drawPoint( parm[ 3 ], parm[ 2 ] );
mPainter.setPen( pen );
@@ -661,16 +661,16 @@ void QWinMetaFile::restoreDC( long, short *parm )
void QWinMetaFile::intersectClipRect( long, short* parm )
{
/* TODO: better implementation : need QT 3.0.2
- QRegion region = mPainter.clipRegion();
+ TQRegion region = mPainter.clipRegion();
if ( region.isEmpty() )
region = bbox();
*/
- QRegion region( bbox() );
+ TQRegion region( bbox() );
- QRegion newRegion( parm[ 3 ], parm[ 2 ], parm[ 1 ] - parm[ 3 ], parm[ 0 ] - parm[ 2 ] );
+ TQRegion newRegion( parm[ 3 ], parm[ 2 ], parm[ 1 ] - parm[ 3 ], parm[ 0 ] - parm[ 2 ] );
region = region.intersect( newRegion );
- mPainter.setClipRegion( region, QPainter::CoordPainter );
+ mPainter.setClipRegion( region, TQPainter::CoordPainter );
}
@@ -678,16 +678,16 @@ void QWinMetaFile::intersectClipRect( long, short* parm )
void QWinMetaFile::excludeClipRect( long, short* parm )
{
/* TODO: better implementation : need QT 3.0.2
- QRegion region = mPainter.clipRegion();
+ TQRegion region = mPainter.clipRegion();
if ( region.isEmpty() )
region = bbox();
*/
- QRegion region( bbox() );
+ TQRegion region( bbox() );
- QRegion newRegion( parm[ 3 ], parm[ 2 ], parm[ 1 ] - parm[ 3 ], parm[ 0 ] - parm[ 2 ] );
+ TQRegion newRegion( parm[ 3 ], parm[ 2 ], parm[ 1 ] - parm[ 3 ], parm[ 0 ] - parm[ 2 ] );
region = region.subtract( newRegion );
- mPainter.setClipRegion( region, QPainter::CoordPainter );
+ mPainter.setClipRegion( region, TQPainter::CoordPainter );
}
@@ -738,16 +738,16 @@ void QWinMetaFile::extTextOut( long num, short* parm )
else
ptStr = (char*)&parm[ 4 ];
- QCString text( ptStr, parm[ 2 ] + 1 );
+ TQCString text( ptStr, parm[ 2 ] + 1 );
- QFontMetrics fm( mPainter.font() );
+ TQFontMetrics fm( mPainter.font() );
width = fm.width( text ) + fm.descent(); // because fm.width(text) isn't rigth with Italic text
height = fm.height();
mPainter.save();
if ( mTextAlign & 0x01 ) { // (left, top) position = current logical position
- QPoint pos = mPainter.pos();
+ TQPoint pos = mPainter.pos();
x = pos.x();
y = pos.y();
}
@@ -795,7 +795,7 @@ void QWinMetaFile::extTextOut( long num, short* parm )
void QWinMetaFile::dibBitBlt( long num, short* parm )
{
if ( num > 9 ) { // DIB image
- QImage bmpSrc;
+ TQImage bmpSrc;
if ( dibToBmp( bmpSrc, (char*)&parm[ 8 ], (num - 8) * 2 ) ) {
long raster = toDWord( parm );
@@ -805,11 +805,11 @@ void QWinMetaFile::dibBitBlt( long num, short* parm )
// wmf file allow negative width or height
mPainter.save();
if ( parm[ 5 ] < 0 ) { // width < 0 => horizontal flip
- QWMatrix m( -1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F );
+ TQWMatrix m( -1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F );
mPainter.setWorldMatrix( m, true );
}
if ( parm[ 4 ] < 0 ) { // height < 0 => vertical flip
- QWMatrix m( 1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F );
+ TQWMatrix m( 1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F );
mPainter.setWorldMatrix( m, true );
}
mPainter.drawImage( parm[ 7 ], parm[ 6 ], bmpSrc, parm[ 3 ], parm[ 2 ], parm[ 5 ], parm[ 4 ] );
@@ -825,7 +825,7 @@ void QWinMetaFile::dibBitBlt( long num, short* parm )
//-----------------------------------------------------------------------------
void QWinMetaFile::dibStretchBlt( long num, short* parm )
{
- QImage bmpSrc;
+ TQImage bmpSrc;
if ( dibToBmp( bmpSrc, (char*)&parm[ 10 ], (num - 10) * 2 ) ) {
long raster = toDWord( parm );
@@ -835,15 +835,15 @@ void QWinMetaFile::dibStretchBlt( long num, short* parm )
// wmf file allow negative width or height
mPainter.save();
if ( parm[ 7 ] < 0 ) { // width < 0 => horizontal flip
- QWMatrix m( -1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F );
+ TQWMatrix m( -1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F );
mPainter.setWorldMatrix( m, true );
}
if ( parm[ 6 ] < 0 ) { // height < 0 => vertical flip
- QWMatrix m( 1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F );
+ TQWMatrix m( 1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F );
mPainter.setWorldMatrix( m, true );
}
bmpSrc = bmpSrc.copy( parm[ 5 ], parm[ 4 ], parm[ 3 ], parm[ 2 ] );
- // TODO: scale the bitmap ( QImage::scale(parm[ 7 ], parm[ 6 ]) is actually too slow )
+ // TODO: scale the bitmap ( TQImage::scale(parm[ 7 ], parm[ 6 ]) is actually too slow )
mPainter.drawImage( parm[ 9 ], parm[ 8 ], bmpSrc );
mPainter.restore();
@@ -854,7 +854,7 @@ void QWinMetaFile::dibStretchBlt( long num, short* parm )
//-----------------------------------------------------------------------------
void QWinMetaFile::stretchDib( long num, short* parm )
{
- QImage bmpSrc;
+ TQImage bmpSrc;
if ( dibToBmp( bmpSrc, (char*)&parm[ 11 ], (num - 11) * 2 ) ) {
long raster = toDWord( parm );
@@ -864,15 +864,15 @@ void QWinMetaFile::stretchDib( long num, short* parm )
// wmf file allow negative width or height
mPainter.save();
if ( parm[ 8 ] < 0 ) { // width < 0 => horizontal flip
- QWMatrix m( -1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F );
+ TQWMatrix m( -1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F );
mPainter.setWorldMatrix( m, true );
}
if ( parm[ 7 ] < 0 ) { // height < 0 => vertical flip
- QWMatrix m( 1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F );
+ TQWMatrix m( 1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F );
mPainter.setWorldMatrix( m, true );
}
bmpSrc = bmpSrc.copy( parm[ 6 ], parm[ 5 ], parm[ 4 ], parm[ 3 ] );
- // TODO: scale the bitmap ( QImage::scale(parm[ 8 ], parm[ 7 ]) is actually too slow )
+ // TODO: scale the bitmap ( TQImage::scale(parm[ 8 ], parm[ 7 ]) is actually too slow )
mPainter.drawImage( parm[ 10 ], parm[ 9 ], bmpSrc );
mPainter.restore();
@@ -885,7 +885,7 @@ void QWinMetaFile::dibCreatePatternBrush( long num, short* parm )
{
WinObjPatternBrushHandle* handle = new WinObjPatternBrushHandle;
addHandle( handle );
- QImage bmpSrc;
+ TQImage bmpSrc;
if ( dibToBmp( bmpSrc, (char*)&parm[ 2 ], (num - 2) * 2 ) ) {
handle->image = bmpSrc;
@@ -997,7 +997,7 @@ void QWinMetaFile::createPenIndirect( long, short* parm )
// TODO : width of pen proportional to device context width
// DOESN'T WORK
/*
- QRect devRec;
+ TQRect devRec;
devRec = mPainter.xForm( mBBox );
width = ( parm[ 0 ] * devRec.width() ) / mBBox.width() ;
kdDebug() << "CreatePenIndirect: " << endl;
@@ -1015,7 +1015,7 @@ void QWinMetaFile::createFontIndirect( long , short* parm)
WinObjFontHandle* handle = new WinObjFontHandle;
addHandle( handle );
- QString family( (const char*)&parm[ 9 ] );
+ TQString family( (const char*)&parm[ 9 ] );
mRotation = -parm[ 2 ] / 10; // text rotation (in 1/10 degree)
// TODO: memorisation of rotation in object Font
@@ -1074,7 +1074,7 @@ int QWinMetaFile::findFunc( unsigned short aFunc ) const
}
//-----------------------------------------------------------------------------
-QPointArray* QWinMetaFile::pointArray( short num, short* parm )
+TQPointArray* QWinMetaFile::pointArray( short num, short* parm )
{
int i;
@@ -1109,7 +1109,7 @@ unsigned int QWinMetaFile::toDWord( short* parm )
//-----------------------------------------------------------------------------
-QColor QWinMetaFile::color( short* parm )
+TQColor QWinMetaFile::color( short* parm )
{
unsigned int colorRef;
int red, green, blue;
@@ -1119,7 +1119,7 @@ QColor QWinMetaFile::color( short* parm )
green = ( colorRef>>8 ) & 255;
blue = ( colorRef>>16 ) & 255;
- return QColor( red, green, blue );
+ return TQColor( red, green, blue );
}
@@ -1222,7 +1222,7 @@ Qt::RasterOp QWinMetaFile::winToQtRaster( long parm ) const
}
//-----------------------------------------------------------------------------
-bool QWinMetaFile::dibToBmp( QImage& bmp, const char* dib, long size )
+bool QWinMetaFile::dibToBmp( TQImage& bmp, const char* dib, long size )
{
typedef struct _BMPFILEHEADER {
WORD bmType;
@@ -1234,7 +1234,7 @@ bool QWinMetaFile::dibToBmp( QImage& bmp, const char* dib, long size )
int sizeBmp = size + 14;
- QByteArray pattern( sizeBmp ); // BMP header and DIB data
+ TQByteArray pattern( sizeBmp ); // BMP header and DIB data
pattern.fill(0);
memcpy( &pattern[ 14 ], dib, size );