#include <boost/shared_ptr.hpp>
using namespace boost;
+// mkr : PAL8150
+#define SYNCPUTINSTUDY(NodesName) \
+ for ( int n = 0; n < nodes->NodesName.length(); n++ ) { \
+ SUPERV_CNode aCNode = SUPERV::CNode::_narrow(nodes->NodesName[n]); \
+ SUPERV_Ports aPortList = aCNode->Ports(); \
+ for (int p = 0; p < aPortList->length(); p++) { \
+ SUPERV::Port_ptr aPort = aPortList[p].in(); \
+ if ( !aPort->IsInput() && !aPort->IsGate() ) { \
+ bool aInStudy = dynamic_cast<SUPERVGUI_CanvasPortOut*>( aMain->getCanvas()->getPort(aPort) )->isInStudy(); \
+ dynamic_cast<SUPERVGUI_CanvasPortOut*>( getCanvas()->getPort( getDataflow()->Node(aCNode->Name())->Port(aPort->Name()) ) )->setStudyState(aInStudy); \
+ } \
+ } \
+ }
+
SUPERVGUI_Main::SUPERVGUI_Main( SUPERVGraph_ViewFrame* theParent,
SUIT_Desktop* theDesktop, SUPERV_Graph theDataFlow )
: SUPERVGraph_View(theParent),
} else {
init(theDesktop);
}
+
+ syncPutInStudy(); // mkr : PAL8150
+
// mkr : IPAL11362
connect(this, SIGNAL(EventToSync()), this, SLOT(onObjectCreatedDeleted()));
}
sync();
show();
- if ( myLogged && !myLogFileName.isEmpty() && QFile::exists( myLogFileName ) ) {
+ if ( myLogged && !myLogFileName.isEmpty() /*&& QFile::exists( myLogFileName )*/ ) { // mkr : PAL7037
myLogFile = fopen( myLogFileName.latin1(), "a" );
if ( myLogFile == NULL )
myLogged = false;
SUIT_ViewManager* aVM = it.data()->getViewManager();
STD_Application* anApp = dynamic_cast<STD_Application*>( SUIT_Session::session()->activeApplication() );
if ( anApp ) anApp->removeViewManager(aVM);
- if ( aVM ) delete aVM;
+ //if ( aVM ) delete aVM; // mkr : IPAL11547
}
mySubGraphs.clear();
fclose( myLogFile );
}
myLogFile = NULL;
- if ( myLogged && !myLogFileName.isEmpty() && QFile::exists( myLogFileName ) ) {
+ if ( myLogged && !myLogFileName.isEmpty() /*&& QFile::exists( myLogFileName )*/ ) { // mkr : PAL7037
myLogFile = fopen( myLogFileName.latin1(), "a" );
if ( myLogFile == NULL ) {
myLogged = false;
if ( aStudyFrame ) {
SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>( aStudyFrame );
if( aViewFrame ) {
- /*SUPERVGUI_Main* m = */new SUPERVGUI_Main(aViewFrame,
- aSupMod->application()->desktop(),//getDesktop(),
- aGraph);
+ new SUPERVGUI_Main(aViewFrame,
+ aSupMod->application()->desktop(),//getDesktop(),
+ aGraph);
// connect(aStudyFrame, SIGNAL(sfStudyFrameClosing(QAD_StudyFrame*)),
// this, SLOT(onSubGraphClosed(QAD_StudyFrame*)));
connect(aSupMod->application()->desktop(), SIGNAL(windowActivated( SUIT_ViewWindow* )),
}
}
+// mkr : IPAL11549
+void SUPERVGUI_Main::destroySubGraph(QString theSubGraphName)
+{
+ if ( mySubGraphs.contains(theSubGraphName) ) {
+ SUIT_ViewWindow* aStudyFrame = mySubGraphs[theSubGraphName];
+ onSubGraphClosed(aStudyFrame);
+ SUIT_ViewManager* aVM = aStudyFrame->getViewManager();
+ STD_Application* anApp = dynamic_cast<STD_Application*>( SUIT_Session::session()->activeApplication() );
+ if ( anApp ) anApp->removeViewManager(aVM);
+ }
+}
+
bool SUPERVGUI_Main::eventFilter( QObject* o, QEvent* e)
{
// workaround to get close event
if ( aMainList->count() == 1 ) {
SUPERVGUI_Main* aMain = dynamic_cast<SUPERVGUI_Main*>( aMainList->first() );
if ( aMain )
- if ( !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR()) // equal dataflows
+ if ( !CORBA::is_nil( aMain->getDataflow() )
+ &&
+ !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR()) // equal dataflows
&&
aMain != this ) // not equal mains
aMain->getCanvas()->merge();
}
}
+// mkr : PAL8150 : synchronize many views of the same dataflow ("Put In Study"/"Not In Study" operation)
+void SUPERVGUI_Main::onPutInStudy( QString* theNodePortName )
+{
+ if ( study ) {
+ if ( STD_Application* app = dynamic_cast<STD_Application*>( study->application() ) ) {
+ ViewManagerList aVMList;
+ app->viewManagers( SUPERVGraph_Viewer::Type(), aVMList );
+ SUIT_ViewManager* aVM;
+ for ( aVM = aVMList.first(); aVM; aVM = aVMList.next() ) {
+ QPtrVector<SUIT_ViewWindow> aVWList = aVM->getViews();
+ for ( int i = 0; i < aVWList.count(); i++ ) {
+ SUPERVGraph_ViewFrame* aVW = dynamic_cast<SUPERVGraph_ViewFrame*>( aVWList[i] );
+ QObjectList* aMainList = aVW->queryList("SUPERVGUI_Main");
+ if ( aMainList->count() == 1 ) {
+ SUPERVGUI_Main* aMain = dynamic_cast<SUPERVGUI_Main*>( aMainList->first() );
+ if ( aMain )
+ if ( !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR()) // equal dataflows
+ &&
+ aMain != this ) { // not equal mains
+ QString aNodeName = theNodePortName->left( theNodePortName->find('_') );
+ QString aPortName = theNodePortName->right( theNodePortName->length() - theNodePortName->find('_') - 1 );
+ bool anIsInStudy = dynamic_cast<SUPERVGUI_CanvasPortOut*>( getCanvas()->getPort( getDataflow()->Node( aNodeName )->GetOutPort( aPortName ) ) )->isInStudy();
+ dynamic_cast<SUPERVGUI_CanvasPortOut*>( aMain->getCanvas()->getPort( aMain->getDataflow()->Node( aNodeName )->GetOutPort( aPortName ) ) )->setStudyState( anIsInStudy );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+// mkr : PAL8150 : synchronize many views of the same dataflow ("Display" operation for dataflow)
+void SUPERVGUI_Main::syncPutInStudy()
+{
+ if ( study ) {
+ if ( STD_Application* app = dynamic_cast<STD_Application*>( study->application() ) ) {
+ ViewManagerList aVMList;
+ app->viewManagers( SUPERVGraph_Viewer::Type(), aVMList );
+ SUIT_ViewManager* aVM;
+ for ( aVM = aVMList.first(); aVM; aVM = aVMList.next() ) {
+ QPtrVector<SUIT_ViewWindow> aVWList = aVM->getViews();
+ for ( int i = 0; i < aVWList.count(); i++ ) {
+ SUPERVGraph_ViewFrame* aVW = dynamic_cast<SUPERVGraph_ViewFrame*>( aVWList[i] );
+ QObjectList* aMainList = aVW->queryList("SUPERVGUI_Main");
+ if ( aMainList->count() == 1 ) {
+ SUPERVGUI_Main* aMain = dynamic_cast<SUPERVGUI_Main*>( aMainList->first() );
+ if ( aMain )
+ if ( !CORBA::is_nil( aMain->getDataflow() )
+ &&
+ !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR()) // equal dataflows
+ &&
+ aMain != this ) { // not equal mains
+
+ // check "myInStudy" field of output ports of original main (i.e. this main)
+ // and synchronize this property for nodes' output ports of dublicate main (i.e. of aMain)
+ SUPERV_Nodes nodes = aMain->getDataflow()->Nodes();
+
+ SYNCPUTINSTUDY(CNodes);
+ SYNCPUTINSTUDY(FNodes);
+ SYNCPUTINSTUDY(INodes);
+ SYNCPUTINSTUDY(GNodes);
+ SYNCPUTINSTUDY(LNodes);
+ SYNCPUTINSTUDY(ELNodes);
+ SYNCPUTINSTUDY(SNodes);
+ SYNCPUTINSTUDY(ESNodes);
+ SYNCPUTINSTUDY(Graphs);
+
+ setRunTime( aMain->getRunTime() );
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
void SUPERVGUI_Main::run( const bool andSuspend ) {
Trace("SUPERVGUI_Main::run");
if ( SUPERV_isNull(dataflow) )
void SUPERVGUI_Main::suspendResume() {
Trace("SUPERVGUI_Main::suspendResume");
+
if ((SUPERV_isNull(dataflow))) return;
if (dataflow->IsEditing()) {
_PTR(ChildIterator) anIterator ( theStudy->NewChildIterator(theSO) );
for (; anIterator->More(); anIterator->Next()) {
if (anIterator->Value()->FindAttribute(anAttr, "AttributeName")) {
- aName = anAttr;
+ aName = _PTR(AttributeName) ( anAttr );
if (strcmp(aName->Value().c_str(), theName) == 0) {
aResult = anIterator->Value();
break;
// add new SObject
aResult = theBuilder->NewObject( theSO );
anAttr = theBuilder->FindOrCreateAttribute(aResult, "AttributeName");
- aName = anAttr;
+ aName = _PTR(AttributeName) ( anAttr );
aName->SetValue(theName);
return aResult;
}
if ( !aComponent ) { // is supervision component not found, then create it
aComponent = aBuilder->NewComponent(STUDY_SUPERVISION);
anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributeName");
- aName = anAttr;
+ aName = _PTR(AttributeName) ( anAttr );
aName->SetValue( (( CAM_Application* )(study->application()))->moduleTitle( "SUPERV" ).latin1() );
anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap");
// create dataflow SObject ("aNewDataflow_1")
aSO = aBuilder->NewObject(aComponent);
anAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName");
- aName = anAttr;
+ aName = _PTR(AttributeName) ( anAttr );
aName->SetValue(dataflow->Name());
anAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeIOR");
_PTR(AttributeIOR) anIORAttr ( anAttr );
long counter;
char* date;
long stamp;
-
+
while (notification->Receive(&graph, &node, &type, &message, &sender, &counter, &date, &stamp)) {
-// if (isFiltered(graph, node, type, message, sender, counter, date, stamp)) {
+ if (isFiltered(graph, node, type, message, sender, counter, date, stamp)) { // mkr : PAL7037
QString mess("");
mess += "NOTIF: "; mess += graph;
mess += " / " ; mess += node;
mess += " / " ; mess += type;
mess += " / " ; mess += message;
getMessage()->putMessage(mess.latin1());
-// };
+ };
};
}
bool b = false;
if (strcmp(getDataflow()->Name(), graph) == 0) {
SUPERVGUI_CanvasNode* n;
- QObjectList* nodes = queryList("SUPERVGUI_CanvasNode");
+ QObjectList* nodes;
+ // mkr : PAL7037 -->
+ if (myCurrentView == CANVASTABLE)
+ nodes = myArray->queryList("SUPERVGUI_CanvasNode");
+ else
+ nodes = myCanvas->queryList("SUPERVGUI_CanvasNode");
+ // mkr : PAL7037 <--
QObjectListIt i(*nodes);
while ((n=(SUPERVGUI_CanvasNode*)i.current()) != 0) {
++i;
SUPERV_CNode aNode = NULL;
SUPERV::GraphEvent aEvent = SUPERV::UndefinedEvent ;
SUPERV::GraphState aState = SUPERV::UndefinedState ;
-
+
// blocking function of Engine. Return from there only after anEvent happens on node aNode
myMain->getDataflow()->Event(aNode, aEvent, aState);
-
+
ProcessVoidEvent( new TMainRunEvent( this, &SUPERVGUI_Thread::main_thread_run,aNode, aEvent, aState ) );
} // end of while( myIsActive )