1 // File: SalomeApp_Application.cxx
2 // Created: 10/22/2004 3:23:45 PM
3 // Author: Sergey LITONIN
4 // Copyright (C) CEA 2004
6 #include "SalomeApp_PyInterp.h" // WARNING! This include must be the first!
8 #include "SalomeApp_Application.h"
10 #include "SalomeApp_Study.h"
11 #include "SalomeApp_Module.h"
12 #include "SalomeApp_OBFilter.h"
13 #include "SalomeApp_EventFilter.h"
14 #include "SalomeApp_WidgetContainer.h"
16 #include "SalomeApp_AboutDlg.h"
17 #include "SalomeApp_ModuleDlg.h"
19 #include "SalomeApp_GLSelector.h"
20 #include "SalomeApp_OBSelector.h"
21 #include "SalomeApp_OCCSelector.h"
22 #include "SalomeApp_VTKSelector.h"
23 #include "SalomeApp_SelectionMgr.h"
25 #include <LogWindow.h>
27 #include <GLViewer_Viewer.h>
28 #include <GLViewer_ViewManager.h>
30 #include <Plot2d_ViewManager.h>
32 #include <OCCViewer_ViewManager.h>
33 #include <SOCC_ViewModel.h>
35 #include <SVTK_ViewModel.h>
36 #include <SVTK_ViewManager.h>
38 #include <STD_TabDesktop.h>
40 #include <SUIT_Tools.h>
41 #include <SUIT_Session.h>
43 #include <QtxToolBar.h>
44 #include <QtxDockAction.h>
46 #include <OB_Browser.h>
48 #include <PythonConsole_PyConsole.h>
50 #include <SUIT_MessageBox.h>
51 #include <SUIT_ResourceMgr.h>
52 #include <SUIT_ActionOperation.h>
54 #include <Utils_ORB_INIT.hxx>
55 #include <Utils_SINGLETON.hxx>
56 #include <SALOME_ModuleCatalog_impl.hxx>
64 #include <qcombobox.h>
65 #include <qmessagebox.h>
66 #include <qapplication.h>
68 #include "SALOMEDS_StudyManager.hxx"
70 #define OBJECT_BROWSER_WIDTH 300
72 static const char* imageEmptyIcon[] = {
75 "....................",
76 "....................",
77 "....................",
78 "....................",
79 "....................",
80 "....................",
81 "....................",
82 "....................",
83 "....................",
84 "....................",
85 "....................",
86 "....................",
87 "....................",
88 "....................",
89 "....................",
90 "....................",
91 "....................",
92 "....................",
93 "....................",
94 "...................."};
96 extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication()
98 return new SalomeApp_Application();
102 Class : SalomeApp_Application
103 Description : Application containing SalomeApp module
106 SalomeApp_Application::SalomeApp_Application()
107 : CAM_Application( false )
109 STD_TabDesktop* desk = new STD_TabDesktop();
113 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
114 QPixmap aLogo = aResMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ) );
116 desktop()->setIcon( aLogo );
117 desktop()->setDockableMenuBar( true );
118 desktop()->setDockableStatusBar( false );
122 mySelMgr = new SalomeApp_SelectionMgr( this );
124 connect( desk, SIGNAL( closing( SUIT_Desktop*, QCloseEvent* ) ),
125 this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) );
127 connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
130 SalomeApp_Application::~SalomeApp_Application()
132 saveWindowsGeometry();
137 desktop()->saveGeometry( resourceMgr(), "desktop" );
138 resourceMgr()->save();
143 SalomeApp_EventFilter::Destroy();
146 void SalomeApp_Application::start()
149 desktop()->loadGeometry( resourceMgr(), "desktop" );
151 CAM_Application::start();
153 QAction* a = action( ViewWindowsId );
154 if ( a && a->inherits( "QtxDockAction" ) )
155 ((QtxDockAction*)a)->setAutoPlace( true );
157 SalomeApp_EventFilter::Init();
160 updateViewManagers();
165 QString SalomeApp_Application::applicationName() const
167 return tr( "APP_NAME" );
170 QString SalomeApp_Application::applicationVersion() const
172 static QString _app_version;
174 if ( _app_version.isEmpty() )
176 QString path( ::getenv( "GUI_ROOT_DIR" ) );
177 if ( !path.isEmpty() )
178 path += QDir::separator();
179 path += QString( "bin/salome/VERSION" );
182 if ( vf.open( IO_ReadOnly ) )
185 vf.readLine( line, 1024 );
188 if ( !line.isEmpty() )
190 while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )
191 line.remove( line.length() - 1, 1 );
193 int idx = line.findRev( ":" );
195 _app_version = line.mid( idx + 1 ).stripWhiteSpace();
203 CAM_Module* SalomeApp_Application::loadModule( const QString& name )
205 CAM_Module* mod = CAM_Application::loadModule( name );
208 connect( this, SIGNAL( studyOpened() ), mod, SLOT( onModelOpened() ) );
209 connect( this, SIGNAL( studySaved() ), mod, SLOT( onModelSaved() ) );
210 connect( this, SIGNAL( studyClosed() ), mod, SLOT( onModelClosed() ) );
215 bool SalomeApp_Application::activateModule( const QString& modName )
218 CAM_Module* prevMod = activeModule();
221 actName = prevMod->moduleName();
223 if ( actName == modName )
226 saveWindowsGeometry();
228 bool status = CAM_Application::activateModule( modName );
230 updateModuleActions();
236 updateViewManagers();
241 SalomeApp_SelectionMgr* SalomeApp_Application::selectionMgr() const
246 void SalomeApp_Application::createActions()
248 STD_Application::createActions();
250 SUIT_Desktop* desk = desktop();
251 SUIT_ResourceMgr* resMgr = resourceMgr();
253 // default icon for neutral point ('SALOME' module)
254 QPixmap defIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ) );
255 if ( defIcon.isNull() )
256 defIcon = QPixmap( imageEmptyIcon );
258 // default icon for any module
259 QPixmap modIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_MODULE_ICO" ) );
260 if ( modIcon.isNull() )
261 modIcon = QPixmap( imageEmptyIcon );
263 QToolBar* modTBar = new QtxToolBar( true, desk );
264 modTBar->setLabel( tr( "INF_TOOLBAR_MODULES" ) );
266 QActionGroup* modGroup = new QActionGroup( this );
267 modGroup->setExclusive( true );
268 modGroup->setUsesDropDown( true );
270 QAction* a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ),
271 tr( "PRP_APP_MODULE" ), 0, desk, true );
273 myActions.insert( QString(), a );
275 QMap<QString, QString> iconMap;
276 moduleIconNames( iconMap );
278 const int iconSize = 20;
280 modGroup->addTo( modTBar );
281 modTBar->addSeparator();
284 modules( modList, false );
286 for ( QStringList::Iterator it = modList.begin(); it != modList.end(); ++it )
288 if ( (*it).isEmpty() )
292 if ( iconMap.contains( *it ) )
293 iconName = iconMap[*it];
295 QString modName = moduleName( *it );
297 QPixmap icon = resMgr->loadPixmap( modName, iconName );
301 icon.convertFromImage( icon.convertToImage().smoothScale( iconSize, iconSize, QImage::ScaleMin ) );
303 QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true );
307 myActions.insert( *it, a );
310 SUIT_Tools::simplifySeparators( modTBar );
314 int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
315 int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
316 createMenu( separator(), windowMenu, -1, 1 );
318 QMap<int, int> accelMap;
319 accelMap[NewGLViewId] = ALT+Key_G;
320 accelMap[NewPlot2dId] = ALT+Key_P;
321 accelMap[NewOCCViewId] = ALT+Key_O;
322 accelMap[NewVTKViewId] = ALT+Key_K;
324 for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
326 QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ), QIconSet(),
327 tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
328 tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
329 accelMap.contains( id ) ? accelMap[id] : 0, desk, false, this, SLOT( onNewWindow() ) );
330 createMenu( a, newWinMenu, -1 );
333 connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) );
336 void SalomeApp_Application::onModuleActivation( QAction* a )
341 QString modName = a->menuText();
342 if ( modName == tr( "APP_NAME" ) )
343 modName = QString::null;
345 // Force user to create/open a study before module activation
346 QMap<QString, QString> iconMap;
347 moduleIconNames( iconMap );
348 QPixmap icon = resourceMgr()->loadPixmap( moduleName( modName ), iconMap[ modName ] );
350 bool cancelled = false;
351 while ( !modName.isEmpty() && !activeStudy() && !cancelled ){
352 SalomeApp_ModuleDlg aDlg( desktop(), modName, icon );
353 int res = aDlg.exec();
367 putInfo( tr("INF_CANCELLED") );
368 myActions[QString()]->setOn( true );
374 activateModule( modName );
377 QString SalomeApp_Application::defaultModule() const
379 QStringList aModuleNames;
380 modules( aModuleNames, false ); // obtain a complete list of module names for the current configuration
381 // If there's the one and only module --> activate it automatically
382 // TODO: Possible improvement - default module can be taken from preferences
383 return aModuleNames.count() > 1 ? "" : ( aModuleNames.count() ? aModuleNames.first() : "" );
386 void SalomeApp_Application::onNewWindow()
388 const QObject* obj = sender();
389 if ( !obj || !obj->inherits( "QAction" ) )
393 int id = actionId( (QAction*)obj );
397 type = GLViewer_Viewer::Type();
400 type = Plot2d_Viewer::Type();
403 type = OCCViewer_Viewer::Type();
406 type = VTKViewer_Viewer::Type();
410 if ( !type.isEmpty() )
411 createViewManager( type );
414 //=======================================================================
416 // Purpose : SLOT. Create new document
417 //=======================================================================
418 void SalomeApp_Application::onNewDoc()
420 SUIT_Study* study = activeStudy();
422 saveWindowsGeometry();
424 CAM_Application::onNewDoc();
426 if ( !study ) // new study will be create in THIS application
429 updateViewManagers();
433 //=======================================================================
435 // Purpose : SLOT. Open new document
436 //=======================================================================
437 void SalomeApp_Application::onOpenDoc()
439 SUIT_Study* study = activeStudy();
440 saveWindowsGeometry();
442 CAM_Application::onOpenDoc();
444 if ( !study ) // new study will be create in THIS application
447 updateViewManagers();
451 void SalomeApp_Application::onSelection()
453 onSelectionChanged();
455 if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
456 ((SalomeApp_Module*)activeModule())->selectionChanged();
459 void SalomeApp_Application::onSelectionChanged()
463 void SalomeApp_Application::setActiveStudy( SUIT_Study* study )
465 CAM_Application::setActiveStudy( study );
470 //=======================================================================
471 // name : createNewStudy
472 // Purpose : Create new study
473 //=======================================================================
474 SUIT_Study* SalomeApp_Application::createNewStudy()
476 SalomeApp_Study* aStudy = new SalomeApp_Study( this );
478 // Set up processing of major study-related events
479 connect( aStudy, SIGNAL( created( SUIT_Study* ) ), this, SLOT( onStudyCreated( SUIT_Study* ) ) );
480 connect( aStudy, SIGNAL( opened ( SUIT_Study* ) ), this, SLOT( onStudyOpened ( SUIT_Study* ) ) );
481 connect( aStudy, SIGNAL( saved ( SUIT_Study* ) ), this, SLOT( onStudySaved ( SUIT_Study* ) ) );
482 connect( aStudy, SIGNAL( closed ( SUIT_Study* ) ), this, SLOT( onStudyClosed ( SUIT_Study* ) ) );
487 //=======================================================================
488 // name : createNewStudy
489 // Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu
490 //=======================================================================
491 void SalomeApp_Application::updateCommandsStatus()
493 CAM_Application::updateCommandsStatus();
495 for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
497 QAction* a = action( id );
499 a->setEnabled( activeStudy() );
503 //=======================================================================
504 // name : onHelpAbout
505 // Purpose : SLOT. Display "About" message box
506 //=======================================================================
507 void SalomeApp_Application::onHelpAbout()
509 SalomeApp_AboutDlg* dlg = new SalomeApp_AboutDlg( applicationName(), applicationVersion(), desktop() );
514 QWidget* SalomeApp_Application::window( const int flag, const int studyId ) const
521 if ( !activeStudy() )
524 sId = activeStudy()->id();
527 if ( myWindows.contains( flag ) )
528 wid = myWindows[flag]->widget( sId );
533 void SalomeApp_Application::addWindow( QWidget* wid, const int flag, const int studyId )
541 if ( !activeStudy() )
544 sId = activeStudy()->id();
547 if ( !myWindows.contains( flag ) )
549 QMap<int, int> winMap;
550 currentWindows( winMap );
552 myWindows.insert( flag, new SalomeApp_WidgetContainer( flag, desktop() ) );
553 if ( winMap.contains( flag ) )
554 desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] );
556 myWindows[flag]->setResizeEnabled( true );
557 myWindows[flag]->setCloseMode( QDockWindow::Always );
558 myWindows[flag]->setName( QString( "dock_window_%1" ).arg( flag ) );
561 myWindows[flag]->insert( sId, wid );
563 setWindowShown( flag, !myWindows[flag]->isEmpty() );
566 void SalomeApp_Application::removeWindow( const int flag, const int studyId )
568 if ( !myWindows.contains( flag ) )
574 if ( !activeStudy() )
577 sId = activeStudy()->id();
580 QWidget* wid = myWindows[flag]->widget( sId );
581 myWindows[flag]->remove( sId );
584 setWindowShown( flag, !myWindows[flag]->isEmpty() );
587 QWidget* SalomeApp_Application::getWindow( const int flag, const int studyId )
589 QWidget* wid = window( flag, studyId );
591 addWindow( wid = createWindow( flag ), flag, studyId );
596 bool SalomeApp_Application::isWindowVisible( const int type ) const
599 if ( myWindows.contains( type ) )
601 SUIT_Desktop* desk = ((SalomeApp_Application*)this)->desktop();
602 res = desk && desk->appropriate( myWindows[type] );
607 void SalomeApp_Application::setWindowShown( const int type, const bool on )
609 if ( !desktop() || !myWindows.contains( type ) )
612 QDockWindow* dw = myWindows[type];
613 desktop()->setAppropriate( dw, on );
614 on ? dw->show() : dw->hide();
617 OB_Browser* SalomeApp_Application::objectBrowser()
620 QWidget* wid = getWindow( WT_ObjectBrowser );
621 if ( wid->inherits( "OB_Browser" ) )
622 ob = (OB_Browser*)wid;
626 LogWindow* SalomeApp_Application::logWindow()
629 QWidget* wid = getWindow( WT_LogWindow );
630 if ( wid->inherits( "LogWindow" ) )
631 lw = (LogWindow*)wid;
635 SUIT_ViewManager* SalomeApp_Application::getViewManager( const QString& vmType, const bool create )
637 SUIT_ViewManager* aVM = viewManager( vmType );
638 SUIT_ViewManager* anActiveVM = CAM_Application::activeViewManager();
639 if ( anActiveVM && anActiveVM->getType() == vmType )
643 if ( !aVM->getActiveView() )
647 aVM = createViewManager( vmType );
651 SUIT_ViewManager* SalomeApp_Application::createViewManager( const QString& vmType )
653 SUIT_ViewManager* viewMgr = 0;
654 if ( vmType == GLViewer_Viewer::Type() )
656 viewMgr = new GLViewer_ViewManager( activeStudy(), desktop() );
657 new SalomeApp_GLSelector( (GLViewer_Viewer2d*)viewMgr->getViewModel(), mySelMgr );
659 else if ( vmType == Plot2d_Viewer::Type() )
660 viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() );
661 else if ( vmType == OCCViewer_Viewer::Type() )
663 viewMgr = new OCCViewer_ViewManager( activeStudy(), desktop() );
664 viewMgr->setViewModel( new SOCC_Viewer() );// custom view model, which extends SALOME_View interface
665 new SalomeApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr );
667 else if ( vmType == SVTK_Viewer::Type() )
669 viewMgr = new SVTK_ViewManager( activeStudy(), desktop() );
670 new SalomeApp_VTKSelector((SVTK_Viewer*)viewMgr->getViewModel(),mySelMgr);
676 addViewManager( viewMgr );
677 SUIT_ViewWindow* viewWin = viewMgr->createViewWindow();
679 if ( viewWin && desktop() )
680 viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) );
682 connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
683 this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
688 void SalomeApp_Application::onCloseView( SUIT_ViewManager* theVM )
690 removeViewManager( theVM );
693 void SalomeApp_Application::onStudyCreated( SUIT_Study* theStudy )
695 SUIT_DataObject* aRoot = 0;
696 if ( theStudy && theStudy->root() )
698 aRoot = theStudy->root();
699 //aRoot->setName( tr( "DATA_MODELS" ) );
701 if ( objectBrowser() != 0 )
702 objectBrowser()->setRootObject( aRoot );
704 activateModule( defaultModule() );
707 void SalomeApp_Application::onStudyOpened( SUIT_Study* theStudy )
709 SUIT_DataObject* aRoot = 0;
710 if ( theStudy && theStudy->root() )
712 aRoot = theStudy->root();
715 if ( objectBrowser() != 0 ) {
716 objectBrowser()->setRootObject( aRoot );
721 activateModule( defaultModule() );
726 void SalomeApp_Application::onStudySaved( SUIT_Study* )
731 void SalomeApp_Application::onStudyClosed( SUIT_Study* )
735 activateModule( "" );
737 saveWindowsGeometry();
740 QString SalomeApp_Application::getFileFilter() const
745 void SalomeApp_Application::beforeCloseDoc( SUIT_Study* s )
747 CAM_Application::beforeCloseDoc( s );
749 for ( WindowMap::ConstIterator itr = myWindows.begin(); s && itr != myWindows.end(); ++itr )
750 removeWindow( itr.key(), s->id() );
753 void SalomeApp_Application::updateActions()
755 updateCommandsStatus();
758 QWidget* SalomeApp_Application::createWindow( const int flag )
762 if ( flag == WT_ObjectBrowser )
764 OB_Browser* ob = new OB_Browser( desktop() );
765 ob->setAutoUpdate( true );
766 ob->setAutoOpenLevel( 1 );
767 ob->setCaption( tr( "OBJECT_BROWSER" ) );
768 ob->resize( OBJECT_BROWSER_WIDTH, ob->height() );
769 ob->setFilter( new SalomeApp_OBFilter( selectionMgr() ) );
772 new SalomeApp_OBSelector( ob, mySelMgr );
776 ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
778 else if ( flag == WT_PyConsole )
780 PythonConsole* pyCons = new PythonConsole( desktop(), new SalomeApp_PyInterp() );
781 pyCons->setCaption( tr( "PYTHON_CONSOLE" ) );
784 // pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
786 else if ( flag == WT_LogWindow )
788 LogWindow* logWin = new LogWindow( desktop() );
789 logWin->setCaption( tr( "LOG_WINDOW" ) );
792 logWin->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
798 void SalomeApp_Application::defaultWindows( QMap<int, int>& aMap ) const
800 aMap.insert( WT_ObjectBrowser, Qt::DockLeft );
801 aMap.insert( WT_PyConsole, Qt::DockBottom );
802 aMap.insert( WT_LogWindow, Qt::DockBottom );
805 void SalomeApp_Application::defaultViewManagers( QStringList& ) const
809 void SalomeApp_Application::afterCloseDoc()
813 CAM_Application::afterCloseDoc();
816 CORBA::ORB_var SalomeApp_Application::orb()
818 ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
819 CORBA::ORB_var& orb = init( qApp->argc(), qApp->argv() );
824 SALOMEDSClient_StudyManager* SalomeApp_Application::studyMgr()
826 static SALOMEDSClient_StudyManager* aStudyManager = NULL;
829 aStudyManager = new SALOMEDS_StudyManager();
831 return aStudyManager;
834 SALOME_NamingService* SalomeApp_Application::namingService()
836 return new SALOME_NamingService( orb() );
839 QString SalomeApp_Application::defaultEngineIOR()
841 // Look for a default module engine (needed for CORBAless modules to use SALOMEDS persistence)
843 CORBA::Object_ptr anEngine = namingService()->Resolve( "/SalomeAppEngine" );
844 if ( !CORBA::is_nil( anEngine ) )
845 anIOR = orb()->object_to_string( anEngine );
849 void SalomeApp_Application::moduleIconNames( QMap<QString, QString>& iconMap ) const
853 SUIT_ResourceMgr* resMgr = resourceMgr();
858 modules( modList, false );
860 for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it )
862 QString modName = *it;
863 QString modIntr = moduleName( modName );
864 QString modIcon = resMgr->stringValue( modIntr, "icon", QString::null );
866 if ( modIcon.isEmpty() )
869 if ( SUIT_Tools::extension( modIcon ).isEmpty() )
870 modIcon += QString( ".png" );
872 iconMap.insert( modName, modIcon );
876 void SalomeApp_Application::updateModuleActions()
879 if ( activeModule() )
880 modName = activeModule()->moduleName();
882 if ( myActions.contains( modName ) )
883 myActions[modName]->setOn( true );
886 void SalomeApp_Application::currentWindows( QMap<int, int>& winMap ) const
889 if ( !activeStudy() )
892 if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
893 ((SalomeApp_Module*)activeModule())->windows( winMap );
895 defaultWindows( winMap );
898 void SalomeApp_Application::currentViewManagers( QStringList& lst ) const
901 if ( !activeStudy() )
904 if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
905 ((SalomeApp_Module*)activeModule())->viewManagers( lst );
907 defaultViewManagers( lst );
910 void SalomeApp_Application::updateWindows()
912 QMap<int, int> winMap;
913 currentWindows( winMap );
915 for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
916 getWindow( it.key() );
918 loadWindowsGeometry();
920 for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
921 setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) );
924 void SalomeApp_Application::updateViewManagers()
927 currentViewManagers( lst );
929 for ( QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it )
930 getViewManager( *it, true );
933 void SalomeApp_Application::loadWindowsGeometry()
935 QtxDockAction* dockMgr = 0;
937 QAction* a = action( ViewWindowsId );
938 if ( a && a->inherits( "QtxDockAction" ) )
939 dockMgr = (QtxDockAction*)a;
945 if ( activeModule() )
946 modName = moduleLibrary( activeModule()->moduleName(), false );
948 QString section = QString( "windows_geometry" );
949 if ( !modName.isEmpty() )
950 section += QString( "." ) + modName;
952 dockMgr->loadGeometry( resourceMgr(), section, false );
953 dockMgr->restoreGeometry();
956 void SalomeApp_Application::saveWindowsGeometry()
958 QtxDockAction* dockMgr = 0;
960 QAction* a = action( ViewWindowsId );
961 if ( a && a->inherits( "QtxDockAction" ) )
962 dockMgr = (QtxDockAction*)a;
968 if ( activeModule() )
969 modName = moduleLibrary( activeModule()->moduleName(), false );
971 QString section = QString( "windows_geometry" );
972 if ( !modName.isEmpty() )
973 section += QString( "." ) + modName;
975 dockMgr->storeGeometry();
976 dockMgr->saveGeometry( resourceMgr(), section, false );
979 void SalomeApp_Application::activateWindows()
983 for ( WindowMap::Iterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
984 itr.data()->activate( activeStudy()->id() );