diff options
Diffstat (limited to 'src/flowparts/flowpart.cpp')
-rw-r--r-- | src/flowparts/flowpart.cpp | 238 |
1 files changed, 119 insertions, 119 deletions
diff --git a/src/flowparts/flowpart.cpp b/src/flowparts/flowpart.cpp index e12213c..abf8880 100644 --- a/src/flowparts/flowpart.cpp +++ b/src/flowparts/flowpart.cpp @@ -24,11 +24,11 @@ #include <kdebug.h> -#include <qbitarray.h> -#include <qbitmap.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qregexp.h> +#include <tqbitarray.h> +#include <tqbitmap.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqregexp.h> #include <assert.h> #include <algorithm> @@ -61,7 +61,7 @@ Node::node_dir inNodePositioning[4] = {Node::dir_up,Node::dir_right,Node::dir_do Node::node_dir outNodePositioning[4] = {Node::dir_down,Node::dir_left,Node::dir_up,Node::dir_right}; -FlowPart::FlowPart( ICNDocument *icnDocument, bool newItem, const QString &id ) +FlowPart::FlowPart( ICNDocument *icnDocument, bool newItem, const TQString &id ) : CNItem( icnDocument, newItem, id ) { icnDocument->registerItem(this); @@ -74,8 +74,8 @@ FlowPart::FlowPart( ICNDocument *icnDocument, bool newItem, const QString &id ) m_stdOutput = 0l; m_altOutput = 0l; - connect( m_pFlowCodeDocument, SIGNAL(picTypeChanged()), this, SLOT(slotUpdateFlowPartVariables()) ); - connect( m_pFlowCodeDocument, SIGNAL(pinMappingsChanged()), this, SLOT(slotUpdateFlowPartVariables()) ); + connect( m_pFlowCodeDocument, TQT_SIGNAL(picTypeChanged()), this, TQT_SLOT(slotUpdateFlowPartVariables()) ); + connect( m_pFlowCodeDocument, TQT_SIGNAL(pinMappingsChanged()), this, TQT_SLOT(slotUpdateFlowPartVariables()) ); } @@ -96,7 +96,7 @@ FlowPart::~FlowPart() } -void FlowPart::setCaption( const QString &caption ) +void FlowPart::setCaption( const TQString &caption ) { if ( m_flowSymbol == FlowPart::ps_other ) { @@ -104,10 +104,10 @@ void FlowPart::setCaption( const QString &caption ) return; } - QWidget *w = new QWidget(); - QPainter p(w); + TQWidget *w = new TQWidget(); + TQPainter p(w); p.setFont( font() ); - const int text_width = p.boundingRect( boundingRect(), (Qt::SingleLine | Qt::AlignHCenter | Qt::AlignVCenter), caption ).width(); + const int text_width = p.boundingRect( boundingRect(), (TQt::SingleLine | TQt::AlignHCenter | TQt::AlignVCenter), caption ).width(); p.end(); delete w; int width = std::max( ((int)(text_width/16))*16, 48 ); @@ -180,18 +180,18 @@ void FlowPart::initSymbol( FlowPart::FlowSymbol symbol, int width ) case FlowPart::ps_call: case FlowPart::ps_process: { - setItemPoints( QRect( -width/2, -16, width, 24 ) ); + setItemPoints( TQRect( -width/2, -16, width, 24 ) ); break; } case FlowPart::ps_io: { - // define parallelogram shape - QPointArray pa(4); - pa[0] = QPoint( -(width-10)/2, -16 ); - pa[1] = QPoint( width/2, -16 ); - pa[2] = QPoint( (width-10)/2, 8 ); - pa[3] = QPoint( -width/2, 8 ); + // define parallelogram tqshape + TQPointArray pa(4); + pa[0] = TQPoint( -(width-10)/2, -16 ); + pa[1] = TQPoint( width/2, -16 ); + pa[2] = TQPoint( (width-10)/2, 8 ); + pa[3] = TQPoint( -width/2, 8 ); setItemPoints(pa); break; } @@ -207,13 +207,13 @@ void FlowPart::initSymbol( FlowPart::FlowSymbol symbol, int width ) // Draw semicircle double x; const int RP_NUM = 48; - QPointArray pa(RP_NUM); + TQPointArray pa(RP_NUM); int point = 0; for ( double y = -1.0; y <= 1.0; y+= 4.0/(RP_NUM-2) ) { x = sqrt(1-y*y)*halfHeight; - pa[point] = QPoint( (int)(width+x)-halfHeight, (int)(halfHeight*y) ); - pa[RP_NUM-1-point] = QPoint ( (int)(halfHeight-x), (int)(halfHeight*y) ); + pa[point] = TQPoint( (int)(width+x)-halfHeight, (int)(halfHeight*y) ); + pa[RP_NUM-1-point] = TQPoint ( (int)(halfHeight-x), (int)(halfHeight*y) ); point++; } @@ -225,13 +225,13 @@ void FlowPart::initSymbol( FlowPart::FlowSymbol symbol, int width ) case FlowPart::ps_decision: { // define rhombus - QPointArray pa(6); - pa[0] = QPoint( 0, -24 ); - pa[1] = QPoint( width/2, -6 ); - pa[2] = QPoint( width/2, 6 ); - pa[3] = QPoint( 0, 24 ); - pa[4] = QPoint( -width/2, 6 ); - pa[5] = QPoint( -width/2, -6 ); + TQPointArray pa(6); + pa[0] = TQPoint( 0, -24 ); + pa[1] = TQPoint( width/2, -6 ); + pa[2] = TQPoint( width/2, 6 ); + pa[3] = TQPoint( 0, 24 ); + pa[4] = TQPoint( -width/2, 6 ); + pa[5] = TQPoint( -width/2, -6 ); setItemPoints(pa); break; } @@ -239,7 +239,7 @@ void FlowPart::initSymbol( FlowPart::FlowSymbol symbol, int width ) } } -void FlowPart::drawShape( QPainter &p ) +void FlowPart::drawShape( TQPainter &p ) { initPainter(p); @@ -272,7 +272,7 @@ void FlowPart::drawShape( QPainter &p ) int outer16 = int(16*outer*DPR); p.save(); - p.setPen( Qt::NoPen ); + p.setPen( TQt::NoPen ); p.drawPolygon( areaPoints() ); p.restore(); @@ -292,7 +292,7 @@ void FlowPart::drawShape( QPainter &p ) case FlowPart::ps_decision: { - // TODO Make the shape nice and pretty with rounded corners + // TODO Make the tqshape nice and pretty with rounded corners CNItem::drawShape(p); break; } @@ -317,19 +317,19 @@ void FlowPart::drawShape( QPainter &p ) } } - p.setPen( Qt::black ); + p.setPen( TQt::black ); p.setFont( font() ); - p.drawText( boundingRect(), (Qt::WordBreak | Qt::AlignHCenter | Qt::AlignVCenter), m_caption ); + p.drawText( boundingRect(), (TQt::WordBreak | TQt::AlignHCenter | TQt::AlignVCenter), m_caption ); } -QString FlowPart::gotoCode( const QString& internalNodeId ) +TQString FlowPart::gotoCode( const TQString& internalNodeId ) { FlowPart *end = outputPart(internalNodeId); if (!end) return ""; return "goto "+end->id(); } -FlowPart* FlowPart::outputPart( const QString& internalNodeId ) +FlowPart* FlowPart::outputPart( const TQString& internalNodeId ) { Node *node = p_icnDocument->nodeWithID( nodeId(internalNodeId) ); @@ -340,7 +340,7 @@ FlowPart* FlowPart::outputPart( const QString& internalNodeId ) return fpnode->outputFlowPart(); } -FlowPartList FlowPart::inputParts( const QString& id ) +FlowPartList FlowPart::inputParts( const TQString& id ) { Node *node = p_icnDocument->nodeWithID(id); @@ -388,7 +388,7 @@ FlowPartList FlowPart::outputParts() } -FlowPart* FlowPart::endPart( QStringList ids, FlowPartList *previousParts ) +FlowPart* FlowPart::endPart( TQStringList ids, FlowPartList *previousParts ) { if ( ids.empty() ) { @@ -403,7 +403,7 @@ FlowPart* FlowPart::endPart( QStringList ids, FlowPartList *previousParts ) const bool createdList = (!previousParts); if (createdList) { previousParts = new FlowPartList; - } else if ( previousParts->contains(this) ) { + } else if ( previousParts->tqcontains(this) ) { return 0l; } previousParts->append(this); @@ -415,23 +415,23 @@ FlowPart* FlowPart::endPart( QStringList ids, FlowPartList *previousParts ) return outputPart( *(ids.begin()) ); } - typedef QValueList<FlowPartList> ValidPartsList; + typedef TQValueList<FlowPartList> ValidPartsList; ValidPartsList validPartsList; - const QStringList::iterator idsEnd = ids.end(); - for ( QStringList::iterator it = ids.begin(); it != idsEnd; ++it ) + const TQStringList::iterator idsEnd = ids.end(); + for ( TQStringList::iterator it = ids.begin(); it != idsEnd; ++it ) { int prevLevel = level(); FlowPartList validParts; FlowPart *part = outputPart(*it); while (part) { - if ( !validParts.contains(part) ) + if ( !validParts.tqcontains(part) ) { validParts.append(part); // if ( part->level() >= level() ) { const int _l = part->level(); - part = part->endPart( QStringList(), previousParts ); + part = part->endPart( TQStringList(), previousParts ); prevLevel = _l; // } else { // part = 0l; @@ -462,7 +462,7 @@ FlowPart* FlowPart::endPart( QStringList ids, FlowPartList *previousParts ) bool ok = true; for ( ValidPartsList::iterator vplit = validPartsList.begin(); vplit != vplEnd; ++vplit ) { - if ( !(*vplit).contains(*it) ) ok = false; + if ( !(*vplit).tqcontains(*it) ) ok = false; } if (ok) return *it; } @@ -471,8 +471,8 @@ FlowPart* FlowPart::endPart( QStringList ids, FlowPartList *previousParts ) } -void FlowPart::handleIfElse( FlowCode *code, const QString &case1Statement, const QString &case2Statement, - const QString &case1, const QString &case2 ) +void FlowPart::handleIfElse( FlowCode *code, const TQString &case1Statement, const TQString &case2Statement, + const TQString &case1, const TQString &case2 ) { if (!code) return; @@ -480,7 +480,7 @@ void FlowPart::handleIfElse( FlowCode *code, const QString &case1Statement, cons FlowPart *part1 = outputPart(case1); FlowPart *part2 = outputPart(case2); - if ( part1 && part2 ) stop = endPart( QStringList::split( ',', case1+","+case2 ) ); + if ( part1 && part2 ) stop = endPart( TQStringList::split( ',', case1+","+case2 ) ); if ( (!part1 && !part2) || (part1 == stop && part2 == stop) ) return; @@ -513,7 +513,7 @@ void FlowPart::handleIfElse( FlowCode *code, const QString &case1Statement, cons } -Variant * FlowPart::createProperty( const QString & id, Variant::Type::Value type ) +Variant * FlowPart::createProperty( const TQString & id, Variant::Type::Value type ) { if ( type != Variant::Type::Port && type != Variant::Type::Pin @@ -529,7 +529,7 @@ Variant * FlowPart::createProperty( const QString & id, Variant::Type::Value typ { if ( MicroSettings * settings = m_pFlowCodeDocument->microSettings() ) v->setAllowed( settings->variableNames() ); - connect( property(id), SIGNAL(valueChanged(QVariant, QVariant )), this, SLOT(varNameChanged(QVariant, QVariant )) ); + connect( property(id), TQT_SIGNAL(valueChanged(TQVariant, TQVariant )), this, TQT_SLOT(varNameChanged(TQVariant, TQVariant )) ); } else slotUpdateFlowPartVariables(); @@ -548,8 +548,8 @@ void FlowPart::slotUpdateFlowPartVariables() return; const PinMappingMap pinMappings = s->pinMappings(); - QStringList sevenSegMaps; - QStringList keyPadMaps; + TQStringList sevenSegMaps; + TQStringList keyPadMaps; PinMappingMap::const_iterator pEnd = pinMappings.end(); for ( PinMappingMap::const_iterator it = pinMappings.begin(); it != pEnd; ++it ) { @@ -569,10 +569,10 @@ void FlowPart::slotUpdateFlowPartVariables() } } - QStringList ports = s->microInfo()->package()->portNames(); + TQStringList ports = s->microInfo()->package()->portNames(); ports.sort(); - QStringList pins = s->microInfo()->package()->pinIDs(PicPin::type_bidir | PicPin::type_input | PicPin::type_open); + TQStringList pins = s->microInfo()->package()->pinIDs(PicPin::type_bidir | PicPin::type_input | PicPin::type_open); pins.sort(); const VariantDataMap::iterator vEnd = m_variantData.end(); @@ -591,14 +591,14 @@ void FlowPart::slotUpdateFlowPartVariables() else if ( v->type() == Variant::Type::SevenSegment ) { v->setAllowed( sevenSegMaps ); - if ( !sevenSegMaps.isEmpty() && !sevenSegMaps.contains( v->value().toString() ) ) + if ( !sevenSegMaps.isEmpty() && !sevenSegMaps.tqcontains( v->value().toString() ) ) v->setValue( sevenSegMaps.first() ); } else if ( v->type() == Variant::Type::KeyPad ) { v->setAllowed( keyPadMaps ); - if ( !keyPadMaps.isEmpty() && !keyPadMaps.contains( v->value().toString() ) ) + if ( !keyPadMaps.isEmpty() && !keyPadMaps.tqcontains( v->value().toString() ) ) v->setValue( keyPadMaps.first() ); } } @@ -614,7 +614,7 @@ void FlowPart::updateVarNames() if (!s) return; - const QStringList names = s->variableNames(); + const TQStringList names = s->variableNames(); const VariantDataMap::iterator end = m_variantData.end(); for ( VariantDataMap::iterator it = m_variantData.begin(); it != end; ++it ) { @@ -625,7 +625,7 @@ void FlowPart::updateVarNames() } -void FlowPart::varNameChanged( QVariant newValue, QVariant oldValue ) +void FlowPart::varNameChanged( TQVariant newValue, TQVariant oldValue ) { if (!m_pFlowCodeDocument) return; @@ -656,17 +656,17 @@ void FlowPart::updateAttachedPositioning( ) return; //BEGIN Rearrange text if appropriate - const QRect textPos[4] = { - QRect( offsetX()+width(), 6, 40, 16 ), - QRect( 0, offsetY()-16, 40, 16 ), - QRect( offsetX()-40, 6, 40, 16 ), - QRect( 0, offsetY()+height(), 40, 16 ) }; + const TQRect textPos[4] = { + TQRect( offsetX()+width(), 6, 40, 16 ), + TQRect( 0, offsetY()-16, 40, 16 ), + TQRect( offsetX()-40, 6, 40, 16 ), + TQRect( 0, offsetY()+height(), 40, 16 ) }; NodeInfo * stdOutputInfo = m_stdOutput ? &m_nodeMap["stdoutput"] : 0; NodeInfo * altOutputInfo = m_altOutput ? &m_nodeMap["altoutput"] : 0l; - Text *outputTrueText = m_textMap.contains("output_true") ? m_textMap["output_true"] : 0l; - Text *outputFalseText = m_textMap.contains("output_false") ? m_textMap["output_false"] : 0l; + Text *outputTrueText = m_textMap.tqcontains("output_true") ? m_textMap["output_true"] : 0l; + Text *outputFalseText = m_textMap.tqcontains("output_false") ? m_textMap["output_false"] : 0l; if ( stdOutputInfo && outputTrueText ) outputTrueText->setOriginalRect( textPos[ nodeDirToPos( (Node::node_dir)stdOutputInfo->orientation ) ] ); @@ -677,7 +677,7 @@ void FlowPart::updateAttachedPositioning( ) const TextMap::iterator textMapEnd = m_textMap.end(); for ( TextMap::iterator it = m_textMap.begin(); it != textMapEnd; ++it ) { - QRect pos = it.data()->recommendedRect(); + TQRect pos = it.data()->recommendedRect(); it.data()->move( pos.x() + x(), pos.y() + y() ); it.data()->setGuiPartSize( pos.width(), pos.height() ); } @@ -820,9 +820,9 @@ uint FlowPart::allowedOrientations( ) const return 0; } -void FlowPart::orientationPixmap( uint orientation, QPixmap & pm ) const +void FlowPart::orientationPixmap( uint orientation, TQPixmap & pm ) const { - const QSize size = pm.size(); + const TQSize size = pm.size(); if ( ! ( allowedOrientations() & ( 1 << orientation ) ) ) { @@ -830,101 +830,101 @@ void FlowPart::orientationPixmap( uint orientation, QPixmap & pm ) const return; } - QBitmap mask( 50, 50 ); - QPainter maskPainter(&mask); - mask.fill( Qt::color0 ); - maskPainter.setBrush(Qt::color1); - maskPainter.setPen(Qt::color1); + TQBitmap tqmask( 50, 50 ); + TQPainter tqmaskPainter(&tqmask); + tqmask.fill( TQt::color0 ); + tqmaskPainter.setBrush(TQt::color1); + tqmaskPainter.setPen(TQt::color1); - QPainter p(&pm); + TQPainter p(&pm); p.setBrush(m_brushCol); - p.setPen( Qt::black ); + p.setPen( TQt::black ); // In order: right corner, top corner, left corner, bottom corner - QPoint c[4] = { - QPoint( int(0.7*size.width()), int(0.5*size.height()) ), - QPoint( int(0.5*size.width()), int(0.4*size.height()) ), - QPoint( int(0.3*size.width()), int(0.5*size.height()) ), - QPoint( int(0.5*size.width()), int(0.6*size.height()) ) }; + TQPoint c[4] = { + TQPoint( int(0.7*size.width()), int(0.5*size.height()) ), + TQPoint( int(0.5*size.width()), int(0.4*size.height()) ), + TQPoint( int(0.3*size.width()), int(0.5*size.height()) ), + TQPoint( int(0.5*size.width()), int(0.6*size.height()) ) }; - QPoint d[4]; - d[0] = c[0] + QPoint( 7, 0 ); - d[1] = c[1] + QPoint( 0, -7 ); - d[2] = c[2] + QPoint( -7, 0 ); - d[3] = c[3] + QPoint( 0, 7 ); + TQPoint d[4]; + d[0] = c[0] + TQPoint( 7, 0 ); + d[1] = c[1] + TQPoint( 0, -7 ); + d[2] = c[2] + TQPoint( -7, 0 ); + d[3] = c[3] + TQPoint( 0, 7 ); if ( m_stdInput && m_stdOutput && m_altOutput ) { //BEGIN Draw diamond outline - QPointArray diamond(4); + TQPointArray diamond(4); for ( uint i=0; i<4; ++i ) diamond[i] = c[i]; p.drawPolygon(diamond); - maskPainter.drawPolygon(diamond); + tqmaskPainter.drawPolygon(diamond); //END Draw diamond outline //BEGIN Draw input int pos0 = nodeDirToPos( diamondNodePositioning[orientation][0] ); p.drawLine( c[pos0], d[pos0] ); - maskPainter.drawLine( c[pos0], d[pos0] ); + tqmaskPainter.drawLine( c[pos0], d[pos0] ); //END Draw input //BEGIN Draw "true" output as a tick - QPointArray tick(4); - tick[0] = QPoint( -3, 0 ); - tick[1] = QPoint( 0, 2 ); - tick[2] = QPoint( 0, 2 ); - tick[3] = QPoint( 4, -2 ); + TQPointArray tick(4); + tick[0] = TQPoint( -3, 0 ); + tick[1] = TQPoint( 0, 2 ); + tick[2] = TQPoint( 0, 2 ); + tick[3] = TQPoint( 4, -2 ); int pos1 = nodeDirToPos( diamondNodePositioning[orientation][1] ); tick.translate( d[pos1].x(), d[pos1].y() ); p.drawLineSegments(tick); - maskPainter.drawLineSegments(tick); + tqmaskPainter.drawLineSegments(tick); //END Draw "true" output as a tick //BEGIN Draw "false" output as a cross - QPointArray cross(4); - cross[0] = QPoint( -2, -2 ); - cross[1] = QPoint( 2, 2 ); - cross[2] = QPoint( -2, 2 ); - cross[3] = QPoint( 2, -2 ); + TQPointArray cross(4); + cross[0] = TQPoint( -2, -2 ); + cross[1] = TQPoint( 2, 2 ); + cross[2] = TQPoint( -2, 2 ); + cross[3] = TQPoint( 2, -2 ); int pos2 = nodeDirToPos( diamondNodePositioning[orientation][2] ); cross.translate( d[pos2].x(), d[pos2].y() ); p.drawLineSegments(cross); - maskPainter.drawLineSegments(cross); + tqmaskPainter.drawLineSegments(cross); //END Draw "false" output as a cross } else if ( m_stdInput || m_stdOutput ) { p.drawRoundRect( int(0.3*size.width()), int(0.4*size.height()), int(0.4*size.width()), int(0.2*size.height()) ); - maskPainter.drawRoundRect( int(0.3*size.width()), int(0.4*size.height()), int(0.4*size.width()), int(0.2*size.height()) ); + tqmaskPainter.drawRoundRect( int(0.3*size.width()), int(0.4*size.height()), int(0.4*size.width()), int(0.2*size.height()) ); int hal = 5; // half arrow length int haw = 3; // half arrow width - QPoint arrows[4][6] = { - { QPoint( hal, 0 ), QPoint( 0, -haw ), - QPoint( hal, 0 ), QPoint( -hal, 0 ), - QPoint( hal, 0 ), QPoint( 0, haw ) }, + TQPoint arrows[4][6] = { + { TQPoint( hal, 0 ), TQPoint( 0, -haw ), + TQPoint( hal, 0 ), TQPoint( -hal, 0 ), + TQPoint( hal, 0 ), TQPoint( 0, haw ) }, - { QPoint( 0, -hal ), QPoint( -haw, 0 ), - QPoint( 0, -hal ), QPoint( 0, hal ), - QPoint( 0, -hal ), QPoint( haw, 0 ) }, + { TQPoint( 0, -hal ), TQPoint( -haw, 0 ), + TQPoint( 0, -hal ), TQPoint( 0, hal ), + TQPoint( 0, -hal ), TQPoint( haw, 0 ) }, - { QPoint( -hal, 0 ), QPoint( 0, -haw ), - QPoint( -hal, 0 ), QPoint( hal, 0 ), - QPoint( -hal, 0 ), QPoint( 0, haw ) }, + { TQPoint( -hal, 0 ), TQPoint( 0, -haw ), + TQPoint( -hal, 0 ), TQPoint( hal, 0 ), + TQPoint( -hal, 0 ), TQPoint( 0, haw ) }, - { QPoint( 0, hal ), QPoint( -haw, 0 ), - QPoint( 0, hal ), QPoint( 0, -hal ), - QPoint( 0, hal ), QPoint( haw, 0 ) } }; + { TQPoint( 0, hal ), TQPoint( -haw, 0 ), + TQPoint( 0, hal ), TQPoint( 0, -hal ), + TQPoint( 0, hal ), TQPoint( haw, 0 ) } }; int inPos = -1; int outPos = -1; @@ -945,30 +945,30 @@ void FlowPart::orientationPixmap( uint orientation, QPixmap & pm ) const if ( inPos != -1 ) { - QPointArray inArrow(6); + TQPointArray inArrow(6); for ( int i=0; i<6; ++i ) { inArrow[i] = arrows[(inPos+2)%4][i]; } inArrow.translate( d[inPos].x(), d[inPos].y() ); p.drawPolygon(inArrow); - maskPainter.drawPolygon(inArrow); + tqmaskPainter.drawPolygon(inArrow); } if ( outPos != -1 ) { - QPointArray outArrow(6); + TQPointArray outArrow(6); for ( int i=0; i<6; ++i ) { outArrow[i] = arrows[outPos][i]; } outArrow.translate( d[outPos].x(), d[outPos].y() ); p.drawPolygon(outArrow); - maskPainter.drawPolygon(outArrow); + tqmaskPainter.drawPolygon(outArrow); } } - pm.setMask(mask); + pm.setMask(tqmask); } |