X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSUPERVGUI%2FSUPERVGUI_Canvas.cxx;h=58d6e2ad8f92d53e5bdb3323f7db06684accaa7e;hb=ea7f29f75031ca13b9454f5e9ac73730f1f584eb;hp=3ca35955ef66619a8ff9cf172dbb5d572e9bfe81;hpb=b7b531f894fd0a967071ce2b05e0ced7b4743f3b;p=modules%2Fsuperv.git diff --git a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx index 3ca3595..58d6e2a 100644 --- a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx @@ -98,13 +98,18 @@ SUPERVGUI_Canvas::SUPERVGUI_Canvas(SUPERVGUI_Main* m): 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) @@ -157,7 +162,6 @@ void SUPERVGUI_Canvas::updateLinks() } void SUPERVGUI_Canvas::sync() { - // cout << "===> SUPERVGUI_Canvas::sync()" << endl; if (SUPERV_isNull(myMain->getDataflow())) return; SUPERVGUI_CanvasNode* ihmNode; @@ -174,7 +178,6 @@ void SUPERVGUI_Canvas::sync() { * 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; @@ -190,14 +193,12 @@ void SUPERVGUI_Canvas::merge() { MESSAGE("Graphs="<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); @@ -210,7 +211,6 @@ void SUPERVGUI_Canvas::merge() { delete ihmList; // update links - //cout << " update links " << endl; SUPERVGUI_CanvasLink* ihmLink; ihmList = queryList("SUPERVGUI_CanvasLink"); /* @@ -218,14 +218,12 @@ void SUPERVGUI_Canvas::merge() { */ //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]); } @@ -235,7 +233,6 @@ void SUPERVGUI_Canvas::merge() { 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]); } @@ -276,24 +273,6 @@ void SUPERVGUI_Canvas::merge() { 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