SUPERVGUI_Canvas::~SUPERVGUI_Canvas() {
+ // asv : 17.01.05 : why delete its own children (CanvasNode-s)?
+ // they must be destroyed automatically.
QObjectList* aNodeList = queryList("SUPERVGUI_CanvasNode");
QObjectListIt aIt(*aNodeList);
QObject* anObj;
- while ((anObj = aIt.current()) != 0) {
+ while ( (anObj = aIt.current()) != 0 ) {
++aIt;
+ aNodeList->removeRef(anObj);
delete anObj;
}
+ // asv : list returned by queryList() must be removed
+ delete aNodeList;
}
void SUPERVGUI_Canvas::addView(QCanvasView* theView)
}
void SUPERVGUI_Canvas::sync() {
- // cout << "===> SUPERVGUI_Canvas::sync()" << endl;
if (SUPERV_isNull(myMain->getDataflow())) return;
SUPERVGUI_CanvasNode* ihmNode;
* Synchronizes Graph presentation with internal graph structure
*/
void SUPERVGUI_Canvas::merge() {
- // cout << "===> SUPERVGUI_Canvas::merge()" << endl;
if (SUPERV_isNull(myMain->getDataflow())) return;
SUPERVGUI_CanvasNode* ihmNode;
MESSAGE("Graphs="<<nodes->Graphs.length());
int n;
- //cout << " update nodes " << endl;
UPDATENODES(CNodes, addComputeNode);
UPDATENODES(FNodes, addComputeNode);
UPDATENODES(INodes, addComputeNode);
UPDATENODES(Graphs, addMacroNode);
UPDATENODES(GNodes, addGOTONode);
- //cout << " update control nodes " << endl;
UPDATECONTROLNODES(LNodes);
UPDATECONTROLNODES(SNodes);
delete ihmList;
// update links
- //cout << " update links " << endl;
SUPERVGUI_CanvasLink* ihmLink;
ihmList = queryList("SUPERVGUI_CanvasLink");
/*
*/
//SUPERV_Links links = myMain->getDataflow()->Links();
SUPERV_Links links = myMain->getDataflow()->GLinks();
- //cout << "===> Number of links " << links->length() << endl;
for (int i = 0; i < links->length(); i++) {
UPDATELINK(links[i]);
}
/*
SUPERV_StreamLinks slinks = myMain->getDataflow()->StreamLinks();
- //cout << "===> Number of stream links " << slinks->length() << endl;
for (int i = 0; i < slinks->length(); i++) {
UPDATELINK(slinks[i]);
}
SUPERV_StreamGraph aSGraph = myMain->getDataflow()->ToStreamGraph();
if (!SUPERV_isNull(aSGraph)) {
SUPERV_StreamLinks slinks = aSGraph->StreamLinks(); // <<- doesn't work!!!
- //cout << "===> Number of stream links " << slinks->length() << endl;
for (int i = 0; i < slinks->length(); i++) {
UPDATELINK(slinks[i]);
}
delete ihmLink;
}
delete ihmList;
- //cout << " merge done " << endl;
-}
-
-void SUPERVGUI_Canvas::setAsFromStudy(bool theToStudy)
-{
- if (theToStudy) return;
-
- SUPERVGUI_CanvasPortOut* aPortOut;
- QObjectList* aPortList = queryList("SUPERVGUI_CanvasPortOut");
- QObjectListIt aPortIt(*aPortList);
- while ((aPortOut=(SUPERVGUI_CanvasPortOut*)aPortIt.current()) != 0) {
- ++aPortIt;
- if (aPortOut->isInStudy()) {
- aPortOut->setStudyState(theToStudy);
- aPortOut->sync();
- }
- }
- delete aPortList;
}
SUPERVGUI_CanvasNode* SUPERVGUI_Canvas::getNode(SUPERV::CNode_ptr theNode) const