diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/connector.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/connector.cpp')
-rw-r--r-- | src/connector.cpp | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/src/connector.cpp b/src/connector.cpp index 03a304c..febb20c 100644 --- a/src/connector.cpp +++ b/src/connector.cpp @@ -31,29 +31,29 @@ inline static int fromCanvas( int pos ) // return (pos>0) ? int((pos-3)/8) : int((pos-5)/8); } -inline static QPoint toCanvas( const QPoint * const pos ) +inline static TQPoint toCanvas( const TQPoint * const pos ) { - return QPoint( toCanvas(pos->x()), toCanvas(pos->y()) ); + return TQPoint( toCanvas(pos->x()), toCanvas(pos->y()) ); } -inline static QPoint fromCanvas( const QPoint * const pos ) +inline static TQPoint fromCanvas( const TQPoint * const pos ) { - return QPoint( fromCanvas(pos->x()), fromCanvas(pos->y()) ); + return TQPoint( fromCanvas(pos->x()), fromCanvas(pos->y()) ); } -inline static QPoint toCanvas( const QPoint &pos ) +inline static TQPoint toCanvas( const TQPoint &pos ) { - return QPoint( toCanvas(pos.x()), toCanvas(pos.y()) ); + return TQPoint( toCanvas(pos.x()), toCanvas(pos.y()) ); } -inline static QPoint fromCanvas( const QPoint &pos ) +inline static TQPoint fromCanvas( const TQPoint &pos ) { - return QPoint( fromCanvas(pos.x()), fromCanvas(pos.y()) ); + return TQPoint( fromCanvas(pos.x()), fromCanvas(pos.y()) ); } //BEGIN class Connector -Connector::Connector( Node * startNode, Node * endNode, ICNDocument *icnDocument, QString *id ) - : QObject(icnDocument), - QCanvasPolygon( icnDocument->canvas() ) +Connector::Connector( Node * startNode, Node * endNode, ICNDocument *icnDocument, TQString *id ) + : TQObject(icnDocument), + TQCanvasPolygon( icnDocument->canvas() ) { p_icnDocument = icnDocument; m_conRouter = new ConRouter(p_icnDocument); @@ -87,8 +87,8 @@ Connector::Connector( Node * startNode, Node * endNode, ICNDocument *icnDocument ECNode * endECNode = dynamic_cast<ECNode*>(endNode); if ( startECNode && endECNode ) { - connect( startECNode, SIGNAL(numPinsChanged(unsigned)), this, SLOT(syncWiresWithNodes()) ); - connect( endECNode, SIGNAL(numPinsChanged(unsigned)), this, SLOT(syncWiresWithNodes()) ); + connect( startECNode, TQT_SIGNAL(numPinsChanged(unsigned)), this, TQT_SLOT(syncWiresWithNodes()) ); + connect( endECNode, TQT_SIGNAL(numPinsChanged(unsigned)), this, TQT_SLOT(syncWiresWithNodes()) ); syncWiresWithNodes(); } } @@ -125,10 +125,10 @@ void Connector::syncWiresWithNodes() if ( startECNode->type() == Node::ec_junction || endECNode->type() == Node::ec_junction ) - newNumWires = QMAX( startECNode->numPins(), endECNode->numPins() ); + newNumWires = TQMAX( startECNode->numPins(), endECNode->numPins() ); else - newNumWires = QMIN( startECNode->numPins(), endECNode->numPins() ); + newNumWires = TQMIN( startECNode->numPins(), endECNode->numPins() ); unsigned oldNumWires = m_wires.size(); @@ -163,9 +163,9 @@ void Connector::syncWiresWithNodes() } -void Connector::setParentContainer( const QString &cnItemId ) +void Connector::setParentContainer( const TQString &cnItemId ) { -// // We only allow the node to be parented once +// // We only allow the node to be tqparented once // if ( p_parentContainer || !ICNDocument->itemWithID(cnItemId) ) return; p_parentContainer = p_icnDocument->cnItemWithID(cnItemId); } @@ -227,7 +227,7 @@ void Connector::updateDrawList() return; } - QPointList drawLineList; + TQPointList drawLineList; int prevX = (*m_conRouter->cellPointList()->begin()).x(); int prevY = (*m_conRouter->cellPointList()->begin()).y(); @@ -238,8 +238,8 @@ void Connector::updateDrawList() Cells *cells = p_icnDocument->cells(); bool bumpNow = false; - const QPointList::const_iterator cplEnd = m_conRouter->cellPointList()->end(); - for ( QPointList::const_iterator it = m_conRouter->cellPointList()->begin(); it != cplEnd; ++it ) + const TQPointList::const_iterator cplEnd = m_conRouter->cellPointList()->end(); + for ( TQPointList::const_iterator it = m_conRouter->cellPointList()->begin(); it != cplEnd; ++it ) { const int x = (*it).x(); const int y = (*it).y(); @@ -267,27 +267,27 @@ void Connector::updateDrawList() if ( !bumpNow && !bumpNext ) { - drawLineList += QPoint( x0, y0 ); - drawLineList += QPoint( x2, y3 ); + drawLineList += TQPoint( x0, y0 ); + drawLineList += TQPoint( x2, y3 ); } else if (bumpNow) { - drawLineList += QPoint( x0, y0 ); - drawLineList += QPoint( x1, y1 ); - drawLineList += QPoint( x2, y3 ); + drawLineList += TQPoint( x0, y0 ); + drawLineList += TQPoint( x1, y1 ); + drawLineList += TQPoint( x2, y3 ); } else if (bumpNext) { - drawLineList += QPoint( x0, y0 ); - drawLineList += QPoint( x1, y2 ); - drawLineList += QPoint( x2, y3 ); + drawLineList += TQPoint( x0, y0 ); + drawLineList += TQPoint( x1, y2 ); + drawLineList += TQPoint( x2, y3 ); } else { - drawLineList += QPoint( x0, y0 ); - drawLineList += QPoint( x1, y1 ); - drawLineList += QPoint( x1, y2 ); - drawLineList += QPoint( x2, y3 ); + drawLineList += TQPoint( x0, y0 ); + drawLineList += TQPoint( x1, y1 ); + drawLineList += TQPoint( x1, y2 ); + drawLineList += TQPoint( x2, y3 ); } prevX = x; @@ -304,14 +304,14 @@ void Connector::updateDrawList() return; } - const QPointList::iterator dllEnd = drawLineList.end(); + const TQPointList::iterator dllEnd = drawLineList.end(); - QPointList::iterator previous = drawLineList.begin(); + TQPointList::iterator previous = drawLineList.begin(); - QPointList::iterator current = previous; + TQPointList::iterator current = previous; current++; - QPointList::const_iterator next = current; + TQPointList::const_iterator next = current; next++; while ( previous != dllEnd && current != dllEnd && next != dllEnd ) @@ -321,7 +321,7 @@ void Connector::updateDrawList() if ( slope1 == slope2 || slope1 == 0 || slope2 == 0 ) { - *current = QPoint( -1, -1 ); + *current = TQPoint( -1, -1 ); } else { @@ -332,15 +332,15 @@ void Connector::updateDrawList() next++; } - drawLineList.remove( QPoint( -1, -1 ) ); + drawLineList.remove( TQPoint( -1, -1 ) ); // Find the bounding rect { int x1=-1, y1=-1, x2=-1, y2=-1; - const QPointList::iterator end = drawLineList.end(); - for ( QPointList::iterator it = drawLineList.begin(); it != end; ++it ) + const TQPointList::iterator end = drawLineList.end(); + for ( TQPointList::iterator it = drawLineList.begin(); it != end; ++it ) { - const QPoint p = *it; + const TQPoint p = *it; if ( p.x() < x1 || x1 == -1 ) { x1 = p.x(); } @@ -355,7 +355,7 @@ void Connector::updateDrawList() } } - QRect boundRect( x1, y1, x2-x1, y2-y1 ); + TQRect boundRect( x1, y1, x2-x1, y2-y1 ); if ( boundRect != m_oldBoundRect ) { canvas()->setChanged( boundRect | m_oldBoundRect ); @@ -371,11 +371,11 @@ void Connector::updateDrawList() if ( drawLineList.size() > 1 ) { - QPoint prev = drawLineList.first(); - const QPointList::iterator end = drawLineList.end(); - for ( QPointList::iterator it = ++drawLineList.begin(); it != end; ++it ) + TQPoint prev = drawLineList.first(); + const TQPointList::iterator end = drawLineList.end(); + for ( TQPointList::iterator it = ++drawLineList.begin(); it != end; ++it ) { - const QPoint next = *it; + const TQPoint next = *it; ConnectorLine *line = new ConnectorLine(this); line->setPoints( prev.x(), prev.y(), next.x(), next.y() ); m_connectorLineList.append(line); @@ -418,8 +418,8 @@ void Connector::updateConnectorPoints( bool add ) } const int mult = (add)?1:-1; - const QPointList::iterator end = --m_conRouter->cellPointList()->end(); - for ( QPointList::iterator it = ++m_conRouter->cellPointList()->begin(); it != end; ++it ) + const TQPointList::iterator end = --m_conRouter->cellPointList()->end(); + for ( TQPointList::iterator it = ++m_conRouter->cellPointList()->begin(); it != end; ++it ) { int x = (*it).x(); int y = (*it).y(); @@ -443,7 +443,7 @@ void Connector::updateConnectorPoints( bool add ) } -void Connector::setRoutePoints( QPointList pointList, bool setManual, bool checkEndPoints ) +void Connector::setRoutePoints( TQPointList pointList, bool setManual, bool checkEndPoints ) { if (!canvas()) { return; @@ -455,13 +455,13 @@ void Connector::setRoutePoints( QPointList pointList, bool setManual, bool check { if (reversed) { - pointList.prepend( QPoint( int(m_endNode->x()), int(m_endNode->y()) ) ); - pointList.append( QPoint( int(m_startNode->x()), int(m_startNode->y()) ) ); + pointList.prepend( TQPoint( int(m_endNode->x()), int(m_endNode->y()) ) ); + pointList.append( TQPoint( int(m_startNode->x()), int(m_startNode->y()) ) ); } else { - pointList.prepend( QPoint( int(m_startNode->x()), int(m_startNode->y()) ) ); - pointList.append( QPoint( int(m_endNode->x()), int(m_endNode->y()) ) ); + pointList.prepend( TQPoint( int(m_startNode->x()), int(m_startNode->y()) ) ); + pointList.append( TQPoint( int(m_endNode->x()), int(m_endNode->y()) ) ); } } @@ -471,7 +471,7 @@ void Connector::setRoutePoints( QPointList pointList, bool setManual, bool check } -bool Connector::pointsAreReverse( const QPointList &pointList ) const +bool Connector::pointsAreReverse( const TQPointList &pointList ) const { if ( !m_startNode || !m_endNode ) { @@ -556,7 +556,7 @@ ConnectorData Connector::connectorData() const { connectorData.startNodeIsChild = true; connectorData.startNodeCId = m_startNode->childId(); - connectorData.startNodeParent = m_startNode->parentItem()->id(); + connectorData.startNodeParent = m_startNode->tqparentItem()->id(); } else { @@ -568,7 +568,7 @@ ConnectorData Connector::connectorData() const { connectorData.endNodeIsChild = true; connectorData.endNodeCId = m_endNode->childId(); - connectorData.endNodeParent = m_endNode->parentItem()->id(); + connectorData.endNodeParent = m_endNode->tqparentItem()->id(); } else { @@ -585,7 +585,7 @@ void Connector::setVisible( bool yes ) if ( !canvas() || isVisible() == yes ) return; - QCanvasPolygon::setVisible(yes); + TQCanvasPolygon::tqsetVisible(yes); updateConnectorLines(); } @@ -595,7 +595,7 @@ void Connector::setSelected( bool yes ) if ( !canvas() || isSelected() == yes ) return; - QCanvasPolygon::setSelected(yes); + TQCanvasPolygon::setSelected(yes); updateConnectorLines(); emit selected(yes); } @@ -603,31 +603,31 @@ void Connector::setSelected( bool yes ) void Connector::updateConnectorLines() { - const QColor color = b_semiHidden ? Qt::gray : (isSelected() ? QColor( 101, 134, 192 ) : Qt::black); -// const QColor color = b_semiHidden ? Qt::gray : (isSelected() ? QColor( 0x7f, 0x7f, 0xff ) : Qt::black); + const TQColor color = b_semiHidden ? TQt::gray : (isSelected() ? TQColor( 101, 134, 192 ) : TQt::black); +// const TQColor color = b_semiHidden ? TQt::gray : (isSelected() ? TQColor( 0x7f, 0x7f, 0xff ) : TQt::black); const int z = ICNDocument::Z::Connector + (isSelected() ? 5 : 0); - QPen pen( color, (numWires() > 1) ? 2 : 1 ); + TQPen pen( color, (numWires() > 1) ? 2 : 1 ); const ConnectorLineList::iterator end = m_connectorLineList.end(); for ( ConnectorLineList::iterator it = m_connectorLineList.begin(); it != end; ++it ) { - QCanvasPolygonalItem *item = static_cast<QCanvasPolygonalItem*>(*it); + TQCanvasPolygonalItem *item = static_cast<TQCanvasPolygonalItem*>(*it); item->setZ(z); item->setPen(pen); item->setBrush(color); - item->setVisible( isVisible() ); + item->tqsetVisible( isVisible() ); } } -QValueList<QPointList> Connector::splitConnectorPoints( const QPoint & pos ) const +TQValueList<TQPointList> Connector::splitConnectorPoints( const TQPoint & pos ) const { return m_conRouter->splitPoints(pos); } -QPointList Connector::connectorPoints( bool reverse ) const +TQPointList Connector::connectorPoints( bool reverse ) const { bool doReverse = (reverse != pointsAreReverse( m_conRouter->pointList(false) )); return m_conRouter->pointList(doReverse); @@ -637,7 +637,7 @@ QPointList Connector::connectorPoints( bool reverse ) const //BEGIN class ConnectorLine ConnectorLine::ConnectorLine( Connector *connector ) - : QObject(connector), QCanvasLine( connector->canvas() ) + : TQObject(connector), TQCanvasLine( connector->canvas() ) { p_connector = connector; } |