diff options
Diffstat (limited to 'src/icndocument.cpp')
-rw-r--r-- | src/icndocument.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/src/icndocument.cpp b/src/icndocument.cpp index d220765..1273802 100644 --- a/src/icndocument.cpp +++ b/src/icndocument.cpp @@ -25,10 +25,10 @@ #include <kapplication.h> #include <kdebug.h> -#include <qclipboard.h> -#include <qtimer.h> +#include <tqclipboard.h> +#include <tqtimer.h> -ICNDocument::ICNDocument( const QString &caption, KTechlab *ktechlab, const char *name ) +ICNDocument::ICNDocument( const TQString &caption, KTechlab *ktechlab, const char *name ) : ItemDocument( caption, ktechlab, name ), m_cells(0l) { @@ -47,10 +47,10 @@ ICNDocument::~ICNDocument() { m_bDeleted = true; - // Go to hell, QCanvas. I'm in charge of what gets deleted. - QCanvasItemList all = m_canvas->allItems(); - const QCanvasItemList::Iterator end = all.end(); - for ( QCanvasItemList::Iterator it= all.begin(); it != end; ++it ) + // Go to hell, TQCanvas. I'm in charge of what gets deleted. + TQCanvasItemList all = m_canvas->allItems(); + const TQCanvasItemList::Iterator end = all.end(); + for ( TQCanvasItemList::Iterator it= all.begin(); it != end; ++it ) (*it)->setCanvas(0l); // Remove all items from the canvas @@ -94,20 +94,20 @@ ItemGroup* ICNDocument::selectList() const } -void ICNDocument::fillContextMenu( const QPoint &pos ) +void ICNDocument::fillContextMenu( const TQPoint &pos ) { ItemDocument::fillContextMenu(pos); slotInitItemActions( dynamic_cast<CNItem*>(m_selectList->activeItem()) ); } -CNItem* ICNDocument::cnItemWithID( const QString &id ) +CNItem* ICNDocument::cnItemWithID( const TQString &id ) { return dynamic_cast<CNItem*>(itemWithID(id)); } -Node *ICNDocument::nodeWithID( const QString &id ) +Node *ICNDocument::nodeWithID( const TQString &id ) { const NodeList::iterator end = m_nodeList.end(); for ( NodeList::iterator it = m_nodeList.begin(); it != end; ++it ) @@ -119,7 +119,7 @@ Node *ICNDocument::nodeWithID( const QString &id ) } -Connector *ICNDocument::connectorWithID( const QString &id ) +Connector *ICNDocument::connectorWithID( const TQString &id ) { const ConnectorList::iterator end = m_connectorList.end(); for ( ConnectorList::iterator it = m_connectorList.begin(); it != end; ++it ) @@ -131,17 +131,17 @@ Connector *ICNDocument::connectorWithID( const QString &id ) } -FlowContainer *ICNDocument::flowContainer( const QPoint &pos ) +FlowContainer *ICNDocument::flowContainer( const TQPoint &pos ) { - QCanvasItemList collisions = m_canvas->collisions(pos); + TQCanvasItemList collisions = m_canvas->collisions(pos); FlowContainer *flowContainer = 0l; int currentLevel = -1; - const QCanvasItemList::iterator end = collisions.end(); - for ( QCanvasItemList::iterator it = collisions.begin(); it != end; ++it ) + const TQCanvasItemList::iterator end = collisions.end(); + for ( TQCanvasItemList::iterator it = collisions.begin(); it != end; ++it ) { if ( FlowContainer *container = dynamic_cast<FlowContainer*>(*it) ) { - if ( container->level() > currentLevel && !m_selectList->contains(container) ) + if ( container->level() > currentLevel && !m_selectList->tqcontains(container) ) { currentLevel = container->level(); flowContainer = container; @@ -152,7 +152,7 @@ FlowContainer *ICNDocument::flowContainer( const QPoint &pos ) } -bool ICNDocument::canConnect( QCanvasItem *qcanvasItem1, QCanvasItem *qcanvasItem2 ) const +bool ICNDocument::canConnect( TQCanvasItem *qcanvasItem1, TQCanvasItem *qcanvasItem2 ) const { // Rough outline of what can and can't connect: // * At most three connectors to a node @@ -279,11 +279,11 @@ bool ICNDocument::canConnect( QCanvasItem *qcanvasItem1, QCanvasItem *qcanvasIte //BEGIN Advanced level check CNItem * startParentItem[3]; for ( unsigned i = 0; i < 3; i++ ) - startParentItem[i] = start[i] ? start[i]->parentItem() : 0l; + startParentItem[i] = start[i] ? start[i]->tqparentItem() : 0l; CNItem * endParentItem[3]; for ( unsigned i = 0; i < 3; i++ ) - endParentItem[i] = end[i] ? end[i]->parentItem() : 0l; + endParentItem[i] = end[i] ? end[i]->tqparentItem() : 0l; Item * container[6] = {0l}; @@ -293,7 +293,7 @@ bool ICNDocument::canConnect( QCanvasItem *qcanvasItem1, QCanvasItem *qcanvasIte { int dl = start[i]->level() - startParentItem[i]->level(); if ( dl == 0 ) - container[i] = startParentItem[i]->parentItem(); + container[i] = startParentItem[i]->tqparentItem(); else if ( dl == 1 ) container[i] = startParentItem[i]; else @@ -303,7 +303,7 @@ bool ICNDocument::canConnect( QCanvasItem *qcanvasItem1, QCanvasItem *qcanvasIte { int dl = end[i]->level() - endParentItem[i]->level(); if ( dl == 0 ) - container[i+3] = endParentItem[i]->parentItem(); + container[i+3] = endParentItem[i]->tqparentItem(); else if ( dl == 1 ) container[i+3] = endParentItem[i]; else @@ -331,12 +331,12 @@ bool ICNDocument::canConnect( QCanvasItem *qcanvasItem1, QCanvasItem *qcanvasIte -Connector * ICNDocument::createConnector( Node *startNode, Node *endNode, QPointList *pointList ) +Connector * ICNDocument::createConnector( Node *startNode, Node *endNode, TQPointList *pointList ) { if ( !canConnect( startNode, endNode ) ) return 0l; - QPointList autoPoints; + TQPointList autoPoints; if (!pointList) { addAllItemConnectorPoints(); @@ -367,7 +367,7 @@ Connector * ICNDocument::createConnector( Node *startNode, Node *endNode, QPoint return con; } -Connector * ICNDocument::createConnector( Node *node, Connector *con, const QPoint &pos2, QPointList *pointList ) +Connector * ICNDocument::createConnector( Node *node, Connector *con, const TQPoint &pos2, TQPointList *pointList ) { if ( !canConnect( node, con ) ) return 0l; @@ -387,7 +387,7 @@ Connector * ICNDocument::createConnector( Node *node, Connector *con, const QPoi else return 0l; - QPointList autoPoints; + TQPointList autoPoints; if (!pointList) { addAllItemConnectorPoints(); @@ -397,7 +397,7 @@ Connector * ICNDocument::createConnector( Node *node, Connector *con, const QPoi pointList = &autoPoints; } - QValueList<QPointList> oldConPoints = con->splitConnectorPoints(pos2); + TQValueList<TQPointList> oldConPoints = con->splitConnectorPoints(pos2); con->hide(); // The actual new connector @@ -431,7 +431,7 @@ Connector * ICNDocument::createConnector( Node *node, Connector *con, const QPoi return new1; } -Connector * ICNDocument::createConnector( Connector *con1, Connector *con2, const QPoint &pos1, const QPoint &pos2, QPointList *pointList ) +Connector * ICNDocument::createConnector( Connector *con1, Connector *con2, const TQPoint &pos1, const TQPoint &pos2, TQPointList *pointList ) { if ( !canConnect( con1, con2 ) ) return 0l; @@ -439,8 +439,8 @@ Connector * ICNDocument::createConnector( Connector *con1, Connector *con2, cons const bool con1UsedManual = con1->usesManualPoints(); const bool con2UsedManual = con2->usesManualPoints(); - QValueList<QPointList> oldCon1Points = con1->splitConnectorPoints(pos1); - QValueList<QPointList> oldCon2Points = con2->splitConnectorPoints(pos2); + TQValueList<TQPointList> oldCon1Points = con1->splitConnectorPoints(pos1); + TQValueList<TQPointList> oldCon2Points = con2->splitConnectorPoints(pos2); Node *node1a = con1->startNode(); Node *node1b = con1->endNode(); @@ -504,7 +504,7 @@ Connector * ICNDocument::createConnector( Connector *con1, Connector *con2, cons con2a->setRoutePoints( *oldCon2Points.at(0), con2UsedManual ); con2b->setRoutePoints( *oldCon2Points.at(1), con2UsedManual ); - QPointList autoPoints; + TQPointList autoPoints; if (!pointList) { addAllItemConnectorPoints(); @@ -553,7 +553,7 @@ NodeGroup* ICNDocument::createNodeGroup( Node *node ) const GuardedNodeGroupList::iterator end = m_nodeGroupList.end(); for ( GuardedNodeGroupList::iterator it = m_nodeGroupList.begin(); it != end; ++it ) { - if ( *it && (*it)->contains(node) ) { + if ( *it && (*it)->tqcontains(node) ) { return *it; } } @@ -575,7 +575,7 @@ bool ICNDocument::deleteNodeGroup( Node *node ) const GuardedNodeGroupList::iterator end = m_nodeGroupList.end(); for ( GuardedNodeGroupList::iterator it = m_nodeGroupList.begin(); it != end; ++it ) { - if ( *it && (*it)->contains(node) ) + if ( *it && (*it)->tqcontains(node) ) { delete *it; m_nodeGroupList.remove(it); @@ -637,7 +637,7 @@ void ICNDocument::getTranslatable( const ItemList & itemList, ConnectorList * fi // the number of times an item in the list is connected to // it - i.e. 1 or 2. For those with 2, it is safe to update their // route as it simply involves shifting the route - typedef QMap< Connector*, int > ConnectorMap; + typedef TQMap< Connector*, int > ConnectorMap; ConnectorMap fixedConnectorMap; // This list of nodes is built up, used for later in determining fixed NodeGroups @@ -662,7 +662,7 @@ void ICNDocument::getTranslatable( const ItemList & itemList, ConnectorList * fi const ConnectorList::iterator clEnd = conList.end(); for ( ConnectorList::iterator clit = conList.begin(); clit != clEnd; ++clit ) { - ConnectorMap::iterator cit = fixedConnectorMap.find(*clit); + ConnectorMap::iterator cit = fixedConnectorMap.tqfind(*clit); if ( cit != fixedConnectorMap.end() ) { cit.data()++; } else { @@ -715,11 +715,11 @@ void ICNDocument::getTranslatable( const ItemList & itemList, ConnectorList * fi Node *startNode = it.key()->endNode(); Node *endNode = it.key()->startNode(); if ( (it.data() > 1) || - (startNode && endNode && startNode->parentItem() == endNode->parentItem()) ) + (startNode && endNode && startNode->tqparentItem() == endNode->tqparentItem()) ) { translatableConnectors->append( const_cast<Connector*>(it.key()) ); } - else if ( !fixedNGConnectors.contains(it.key()) && !fixedConnectors->contains(it.key()) ) + else if ( !fixedNGConnectors.tqcontains(it.key()) && !fixedConnectors->tqcontains(it.key()) ) { fixedConnectors->append(it.key()); } @@ -738,8 +738,8 @@ void ICNDocument::addCPenalty( int x, int y, int score ) void ICNDocument::createCellMap() { - unsigned newCellsX = QMAX( canvas()->width()/cellSize, 1 ); - unsigned newCellsY = QMAX( canvas()->height()/cellSize, 1 ); + unsigned newCellsX = TQMAX( canvas()->width()/cellSize, 1 ); + unsigned newCellsY = TQMAX( canvas()->height()/cellSize, 1 ); if ( m_cells && newCellsX == m_cellsX && newCellsY == m_cellsY ) return; @@ -773,15 +773,15 @@ int ICNDocument::gridSnap( int pos ) // return int((floor(pos/8))*8)+4; } -QPoint ICNDocument::gridSnap( const QPoint &pos ) +TQPoint ICNDocument::gridSnap( const TQPoint &pos ) { - return QPoint( gridSnap( pos.x() ), gridSnap( pos.y() ) ); + return TQPoint( gridSnap( pos.x() ), gridSnap( pos.y() ) ); } -void ICNDocument::appendDeleteList( QCanvasItem *qcanvasItem ) +void ICNDocument::appendDeleteList( TQCanvasItem *qcanvasItem ) { - if ( !qcanvasItem || m_itemDeleteList.findIndex(qcanvasItem) != -1 ) { + if ( !qcanvasItem || m_itemDeleteList.tqfindIndex(qcanvasItem) != -1 ) { return; } @@ -803,32 +803,32 @@ void ICNDocument::appendDeleteList( QCanvasItem *qcanvasItem ) { Connector *connector = dynamic_cast<Connector*>(qcanvasItem); if (!connector) - connector = (dynamic_cast<ConnectorLine*>(qcanvasItem))->parent(); + connector = (dynamic_cast<ConnectorLine*>(qcanvasItem))->tqparent(); connector->removeConnector(); } else { - kdDebug() << k_funcinfo << "unrecognised QCanvasItem rtti " << QString::number(qcanvasItem->rtti()) << endl; + kdDebug() << k_funcinfo << "unrecognised TQCanvasItem rtti " << TQString::number(qcanvasItem->rtti()) << endl; } } void ICNDocument::flushDeleteList() { // Remove duplicate items in the delete list - QCanvasItemList::iterator end = m_itemDeleteList.end(); - for ( QCanvasItemList::iterator it = m_itemDeleteList.begin(); it != end; ++it ) + TQCanvasItemList::iterator end = m_itemDeleteList.end(); + for ( TQCanvasItemList::iterator it = m_itemDeleteList.begin(); it != end; ++it ) { - if ( *it && m_itemDeleteList.contains(*it) > 1 ) { + if ( *it && m_itemDeleteList.tqcontains(*it) > 1 ) { *it = 0l; } } m_itemDeleteList.remove(0l); end = m_itemDeleteList.end(); - for ( QCanvasItemList::iterator it = m_itemDeleteList.begin(); it != end; ++it ) + for ( TQCanvasItemList::iterator it = m_itemDeleteList.begin(); it != end; ++it ) { - QCanvasItem *qcanvasItem = *it; - m_selectList->removeQCanvasItem(*it); + TQCanvasItem *qcanvasItem = *it; + m_selectList->removeTQCanvasItem(*it); if ( Item *item = dynamic_cast<Item*>(qcanvasItem) ) m_itemList.remove(item); @@ -855,7 +855,7 @@ void ICNDocument::flushDeleteList() { (*it)->removeNullConnectors(); int conCount = (*it)->inputConnectorList().count() + (*it)->outputConnectorList().count(); - if ( conCount == 2 && !(*it)->parentItem() ) + if ( conCount == 2 && !(*it)->tqparentItem() ) { if ( joinConnectors(*it) ) doneJoin = true; @@ -872,8 +872,8 @@ void ICNDocument::flushDeleteList() bool ICNDocument::joinConnectors( Node *node ) { - // We don't want to destroy the node if it has a parent - if ( node->parentItem() ) + // We don't want to destroy the node if it has a tqparent + if ( node->tqparentItem() ) return false; node->removeNullConnectors(); @@ -884,7 +884,7 @@ bool ICNDocument::joinConnectors( Node *node ) Connector *con1, *con2; Node *startNode, *endNode; - QPointList conPoints; + TQPointList conPoints; if ( node->inputConnectorList().count() == 0 ) @@ -950,7 +950,7 @@ bool ICNDocument::joinConnectors( Node *node ) } -bool ICNDocument::registerItem( QCanvasItem *qcanvasItem ) +bool ICNDocument::registerItem( TQCanvasItem *qcanvasItem ) { if (!qcanvasItem) return false; @@ -963,7 +963,7 @@ bool ICNDocument::registerItem( QCanvasItem *qcanvasItem ) { Node *node = (Node*)qcanvasItem; m_nodeList.append(node); - connect( node, SIGNAL(removed(Node*)), this, SLOT(requestRerouteInvalidatedConnectors()) ); + connect( node, TQT_SIGNAL(removed(Node*)), this, TQT_SLOT(requestRerouteInvalidatedConnectors()) ); emit nodeAdded(node); break; } @@ -971,7 +971,7 @@ bool ICNDocument::registerItem( QCanvasItem *qcanvasItem ) { Connector *connector = dynamic_cast<Connector*>(qcanvasItem); m_connectorList.append(connector); - connect( connector, SIGNAL(removed(Connector*)), this, SLOT(requestRerouteInvalidatedConnectors()) ); + connect( connector, TQT_SIGNAL(removed(Connector*)), this, TQT_SLOT(requestRerouteInvalidatedConnectors()) ); emit connectorAdded(connector); break; } @@ -999,7 +999,7 @@ void ICNDocument::copy() // We only want to copy the connectors who have all ends attached to something in the selection ConnectorList connectorList = m_selectList->connectors(false); - typedef QMap< Node*, ConnectorList > NCLMap; + typedef TQMap< Node*, ConnectorList > NCLMap; NCLMap nclMap; ConnectorList::iterator end = connectorList.end(); @@ -1030,7 +1030,7 @@ void ICNDocument::copy() data.addNodes( nodeList ); data.addConnectors( connectorList ); - KApplication::clipboard()->setText( data.toXML(), QClipboard::Clipboard ); + KApplication::tqclipboard()->setText( data.toXML(), TQClipboard::Clipboard ); } void ICNDocument::selectAll() @@ -1056,7 +1056,7 @@ void ICNDocument::selectAll() } -Item* ICNDocument::addItem( const QString &id, const QPoint &p, bool newItem ) +Item* ICNDocument::addItem( const TQString &id, const TQPoint &p, bool newItem ) { if ( !isValidItem(id) ) { return 0l; @@ -1070,7 +1070,7 @@ Item* ICNDocument::addItem( const QString &id, const QPoint &p, bool newItem ) if ( FlowContainer *flowContainer = dynamic_cast<FlowContainer*>((Item*)(*it)) ) flowContainer->setFullBounds(true); } - QCanvasItemList preCollisions = canvas()->collisions(p); + TQCanvasItemList preCollisions = canvas()->collisions(p); for ( ItemList::iterator it = m_itemList.begin(); it != end; ++it ) { if ( FlowContainer *flowContainer = dynamic_cast<FlowContainer*>((Item*)(*it)) ) @@ -1084,8 +1084,8 @@ Item* ICNDocument::addItem( const QString &id, const QPoint &p, bool newItem ) // Look through the CNItems at the given point (sorted by z-coordinate) for // a container item. FlowContainer *container = 0l; - const QCanvasItemList::iterator pcEnd = preCollisions.end(); - for ( QCanvasItemList::iterator it = preCollisions.begin(); it != pcEnd && !container; ++it ) + const TQCanvasItemList::iterator pcEnd = preCollisions.end(); + for ( TQCanvasItemList::iterator it = preCollisions.begin(); it != pcEnd && !container; ++it ) { if ( FlowContainer *flowContainer = dynamic_cast<FlowContainer*>(*it) ) container = flowContainer; @@ -1142,7 +1142,7 @@ void ICNDocument::requestRerouteInvalidatedConnectors() } void ICNDocument::rerouteInvalidatedConnectors() { - qApp->processEvents(300); + tqApp->tqprocessEvents(300); // We only ever need to add the connector points for CNItem's when we're about to reroute... addAllItemConnectorPoints(); @@ -1163,17 +1163,17 @@ void ICNDocument::rerouteInvalidatedConnectors() bool needsRerouting = false; // Test to see if we actually have any points - const QPointList pointList = connector->connectorPoints(); + const TQPointList pointList = connector->connectorPoints(); if ( pointList.isEmpty() ) needsRerouting = true; // Test to see if the route doesn't match up with the node positions at either end if (!needsRerouting) { - const QPoint listStart = pointList.first(); - const QPoint listEnd = pointList.last(); - const QPoint nodeStart = QPoint( int(connector->startNode()->x()), int(connector->startNode()->y()) ); - const QPoint nodeEnd = QPoint( int(connector->endNode()->x()), int(connector->endNode()->y()) ); + const TQPoint listStart = pointList.first(); + const TQPoint listEnd = pointList.last(); + const TQPoint nodeStart = TQPoint( int(connector->startNode()->x()), int(connector->startNode()->y()) ); + const TQPoint nodeEnd = TQPoint( int(connector->endNode()->x()), int(connector->endNode()->y()) ); if ( ((listStart != nodeStart) || (listEnd != nodeEnd)) && ((listStart != nodeEnd) || (listEnd != nodeStart)) ) @@ -1186,9 +1186,9 @@ void ICNDocument::rerouteInvalidatedConnectors() // Test to see if the route intersects any Items (we ignore if it is a manual route) if ( !needsRerouting && !connector->usesManualPoints() ) { - const QCanvasItemList collisions = connector->collisions(true); - const QCanvasItemList::const_iterator collisionsEnd = collisions.end(); - for ( QCanvasItemList::const_iterator collisionsIt = collisions.begin(); (collisionsIt != collisionsEnd) && !needsRerouting; ++collisionsIt ) + const TQCanvasItemList collisions = connector->collisions(true); + const TQCanvasItemList::const_iterator collisionsEnd = collisions.end(); + for ( TQCanvasItemList::const_iterator collisionsIt = collisions.begin(); (collisionsIt != collisionsEnd) && !needsRerouting; ++collisionsIt ) { if ( dynamic_cast<Item*>(*collisionsIt) ) needsRerouting = true; @@ -1199,16 +1199,16 @@ void ICNDocument::rerouteInvalidatedConnectors() { NodeGroup *nodeGroup = connector->nodeGroup(); - if ( !nodeGroup && !connectorRerouteList.contains(connector) ) + if ( !nodeGroup && !connectorRerouteList.tqcontains(connector) ) connectorRerouteList.append(connector); - else if ( nodeGroup && !nodeGroupRerouteList.contains(nodeGroup) ) + else if ( nodeGroup && !nodeGroupRerouteList.tqcontains(nodeGroup) ) nodeGroupRerouteList.append(nodeGroup); } } } - // To allow proper rerouting, we want to start with clean routes for all of the invalidated connectors + // To allow proper rerouting, we want to start with clean routes for all of the tqinvalidated connectors const NodeGroupList::iterator nodeGroupRerouteEnd = nodeGroupRerouteList.end(); for ( NodeGroupList::iterator it = nodeGroupRerouteList.begin(); it != nodeGroupRerouteEnd; ++it ) { @@ -1237,7 +1237,7 @@ void ICNDocument::rerouteInvalidatedConnectors() } -Connector* ICNDocument::createConnector( const QString &startNodeId, const QString &endNodeId, QPointList *pointList ) +Connector* ICNDocument::createConnector( const TQString &startNodeId, const TQString &endNodeId, TQPointList *pointList ) { Node *startNode = nodeWithID(startNodeId); Node *endNode = nodeWithID(endNodeId); @@ -1303,7 +1303,7 @@ ConnectorList ICNDocument::getCommonConnectors( const ItemList &list ) for ( ConnectorList::iterator it = connectorList.begin(); it != connectorListEnd; ++it ) { Connector *con = *it; - if ( !con || !nodeList.contains(con->startNode()) || !nodeList.contains(con->endNode()) ) { + if ( !con || !nodeList.tqcontains(con->startNode()) || !nodeList.tqcontains(con->endNode()) ) { *it = 0l; } } @@ -1328,7 +1328,7 @@ NodeList ICNDocument::getCommonNodes( const ItemList &list ) { Node *node = it.data().node; - if ( !nodeList.contains(node) ) { + if ( !nodeList.tqcontains(node) ) { nodeList += node; } @@ -1340,7 +1340,7 @@ NodeList ICNDocument::getCommonNodes( const ItemList &list ) for ( NodeList::iterator it = intNodeList.begin(); it != intNodeListEnd; ++it ) { Node *intNode = *it; - if ( !nodeList.contains(intNode) ) { + if ( !nodeList.tqcontains(intNode) ) { nodeList += intNode; } } @@ -1372,11 +1372,11 @@ DirCursor* DirCursor::self() void DirCursor::initCursors() { -// QCursor c(Qt::ArrowCursor); -// QBitmap bitmap = *c.bitmap(); -// QBitmap mask = *c.mask(); -// QPixmap pm( bitmap->width(), bitmap->height() ); -// pm.setMask(mask); +// TQCursor c(TQt::ArrowCursor); +// TQBitmap bitmap = *c.bitmap(); +// TQBitmap tqmask = *c.tqmask(); +// TQPixmap pm( bitmap->width(), bitmap->height() ); +// pm.setMask(tqmask); // pm = c.pi // @todo finish } |