From c7072ad1996c5d8e29389d0262cb3c40743ceadb Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 22 Jun 2005 11:04:05 +0000 Subject: [PATCH] Fix for bug IPAL9204: 3.0.0: When Supervisor is opened, it's necessary to create empty supervision view. --- src/SUPERVGUI/SUPERVGUI.cxx | 33 +++++++++++++++++++++++++++------ src/SUPERVGUI/SUPERVGUI.h | 5 ++++- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index b685097..6ee1bda 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -73,7 +73,9 @@ extern "C" { SUPERVGUI::SUPERVGUI() : SalomeApp_Module( "SUPERV" ), study(0), - browser(0) + browser(0), + myFirstActivation(true), + myInitialViewFrame(0) //info(0) { Trace("SUPERVGUI::SUPERVGUI") @@ -227,6 +229,10 @@ bool SUPERVGUI::activateModule( SUIT_Study* theStudy ) connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), this, SLOT( setMain( SUIT_ViewWindow* ) ) ); + if ( myFirstActivation ) + // create new empty dataflow + createDataflow( New, true ); + return true; } @@ -245,6 +251,8 @@ bool SUPERVGUI::deactivateModule( SUIT_Study* theStudy ) disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), this, SLOT( setMain( SUIT_ViewWindow* ) ) ); //--------------------------------------- + + myFirstActivation = false; return SalomeApp_Module::deactivateModule( theStudy ); } @@ -584,7 +592,7 @@ void SUPERVGUI::modifyDataflow() { createDataflow( Modify ); } -bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) { +bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode, bool theInitialDF ) { Trace("SUPERVGUI::createDataflow, mode = " << mode ); // asv : 27.01.05 : fix for PAL7823 : if the study is locked - warn the user and return. @@ -622,14 +630,27 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) { return false; } - // 2. create a ViewFrame object - SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast( createGraph() ); + SUPERVGraph_ViewFrame* aViewFrame; + if ( theInitialDF || !myInitialViewFrame ) { + // 2. create a ViewFrame object + aViewFrame = dynamic_cast( createGraph() ); + } + else { + // 2. get empty initial view frame as new ViewFrame object + aViewFrame = myInitialViewFrame; + myInitialViewFrame = 0; + } + if ( aViewFrame ) { // 3. bind Graph and ViewFrame == create SUPERVGUI_Main object main = new SUPERVGUI_Main( aViewFrame, application()->desktop(), aGraph ); - if ( mode == New ) - main->addNode(); + if ( mode == New ) { + if ( !theInitialDF ) + main->addNode(); + else + myInitialViewFrame = aViewFrame; + } else registerGraph( f, main ); aViewFrame->show(); diff --git a/src/SUPERVGUI/SUPERVGUI.h b/src/SUPERVGUI/SUPERVGUI.h index 0c9649d..578a734 100644 --- a/src/SUPERVGUI/SUPERVGUI.h +++ b/src/SUPERVGUI/SUPERVGUI.h @@ -137,7 +137,7 @@ class SUPERVGUI: public SalomeApp_Module { // method called from importDataflow(), modifyDataflow(), newDataflow() with // different modes. The behavior of the function is very similar in all 3 cases, // but some differences still exist. These differences are implemented using NEW_DF_MODE param. - bool createDataflow( const NEW_DF_MODE f ); + bool createDataflow( const NEW_DF_MODE f, bool theInitialDF = false ); void createSupervAction( const int id, const QString& po_id, const QString& icon_id = QString(""), const int key = 0, const bool toggle = false ); @@ -154,6 +154,9 @@ class SUPERVGUI: public SalomeApp_Module { SUPERVGUI_Main* main; // active main QPtrList myGraphList; QMap myInterfaceNameMap; + + bool myFirstActivation; + SUPERVGraph_ViewFrame* myInitialViewFrame; }; #endif -- 2.39.2