From: ribes Date: Mon, 4 Oct 2010 13:50:09 +0000 (+0000) Subject: Better management of the viewers X-Git-Tag: V6_2_0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=01f21963a2c9308a90941aaf9bafc8d8ad0fd3f6;p=modules%2Fjobmanager.git Better management of the viewers --- diff --git a/src/salomegui/BL_SalomeGui.cxx b/src/salomegui/BL_SalomeGui.cxx index 4d23041..4461486 100644 --- a/src/salomegui/BL_SalomeGui.cxx +++ b/src/salomegui/BL_SalomeGui.cxx @@ -41,6 +41,9 @@ BL::SalomeGui::initialize(CAM_Application* app) DEBTRACE("Entering in initialize"); SalomeApp_Module::initialize(app); // MANDATORY -> Otherwise SISEGV... connect( getApp(), SIGNAL(studyClosed()), this, SLOT(studyClosed())); + if ( app && app->desktop() ) + connect( app->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT(onWindowActivated( SUIT_ViewWindow* )) ); } void @@ -51,6 +54,7 @@ BL::SalomeGui::studyClosed() _gengui->deleteDockWidget(); delete _gengui; _gengui = NULL; + _viewWin = NULL; } } @@ -107,6 +111,18 @@ BL::SalomeGui::deactivateModule(SUIT_Study* theStudy) return bOk; } +void +BL::SalomeGui::onWindowActivated( SUIT_ViewWindow* svw) +{ + DEBTRACE("BL::SalomeGui::onWindowActivated"); + DEBTRACE("activeModule()->moduleName() " << (getApp()->activeModule() ? getApp()->activeModule()->moduleName().toStdString() : "") ); + + if (_viewWin) // Be sure to have a _viewWindow + if (svw->getId() == _viewWin->getId()) // Same Id ? + if (getApp()->activeModule() && getApp()->activeModule()->moduleName().compare("JobManager") != 0) // JobManager already activated ? + getApp()->activateModule("JobManager"); +} + // --- Export the module extern "C" { diff --git a/src/salomegui/BL_SalomeGui.hxx b/src/salomegui/BL_SalomeGui.hxx index 5ca85de..f6069a9 100644 --- a/src/salomegui/BL_SalomeGui.hxx +++ b/src/salomegui/BL_SalomeGui.hxx @@ -46,6 +46,9 @@ namespace BL bool activateModule( SUIT_Study* theStudy); void studyClosed(); + protected slots: + void onWindowActivated( SUIT_ViewWindow* svw); + protected: BL::GenericGui * _gengui; };