- a = action(EditCopyId);
- a->setEnabled(false);
- a = action(EditPasteId);
- a->setEnabled(false);
-}
-
-//=======================================================================
-// name : onHelpAbout
-/*! Purpose : SLOT. Display "About" message box*/
-//=======================================================================
-void SalomeApp_Application::onHelpAbout()
-{
- SalomeApp_AboutDlg* dlg = new SalomeApp_AboutDlg( applicationName(), applicationVersion(), desktop() );
- dlg->exec();
- delete dlg;
-}
-
-QWidget* SalomeApp_Application::window( const int flag, const int studyId ) const
-{
- QWidget* wid = 0;
-
- int sId = studyId;
- if ( sId < 0 )
- {
- if ( !activeStudy() )
- return 0;
- else
- sId = activeStudy()->id();
- }
-
- if ( myWindows.contains( flag ) )
- wid = myWindows[flag]->widget( sId );
-
- return wid;
-}
-
-/*!Adds window to application.
- *\param wid - QWidget
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
-void SalomeApp_Application::addWindow( QWidget* wid, const int flag, const int studyId )
-{
- if ( !wid )
- return;
-
- int sId = studyId;
- if ( sId < 0 )
- {
- if ( !activeStudy() )
- return;
- else
- sId = activeStudy()->id();
- }
-
- if ( !myWindows.contains( flag ) )
- {
- QMap<int, int> winMap;
- currentWindows( winMap );
-
- myWindows.insert( flag, new SalomeApp_WidgetContainer( flag, desktop() ) );
- if ( winMap.contains( flag ) )
- desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] );
-
- myWindows[flag]->setResizeEnabled( true );
- myWindows[flag]->setCloseMode( QDockWindow::Always );
- myWindows[flag]->setName( QString( "dock_window_%1" ).arg( flag ) );
- }
-
- QFont f;
- if( wid->inherits( "PythonConsole" ) )
- f = ( ( PythonConsole* )wid )->font();
- else
- f = wid->font();
-
- myWindows[flag]->insert( sId, wid );
- wid->setFont( f );
-
- setWindowShown( flag, !myWindows[flag]->isEmpty() );
-}
-
-/*!Remove window from application.
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
-void SalomeApp_Application::removeWindow( const int flag, const int studyId )
-{
- if ( !myWindows.contains( flag ) )
- return;
-
- int sId = studyId;
- if ( sId < 0 )
- {
- if ( !activeStudy() )
- return;
- else
- sId = activeStudy()->id();
- }
-
- QWidget* wid = myWindows[flag]->widget( sId );
- myWindows[flag]->remove( sId );
- delete wid;
-
- setWindowShown( flag, !myWindows[flag]->isEmpty() );
-}
-
-/*!Gets window.
- *\param flag - key wor window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
-QWidget* SalomeApp_Application::getWindow( const int flag, const int studyId )
-{
- QWidget* wid = window( flag, studyId );
- if ( !wid )
- addWindow( wid = createWindow( flag ), flag, studyId );
-
- return wid;
-}
-
-/*!Check is window visible?(with identificator \a type)*/
-bool SalomeApp_Application::isWindowVisible( const int type ) const
-{
- bool res = false;
- if ( myWindows.contains( type ) )
- {
- SUIT_Desktop* desk = ((SalomeApp_Application*)this)->desktop();
- res = desk && desk->appropriate( myWindows[type] );
- }
- return res;
-}
-
-/*!Sets window show or hide.
- *\param type - window identificator.
- *\param on - true/false (window show/hide)
- */
-void SalomeApp_Application::setWindowShown( const int type, const bool on )
-{
- if ( !desktop() || !myWindows.contains( type ) )
- return;
-
- QDockWindow* dw = myWindows[type];
- desktop()->setAppropriate( dw, on );
- on ? dw->show() : dw->hide();
-}
-
-OB_Browser* SalomeApp_Application::objectBrowser()
-{
- OB_Browser* ob = 0;
- QWidget* wid = getWindow( WT_ObjectBrowser );
- if ( wid->inherits( "OB_Browser" ) )
- ob = (OB_Browser*)wid;
- return ob;
-}
-
-/*!Gets "LogWindow".*/
-LogWindow* SalomeApp_Application::logWindow()
-{
- LogWindow* lw = 0;
- QWidget* wid = getWindow( WT_LogWindow );
- if ( wid->inherits( "LogWindow" ) )
- lw = (LogWindow*)wid;
- return lw;
-}
-
-/*!Get "PythonConsole"*/
-PythonConsole* SalomeApp_Application::pythonConsole()
-{
- PythonConsole* console = 0;
- QWidget* wid = getWindow( WT_PyConsole );
- if ( wid->inherits( "PythonConsole" ) )
- console = (PythonConsole*)wid;
- return console;
-}
-
-/*!Gets preferences.*/
-SalomeApp_Preferences* SalomeApp_Application::preferences() const
-{
- return preferences( false );
-}
-
-/*!Gets view manager*/
-SUIT_ViewManager* SalomeApp_Application::getViewManager( const QString& vmType, const bool create )
-{
- SUIT_ViewManager* aVM = viewManager( vmType );
- SUIT_ViewManager* anActiveVM = CAM_Application::activeViewManager();
-
- if ( anActiveVM && anActiveVM->getType() == vmType )
- aVM = anActiveVM;
-
- if ( aVM && create )
- {
- if ( !aVM->getActiveView() )
- aVM->createView();
- else
- aVM->getActiveView()->setFocus();
- }
- else if ( create )
- aVM = createViewManager( vmType );