From a6a09540e1901b19f46a3aa34df7d21015bf975a Mon Sep 17 00:00:00 2001 From: asv Date: Tue, 18 Jan 2005 08:37:49 +0000 Subject: [PATCH] A lot of unneccessary "cout"-s and MESSAGE()-s were removed. --- src/SUPERVGUI/SUPERVGUI_ArrayView.cxx | 2 - src/SUPERVGUI/SUPERVGUI_Canvas.cxx | 8 ++- src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx | 13 ---- src/SUPERVGUI/SUPERVGUI_CanvasCellNodePrs.cxx | 64 +++++++++---------- src/SUPERVGUI/SUPERVGUI_CanvasCellNodePrs.h | 2 +- src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx | 8 +-- src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h | 2 +- src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx | 35 +++------- src/SUPERVGUI/SUPERVGUI_CanvasNode.h | 18 +++--- src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx | 28 ++++---- src/SUPERVGUI/SUPERVGUI_CanvasView.cxx | 4 -- src/SUPERVGUI/SUPERVGUI_Main.cxx | 1 - 12 files changed, 73 insertions(+), 112 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx b/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx index 92725e0..16561b0 100644 --- a/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx @@ -80,7 +80,6 @@ SUPERVGUI_ArrayView::~SUPERVGUI_ArrayView() void SUPERVGUI_ArrayView::ActivatePanning() { - cout<<" ===> SUPERVGUI_ArrayView::ActivatePanning()"<setMouseTracking(false); } @@ -109,7 +108,6 @@ void SUPERVGUI_ArrayView::changeBackground() void SUPERVGUI_ArrayView::contentsMousePressEvent(QMouseEvent* theEvent) { myGlobalPoint = theEvent->globalPos(); - cout<<" ===> myIsPanActivated = "<button() == Qt::MidButton) && (theEvent->state() == Qt::ControlButton)) || myIsPanActivated) { diff --git a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx index fb1f77c..1a622ca 100644 --- a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx @@ -98,13 +98,17 @@ 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; delete anObj; } + // asv : list returned by queryList() must be removed + delete aNodeList; } void SUPERVGUI_Canvas::addView(QCanvasView* theView) @@ -157,7 +161,6 @@ void SUPERVGUI_Canvas::updateLinks() } void SUPERVGUI_Canvas::sync() { - // MESSAGE("===> SUPERVGUI_Canvas::sync()"); if (SUPERV_isNull(myMain->getDataflow())) return; SUPERVGUI_CanvasNode* ihmNode; @@ -174,7 +177,6 @@ void SUPERVGUI_Canvas::sync() { * Synchronizes Graph presentation with internal graph structure */ void SUPERVGUI_Canvas::merge() { - // MESSAGE("===> SUPERVGUI_Canvas::merge()"); if (SUPERV_isNull(myMain->getDataflow())) return; SUPERVGUI_CanvasNode* ihmNode; diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx index cce72c3..c7ad485 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx @@ -25,13 +25,11 @@ using namespace std; else x += (CELL_WIDTH + CELL_SPACE); \ cell = getCellNode(aCNode); \ if (cell == NULL) { \ - cout<<" ***> cell is NULL => create a new one"<move(x, y); \ aNode->show(); \ aNode->sync(); \ } else { \ - cout<<" ***> cell is NOT NULL => not create"<move(x, y); \ cell->show(); \ } \ @@ -49,7 +47,6 @@ using namespace std; SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->NodesName[co]->Coupled()); \ cell = getCellNode(aCNode); \ if (cell == NULL) { \ - cout<<" ***> cell control is NULL => create a new one"<move(x, y); \ aNode->show(); \ @@ -60,7 +57,6 @@ using namespace std; aNodeEnd->show(); \ aNodeEnd->sync(); \ } else { \ - cout<<" ***> cell control is NOT NULL => not create"<move(x, y); \ cell->show(); \ y += (CELL_HEIGHT + CELL_SPACE); \ @@ -122,7 +118,6 @@ SUPERVGUI_CanvasArray::~SUPERVGUI_CanvasArray() { } void SUPERVGUI_CanvasArray::sync() { - MESSAGE("===> SUPERVGUI_CanvasArray::sync()"); if (SUPERV_isNull(myMain->getDataflow())) return; SUPERVGUI_CanvasCellNode* ihmNode; @@ -166,14 +161,12 @@ bool SUPERVGUI_CanvasArray::create() { if (ncols == 0) return false; QCanvasItemList anIL1 = this->allItems(); - cout<<" ===> begin create() : CanvasArray has "< second ... creation !"<allItems(); - cout<<" ===> 1 create() : CanvasArray has "<allItems(); - cout<<" ===> 2 create() : CanvasArray has "< nodes->FNodes.length()) LevelHasDiffNT = true; @@ -265,7 +256,6 @@ bool SUPERVGUI_CanvasArray::create() { nodeY = y + CELL_HEIGHT*2; QCanvasItemList anIL4 = this->allItems(); - cout<<" ===> end create() : CanvasArray has "<allItems(); - cout<<" ===> begin destroy() : CanvasArray has "<children(); - cout<<" ===> begin destroy() : CanvasArray has "<count()<<" children!"<allItems(); - cout<<" ===> end destroy() : CanvasArray has "<allItems(); - cout<<" ===> 1 conatructor CellPrs : CanvasArray has "<getEngine()->IsLoop() || getNode()->getEngine()->IsEndLoop() || @@ -101,12 +100,12 @@ void SUPERVGUI_CanvasCellNodePrs::drawTitle(QPainter& thePainter) { thePainter.setBrush(saved); drawCellText(thePainter, getNode()->getEngine()->Name(), getTitleRect(), Qt::AlignLeft); - MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawTitle end"); +//MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawTitle end"); } void SUPERVGUI_CanvasCellNodePrs::drawLabel(QPainter& thePainter) { - MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawLabel begin"); +//MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawLabel begin"); QRect r = getLabelRect(); QPen saved = thePainter.pen(); @@ -115,12 +114,12 @@ void SUPERVGUI_CanvasCellNodePrs::drawLabel(QPainter& thePainter) thePainter.setPen(saved); drawCellText(thePainter, getNode()->getLabelText(), r, Qt::AlignLeft); - MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawLabel end"); +//MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawLabel end"); } void SUPERVGUI_CanvasCellNodePrs::drawStatus(QPainter& thePainter) { - MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawStatus begin"); +//MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawStatus begin"); QRect r = getStatusRect(); QBrush savedB = thePainter.brush(); @@ -129,36 +128,36 @@ void SUPERVGUI_CanvasCellNodePrs::drawStatus(QPainter& thePainter) thePainter.setBrush(savedB); drawCellText(thePainter, getStatus(), r, Qt::AlignHCenter); - MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawStatus end"); +//MESSAGE("SUPERVGUI_CanvasCellNodePrs::drawStatus end"); } QRect SUPERVGUI_CanvasCellNodePrs::getTitleRect() const { - MESSAGE("SUPERVGUI_CanvasCellNodePrs::getTitleRect()!!!"); - cout<<" xT = "<<(int)x() - <<" yT = "<<(int)y() - <<" wT = "<>> setState from CELL!"<setChanged(getStatusRect()); - cout<<"=================>>> before canvas()->update()!"<update(); - cout<<"=================>>> after canvas()->update()!"< SUPERVGUI_CanvasCellNode::sync() " << getEngine()->Name() << ", state " << getEngine()->State()); - const bool isExecuting = getMain()->getDataflow()->IsExecuting(); //if getEngine() is a MacroNode then set it state to state of its subgraph if ( getEngine()->IsMacro() && isExecuting ) { @@ -372,11 +374,9 @@ bool SUPERVGUI_CanvasCellNode::setNodeName(QString aName) SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasCellNode::createPrs() const { - MESSAGE(" -> SUPERVGUI_CanvasCellNode::createPrs()"); SUPERVGUI_CanvasNodePrs* aPrs = new SUPERVGUI_CanvasCellNodePrs(getMain()->getCanvasArray(), (SUPERVGUI_CanvasCellNode*)this); - MESSAGE(" -> SUPERVGUI_CanvasCellNode::createPrs() 11"); return aPrs; } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h b/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h index 39d4c5d..686fcbf 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h @@ -126,7 +126,7 @@ class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode { SUPERVGUI_CanvasCellNode(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode); - virtual ~SUPERVGUI_CanvasCellNode() {} + virtual ~SUPERVGUI_CanvasCellNode(); virtual QPopupMenu* getPopupMenu(QWidget* theParent); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx index 997e51a..e18aaca 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx @@ -58,16 +58,12 @@ SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode(QObject* theParent, SUPERVGUI_Main* t // create node ports isIgnore = true; - //cout << " get port list... " ; SUPERV_Ports aPortList = myNode->Ports(); - //cout << aPortList->length() << endl; for (int i = 0; i < aPortList->length(); i++) { createPort(aPortList[i].in()); } - //cout << " get stream port list... " ; SUPERV_StreamPorts aStreamPortList = myNode->StreamPorts(); - //cout << aStreamPortList->length() << endl; for (int i = 0; i < aStreamPortList->length(); i++) { createStreamPort(aStreamPortList[i].in()); } @@ -75,13 +71,15 @@ SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode(QObject* theParent, SUPERVGUI_Main* t isIgnore = false; QCanvasItemList anIL2 = ((QCanvas*)parent())->allItems(); - cout<<" ===> 1 conatructor CanvasNode : CanvasArray has "<hide(); } -SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::getPrs() const +SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::getPrs() { - if (myPrs == 0) { - ((SUPERVGUI_CanvasNode*)this)->myPrs = createPrs(); - } + if ( !myPrs ) + myPrs = createPrs(); + return myPrs; } @@ -103,7 +101,7 @@ SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::createPrs() const return new SUPERVGUI_CanvasNodePrs(myMain->getCanvas(), (SUPERVGUI_CanvasNode*)this); } -void SUPERVGUI_CanvasNode::createPort(SUPERV::Port_ptr thePort) const +void SUPERVGUI_CanvasNode::createPort(SUPERV::Port_ptr thePort) { SUPERVGUI_CanvasPort* aPort = 0; if (thePort->IsInput()) @@ -117,7 +115,7 @@ void SUPERVGUI_CanvasNode::createPort(SUPERV::Port_ptr thePort) const } } -void SUPERVGUI_CanvasNode::createStreamPort(SUPERV::StreamPort_ptr thePort) const +void SUPERVGUI_CanvasNode::createStreamPort(SUPERV::StreamPort_ptr thePort) { SUPERVGUI_CanvasPort* aPort = 0; if (thePort->IsInput()) @@ -234,49 +232,39 @@ void SUPERVGUI_CanvasNode::move(int x, int y) void SUPERVGUI_CanvasNode::merge() { - //MESSAGE("===> SUPERVGUI_CanvasNode::merge() " << myNode->Name()); // synchronize port list bool update = false; isIgnore = true; SUPERVGUI_CanvasPort* aPort; QObjectList* aPortList = queryList("SUPERVGUI_CanvasPort"); - //cout << " get port list... " ; SUPERV_Ports aPorts = myNode->Ports(); - //cout << aPorts->length() << endl; for (int i = 0; i < aPorts->length(); i++) { aPort = (SUPERVGUI_CanvasPort*) child(myMain->getCanvas()->getPortName(aPorts[i].in()), "SUPERVGUI_CanvasPort"); if (aPort) { - //cout << " update port " << aPort->name() << endl; aPortList->removeRef(aPort); aPort->update(); } else { - //cout << " create port " << myMain->getCanvas()->getPortName(aPorts[i].in()) << endl; createPort(aPorts[i].in()); update = true; } } - //cout << " get stream port list... " ; SUPERV_StreamPorts aStreamPorts = myNode->StreamPorts(); - //cout << aStreamPorts->length() << endl; for (int i = 0; i < aStreamPorts->length(); i++) { aPort = (SUPERVGUI_CanvasPort*) child(myMain->getCanvas()->getPortName(aStreamPorts[i].in()), "SUPERVGUI_CanvasPort"); if (aPort) { - //cout << " update stream port " << aPort->name() << endl; aPortList->removeRef(aPort); aPort->update(); } else { - //cout << " create stream port " << myMain->getCanvas()->getPortName(aStreamPorts[i].in()) << endl; createPort(aStreamPorts[i].in()); update = true; } } - //cout << " remove inexistant " << endl; QObjectListIt it(*aPortList); while ((aPort=(SUPERVGUI_CanvasPort*)it.current()) != 0) { ++it; @@ -292,10 +280,7 @@ void SUPERVGUI_CanvasNode::merge() } void SUPERVGUI_CanvasNode::sync() { - //MESSAGE("===> SUPERVGUI_CanvasNode::sync() " << myNode->Name() << ", state " << myNode->State()); - const bool isExecuting = myMain->getDataflow()->IsExecuting(); - //if myNode is a MacroNode then set it state to state of its subgraph if ( myNode->IsMacro() && isExecuting ) { // get SubGraph from MacroNode SUPERV_Graph aMacro = SUPERV::Graph::_narrow(myNode); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNode.h b/src/SUPERVGUI/SUPERVGUI_CanvasNode.h index acead4e..12b6b2b 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNode.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNode.h @@ -42,9 +42,9 @@ class SUPERVGUI_CanvasNode : public QObject { virtual void showAll(); virtual bool setNodeName(QString aName); - SUPERV_CNode getEngine() const { return myNode; } - SUPERVGUI_Main* getMain() const { return myMain; } - SUPERVGUI_CanvasNodePrs* getPrs() const; + SUPERV_CNode getEngine() const { return myNode; } + SUPERVGUI_Main* getMain() const { return myMain; } + SUPERVGUI_CanvasNodePrs* getPrs(); bool isWarning(); bool isStep(); @@ -58,10 +58,10 @@ class SUPERVGUI_CanvasNode : public QObject { SUPERV_INode getInlineNode() const { return SUPERV::INode::_narrow(myNode); } SUPERV_GNode getGotoNode() const { return SUPERV::GNode::_narrow(myNode); } SUPERV_LNode getLoopNode() const { return SUPERV::LNode::_narrow(myNode); } - SUPERV_ELNode getEndLoopNode() const { return SUPERV::ELNode::_narrow(myNode); } + SUPERV_ELNode getEndLoopNode() const { return SUPERV::ELNode::_narrow(myNode);} SUPERV_SNode getSwitchNode() const { return SUPERV::SNode::_narrow(myNode); } - SUPERV_ESNode getEndSwitchNode() const { return SUPERV::ESNode::_narrow(myNode); } - SUPERV_Graph getMacroNode() const { return SUPERV::Graph::_narrow(myNode); } + SUPERV_ESNode getEndSwitchNode() const { return SUPERV::ESNode::_narrow(myNode);} + SUPERV_Graph getMacroNode() const { return SUPERV::Graph::_narrow(myNode); } SUPERV_Port createInPort(); SUPERV_Port createOutPort(); @@ -101,9 +101,11 @@ class SUPERVGUI_CanvasNode : public QObject { void exportToLib(); protected: + // redefined by most of CanvasNode successors virtual SUPERVGUI_CanvasNodePrs* createPrs() const; - virtual void createPort(SUPERV::Port_ptr thePort) const; - virtual void createStreamPort(SUPERV::StreamPort_ptr thePort) const; + + void createPort(SUPERV::Port_ptr thePort); + void createStreamPort(SUPERV::StreamPort_ptr thePort); virtual bool eventFilter(QObject* o, QEvent* e); SUPERVGUI_BrowseNodeDlg* myBrowseDlg; diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx index 1661c8e..3c0dd0c 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx @@ -56,32 +56,28 @@ SUPERVGUI_CanvasNodePrs::SUPERVGUI_CanvasNodePrs(QCanvas* theCanvas, // create in/out connection points prs myPointIn = new SUPERVGUI_CanvasHookPrs(theCanvas, this, true); myPointOut = new SUPERVGUI_CanvasHookPrs(theCanvas, this, false); - } - cout<<" ===> 0.2 conatructor NodePrs : CanvasArray has ......"< 0.3 conatructor NodePrs : CanvasArray has ......"< 0.35 conatructor NodePrs : CanvasArray has ......"<getEngine()->State()); updatePorts(); } - cout<<" ===> 0.4 conatructor NodePrs : CanvasArray has ......"<allItems(); - cout<<" ===> 1 conatructor NodePrs : CanvasArray has "<getNode(); - else if (myPortPrs) + else if ( myPortPrs ) anObj = myPortPrs->getPort(); return anObj; } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx index d86b9cc..4f65056 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx @@ -158,7 +158,6 @@ SUPERVGUI_CanvasView::~SUPERVGUI_CanvasView() void SUPERVGUI_CanvasView::contentsMousePressEvent(QMouseEvent* theEvent) { - // MESSAGE("===> SUPERVGUI_CanvasView::contentsMousePressEvent(...) "); myPoint = inverseWorldMatrix().map(theEvent->pos()); myGlobalPoint = theEvent->globalPos(); myCurrentItem = 0; @@ -428,7 +427,6 @@ void SUPERVGUI_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) void SUPERVGUI_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) { - // MESSAGE("===> SUPERVGUI_CanvasView::contentsMouseReleaseEvent(...) "); if (myTimer->isActive()) myTimer->stop(); if (myCurrentItem) { @@ -490,7 +488,6 @@ void SUPERVGUI_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) void SUPERVGUI_CanvasView::contentsMouseDoubleClickEvent(QMouseEvent* theEvent) { - // MESSAGE("===> SUPERVGUI_CanvasView::contentsMouseDoubleClickEvent(...) "); QPoint p = inverseWorldMatrix().map(theEvent->pos()); // compute collision rectangle @@ -580,7 +577,6 @@ void SUPERVGUI_CanvasView::startSketch(SUPERVGUI_CanvasPort* thePort) void SUPERVGUI_CanvasView::endSketch(SUPERVGUI_CanvasPort* thePort) { - // MESSAGE("===> SUPERVGUI_CanvasView::endSketch(" << thePort->name() << ")"); if (!myIsLinkCreating) return; if (myLinkBuilder && myLinkBuilder->canCreateEngine(thePort)) { diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index e454143..c3c1fb4 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -179,7 +179,6 @@ SUPERVGUI_Main::~SUPERVGUI_Main() { fclose( myLogFile ); } - //delete myCanvas; // delete notification; // kloss : nota bene : quand un datalow est detruit : verifier que les canaux de notification sont aussi detruit notification->_remove_ref(); // kloss : nota bene : quand un datalow est detruit : verifier que les canaux de notification sont aussi detruit -- 2.39.2