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_GLSelector.h"
13 #include "SalomeApp_OBSelector.h"
14 #include "SalomeApp_OCCSelector.h"
15 #include "SalomeApp_VTKSelector.h"
16 #include "SalomeApp_EventFilter.h"
17 #include "SalomeApp_SelectionMgr.h"
18 #include "SalomeApp_EventFilter.h"
19 #include "SalomeApp_WidgetContainer.h"
20 #include "SalomeApp_ModuleDlg.h"
22 #include <LogWindow.h>
24 #include <GLViewer_Viewer.h>
25 #include <GLViewer_ViewManager.h>
27 #include <Plot2d_ViewManager.h>
29 #include <OCCViewer_ViewManager.h>
30 #include <SOCC_ViewModel.h>
32 #include <SVTK_ViewModel.h>
33 #include <SVTK_ViewManager.h>
35 #include <STD_TabDesktop.h>
37 #include <SUIT_Tools.h>
38 #include <SUIT_Session.h>
40 #include <QtxToolBar.h>
41 #include <QtxDockAction.h>
43 #include <OB_Browser.h>
45 #include <PythonConsole_PyConsole.h>
47 #include <SUIT_MessageBox.h>
48 #include <SUIT_ResourceMgr.h>
49 #include <SUIT_ActionOperation.h>
51 #include <Utils_ORB_INIT.hxx>
52 #include <Utils_SINGLETON.hxx>
53 #include <SALOME_ModuleCatalog_impl.hxx>
60 #include <qcombobox.h>
61 #include <qmessagebox.h>
62 #include <qapplication.h>
64 #include "SALOMEDS_StudyManager.hxx"
66 #define OBJECT_BROWSER_WIDTH 300
68 static const char* imageEmptyIcon[] = {
71 "....................",
72 "....................",
73 "....................",
74 "....................",
75 "....................",
76 "....................",
77 "....................",
78 "....................",
79 "....................",
80 "....................",
81 "....................",
82 "....................",
83 "....................",
84 "....................",
85 "....................",
86 "....................",
87 "....................",
88 "....................",
89 "....................",
90 "...................."};
92 extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication()
94 return new SalomeApp_Application();
98 Class : SalomeApp_Application
99 Description : Application containing SalomeApp module
102 SalomeApp_Application::SalomeApp_Application()
103 : CAM_Application( false )
105 STD_TabDesktop* desk = new STD_TabDesktop();
109 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
110 QPixmap aLogo = aResMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ) );
112 desktop()->setIcon( aLogo );
113 desktop()->setDockableMenuBar( true );
114 desktop()->setDockableStatusBar( false );
118 mySelMgr = new SalomeApp_SelectionMgr( this );
120 connect( desk, SIGNAL( closing( SUIT_Desktop*, QCloseEvent* ) ),
121 this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) );
123 connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
126 SalomeApp_Application::~SalomeApp_Application()
128 saveWindowsGeometry();
133 desktop()->saveGeometry( resourceMgr(), "desktop" );
134 resourceMgr()->save();
139 SalomeApp_EventFilter::Destroy();
142 void SalomeApp_Application::start()
145 desktop()->loadGeometry( resourceMgr(), "desktop" );
147 CAM_Application::start();
149 QAction* a = action( ViewWindowsId );
150 if ( a && a->inherits( "QtxDockAction" ) )
151 ((QtxDockAction*)a)->setAutoPlace( true );
153 SalomeApp_EventFilter::Init();
156 updateViewManagers();
161 QString SalomeApp_Application::applicationName() const
166 CAM_Module* SalomeApp_Application::loadModule( const QString& name )
168 CAM_Module* mod = CAM_Application::loadModule( name );
171 connect( this, SIGNAL( studyOpened() ), mod, SLOT( onModelOpened() ) );
172 connect( this, SIGNAL( studySaved() ), mod, SLOT( onModelSaved() ) );
173 connect( this, SIGNAL( studyClosed() ), mod, SLOT( onModelClosed() ) );
178 bool SalomeApp_Application::activateModule( const QString& modName )
181 CAM_Module* prevMod = activeModule();
184 actName = prevMod->moduleName();
186 if ( actName == modName )
189 saveWindowsGeometry();
191 bool status = CAM_Application::activateModule( modName );
193 updateModuleActions();
199 updateViewManagers();
204 SalomeApp_SelectionMgr* SalomeApp_Application::selectionMgr() const
209 void SalomeApp_Application::createActions()
211 STD_Application::createActions();
213 SUIT_Desktop* desk = desktop();
214 SUIT_ResourceMgr* resMgr = resourceMgr();
216 // default icon for neutral point ('SALOME' module)
217 QPixmap defIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ) );
218 if ( defIcon.isNull() )
219 defIcon = QPixmap( imageEmptyIcon );
221 // default icon for any module
222 QPixmap modIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_MODULE_ICO" ) );
223 if ( modIcon.isNull() )
224 modIcon = QPixmap( imageEmptyIcon );
226 QToolBar* modTBar = new QtxToolBar( true, desk );
227 modTBar->setLabel( tr( "INF_TOOLBAR_MODULES" ) );
229 QActionGroup* modGroup = new QActionGroup( this );
230 modGroup->setExclusive( true );
231 modGroup->setUsesDropDown( true );
233 QAction* a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ),
234 tr( "PRP_APP_MODULE" ), 0, desk, true );
236 myActions.insert( QString(), a );
238 QMap<QString, QString> iconMap;
239 moduleIconNames( iconMap );
241 const int iconSize = 20;
243 modGroup->addTo( modTBar );
244 modTBar->addSeparator();
247 modules( modList, false );
249 for ( QStringList::Iterator it = modList.begin(); it != modList.end(); ++it )
251 if ( (*it).isEmpty() )
255 if ( iconMap.contains( *it ) )
256 iconName = iconMap[*it];
258 QString modName = moduleName( *it );
260 QPixmap icon = resMgr->loadPixmap( modName, iconName );
264 icon.convertFromImage( icon.convertToImage().smoothScale( iconSize, iconSize, QImage::ScaleMin ) );
266 QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true );
270 myActions.insert( *it, a );
273 SUIT_Tools::simplifySeparators( modTBar );
277 int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
278 int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
279 createMenu( separator(), windowMenu, -1, 1 );
281 for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
283 QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ), QIconSet(),
284 tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
285 tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
286 0, desk, false, this, SLOT( onNewWindow() ) );
287 createMenu( a, newWinMenu, -1 );
290 connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) );
293 void SalomeApp_Application::onModuleActivation( QAction* a )
298 QString modName = a->menuText();
299 if ( modName == tr( "APP_NAME" ) )
300 modName = QString::null;
302 // Force user to create/open a study before module activation
303 QMap<QString, QString> iconMap;
304 moduleIconNames( iconMap );
305 QPixmap icon = resourceMgr()->loadPixmap( moduleName( modName ), iconMap[ modName ] );
307 bool cancelled = false;
308 while ( !modName.isEmpty() && !activeStudy() && !cancelled ){
309 SalomeApp_ModuleDlg aDlg( desktop(), modName, icon );
310 int res = aDlg.exec();
324 putInfo( tr("INF_CANCELLED") );
325 myActions[QString()]->setOn( true );
331 activateModule( modName );
334 QString SalomeApp_Application::defaultModule() const
336 QStringList aModuleNames;
337 modules( aModuleNames, false ); // obtain a complete list of module names for the current configuration
338 // If there's the one and only module --> activate it automatically
339 // TODO: Possible improvement - default module can be taken from preferences
340 return aModuleNames.count() > 1 ? "" : ( aModuleNames.count() ? aModuleNames.first() : "" );
343 void SalomeApp_Application::onNewWindow()
345 const QObject* obj = sender();
346 if ( !obj || !obj->inherits( "QAction" ) )
350 int id = actionId( (QAction*)obj );
354 type = GLViewer_Viewer::Type();
357 type = Plot2d_Viewer::Type();
360 type = OCCViewer_Viewer::Type();
363 type = VTKViewer_Viewer::Type();
367 if ( !type.isEmpty() )
368 createViewManager( type );
371 //=======================================================================
373 // Purpose : SLOT. Create new document
374 //=======================================================================
375 void SalomeApp_Application::onNewDoc()
377 SUIT_Study* study = activeStudy();
379 saveWindowsGeometry();
381 CAM_Application::onNewDoc();
383 if ( !study ) // new study will be create in THIS application
386 updateViewManagers();
390 //=======================================================================
392 // Purpose : SLOT. Open new document
393 //=======================================================================
394 void SalomeApp_Application::onOpenDoc()
396 SUIT_Study* study = activeStudy();
397 saveWindowsGeometry();
399 CAM_Application::onOpenDoc();
401 if ( !study ) // new study will be create in THIS application
404 updateViewManagers();
408 void SalomeApp_Application::onSelection()
410 onSelectionChanged();
412 if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
413 ((SalomeApp_Module*)activeModule())->selectionChanged();
416 void SalomeApp_Application::onSelectionChanged()
420 void SalomeApp_Application::setActiveStudy( SUIT_Study* study )
422 CAM_Application::setActiveStudy( study );
427 //=======================================================================
428 // name : createNewStudy
429 // Purpose : Create new study
430 //=======================================================================
431 SUIT_Study* SalomeApp_Application::createNewStudy()
433 SalomeApp_Study* aStudy = new SalomeApp_Study( this );
435 // Set up processing of major study-related events
436 connect( aStudy, SIGNAL( created( SUIT_Study* ) ), this, SLOT( onStudyCreated( SUIT_Study* ) ) );
437 connect( aStudy, SIGNAL( opened ( SUIT_Study* ) ), this, SLOT( onStudyOpened ( SUIT_Study* ) ) );
438 connect( aStudy, SIGNAL( saved ( SUIT_Study* ) ), this, SLOT( onStudySaved ( SUIT_Study* ) ) );
439 connect( aStudy, SIGNAL( closed ( SUIT_Study* ) ), this, SLOT( onStudyClosed ( SUIT_Study* ) ) );
444 //=======================================================================
445 // name : createNewStudy
446 // Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu
447 //=======================================================================
448 void SalomeApp_Application::updateCommandsStatus()
450 CAM_Application::updateCommandsStatus();
452 for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
454 QAction* a = action( id );
456 a->setEnabled( activeStudy() );
460 //=======================================================================
461 // name : onHelpAbout
462 // Purpose : SLOT. Display "About" message box
463 //=======================================================================
464 void SalomeApp_Application::onHelpAbout()
466 //QAD_MessageBox::info1( myDesktop, tr( "ABOUT" ), tr( "APP_NAME_LONG" ).arg( APP_VERSION ), tr( "BUT_OK" ) );
468 QMessageBox aDlg( desktop(), "AboutDlg" );
470 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
471 QPixmap aPixmap = aResMgr->loadPixmap( "SalomeApp", tr( "ABOUT_ICO" ) );
473 QFontMetrics m( aDlg.font() );
474 QImage anImage = aPixmap.convertToImage();
475 int w = m.height() * 3;
476 anImage = anImage.scale( w, w );
477 aPixmap.convertFromImage( anImage );
479 aDlg.setCaption( tr( "ABOUT" ) );
480 aDlg.setText( tr( "APP_NAME_LONG" ).arg( APP_VERSION ) );
481 aDlg.setIconPixmap( aPixmap );
485 QWidget* SalomeApp_Application::window( const int flag, const int studyId ) const
492 if ( !activeStudy() )
495 sId = activeStudy()->id();
498 if ( myWindows.contains( flag ) )
499 wid = myWindows[flag]->widget( sId );
504 void SalomeApp_Application::addWindow( QWidget* wid, const int flag, const int studyId )
512 if ( !activeStudy() )
515 sId = activeStudy()->id();
518 if ( !myWindows.contains( flag ) )
520 QMap<int, int> winMap;
521 currentWindows( winMap );
523 myWindows.insert( flag, new SalomeApp_WidgetContainer( flag, desktop() ) );
524 if ( winMap.contains( flag ) )
525 desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] );
527 myWindows[flag]->setResizeEnabled( true );
528 myWindows[flag]->setCloseMode( QDockWindow::Always );
529 myWindows[flag]->setName( QString( "dock_window_%1" ).arg( flag ) );
532 myWindows[flag]->insert( sId, wid );
534 setWindowShown( flag, !myWindows[flag]->isEmpty() );
537 void SalomeApp_Application::removeWindow( const int flag, const int studyId )
539 if ( !myWindows.contains( flag ) )
545 if ( !activeStudy() )
548 sId = activeStudy()->id();
551 myWindows[flag]->remove( sId );
553 setWindowShown( flag, !myWindows[flag]->isEmpty() );
556 QWidget* SalomeApp_Application::getWindow( const int flag, const int studyId )
558 QWidget* wid = window( flag, studyId );
560 addWindow( wid = createWindow( flag ), flag, studyId );
565 bool SalomeApp_Application::isWindowVisible( const int type ) const
568 if ( myWindows.contains( type ) )
570 SUIT_Desktop* desk = ((SalomeApp_Application*)this)->desktop();
571 res = desk && desk->appropriate( myWindows[type] );
576 void SalomeApp_Application::setWindowShown( const int type, const bool on )
578 if ( !desktop() || !myWindows.contains( type ) )
581 QDockWindow* dw = myWindows[type];
582 desktop()->setAppropriate( dw, on );
583 on ? dw->show() : dw->hide();
586 OB_Browser* SalomeApp_Application::objectBrowser()
589 QWidget* wid = getWindow( WT_ObjectBrowser );
590 if ( wid->inherits( "OB_Browser" ) )
591 ob = (OB_Browser*)wid;
595 LogWindow* SalomeApp_Application::logWindow()
598 QWidget* wid = getWindow( WT_LogWindow );
599 if ( wid->inherits( "LogWindow" ) )
600 lw = (LogWindow*)wid;
604 SUIT_ViewManager* SalomeApp_Application::getViewManager( const QString& vmType, const bool create )
606 SUIT_ViewManager* aVM = viewManager( vmType );
607 SUIT_ViewManager* anActiveVM = CAM_Application::activeViewManager();
608 if ( anActiveVM && anActiveVM->getType() == vmType )
612 if ( !aVM->getActiveView() )
616 aVM = createViewManager( vmType );
620 SUIT_ViewManager* SalomeApp_Application::createViewManager( const QString& vmType )
622 SUIT_ViewManager* viewMgr = 0;
623 if ( vmType == GLViewer_Viewer::Type() )
625 viewMgr = new GLViewer_ViewManager( activeStudy(), desktop() );
626 new SalomeApp_GLSelector( (GLViewer_Viewer2d*)viewMgr->getViewModel(), mySelMgr );
628 else if ( vmType == Plot2d_Viewer::Type() )
629 viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() );
630 else if ( vmType == OCCViewer_Viewer::Type() )
632 viewMgr = new OCCViewer_ViewManager( activeStudy(), desktop() );
633 viewMgr->setViewModel( new SOCC_Viewer() );// custom view model, which extends SALOME_View interface
634 new SalomeApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr );
636 else if ( vmType == SVTK_Viewer::Type() )
638 viewMgr = new SVTK_ViewManager( activeStudy(), desktop() );
639 new SalomeApp_VTKSelector((SVTK_Viewer*)viewMgr->getViewModel(),mySelMgr);
645 addViewManager( viewMgr );
646 SUIT_ViewWindow* viewWin = viewMgr->createViewWindow();
648 if ( viewWin && desktop() )
649 viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) );
651 connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
652 this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
657 void SalomeApp_Application::onCloseView( SUIT_ViewManager* theVM )
659 removeViewManager( theVM );
662 void SalomeApp_Application::onStudyCreated( SUIT_Study* theStudy )
664 SUIT_DataObject* aRoot = 0;
665 if ( theStudy && theStudy->root() )
667 aRoot = theStudy->root();
668 //aRoot->setName( tr( "DATA_MODELS" ) );
670 if ( objectBrowser() != 0 )
671 objectBrowser()->setRootObject( aRoot );
673 activateModule( defaultModule() );
676 void SalomeApp_Application::onStudyOpened( SUIT_Study* theStudy )
678 SUIT_DataObject* aRoot = 0;
679 if ( theStudy && theStudy->root() )
681 aRoot = theStudy->root();
684 if ( objectBrowser() != 0 ) {
685 objectBrowser()->setRootObject( aRoot );
690 activateModule( defaultModule() );
695 void SalomeApp_Application::onStudySaved( SUIT_Study* )
700 void SalomeApp_Application::onStudyClosed( SUIT_Study* )
704 activateModule( "" );
705 if ( objectBrowser() != 0 )
706 objectBrowser()->setRootObject( 0 );
708 saveWindowsGeometry();
711 QString SalomeApp_Application::getFileFilter() const
716 void SalomeApp_Application::beforeCloseDoc( SUIT_Study* s )
718 CAM_Application::beforeCloseDoc( s );
720 for ( WindowMap::ConstIterator itr = myWindows.begin(); s && itr != myWindows.end(); ++itr )
721 removeWindow( itr.key(), s->id() );
724 void SalomeApp_Application::afterCloseDoc()
728 CAM_Application::afterCloseDoc();
731 void SalomeApp_Application::updateActions()
733 updateCommandsStatus();
736 QWidget* SalomeApp_Application::createWindow( const int flag )
740 if ( flag == WT_ObjectBrowser )
742 OB_Browser* ob = new OB_Browser( desktop() );
744 ob->setCaption( tr( "OBJECT_BROWSER" ) );
745 ob->resize( OBJECT_BROWSER_WIDTH, ob->height() );
746 ob->setAutoUpdate( true );
749 new SalomeApp_OBSelector( ob, mySelMgr );
753 ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
755 else if ( flag == WT_PyConsole )
757 PythonConsole* pyCons = new PythonConsole( desktop(), new SalomeApp_PyInterp() );
758 pyCons->setCaption( tr( "PYTHON_CONSOLE" ) );
761 // pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
763 else if ( flag == WT_LogWindow )
765 LogWindow* logWin = new LogWindow( desktop() );
766 logWin->setCaption( tr( "LOG_WINDOW" ) );
769 logWin->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
775 void SalomeApp_Application::defaultWindows( QMap<int, int>& aMap ) const
777 aMap.insert( WT_ObjectBrowser, Qt::DockLeft );
778 aMap.insert( WT_PyConsole, Qt::DockBottom );
781 void SalomeApp_Application::defaultViewManagers( QStringList& ) const
785 CORBA::ORB_var SalomeApp_Application::orb()
787 ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
788 CORBA::ORB_var& orb = init( qApp->argc(), qApp->argv() );
793 SALOMEDSClient_StudyManager* SalomeApp_Application::studyMgr()
795 static SALOMEDSClient_StudyManager* aStudyManager = NULL;
798 aStudyManager = new SALOMEDS_StudyManager();
800 return aStudyManager;
803 SALOME_NamingService* SalomeApp_Application::namingService()
805 return new SALOME_NamingService( orb() );
808 QString SalomeApp_Application::defaultEngineIOR()
810 // Look for a default module engine (needed for CORBAless modules to use SALOMEDS persistence)
812 CORBA::Object_ptr anEngine = namingService()->Resolve( "/SalomeAppEngine" );
813 if ( !CORBA::is_nil( anEngine ) )
814 anIOR = orb()->object_to_string( anEngine );
818 void SalomeApp_Application::moduleIconNames( QMap<QString, QString>& iconMap ) const
822 SUIT_ResourceMgr* resMgr = resourceMgr();
827 modules( modList, false );
829 for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it )
831 QString modName = *it;
832 QString modIntr = moduleName( modName );
833 QString modIcon = resMgr->stringValue( modIntr, "icon", QString::null );
835 if ( modIcon.isEmpty() )
838 if ( SUIT_Tools::extension( modIcon ).isEmpty() )
839 modIcon += QString( ".png" );
841 iconMap.insert( modName, modIcon );
845 void SalomeApp_Application::updateModuleActions()
848 if ( activeModule() )
849 modName = activeModule()->moduleName();
851 if ( myActions.contains( modName ) )
852 myActions[modName]->setOn( true );
855 void SalomeApp_Application::currentWindows( QMap<int, int>& winMap ) const
858 if ( !activeStudy() )
861 if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
862 ((SalomeApp_Module*)activeModule())->windows( winMap );
864 defaultWindows( winMap );
867 void SalomeApp_Application::currentViewManagers( QStringList& lst ) const
870 if ( !activeStudy() )
873 if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
874 ((SalomeApp_Module*)activeModule())->viewManagers( lst );
876 defaultViewManagers( lst );
879 void SalomeApp_Application::updateWindows()
881 QMap<int, int> winMap;
882 currentWindows( winMap );
884 for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
885 getWindow( it.key() );
887 loadWindowsGeometry();
889 for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
890 setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) );
893 void SalomeApp_Application::updateViewManagers()
896 currentViewManagers( lst );
898 for ( QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it )
899 getViewManager( *it, true );
902 void SalomeApp_Application::loadWindowsGeometry()
904 QtxDockAction* dockMgr = 0;
906 QAction* a = action( ViewWindowsId );
907 if ( a && a->inherits( "QtxDockAction" ) )
908 dockMgr = (QtxDockAction*)a;
914 if ( activeModule() )
915 modName = moduleLibrary( activeModule()->moduleName(), false );
917 QString section = QString( "windows_geometry" );
918 if ( !modName.isEmpty() )
919 section += QString( "." ) + modName;
922 dockMgr->loadGeometry( resourceMgr(), section, false );
923 dockMgr->restoreGeometry();
926 void SalomeApp_Application::saveWindowsGeometry()
928 QtxDockAction* dockMgr = 0;
930 QAction* a = action( ViewWindowsId );
931 if ( a && a->inherits( "QtxDockAction" ) )
932 dockMgr = (QtxDockAction*)a;
938 if ( activeModule() )
939 modName = moduleLibrary( activeModule()->moduleName(), false );
941 QString section = QString( "windows_geometry" );
942 if ( !modName.isEmpty() )
943 section += QString( "." ) + modName;
945 dockMgr->storeGeometry();
946 dockMgr->saveGeometry( resourceMgr(), section, false );
949 void SalomeApp_Application::activateWindows()
953 for ( WindowMap::Iterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
954 itr.data()->activate( activeStudy()->id() );