+/**
+ * Editing() is to be called by any operation in GUI before modification of a datamodel
+ * (add/remove ports or nodes, etc.). It is used to resolve inconsistancies between 2 data models
+ * in Engine: Editor and Executor. During and after execution, the values of ports and statuses of nodes
+ * are taken from Executor data model. But when user starts editing the graph - these changes must
+ * be applied to Editor data model. This function destroys Executor data model and moves to Editor.
+ */
+void SUPERVGUI_Main::Editing() {
+ if ( !SUPERV_isNull( dataflow ) )
+ dataflow->Editing();
+
+ // updata GUI, Nodes' statuses and Ports' values could change.
+ sync();
+}
+
+void SUPERVGUI_Main::removeArrayChild(SUPERV::CNode_ptr theNode)
+{
+ // mkr: since the deletion of the node allow only in CANVAS view,
+ // it is necessary to remove the CanvasArray's children, which
+ // have the same CNode engine as deleting node. This CNode is given
+ // as argument
+ if (myArray) {
+ const QObjectList* aChList = myArray->children();
+ if ( aChList ) { // asv 27.01.05 : fix for 7817
+ QObjectListIt aItChList(*aChList);
+ SUPERVGUI_CanvasNode* anObjNode;
+ while ((anObjNode = (SUPERVGUI_CanvasNode*)aItChList.current()) != 0) {
+ ++aItChList;
+ if ((QString(anObjNode->getEngine()->Name())).compare(QString(theNode->Name())) == 0) {
+ myArray->removeChild(anObjNode);
+ delete anObjNode;
+ }
+ }
+ } // end of if ( ChList )
+ }
+}
+
+/**
+ * ReadyToModify() must be called before any modification
+ * operation - asks to kill execution of dataflow. If returns false -
+ * modification (==Editing() ) is not allowed.
+ */
+bool SUPERVGUI_Main::ReadyToModify() {
+ if ( CORBA::is_nil( dataflow ) )
+ return false;
+ if ( dataflow->IsExecuting() ) {
+ bool quit = SUIT_MessageBox::warn2( SUIT_Session::session()->activeApplication()->desktop(), // 0=Yes, 1=No
+ tr("WARNING"), tr("MSG_GRAPH_ISRUN"), tr( "BUT_YES" ), tr( "BUT_CANCEL" ), 0, 1, 0 );
+ if ( quit ) // user selected NOT to kill dataflow and NOT to add new node
+ return false;
+ else if ( dataflow->IsExecuting() ) // user selected to kill the dataflow and add new node after that
+ kill(); // checking again for IsExecuting to be sure that it was not finished while MB was up
+ }
+ return true;
+}
+
+void SUPERVGUI_Main::resizeView( QResizeEvent* theEvent )
+{
+ if ( (myCurrentView == CANVAS || myCurrentView == CONTROLFLOW) && getCanvas() )
+ if ( getCanvas()->width() < theEvent->size().width()
+ ||
+ getCanvas()->height() < theEvent->size().height() )
+ getCanvas()->resize( theEvent->size().width(), theEvent->size().height() );
+ if ( myCurrentView == CANVASTABLE && getCanvasArray() )
+ if ( getCanvasArray()->width() < theEvent->size().width()
+ ||
+ getCanvasArray()->height() < theEvent->size().height() )
+ getCanvasArray()->resize( theEvent->size().width(), theEvent->size().height() );
+}
+