diff options
Diffstat (limited to 'kig/misc/special_constructors.cc')
-rw-r--r-- | kig/misc/special_constructors.cc | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/kig/misc/special_constructors.cc b/kig/misc/special_constructors.cc index d419a546..ccb92ac6 100644 --- a/kig/misc/special_constructors.cc +++ b/kig/misc/special_constructors.cc @@ -68,7 +68,7 @@ public: ConicConicIntersectionConstructor(); ~ConicConicIntersectionConstructor(); - void drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, + void drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& ) const; std::vector<ObjectHolder*> build( const std::vector<ObjectCalcer*>& os, KigDocument& d, KigWidget& w ) const; void plug( KigPart* doc, KigGUIAction* kact ); @@ -109,13 +109,13 @@ ConicRadicalConstructor::~ConicRadicalConstructor() } void ConicRadicalConstructor::drawprelim( - const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, const KigDocument& doc ) const + const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& doc ) const { - if ( parents.size() == 2 && parents[0]->imp()->inherits( ConicImp::stype() ) && - parents[1]->imp()->inherits( ConicImp::stype() ) ) + if ( tqparents.size() == 2 && tqparents[0]->imp()->inherits( ConicImp::stype() ) && + tqparents[1]->imp()->inherits( ConicImp::stype() ) ) { Args args; - std::transform( parents.begin(), parents.end(), + std::transform( tqparents.begin(), tqparents.end(), std::back_inserter( args ), std::mem_fun( &ObjectCalcer::imp ) ); for ( int i = -1; i < 2; i += 2 ) { @@ -170,27 +170,27 @@ LocusConstructor::~LocusConstructor() { } -void LocusConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, +void LocusConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& ) const { // this function is rather ugly, but it is necessary to do it this // way in order to play nice with Kig's design.. - if ( parents.size() != 2 ) return; - const ObjectTypeCalcer* constrained = dynamic_cast<ObjectTypeCalcer*>( parents.front() ); - const ObjectCalcer* moving = parents.back(); + if ( tqparents.size() != 2 ) return; + const ObjectTypeCalcer* constrained = dynamic_cast<ObjectTypeCalcer*>( tqparents.front() ); + const ObjectCalcer* moving = tqparents.back(); if ( ! constrained || ! constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ) { // moving is in fact the constrained point.. swap them.. - moving = parents.front(); - constrained = dynamic_cast<const ObjectTypeCalcer*>( parents.back() ); + moving = tqparents.front(); + constrained = dynamic_cast<const ObjectTypeCalcer*>( tqparents.back() ); assert( constrained ); }; assert( constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ); - const ObjectImp* oimp = constrained->parents().back()->imp(); + const ObjectImp* oimp = constrained->tqparents().back()->imp(); if( !oimp->inherits( CurveImp::stype() ) ) - oimp = constrained->parents().front()->imp(); + oimp = constrained->tqparents().front()->imp(); assert( oimp->inherits( CurveImp::stype() ) ); const CurveImp* cimp = static_cast<const CurveImp*>( oimp ); @@ -210,30 +210,30 @@ const int LocusConstructor::wantArgs( if ( dynamic_cast<ObjectTypeCalcer*>( os.front() ) && static_cast<ObjectTypeCalcer*>( os.front() )->type()->inherits( ObjectType::ID_ConstrainedPointType ) ) { - std::set<ObjectCalcer*> children = getAllChildren( os.front() ); - return children.find( os.back() ) != children.end() ? ret : ArgsParser::Invalid; + std::set<ObjectCalcer*> tqchildren = getAllChildren( os.front() ); + return tqchildren.find( os.back() ) != tqchildren.end() ? ret : ArgsParser::Invalid; } if ( dynamic_cast<ObjectTypeCalcer*>( os.back() ) && static_cast<ObjectTypeCalcer*>( os.back() )->type()->inherits( ObjectType::ID_ConstrainedPointType ) ) { - std::set<ObjectCalcer*> children = getAllChildren( os.back() ); - return children.find( os.front() ) != children.end() ? ret : ArgsParser::Invalid; + std::set<ObjectCalcer*> tqchildren = getAllChildren( os.back() ); + return tqchildren.find( os.front() ) != tqchildren.end() ? ret : ArgsParser::Invalid; } return ArgsParser::Invalid; } -std::vector<ObjectHolder*> LocusConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> LocusConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const { std::vector<ObjectHolder*> ret; - assert( parents.size() == 2 ); + assert( tqparents.size() == 2 ); - ObjectTypeCalcer* constrained = dynamic_cast<ObjectTypeCalcer*>( parents.front() ); - ObjectCalcer* moving = parents.back(); + ObjectTypeCalcer* constrained = dynamic_cast<ObjectTypeCalcer*>( tqparents.front() ); + ObjectCalcer* moving = tqparents.back(); if ( ! constrained || ! constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ) { // moving is in fact the constrained point.. swap them.. - moving = parents.front(); - constrained = dynamic_cast<ObjectTypeCalcer*>( parents.back() ); + moving = tqparents.front(); + constrained = dynamic_cast<ObjectTypeCalcer*>( tqparents.back() ); assert( constrained ); }; assert( constrained->type()->inherits( ObjectType::ID_ConstrainedPointType ) ); @@ -350,12 +350,12 @@ void PolygonBNPTypeConstructor::handlePrelim( std::vector<ObjectCalcer*> args = os; p.setBrushStyle( Qt::NoBrush ); - p.setBrushColor( Qt::red ); - p.setPen( TQPen ( Qt::red, 1) ); + p.setBrushColor( TQt::red ); + p.setPen( TQPen ( TQt::red, 1) ); p.setWidth( -1 ); // -1 means the default width for the object being // drawn.. - ObjectDrawer drawer( Qt::red ); + ObjectDrawer drawer( TQt::red ); drawprelim( drawer, p, args, d ); } @@ -374,21 +374,21 @@ TQString PolygonBNPTypeConstructor::selectStatement( return i18n("Select a point to be a vertex of the new polygon..."); } -void PolygonBNPTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, +void PolygonBNPTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& ) const { - if ( parents.size() < 2 ) return; + if ( tqparents.size() < 2 ) return; std::vector<Coordinate> points; - for ( uint i = 0; i < parents.size(); ++i ) + for ( uint i = 0; i < tqparents.size(); ++i ) { const Coordinate vertex = - static_cast<const PointImp*>( parents[i]->imp() )->coordinate(); + static_cast<const PointImp*>( tqparents[i]->imp() )->coordinate(); points.push_back( vertex ); } - if ( parents.size() == 2 ) + if ( tqparents.size() == 2 ) { SegmentImp segment = SegmentImp( points[0], points[1] ); drawer.draw( segment, p, true ); @@ -398,12 +398,12 @@ void PolygonBNPTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPaint } } -std::vector<ObjectHolder*> PolygonBNPTypeConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> PolygonBNPTypeConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const { - uint count = parents.size() - 1; + uint count = tqparents.size() - 1; assert ( count >= 3 ); std::vector<ObjectCalcer*> args; - for ( uint i = 0; i < count; ++i ) args.push_back( parents[i] ); + for ( uint i = 0; i < count; ++i ) args.push_back( tqparents[i] ); ObjectTypeCalcer* calcer = new ObjectTypeCalcer( mtype, args ); ObjectHolder* h = new ObjectHolder( calcer ); std::vector<ObjectHolder*> ret; @@ -443,12 +443,12 @@ PolygonVertexTypeConstructor::~PolygonVertexTypeConstructor() { } -void PolygonVertexTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, +void PolygonVertexTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& ) const { - if ( parents.size() != 1 ) return; + if ( tqparents.size() != 1 ) return; - const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( parents.front()->imp() ); + const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( tqparents.front()->imp() ); const std::vector<Coordinate> points = polygon->points(); int sides = points.size(); @@ -459,11 +459,11 @@ void PolygonVertexTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPa } } -std::vector<ObjectHolder*> PolygonVertexTypeConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> PolygonVertexTypeConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const { std::vector<ObjectHolder*> ret; - assert( parents.size() == 1 ); - const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( parents.front()->imp() ); + assert( tqparents.size() == 1 ); + const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( tqparents.front()->imp() ); const std::vector<Coordinate> points = polygon->points(); int sides = points.size(); @@ -471,7 +471,7 @@ std::vector<ObjectHolder*> PolygonVertexTypeConstructor::build( const std::vecto for ( int i = 0; i < sides; ++i ) { ObjectConstCalcer* d = new ObjectConstCalcer( new IntImp( i ) ); - std::vector<ObjectCalcer*> args( parents ); + std::vector<ObjectCalcer*> args( tqparents ); args.push_back( d ); ret.push_back( new ObjectHolder( new ObjectTypeCalcer( mtype, args ) ) ); } @@ -510,12 +510,12 @@ PolygonSideTypeConstructor::~PolygonSideTypeConstructor() { } -void PolygonSideTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, +void PolygonSideTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& ) const { - if ( parents.size() != 1 ) return; + if ( tqparents.size() != 1 ) return; - const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( parents.front()->imp() ); + const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( tqparents.front()->imp() ); const std::vector<Coordinate> points = polygon->points(); uint sides = points.size(); @@ -527,11 +527,11 @@ void PolygonSideTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPain } } -std::vector<ObjectHolder*> PolygonSideTypeConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> PolygonSideTypeConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const { std::vector<ObjectHolder*> ret; - assert( parents.size() == 1 ); - const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( parents.front()->imp() ); + assert( tqparents.size() == 1 ); + const PolygonImp* polygon = dynamic_cast<const PolygonImp*>( tqparents.front()->imp() ); const std::vector<Coordinate> points = polygon->points(); uint sides = points.size(); @@ -539,7 +539,7 @@ std::vector<ObjectHolder*> PolygonSideTypeConstructor::build( const std::vector< for ( uint i = 0; i < sides; ++i ) { ObjectConstCalcer* d = new ObjectConstCalcer( new IntImp( i ) ); - std::vector<ObjectCalcer*> args( parents ); + std::vector<ObjectCalcer*> args( tqparents ); args.push_back( d ); ret.push_back( new ObjectHolder( new ObjectTypeCalcer( mtype, args ) ) ); } @@ -659,12 +659,12 @@ void PolygonBCVConstructor::handlePrelim( } p.setBrushStyle( Qt::NoBrush ); - p.setBrushColor( Qt::red ); - p.setPen( TQPen ( Qt::red, 1) ); + p.setBrushColor( TQt::red ); + p.setPen( TQPen ( TQt::red, 1) ); p.setWidth( -1 ); // -1 means the default width for the object being // drawn.. - ObjectDrawer drawer( Qt::red ); + ObjectDrawer drawer( TQt::red ); drawprelim( drawer, p, args, d ); if ( moreinfo ) { @@ -682,7 +682,7 @@ void PolygonBCVConstructor::handlePrelim( ptn = PointImp( where ); ptn.draw( p ); if ( i > 5 ) continue; - text = TextImp( TQString( "(%1)" ).arg(i), where, false ); + text = TextImp( TQString( "(%1)" ).tqarg(i), where, false ); text.draw( p ); } p.setStyle( Qt::DotLine ); @@ -700,17 +700,17 @@ void PolygonBCVConstructor::handlePrelim( delete_all( args.begin() + 2, args.end() ); } -std::vector<ObjectHolder*> PolygonBCVConstructor::build( const std::vector<ObjectCalcer*>& parents, KigDocument&, KigWidget& ) const +std::vector<ObjectHolder*> PolygonBCVConstructor::build( const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const { - assert ( parents.size() == 3 ); + assert ( tqparents.size() == 3 ); std::vector<ObjectCalcer*> args; - Coordinate c = static_cast<const PointImp*>( parents[0]->imp() )->coordinate(); - Coordinate v = static_cast<const PointImp*>( parents[1]->imp() )->coordinate(); - Coordinate cntrl = static_cast<const PointImp*>( parents[2]->imp() )->coordinate(); + Coordinate c = static_cast<const PointImp*>( tqparents[0]->imp() )->coordinate(); + Coordinate v = static_cast<const PointImp*>( tqparents[1]->imp() )->coordinate(); + Coordinate cntrl = static_cast<const PointImp*>( tqparents[2]->imp() )->coordinate(); - args.push_back( parents[0] ); - args.push_back( parents[1] ); + args.push_back( tqparents[0] ); + args.push_back( tqparents[1] ); int winding = 0; int nsides = computeNsides( c, v, cntrl, winding ); ObjectConstCalcer* d = new ObjectConstCalcer( new IntImp( nsides ) ); @@ -752,13 +752,13 @@ TQString PolygonBCVConstructor::useText( const ObjectCalcer&, const std::vector< { TQString result = TQString( i18n( "Adjust the number of sides (%1/%2)" ) - ).arg( nsides ).arg( winding ); + ).tqarg( nsides ).tqarg( winding ); return result; } else { TQString result = TQString( i18n( "Adjust the number of sides (%1)" ) - ).arg( nsides ); + ).tqarg( nsides ); return result; } break; @@ -789,20 +789,20 @@ TQString PolygonBCVConstructor::selectStatement( return ""; } -void PolygonBCVConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, +void PolygonBCVConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& doc ) const { - if ( parents.size() < 3 || parents.size() > 4 ) return; + if ( tqparents.size() < 3 || tqparents.size() > 4 ) return; - assert ( parents[0]->imp()->inherits( PointImp::stype() ) && - parents[1]->imp()->inherits( PointImp::stype() ) && - parents[2]->imp()->inherits( IntImp::stype() ) ); + assert ( tqparents[0]->imp()->inherits( PointImp::stype() ) && + tqparents[1]->imp()->inherits( PointImp::stype() ) && + tqparents[2]->imp()->inherits( IntImp::stype() ) ); - if ( parents.size() == 4 ) - assert ( parents[3]->imp()->inherits( IntImp::stype() ) ); + if ( tqparents.size() == 4 ) + assert ( tqparents[3]->imp()->inherits( IntImp::stype() ) ); Args args; - std::transform( parents.begin(), parents.end(), + std::transform( tqparents.begin(), tqparents.end(), std::back_inserter( args ), std::mem_fun( &ObjectCalcer::imp ) ); ObjectImp* data = mtype->calc( args, doc ); @@ -878,16 +878,16 @@ ConicConicIntersectionConstructor::~ConicConicIntersectionConstructor() { } -void ConicConicIntersectionConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, +void ConicConicIntersectionConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& ) const { - if ( parents.size() != 2 ) return; - assert ( parents[0]->imp()->inherits( ConicImp::stype() ) && - parents[1]->imp()->inherits( ConicImp::stype() ) ); + if ( tqparents.size() != 2 ) return; + assert ( tqparents[0]->imp()->inherits( ConicImp::stype() ) && + tqparents[1]->imp()->inherits( ConicImp::stype() ) ); const ConicCartesianData conica = - static_cast<const ConicImp*>( parents[0]->imp() )->cartesianData(); + static_cast<const ConicImp*>( tqparents[0]->imp() )->cartesianData(); const ConicCartesianData conicb = - static_cast<const ConicImp*>( parents[1]->imp() )->cartesianData(); + static_cast<const ConicImp*>( tqparents[1]->imp() )->cartesianData(); bool ok = true; for ( int wr = -1; wr < 2; wr += 2 ) { @@ -1179,23 +1179,23 @@ void MeasureTransportConstructor::handlePrelim( ) const { p.setBrushStyle( Qt::NoBrush ); - p.setBrushColor( Qt::red ); - p.setPen( TQPen ( Qt::red, 1) ); + p.setBrushColor( TQt::red ); + p.setPen( TQPen ( TQt::red, 1) ); p.setWidth( -1 ); // -1 means the default width for the object being // drawn.. - ObjectDrawer drawer( Qt::red ); + ObjectDrawer drawer( TQt::red ); drawprelim( drawer, p, os, d ); } void MeasureTransportConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter& p, - const std::vector<ObjectCalcer*>& parents, + const std::vector<ObjectCalcer*>& tqparents, const KigDocument& doc ) const { Args args; using namespace std; - transform( parents.begin(), parents.end(), + transform( tqparents.begin(), tqparents.end(), back_inserter( args ), mem_fun( &ObjectCalcer::imp ) ); ObjectImp* data = mtype->calc( args, doc ); drawer.draw( *data, p, true ); @@ -1236,13 +1236,13 @@ TQString MeasureTransportConstructor::selectStatement( } std::vector<ObjectHolder*> MeasureTransportConstructor::build( - const std::vector<ObjectCalcer*>& parents, + const std::vector<ObjectCalcer*>& tqparents, KigDocument&, KigWidget& ) const { - assert ( parents.size() == 3 ); + assert ( tqparents.size() == 3 ); // std::vector<ObjectCalcer*> args; -// for ( uint i = 0; i < count; ++i ) args.push_back( parents[i] ); - ObjectTypeCalcer* calcer = new ObjectTypeCalcer( mtype, parents ); +// for ( uint i = 0; i < count; ++i ) args.push_back( tqparents[i] ); + ObjectTypeCalcer* calcer = new ObjectTypeCalcer( mtype, tqparents ); ObjectHolder* h = new ObjectHolder( calcer ); std::vector<ObjectHolder*> ret; ret.push_back( h ); @@ -1362,7 +1362,7 @@ TQString GenericIntersectionConstructor::useText( break; } - return TQString::null; + return TQString(); } static const ArgsParser::spec argsspecMidPointOfTwoPoints[] = @@ -1386,15 +1386,15 @@ MidPointOfTwoPointsConstructor::~MidPointOfTwoPointsConstructor() } void MidPointOfTwoPointsConstructor::drawprelim( - const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& parents, + const ObjectDrawer& drawer, KigPainter& p, const std::vector<ObjectCalcer*>& tqparents, const KigDocument& ) const { - if ( parents.size() != 2 ) return; - assert( parents[0]->imp()->inherits( PointImp::stype() ) ); - assert( parents[1]->imp()->inherits( PointImp::stype() ) ); + if ( tqparents.size() != 2 ) return; + assert( tqparents[0]->imp()->inherits( PointImp::stype() ) ); + assert( tqparents[1]->imp()->inherits( PointImp::stype() ) ); const Coordinate m = - ( static_cast<const PointImp*>( parents[0]->imp() )->coordinate() + - static_cast<const PointImp*>( parents[1]->imp() )->coordinate() ) / 2; + ( static_cast<const PointImp*>( tqparents[0]->imp() )->coordinate() + + static_cast<const PointImp*>( tqparents[1]->imp() )->coordinate() ) / 2; drawer.draw( PointImp( m ), p, true ); } @@ -1403,7 +1403,7 @@ std::vector<ObjectHolder*> MidPointOfTwoPointsConstructor::build( { ObjectTypeCalcer* seg = new ObjectTypeCalcer( SegmentABType::instance(), os ); seg->calc( d ); - int index = seg->imp()->propertiesInternalNames().findIndex( "mid-point" ); + int index = seg->imp()->propertiesInternalNames().tqfindIndex( "mid-point" ); assert( index != -1 ); ObjectPropertyCalcer* prop = new ObjectPropertyCalcer( seg, index ); prop->calc( d ); @@ -1542,7 +1542,7 @@ TQString TangentConstructor::useText( else if ( o.imp()->inherits( PointImp::stype() ) ) return i18n( "Tangent at This Point" ); // else assert( false ); - return TQString::null; + return TQString(); } //TQString TangentConstructor::selectStatement( @@ -1604,7 +1604,7 @@ TQString CocConstructor::useText( return i18n( "Center of Curvature of This Curve" ); else if ( o.imp()->inherits( PointImp::stype() ) ) return i18n( "Center of Curvature at This Point" ); - return TQString::null; + return TQString(); } bool relativePrimes( int n, int p ) |