diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kpresenter/KoPointArray.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpresenter/KoPointArray.cpp')
-rw-r--r-- | kpresenter/KoPointArray.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/kpresenter/KoPointArray.cpp b/kpresenter/KoPointArray.cpp index 17f54e66..2ac496ea 100644 --- a/kpresenter/KoPointArray.cpp +++ b/kpresenter/KoPointArray.cpp @@ -36,7 +36,7 @@ void KoPointArray::translate( double dx, double dy ) void KoPointArray::point( uint index, double *x, double *y ) const { - KoPoint p = QMemArray<KoPoint>::at( index ); + KoPoint p = TQMemArray<KoPoint>::at( index ); if ( x ) *x = (double)p.x(); if ( y ) @@ -45,12 +45,12 @@ void KoPointArray::point( uint index, double *x, double *y ) const KoPoint KoPointArray::point( uint index ) const { // #### index out of bounds - return QMemArray<KoPoint>::at( index ); + return TQMemArray<KoPoint>::at( index ); } void KoPointArray::setPoint( uint index, double x, double y ) { // #### index out of bounds - QMemArray<KoPoint>::at( index ) = KoPoint( x, y ); + TQMemArray<KoPoint>::at( index ) = KoPoint( x, y ); } @@ -152,8 +152,8 @@ int pnt_on_line( const int* p, const int* q, const int* t ) return 2; } - if ( QABS((q[1]-p[1])*(t[0]-p[0])-(t[1]-p[1])*(q[0]-p[0])) >= - (QMAX(QABS(q[0]-p[0]), QABS(q[1]-p[1])))) return 0; + if ( TQABS((q[1]-p[1])*(t[0]-p[0])-(t[1]-p[1])*(q[0]-p[0])) >= + (TQMAX(TQABS(q[0]-p[0]), TQABS(q[1]-p[1])))) return 0; if (((q[0]<p[0])&&(p[0]<t[0])) || ((q[1]<p[1])&&(p[1]<t[1]))) return 1 ; @@ -168,7 +168,7 @@ int pnt_on_line( const int* p, const int* q, const int* t ) } static -void polygonizeQBezier( double* acc, int& accsize, const double ctrl[], +void polygonizeTQBezier( double* acc, int& accsize, const double ctrl[], int maxsize ) { if ( accsize > maxsize / 2 ) @@ -197,9 +197,9 @@ void polygonizeQBezier( double* acc, int& accsize, const double ctrl[], int c3[2]; c3[0] = int(ctrl[6]); c3[1] = int(ctrl[7]); // #### Duplication needed? - if ( QABS(c1[0]-c0[0]) <= 1 && QABS(c1[1]-c0[1]) <= 1 - && QABS(c2[0]-c0[0]) <= 1 && QABS(c2[1]-c0[1]) <= 1 - && QABS(c3[0]-c1[0]) <= 1 && QABS(c3[1]-c0[1]) <= 1 ) + if ( TQABS(c1[0]-c0[0]) <= 1 && TQABS(c1[1]-c0[1]) <= 1 + && TQABS(c2[0]-c0[0]) <= 1 && TQABS(c2[1]-c0[1]) <= 1 + && TQABS(c3[0]-c1[0]) <= 1 && TQABS(c3[1]-c0[1]) <= 1 ) { // Approximate by one line. // Dont need to write last pt as it is the same as first pt @@ -210,9 +210,9 @@ void polygonizeQBezier( double* acc, int& accsize, const double ctrl[], } if ( ( pnt_on_line( c0, c3, c1 ) == 2 && pnt_on_line( c0, c3, c2 ) == 2 ) - || ( QABS(c1[0]-c0[0]) <= 1 && QABS(c1[1]-c0[1]) <= 1 - && QABS(c2[0]-c0[0]) <= 1 && QABS(c2[1]-c0[1]) <= 1 - && QABS(c3[0]-c1[0]) <= 1 && QABS(c3[1]-c0[1]) <= 1 ) ) + || ( TQABS(c1[0]-c0[0]) <= 1 && TQABS(c1[1]-c0[1]) <= 1 + && TQABS(c2[0]-c0[0]) <= 1 && TQABS(c2[1]-c0[1]) <= 1 + && TQABS(c3[0]-c1[0]) <= 1 && TQABS(c3[1]-c0[1]) <= 1 ) ) { // Approximate by one line. // Dont need to write last pt as it is the same as first pt @@ -223,8 +223,8 @@ void polygonizeQBezier( double* acc, int& accsize, const double ctrl[], } // Too big and too curved - recusively subdivide. - polygonizeQBezier( acc, accsize, l, maxsize ); - polygonizeQBezier( acc, accsize, r, maxsize ); + polygonizeTQBezier( acc, accsize, l, maxsize ); + polygonizeTQBezier( acc, accsize, r, maxsize ); } @@ -255,14 +255,14 @@ KoRect KoPointArray::boundingRect() const KoPointArray KoPointArray::cubicBezier() const { if ( size() != 4 ) { -#if defined(QT_CHECK_RANGE) - qWarning( "QPointArray::bezier: The array must have 4 control points" ); +#if defined(TQT_CHECK_RANGE) + qWarning( "TQPointArray::bezier: The array must have 4 control points" ); #endif KoPointArray pa; return pa; } else { KoRect r = boundingRect(); - int m = (int)(4+2*QMAX(r.width(),r.height())); + int m = (int)(4+2*TQMAX(r.width(),r.height())); double *p = new double[m]; double ctrl[8]; int i; @@ -271,12 +271,12 @@ KoPointArray KoPointArray::cubicBezier() const ctrl[i*2+1] = at(i).y(); } int len=0; - polygonizeQBezier( p, len, ctrl, m ); + polygonizeTQBezier( p, len, ctrl, m ); KoPointArray pa((len/2)+1); // one extra point for last point on line int j=0; for (i=0; j<len; i++) { - double x = qRound(p[j++]); - double y = qRound(p[j++]); + double x = tqRound(p[j++]); + double y = tqRound(p[j++]); pa[i] = KoPoint(x,y); } // add last pt on the line, which will be at the last control pt @@ -287,9 +287,9 @@ KoPointArray KoPointArray::cubicBezier() const } } -QPointArray KoPointArray::zoomPointArray( const KoZoomHandler* zoomHandler ) const +TQPointArray KoPointArray::zoomPointArray( const KoZoomHandler* zoomHandler ) const { - QPointArray tmpPoints(size()); + TQPointArray tmpPoints(size()); for ( uint i= 0; i<size();i++ ) { KoPoint p = at( i ); tmpPoints.putPoints( i, 1, zoomHandler->zoomItX(p.x()),zoomHandler->zoomItY(p.y()) ); @@ -297,7 +297,7 @@ QPointArray KoPointArray::zoomPointArray( const KoZoomHandler* zoomHandler ) con return tmpPoints; } -QPointArray KoPointArray::zoomPointArray( const KoZoomHandler* zoomHandler, int penWidth ) const +TQPointArray KoPointArray::zoomPointArray( const KoZoomHandler* zoomHandler, int penWidth ) const { double fx; double fy; @@ -308,11 +308,11 @@ QPointArray KoPointArray::zoomPointArray( const KoZoomHandler* zoomHandler, int fy = (double)( zoomHandler->zoomItY(ext.height()) - 2 * pw ) / ext.height(); unsigned int index = 0; - QPointArray tmpPoints; + TQPointArray tmpPoints; KoPointArray::ConstIterator it; for ( it = begin(); it != end(); ++it, ++index ) { - int tmpX = qRound((*it).x() * fx + pw); - int tmpY = qRound((*it).y() * fy + pw); + int tmpX = tqRound((*it).x() * fx + pw); + int tmpY = tqRound((*it).y() * fy + pw); tmpPoints.putPoints( index, 1, tmpX, tmpY ); } |