From a374efce3a207b39514be3c52264091400ce297e Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 11 Jun 2011 04:44:41 +0000 Subject: TQt4 port kdeedu This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kig/filters/kseg-filter.cc | 188 ++++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 94 deletions(-) (limited to 'kig/filters/kseg-filter.cc') diff --git a/kig/filters/kseg-filter.cc b/kig/filters/kseg-filter.cc index fb96c25c..6f784759 100644 --- a/kig/filters/kseg-filter.cc +++ b/kig/filters/kseg-filter.cc @@ -67,7 +67,7 @@ bool KigFilterKSeg::supportMime( const TQString& mime ) struct drawstyle { - Q_INT8 pointstyle; + TQ_INT8 pointstyle; TQFont font; TQPen pen; TQBrush brush; @@ -93,50 +93,50 @@ static Coordinate readKSegCoordinate( TQDataStream& stream ) return t + Coordinate( -7, -7 ); } -static ObjectTypeCalcer* intersectionPoint( const std::vector& parents, int which ) +static ObjectTypeCalcer* intersectionPoint( const std::vector& tqparents, int which ) { - if ( parents.size() != 2 ) return 0; + if ( tqparents.size() != 2 ) return 0; int nlines = 0; int nconics = 0; int narcs = 0; for ( int i = 0; i < 2; ++i ) { - if ( parents[i]->imp()->inherits( AbstractLineImp::stype() ) ) ++nlines; - else if ( parents[i]->imp()->inherits( ConicImp::stype() ) ) ++nconics; - else if ( parents[i]->imp()->inherits( ArcImp::stype() ) ) ++narcs; + if ( tqparents[i]->imp()->inherits( AbstractLineImp::stype() ) ) ++nlines; + else if ( tqparents[i]->imp()->inherits( ConicImp::stype() ) ) ++nconics; + else if ( tqparents[i]->imp()->inherits( ArcImp::stype() ) ) ++narcs; else return 0; }; if ( nlines == 2 ) - return which == -1 ? new ObjectTypeCalcer( LineLineIntersectionType::instance(), parents ) : 0; + return which == -1 ? new ObjectTypeCalcer( LineLineIntersectionType::instance(), tqparents ) : 0; else if ( nlines == 1 && nconics == 1 ) { - std::vector intparents( parents ); - intparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) ); - return new ObjectTypeCalcer( ConicLineIntersectionType::instance(), intparents ); + std::vector inttqparents( tqparents ); + inttqparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) ); + return new ObjectTypeCalcer( ConicLineIntersectionType::instance(), inttqparents ); } else if ( nlines == 0 && nconics == 2 ) { - std::vector rparents( parents ); - rparents.push_back( new ObjectConstCalcer( new IntImp( 1 ) ) ); - rparents.push_back( new ObjectConstCalcer( new IntImp( 1 ) ) ); - rparents.push_back( new ObjectTypeCalcer( ConicRadicalType::instance(), rparents ) ); - std::vector iparents; - iparents.push_back( parents[0] ); - iparents.push_back( rparents.back() ); - iparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) ); - return new ObjectTypeCalcer( ConicLineIntersectionType::instance(), iparents ); + std::vector rtqparents( tqparents ); + rtqparents.push_back( new ObjectConstCalcer( new IntImp( 1 ) ) ); + rtqparents.push_back( new ObjectConstCalcer( new IntImp( 1 ) ) ); + rtqparents.push_back( new ObjectTypeCalcer( ConicRadicalType::instance(), rtqparents ) ); + std::vector itqparents; + itqparents.push_back( tqparents[0] ); + itqparents.push_back( rtqparents.back() ); + itqparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) ); + return new ObjectTypeCalcer( ConicLineIntersectionType::instance(), itqparents ); } else if ( nlines == 1 && narcs == 1 ) { - std::vector intparents( parents ); - intparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) ); - return new ObjectTypeCalcer( ArcLineIntersectionType::instance(), intparents ); + std::vector inttqparents( tqparents ); + inttqparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) ); + return new ObjectTypeCalcer( ArcLineIntersectionType::instance(), inttqparents ); } else return 0; } ObjectCalcer* KigFilterKSeg::transformObject( const TQString& file, KigDocument& kigdoc, - std::vector& parents, + std::vector& tqparents, int subtype, bool& ok ) { ok = true; @@ -145,34 +145,34 @@ ObjectCalcer* KigFilterKSeg::transformObject( const TQString& file, KigDocument& { case G_TRANSLATED: { - std::vector vectorparents( parents.begin() + 1, parents.end() ); - ObjectTypeCalcer* vector = new ObjectTypeCalcer( VectorType::instance(), vectorparents ); + std::vector vectortqparents( tqparents.begin() + 1, tqparents.end() ); + ObjectTypeCalcer* vector = new ObjectTypeCalcer( VectorType::instance(), vectortqparents ); vector->calc( kigdoc ); std::vector transparents; - transparents.push_back( parents[0] ); + transparents.push_back( tqparents[0] ); transparents.push_back( vector ); retobj = new ObjectTypeCalcer( TranslatedType::instance(), transparents ); break; } case G_ROTATED: { - std::vector angleparents( parents.begin() + 2, parents.end() ); - ObjectTypeCalcer* angle = new ObjectTypeCalcer( AngleType::instance(), angleparents ); + std::vector angletqparents( tqparents.begin() + 2, tqparents.end() ); + ObjectTypeCalcer* angle = new ObjectTypeCalcer( AngleType::instance(), angletqparents ); angle->calc( kigdoc ); - std::vector rotparents; - rotparents.push_back( parents[0] ); - rotparents.push_back( parents[1] ); - rotparents.push_back( angle ); - retobj = new ObjectTypeCalcer( RotationType::instance(), rotparents ); + std::vector rottqparents; + rottqparents.push_back( tqparents[0] ); + rottqparents.push_back( tqparents[1] ); + rottqparents.push_back( angle ); + retobj = new ObjectTypeCalcer( RotationType::instance(), rottqparents ); break; } case G_SCALED: { - if ( parents.size() == 4 ) + if ( tqparents.size() == 4 ) { - retobj = new ObjectTypeCalcer( ScalingOverCenter2Type::instance(), parents ); + retobj = new ObjectTypeCalcer( ScalingOverCenter2Type::instance(), tqparents ); } else { @@ -187,8 +187,8 @@ ObjectCalcer* KigFilterKSeg::transformObject( const TQString& file, KigDocument& } case G_REFLECTED: { - std::vector mirparents( parents.begin(), parents.end() ); - retobj = new ObjectTypeCalcer( LineReflectionType::instance(), mirparents ); + std::vector mirtqparents( tqparents.begin(), tqparents.end() ); + retobj = new ObjectTypeCalcer( LineReflectionType::instance(), mirtqparents ); break; } } @@ -250,14 +250,14 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) { short styleid; stream >> styleid; - short nparents; - stream >> nparents; - std::vector parents( nparents, 0 ); - for ( short j = 0; j < nparents; ++j ) + short ntqparents; + stream >> ntqparents; + std::vector tqparents( ntqparents, 0 ); + for ( short j = 0; j < ntqparents; ++j ) { - int parent; - stream >> parent; - parents[j] = ret[parent]->calcer(); + int tqparent; + stream >> tqparent; + tqparents[j] = ret[tqparent]->calcer(); }; // read the object.. @@ -318,13 +318,13 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) case G_SCALED: case G_REFLECTED: { - o = transformObject( file, *retdoc, parents, descendtype, ok ); + o = transformObject( file, *retdoc, tqparents, descendtype, ok ); break; } case G_FREE_POINT: { // fixed point - if ( nparents != 0 ) KIG_FILTER_PARSE_ERROR; + if ( ntqparents != 0 ) KIG_FILTER_PARSE_ERROR; Coordinate c = readKSegCoordinate( stream ); o = fact->fixedPointCalcer( c ); break; @@ -334,37 +334,37 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) // constrained point double p; stream >> p; - if ( nparents != 1 ) KIG_FILTER_PARSE_ERROR; - ObjectCalcer* parent = parents[0]; - assert( parent ); - o = fact->constrainedPointCalcer( parent, p ); + if ( ntqparents != 1 ) KIG_FILTER_PARSE_ERROR; + ObjectCalcer* tqparent = tqparents[0]; + assert( tqparent ); + o = fact->constrainedPointCalcer( tqparent, p ); break; } case G_INTERSECTION_POINT: { // KSeg has somewhat weird intersection objects.. // for all objects G_INTERSECTION_POINT gets the - // first intersection of its parents, G_INTERSECTION2_POINT + // first intersection of its tqparents, G_INTERSECTION2_POINT // represents the second, if present. - o = intersectionPoint( parents, -1 ); + o = intersectionPoint( tqparents, -1 ); if ( ! o ) KIG_FILTER_PARSE_ERROR; break; } case G_INTERSECTION2_POINT: { - o = intersectionPoint( parents, 1 ); + o = intersectionPoint( tqparents, 1 ); if ( ! o ) KIG_FILTER_PARSE_ERROR; break; } case G_MID_POINT: { // midpoint of a segment.. - if ( parents.size() != 1 ) KIG_FILTER_PARSE_ERROR; - if ( !parents[0]->imp()->inherits( SegmentImp::stype() ) ) + if ( tqparents.size() != 1 ) KIG_FILTER_PARSE_ERROR; + if ( !tqparents[0]->imp()->inherits( SegmentImp::stype() ) ) KIG_FILTER_PARSE_ERROR; - int index = parents[0]->imp()->propertiesInternalNames().findIndex( "mid-point" ); + int index = tqparents[0]->imp()->propertiesInternalNames().tqfindIndex( "mid-point" ); assert( index != -1 ); - o = new ObjectPropertyCalcer( parents[0], index ); + o = new ObjectPropertyCalcer( tqparents[0], index ); break; } default: @@ -383,13 +383,13 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) case G_SCALED: case G_REFLECTED: { - o = transformObject( file, *retdoc, parents, descendtype, ok ); + o = transformObject( file, *retdoc, tqparents, descendtype, ok ); break; } case G_ENDPOINTS_SEGMENT: { - if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectTypeCalcer( SegmentABType::instance(), parents ); + if ( ntqparents != 2 ) KIG_FILTER_PARSE_ERROR; + o = new ObjectTypeCalcer( SegmentABType::instance(), tqparents ); break; } default: @@ -406,18 +406,18 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) case G_SCALED: case G_REFLECTED: { - o = transformObject( file, *retdoc, parents, descendtype, ok ); + o = transformObject( file, *retdoc, tqparents, descendtype, ok ); break; } case G_TWOPOINTS_RAY: { - if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectTypeCalcer( RayABType::instance(), parents ); + if ( ntqparents != 2 ) KIG_FILTER_PARSE_ERROR; + o = new ObjectTypeCalcer( RayABType::instance(), tqparents ); break; } case G_BISECTOR_RAY: { - ObjectTypeCalcer* angle = new ObjectTypeCalcer( HalfAngleType::instance(), parents ); + ObjectTypeCalcer* angle = new ObjectTypeCalcer( HalfAngleType::instance(), tqparents ); angle->calc( *retdoc ); o = fact->propertyObjectCalcer( angle, "angle-bisector" ); break; @@ -436,25 +436,25 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) case G_SCALED: case G_REFLECTED: { - o = transformObject( file, *retdoc, parents, descendtype, ok ); + o = transformObject( file, *retdoc, tqparents, descendtype, ok ); break; } case G_TWOPOINTS_LINE: { - if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectTypeCalcer( LineABType::instance(), parents ); + if ( ntqparents != 2 ) KIG_FILTER_PARSE_ERROR; + o = new ObjectTypeCalcer( LineABType::instance(), tqparents ); break; } case G_PARALLEL_LINE: { - if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectTypeCalcer( LineParallelLPType::instance(), parents ); + if ( ntqparents != 2 ) KIG_FILTER_PARSE_ERROR; + o = new ObjectTypeCalcer( LineParallelLPType::instance(), tqparents ); break; } case G_PERPENDICULAR_LINE: { - if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectTypeCalcer( LinePerpendLPType::instance(), parents ); + if ( ntqparents != 2 ) KIG_FILTER_PARSE_ERROR; + o = new ObjectTypeCalcer( LinePerpendLPType::instance(), tqparents ); break; } default: @@ -471,37 +471,37 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) case G_SCALED: case G_REFLECTED: { - o = transformObject( file, *retdoc, parents, descendtype, ok ); + o = transformObject( file, *retdoc, tqparents, descendtype, ok ); break; } case G_CENTERPOINT_CIRCLE: { - if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectTypeCalcer( CircleBCPType::instance(), parents ); + if ( ntqparents != 2 ) KIG_FILTER_PARSE_ERROR; + o = new ObjectTypeCalcer( CircleBCPType::instance(), tqparents ); break; } case G_CENTERRADIUS_CIRCLE: { ObjectCalcer* point; ObjectCalcer* segment; - if ( parents[0]->imp()->inherits( PointImp::stype() ) ) + if ( tqparents[0]->imp()->inherits( PointImp::stype() ) ) { - point = parents[0]; - segment = parents[1]; + point = tqparents[0]; + segment = tqparents[1]; } else { - point = parents[1]; - segment = parents[0]; + point = tqparents[1]; + segment = tqparents[0]; }; - int index = segment->imp()->propertiesInternalNames().findIndex( "length" ); + int index = segment->imp()->propertiesInternalNames().tqfindIndex( "length" ); if ( index == -1 ) KIG_FILTER_PARSE_ERROR; ObjectPropertyCalcer* length = new ObjectPropertyCalcer( segment, index ); length->calc( *retdoc ); - std::vector cparents; - cparents.push_back( point ); - cparents.push_back( length ); - o = new ObjectTypeCalcer( CircleBPRType::instance(), cparents ); + std::vector ctqparents; + ctqparents.push_back( point ); + ctqparents.push_back( length ); + o = new ObjectTypeCalcer( CircleBPRType::instance(), ctqparents ); break; } default: @@ -518,13 +518,13 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) case G_SCALED: case G_REFLECTED: { - o = transformObject( file, *retdoc, parents, descendtype, ok ); + o = transformObject( file, *retdoc, tqparents, descendtype, ok ); break; } case G_THREEPOINTS_ARC: { - if ( nparents != 3 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectTypeCalcer( ArcBTPType::instance(), parents ); + if ( ntqparents != 3 ) KIG_FILTER_PARSE_ERROR; + o = new ObjectTypeCalcer( ArcBTPType::instance(), tqparents ); break; } default: @@ -541,13 +541,13 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) case G_SCALED: case G_REFLECTED: { - o = transformObject( file, *retdoc, parents, descendtype, ok ); + o = transformObject( file, *retdoc, tqparents, descendtype, ok ); break; } default: { - if ( nparents < 3 ) KIG_FILTER_PARSE_ERROR; - o = new ObjectTypeCalcer( PolygonBNPType::instance(), parents ); + if ( ntqparents < 3 ) KIG_FILTER_PARSE_ERROR; + o = new ObjectTypeCalcer( PolygonBNPType::instance(), tqparents ); } } // default: @@ -581,13 +581,13 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) case G_SCALED: case G_REFLECTED: { - o = transformObject( file, *retdoc, parents, descendtype, ok ); + o = transformObject( file, *retdoc, tqparents, descendtype, ok ); break; } case G_OBJECT_LOCUS: { - if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR; - o = fact->locusCalcer( parents[0], parents[1] ); + if ( ntqparents != 2 ) KIG_FILTER_PARSE_ERROR; + o = fact->locusCalcer( tqparents[0], tqparents[1] ); break; } default: @@ -636,7 +636,7 @@ KigDocument* KigFilterKSeg::load( const TQString& file ) std::vector args2; args2.push_back( object->nameCalcer() ); ObjectCalcer* oc2 = fact->attachedLabelCalcer( - TQString::fromLatin1( "%1" ), object->calcer(), + TQString::tqfromLatin1( "%1" ), object->calcer(), static_cast( object->imp() )->coordinate(), false, args2, *retdoc ); oc2->calc( *retdoc ); -- cgit v1.2.1