# header files
EXPORT_HEADERS= SalomeApp.h \
- SalomeApp_AboutDlg.h \
SalomeApp_Application.h \
SalomeApp_DataModel.h \
SalomeApp_DataObject.h \
- SalomeApp_DataOwner.h \
- SalomeApp_OCCSelector.h \
- SalomeApp_VTKSelector.h \
- SalomeApp_OBSelector.h \
- SalomeApp_GLSelector.h \
SalomeApp_Module.h \
SalomeApp_Study.h \
- SalomeApp_WidgetContainer.h \
SalomeApp_ExceptionHandler.h \
- SalomeApp_RootObject.h \
- SalomeApp_SelectionMgr.h \
SalomeApp_EventFilter.h \
- SalomeApp_Preferences.h \
- SalomeApp_PreferencesDlg.h \
SalomeApp_Tools.h \
- SalomeApp_NameDlg.h \
SalomeApp_ImportOperation.h \
- SalomeApp_DataSubOwner.h \
- SalomeApp_Selection.h \
SalomeApp_Filter.h \
SalomeApp_TypeFilter.h \
- SalomeApp_OBFilter.h \
SalomeApp_StudyPropertiesDlg.h \
- SalomeApp_CheckFileDlg.h \
- SalomeApp_Operation.h \
- SalomeApp_Dialog.h \
- SalomeApp_UpdateFlags.h \
- SalomeApp_Displayer.h
+ SalomeApp_CheckFileDlg.h
# .po files to transform in .qm
PO_FILES = SalomeApp_images.po \
LIB = libSalomeApp.la
LIB_SRC= SalomeApp_Module.cxx \
- SalomeApp_AboutDlg.cxx \
SalomeApp_Application.cxx \
SalomeApp_DataModel.cxx \
SalomeApp_DataObject.cxx \
- SalomeApp_DataOwner.cxx \
- SalomeApp_OCCSelector.cxx \
- SalomeApp_VTKSelector.cxx \
- SalomeApp_OBSelector.cxx \
- SalomeApp_GLSelector.cxx \
SalomeApp_Study.cxx \
- SalomeApp_WidgetContainer.cxx \
SalomeApp_ExceptionHandler.cxx \
- SalomeApp_SelectionMgr.cxx \
SalomeApp_EventFilter.cxx \
- SalomeApp_Preferences.cxx \
- SalomeApp_PreferencesDlg.cxx \
SalomeApp_PyInterp.cxx \
SalomeApp_Tools.cxx \
- SalomeApp_NameDlg.cxx \
SalomeApp_ImportOperation.cxx \
- SalomeApp_DataSubOwner.cxx \
- SalomeApp_ModuleDlg.cxx \
- SalomeApp_Selection.cxx \
SalomeApp_Filter.cxx \
SalomeApp_TypeFilter.cxx \
- SalomeApp_OBFilter.cxx \
SalomeApp_StudyPropertiesDlg.cxx \
SalomeApp_ListView.cxx \
- SalomeApp_CheckFileDlg.cxx \
- SalomeApp_Operation.cxx \
- SalomeApp_Dialog.cxx \
- SalomeApp_SwitchOp.cxx \
- SalomeApp_Displayer.cxx \
- SalomeApp_ShowHideOp.cxx
-
-LIB_MOC = SalomeApp_AboutDlg.h \
- SalomeApp_Application.h \
+ SalomeApp_CheckFileDlg.cxx
+
+LIB_MOC = SalomeApp_Application.h \
SalomeApp_DataModel.h \
- SalomeApp_OBSelector.h \
- SalomeApp_OCCSelector.h \
- SalomeApp_VTKSelector.h \
- SalomeApp_GLSelector.h \
SalomeApp_Module.h \
SalomeApp_Study.h \
- SalomeApp_SelectionMgr.h \
- SalomeApp_WidgetContainer.h \
- SalomeApp_Preferences.h \
- SalomeApp_PreferencesDlg.h \
- SalomeApp_NameDlg.h \
- SalomeApp_ModuleDlg.h \
SalomeApp_StudyPropertiesDlg.h \
SalomeApp_ListView.h \
- SalomeApp_CheckFileDlg.h \
- SalomeApp_Operation.h \
- SalomeApp_Dialog.h \
- SalomeApp_SwitchOp.h \
- SalomeApp_ShowHideOp.h
+ SalomeApp_CheckFileDlg.h
LIB_CLIENT_IDL = SALOMEDS.idl \
SALOME_Exception.idl \
SALOME_GenericObj.idl
-RESOURCES_FILES = icon_about.png \
- icon_applogo.png \
- icon_default.png \
- icon_module.png \
- icon_module_big.png \
- icon_select.png \
- SalomeApp.ini \
+RESOURCES_FILES = SalomeApp.ini \
SalomeApp.xml
CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS)
-LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lSalomePrs -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lSalomeContainer -lToolsGUI
+LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lSalomePrs -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lSPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow -lLightApp -lSalomeContainer -lToolsGUI
@CONCLUDE@
#include "SalomeApp_Application.h"
#include "SalomeApp_Study.h"
-#include "SalomeApp_Module.h"
-#include "SalomeApp_OBFilter.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_EventFilter.h"
-#include "SalomeApp_WidgetContainer.h"
-#include "SalomeApp_AboutDlg.h"
-#include "SalomeApp_ModuleDlg.h"
-#include "SalomeApp_Preferences.h"
-#include "SalomeApp_PreferencesDlg.h"
#include "SalomeApp_StudyPropertiesDlg.h"
-#include "SalomeApp_CheckFileDlg.h"
-
-#include "SalomeApp_GLSelector.h"
-#include "SalomeApp_OBSelector.h"
-#include "SalomeApp_OCCSelector.h"
-#include "SalomeApp_VTKSelector.h"
-#include "SalomeApp_SelectionMgr.h"
-
-#include <LogWindow.h>
-
-#include <GLViewer_Viewer.h>
-#include <GLViewer_ViewManager.h>
-#include <Plot2d_ViewManager.h>
-#include <SPlot2d_ViewModel.h>
-
-#include <OCCViewer_ViewManager.h>
-#include <SOCC_ViewModel.h>
-
-#include <SVTK_ViewModel.h>
-#include <SVTK_ViewManager.h>
+#include "SalomeApp_CheckFileDlg.h"
-#include <STD_TabDesktop.h>
+#include "LightApp_Application.h"
+#include "LightApp_Preferences.h"
+#include "LightApp_WidgetContainer.h"
+#include "LightApp_SelectionMgr.h"
#include "STD_LoadStudiesDlg.h"
#include <SUIT_Tools.h>
#include <SUIT_Session.h>
-#include <SUIT_Accel.h>
-#include <QtxToolBar.h>
#include <QtxMRUAction.h>
-#include <QtxDockAction.h>
-#include <QtxResourceEdit.h>
#include <OB_Browser.h>
#include <OB_ListItem.h>
#include <SALOME_LifeCycleCORBA.hxx>
#include <qmap.h>
-#include <qdir.h>
-#include <qlabel.h>
-#include <qimage.h>
#include <qaction.h>
-#include <qmenubar.h>
#include <qcombobox.h>
-#include <qmessagebox.h>
-#include <qapplication.h>
#include <qlistbox.h>
#include <qregexp.h>
-#include <qthread.h>
-#include <qstatusbar.h>
#include "SALOMEDS_StudyManager.hxx"
+#include "SALOMEDS_SObject.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
#include "ToolsGUI_CatalogGeneratorDlg.h"
#include "ToolsGUI_RegWidget.h"
-#define OBJECT_BROWSER_WIDTH 300
-#define OBJECT_COLUMN_WIDTH 150
-#define DEFAULT_BROWSER "mozilla"
-
-/*!Image for empty icon.*/
-static const char* imageEmptyIcon[] = {
-"20 20 1 1",
-". c None",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"....................",
-"...................."};
-
/*!Create new instance of SalomeApp_Application.*/
extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication()
{
return new SalomeApp_Application();
}
-SalomeApp_Preferences* SalomeApp_Application::_prefs_ = 0;
-
/*
Class : SalomeApp_Application
- Description : Application containing SalomeApp module
+ Description : Application containing SalomeApp module or LightApp module
*/
/*!Constructor.*/
SalomeApp_Application::SalomeApp_Application()
-: CAM_Application( false ),
-myPrefs( 0 )
+: LightApp_Application()
{
- STD_TabDesktop* desk = new STD_TabDesktop();
-
- setDesktop( desk );
-
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- QPixmap aLogo = aResMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ), false );
-
- desktop()->setIcon( aLogo );
- desktop()->setDockableMenuBar( true );
- desktop()->setDockableStatusBar( false );
-
- // base logo (salome itself)
- desktop()->addLogo( "_app_base", aResMgr->loadPixmap( "SalomeApp", tr( "APP_BASE_LOGO" ), false ) );
- // extra logo (salome-based application)
- desktop()->addLogo( "_app_extra", aResMgr->loadPixmap( "SalomeApp", tr( "APP_EXTRA_LOGO" ), false ) );
-
- clearViewManagers();
-
- mySelMgr = new SalomeApp_SelectionMgr( this );
-
- myAccel = new SUIT_Accel( desktop() );
- myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::RotateLeft, ALT+Key_Left, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, OCCViewer_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::RotateLeft, ALT+Key_Left, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, SVTK_Viewer::Type() );
- myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, SVTK_Viewer::Type() );
-
- connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
}
/*!Destructor.
- *\li Save window geometry.
- *\li Save desktop geometry.
- *\li Save resource maneger.
- *\li Delete selection manager.
*\li Destroy event filter.
*/
SalomeApp_Application::~SalomeApp_Application()
{
- saveWindowsGeometry();
-
- if ( resourceMgr() )
- {
- if ( desktop() )
- desktop()->saveGeometry( resourceMgr(), "desktop" );
- resourceMgr()->save();
- }
-
- delete mySelMgr;
-
SalomeApp_EventFilter::Destroy();
}
/*!Start application.*/
void SalomeApp_Application::start()
{
- if ( desktop() )
- desktop()->loadGeometry( resourceMgr(), "desktop" );
-
- CAM_Application::start();
-
- QAction* a = action( ViewWindowsId );
- if ( a && a->inherits( "QtxDockAction" ) )
- ((QtxDockAction*)a)->setAutoPlace( true );
+ LightApp_Application::start();
SalomeApp_EventFilter::Init();
-
- updateWindows();
- updateViewManagers();
-
- putInfo( "" );
- desktop()->statusBar()->message( "" );
-}
-
-/*!Gets application name.*/
-QString SalomeApp_Application::applicationName() const
-{
- return tr( "APP_NAME" );
-}
-
-/*!Gets application version.*/
-QString SalomeApp_Application::applicationVersion() const
-{
- static QString _app_version;
-
- if ( _app_version.isEmpty() )
- {
- QString resVersion = tr( "APP_VERSION" );
- if ( resVersion != "APP_VERSION" )
- {
- _app_version = resVersion;
- }
- else
- {
- QString path( ::getenv( "GUI_ROOT_DIR" ) );
- if ( !path.isEmpty() )
- path += QDir::separator();
- path += QString( "bin/salome/VERSION" );
-
- QFile vf( path );
- if ( vf.open( IO_ReadOnly ) )
- {
- QString line;
- vf.readLine( line, 1024 );
- vf.close();
-
- if ( !line.isEmpty() )
- {
- while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )
- line.remove( line.length() - 1, 1 );
-
- int idx = line.findRev( ":" );
- if ( idx != -1 )
- _app_version = line.mid( idx + 1 ).stripWhiteSpace();
- }
- }
- }
- }
- return _app_version;
-}
-
-/*!Load module by \a name.*/
-CAM_Module* SalomeApp_Application::loadModule( const QString& name )
-{
- CAM_Module* mod = CAM_Application::loadModule( name );
- if ( mod )
- {
- connect( this, SIGNAL( studyOpened() ), mod, SLOT( onModelOpened() ) );
- connect( this, SIGNAL( studySaved() ), mod, SLOT( onModelSaved() ) );
- connect( this, SIGNAL( studyClosed() ), mod, SLOT( onModelClosed() ) );
- }
- return mod;
-}
-
-/*!Activate module by \a modName*/
-bool SalomeApp_Application::activateModule( const QString& modName )
-{
- QString actName;
- CAM_Module* prevMod = activeModule();
-
- if ( prevMod )
- actName = prevMod->moduleName();
-
- if ( actName == modName )
- return true;
-
- putInfo( tr( "ACTIVATING_MODULE" ).arg( modName ) );
-
- saveWindowsGeometry();
-
- bool status = CAM_Application::activateModule( modName );
-
- updateModuleActions();
-
- putInfo( "" );
-
- if ( !status )
- return false;
-
- updateWindows();
- updateViewManagers();
-
- return true;
-}
-
-/*!Gets selection manager.*/
-SalomeApp_SelectionMgr* SalomeApp_Application::selectionMgr() const
-{
- return mySelMgr;
}
/*!Create actions:*/
void SalomeApp_Application::createActions()
{
- STD_Application::createActions();
+ LightApp_Application::createActions();
SUIT_Desktop* desk = desktop();
- SUIT_ResourceMgr* resMgr = resourceMgr();
-
+
//! Dump study
createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIconSet(),
tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
0, desk, false, this, SLOT( onDumpStudy() ) );
-
+
//! Load script
createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIconSet(),
tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ),
tr( "MEN_DESK_PROPERTIES" ), tr( "PRP_DESK_PROPERTIES" ),
0, desk, false, this, SLOT( onProperties() ) );
- //! Preferences
- createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIconSet(),
- tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
- CTRL+Key_P, desk, false, this, SLOT( onPreferences() ) );
-
//! Catalog Generator
createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIconSet(),
tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
tr( "MEN_DESK_REGISTRY_DISPLAY" ), tr( "PRP_DESK_REGISTRY_DISPLAY" ),
0, desk, false, this, SLOT( onRegDisplay() ) );
- //! MRU
- QtxMRUAction* mru = new QtxMRUAction( tr( "TOT_DESK_MRU" ), tr( "MEN_DESK_MRU" ), desk );
- connect( mru, SIGNAL( activated( QString ) ), this, SLOT( onMRUActivated( QString ) ) );
- registerAction( MRUId, mru );
-
- //! default icon for neutral point ('SALOME' module)
- QPixmap defIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ), false );
- if ( defIcon.isNull() )
- defIcon = QPixmap( imageEmptyIcon );
-
- //! default icon for any module
- QPixmap modIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_MODULE_ICO" ), false );
- if ( modIcon.isNull() )
- modIcon = QPixmap( imageEmptyIcon );
-
- QToolBar* modTBar = new QtxToolBar( true, desk );
- modTBar->setLabel( tr( "INF_TOOLBAR_MODULES" ) );
-
- QActionGroup* modGroup = new QActionGroup( this );
- modGroup->setExclusive( true );
- modGroup->setUsesDropDown( true );
-
- QAction* a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ),
- tr( "PRP_APP_MODULE" ), 0, desk, true );
- modGroup->add( a );
- myActions.insert( QString(), a );
-
- QMap<QString, QString> iconMap;
- moduleIconNames( iconMap );
-
- const int iconSize = 20;
-
- modGroup->addTo( modTBar );
- modTBar->addSeparator();
-
- QStringList modList;
- modules( modList, false );
-
- for ( QStringList::Iterator it = modList.begin(); it != modList.end(); ++it )
- {
- if ( (*it).isEmpty() )
- continue;
-
- QString iconName;
- if ( iconMap.contains( *it ) )
- iconName = iconMap[*it];
-
- QString modName = moduleName( *it );
-
- QPixmap icon = resMgr->loadPixmap( modName, iconName, false );
- if ( icon.isNull() )
- icon = modIcon;
-
- icon.convertFromImage( icon.convertToImage().smoothScale( iconSize, iconSize, QImage::ScaleMin ) );
-
- QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true );
- a->addTo( modTBar );
- modGroup->add( a );
-
- myActions.insert( *it, a );
- }
-
- SUIT_Tools::simplifySeparators( modTBar );
-
- //! New window
-
- int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
- int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
- createMenu( separator(), windowMenu, -1, 1 );
-
- QMap<int, int> accelMap;
- accelMap[NewGLViewId] = ALT+Key_G;
- accelMap[NewPlot2dId] = ALT+Key_P;
- accelMap[NewOCCViewId] = ALT+Key_O;
- accelMap[NewVTKViewId] = ALT+Key_K;
-
- for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
- {
- QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ), QIconSet(),
- tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
- tr( QString( "NEW_WINDOW_%1" ).arg( id - NewGLViewId ) ),
- accelMap.contains( id ) ? accelMap[id] : 0, desk, false, this, SLOT( onNewWindow() ) );
- createMenu( a, newWinMenu, -1 );
- }
- connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) );
-
- //! Help for modules
- int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
- int helpModuleMenu = createMenu( tr( "MEN_DESK_MODULE_HELP" ), helpMenu, -1, 0 );
- createMenu( separator(), helpMenu, -1, 1 );
-
- QStringList aModuleList;
- modules( aModuleList, false );
-
- int id = SalomeApp_Application::UserID;
- // help for KERNEL and GUI
- QCString dir;
- if (dir = getenv("GUI_ROOT_DIR")) {
- a = createAction( id, tr( QString("Kernel & GUI Help") ), QIconSet(),
- tr( QString("Kernel && GUI Help") ),
- tr( QString("Kernel & GUI Help") ),
- 0, desk, false, this, SLOT( onHelpContentsModule() ) );
- a->setName( QString("GUI") );
- createMenu( a, helpModuleMenu, -1 );
- id++;
- }
- // help for other existing modules
- for ( QStringList::Iterator it = aModuleList.begin(); it != aModuleList.end(); ++it )
- {
- if ( (*it).isEmpty() )
- continue;
-
- QString modName = moduleName( *it );
- if ( modName.compare("GEOM") == 0 ) { // to be removed when documentation for other modules will be done
- QAction* a = createAction( id, tr( moduleTitle(modName) + QString(" Help") ), QIconSet(),
- tr( moduleTitle(modName) + QString(" Help") ),
- tr( moduleTitle(modName) + QString(" Help") ),
- 0, desk, false, this, SLOT( onHelpContentsModule() ) );
- a->setName( modName );
- createMenu( a, helpModuleMenu, -1 );
- id++;
- }
- }
-
int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
createMenu( DumpStudyId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
createMenu( PropertiesId, fileMenu, 10, -1 );
createMenu( separator(), fileMenu, -1, 15, -1 );
- createMenu( PreferencesId, fileMenu, 15, -1 );
- createMenu( separator(), fileMenu, -1, 15, -1 );
int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 50 );
createMenu( CatalogGenId, toolsMenu, 10, -1 );
createMenu( RegDisplayId, toolsMenu, 10, -1 );
createMenu( separator(), toolsMenu, -1, 15, -1 );
-
-
- /*
- createMenu( separator(), fileMenu, -1, 100, -1 );
- createMenu( MRUId, fileMenu, 100, -1 );
- createMenu( separator(), fileMenu, -1, 100, -1 );
- */
-}
-
-/*!On module activation action.*/
-void SalomeApp_Application::onModuleActivation( QAction* a )
-{
- if ( !a )
- return;
-
- QString modName = a->menuText();
- if ( modName == tr( "APP_NAME" ) )
- modName = QString::null;
-
- // Force user to create/open a study before module activation
- QMap<QString, QString> iconMap;
- moduleIconNames( iconMap );
- QPixmap icon = resourceMgr()->loadPixmap( moduleName( modName ), iconMap[ modName ], false );
- if ( icon.isNull() )
- icon = resourceMgr()->loadPixmap( "SalomeApp", tr( "APP_MODULE_BIG_ICO" ), false ); // default icon for any module
-
- bool cancelled = false;
- while ( !modName.isEmpty() && !activeStudy() && !cancelled ){
- SalomeApp_ModuleDlg aDlg( desktop(), modName, icon );
- int res = aDlg.exec();
-
- switch ( res ){
- case 1:
- onNewDoc();
- break;
- case 2:
- onOpenDoc();
- break;
- case 3:
- //onLoadStudy();
- //break;
- case 0:
- default:
- putInfo( tr("INF_CANCELLED") );
- myActions[QString()]->setOn( true );
- cancelled = true;
- }
- }
-
- if ( !cancelled )
- activateModule( modName );
-}
-
-/*!Default module activation.*/
-QString SalomeApp_Application::defaultModule() const
-{
- QStringList aModuleNames;
- modules( aModuleNames, false ); // obtain a complete list of module names for the current configuration
- //! If there's the one and only module --> activate it automatically
- //! TODO: Possible improvement - default module can be taken from preferences
- return aModuleNames.count() > 1 ? "" : ( aModuleNames.count() ? aModuleNames.first() : "" );
-}
-
-/*!On new window slot.*/
-void SalomeApp_Application::onNewWindow()
-{
- const QObject* obj = sender();
- if ( !obj || !obj->inherits( "QAction" ) )
- return;
-
- QString type;
- int id = actionId( (QAction*)obj );
- switch ( id )
- {
- case NewGLViewId:
- type = GLViewer_Viewer::Type();
- break;
- case NewPlot2dId:
- type = Plot2d_Viewer::Type();
- break;
- case NewOCCViewId:
- type = OCCViewer_Viewer::Type();
- break;
- case NewVTKViewId:
- type = SVTK_Viewer::Type();
- break;
- }
-
- if ( !type.isEmpty() )
- createViewManager( type );
-}
-
-//=======================================================================
-// name : onNewDoc
-/*! Purpose : SLOT. Create new document*/
-//=======================================================================
-void SalomeApp_Application::onNewDoc()
-{
- SUIT_Study* study = activeStudy();
-
- saveWindowsGeometry();
-
- CAM_Application::onNewDoc();
-
- if ( !study ) // new study will be create in THIS application
- {
- updateWindows();
- updateViewManagers();
- }
-}
-
-//=======================================================================
-// name : onOpenDoc
-/*! Purpose : SLOT. Open new document*/
-//=======================================================================
-void SalomeApp_Application::onOpenDoc()
-{
- SUIT_Study* study = activeStudy();
- saveWindowsGeometry();
-
- CAM_Application::onOpenDoc();
-
- if ( !study ) // new study will be create in THIS application
- {
- updateWindows();
- updateViewManagers();
- }
}
/*! Purpose : SLOT. Open new document with \a aName.*/
name = studyname;
name.replace( QRegExp(":"), "/" );
- if(onLoadDoc(name)) {
+ if( LightApp_Application::onLoadDoc( name ) )
+ {
updateWindows();
updateViewManagers();
updateObjectBrowser(true);
/*!SLOT. Load document with \a aName.*/
bool SalomeApp_Application::onLoadDoc( const QString& aName )
{
- bool res = CAM_Application::onLoadDoc( aName );
-
- /*jfa tmp:QAction* a = action( MRUId );
- if ( a && a->inherits( "QtxMRUAction" ) )
- {
- QtxMRUAction* mru = (QtxMRUAction*)a;
- if ( res )
- mru->insert( aName );
- else
- mru->remove( aName );
- }*/
- return res;
-}
-
-/*!Private SLOT. Selection.*/
-void SalomeApp_Application::onSelection()
-{
- onSelectionChanged();
-
- if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
- ((SalomeApp_Module*)activeModule())->selectionChanged();
+ return LightApp_Application::onLoadDoc( aName );
}
/*!SLOT. Copy objects to study maneger from selection maneger..*/
void SalomeApp_Application::onCopy()
{
SALOME_ListIO list;
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
-
+
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
if(study == NULL) return;
-
+
_PTR(Study) stdDS = study->studyDS();
if(!stdDS) return;
void SalomeApp_Application::onPaste()
{
SALOME_ListIO list;
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
try {
studyMgr()->Paste(so);
updateObjectBrowser( true );
- updateActions(); //SRN: BugID IPAL9377, case 3
+ updateActions(); //SRN: BugID IPAL9377, case 3
}
catch(...) {
}
void SalomeApp_Application::onSelectionChanged()
{
SALOME_ListIO list;
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
qaction = action(EditCopyId);
- if( so && studyMgr()->CanCopy(so) ) qaction->setEnabled(true);
+ if( so ) {
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
+ if ( aSO && studyMgr()->CanCopy(so) ) qaction->setEnabled(true);
+ else qaction->setEnabled(false);
+ }
else qaction->setEnabled(false);
qaction = action(EditPasteId);
- if( so && studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
+ if( so ) {
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
+ if( aSO && studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
+ qaction->setEnabled(false);
+ }
else qaction->setEnabled(false);
}
else {
}
}
-/*!Update object browser.*/
-void SalomeApp_Application::onRefresh()
-{
- updateObjectBrowser( true );
-}
-
/*!Delete references.*/
void SalomeApp_Application::onDeleteReferences()
{
SALOME_ListIO aList;
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(aList);
if (aList.Extent() < 1) return;
{
QApplication::setOverrideCursor( Qt::waitCursor );
SALOME_ListIO aList;
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(aList);
if (aList.Extent() != 1)
{
QApplication::restoreOverrideCursor();
}
-bool SalomeApp_Application::useStudy(const QString& theName)
-{
- createEmptyStudy();
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
- bool res = false;
- if (aStudy)
- res = aStudy->loadDocument( theName );
- updateDesktopTitle();
- updateCommandsStatus();
- return res;
-}
-
-/*!Set active study.
- *\param study - SUIT_Study.
- */
-void SalomeApp_Application::setActiveStudy( SUIT_Study* study )
-{
- CAM_Application::setActiveStudy( study );
-
- activateWindows();
-}
-
//=======================================================================
// name : createNewStudy
/*! Purpose : Create new study*/
}
//=======================================================================
-// name : createNewStudy
+// name : updateCommandsStatus
/*! Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu*/
//=======================================================================
void SalomeApp_Application::updateCommandsStatus()
{
- CAM_Application::updateCommandsStatus();
-
- for ( int id = NewGLViewId; id <= NewVTKViewId; id++ )
- {
- QAction* a = action( id );
- if ( a )
- a->setEnabled( activeStudy() );
- }
+ LightApp_Application::updateCommandsStatus();
// Dump study menu
QAction* a = action( DumpStudyId );
a->setEnabled(false);
}
-//=======================================================================
-// name : onHelpAbout
-/*! Purpose : SLOT. Display "About" message box*/
-//=======================================================================
-void SalomeApp_Application::onHelpAbout()
+/*!Private SLOT. On dump study.*/
+void SalomeApp_Application::onDumpStudy( )
{
- SalomeApp_AboutDlg* dlg = new SalomeApp_AboutDlg( applicationName(), applicationVersion(), desktop() );
- dlg->exec();
- delete dlg;
-}
-
-// Helps to execute command
-class RunBrowser: public QThread {
-public:
-
- RunBrowser(QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL):
- myApp(theApp), myParams(theParams), myHelpFile("file:" + theHelpFile + theContext), myStatus(0) {};
-
- virtual void run()
- {
- QString aCommand;
-
- if ( !myApp.isEmpty())
- {
- aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1());
- myStatus = system(aCommand);
- if(myStatus != 0)
- {
- QCustomEvent* ce2000 = new QCustomEvent (2000);
- postEvent (qApp, ce2000);
- }
- }
-
- if( myStatus != 0 || myApp.isEmpty())
- {
- myParams = "";
- aCommand.sprintf("%s %s %s", QString(DEFAULT_BROWSER).latin1(),myParams.latin1(), myHelpFile.latin1());
- myStatus = system(aCommand);
- if(myStatus != 0)
- {
- QCustomEvent* ce2001 = new QCustomEvent (2001);
- postEvent (qApp, ce2001);
- }
- }
- }
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !appStudy ) return;
+ _PTR(Study) aStudy = appStudy->studyDS();
-private:
- QString myApp;
- QString myParams;
- QString myHelpFile;
- int myStatus;
+ QStringList aFilters;
+ aFilters.append( tr( "PYTHON_FILES_FILTER" ) );
-};
+ SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( desktop(), false, tr("PUBLISH_IN_STUDY"), true, true);
+ fd->setCaption( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
+ fd->setFilters( aFilters );
+ fd->SetChecked(true);
+ fd->exec();
+ QString aFileName = fd->selectedFile();
+ bool toPublish = fd->IsChecked();
+ delete fd;
-//=======================================================================
-// name : onHelpContentsModule
-/*! Purpose : SLOT. Display help contents for choosen module*/
-//=======================================================================
-void SalomeApp_Application::onHelpContentsModule()
-{
- const QAction* obj = (QAction*) sender();
-
- QString aComponentName = obj->name();
- QString aFileName = aComponentName.lower() + ".htm";
-
- QCString dir;
- QString root;
- QString homeDir;
- if (dir = getenv( aComponentName + "_ROOT_DIR")) {
- root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") + Qtx::addSlash(aComponentName));
- if ( QFileInfo( root + aFileName ).exists() ) {
- homeDir = root;
- } else {
- SUIT_MessageBox::warn1( desktop(), tr("WRN_WARNING"),
- QString( "%1"+ aFileName + " doesn't exist." ).arg(root), tr ("BUT_OK") );
- return;
- }
+ if(!aFileName.isEmpty()) {
+ QFileInfo aFileInfo(aFileName);
+ aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish );
}
-
- QString helpFile = QFileInfo( homeDir + aFileName ).absFilePath();
- SUIT_ResourceMgr* resMgr = resourceMgr();
- QString anApp = resMgr->stringValue("ExternalBrowser", "application");
- QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
-
- RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
- rs->start();
}
-QWidget* SalomeApp_Application::window( const int flag, const int studyId ) const
+/*!Private SLOT. On load script.*/
+void SalomeApp_Application::onLoadScript( )
{
- QWidget* wid = 0;
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
+ if ( !appStudy ) return;
+ _PTR(Study) aStudy = appStudy->studyDS();
- int sId = studyId;
- if ( sId < 0 )
- {
- if ( !activeStudy() )
- return 0;
- else
- sId = activeStudy()->id();
+ if ( aStudy->GetProperties()->IsLocked() ) {
+ SUIT_MessageBox::warn1 ( desktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
+ return;
}
- 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;
+ QStringList filtersList;
+ filtersList.append(tr("PYTHON_FILES_FILTER"));
+ filtersList.append(tr("ALL_FILES_FILTER"));
- int sId = studyId;
- if ( sId < 0 )
- {
- if ( !activeStudy() )
- return;
- else
- sId = activeStudy()->id();
- }
+ QString aFile = SUIT_FileDlg::getFileName( desktop(), "", filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true );
- if ( !myWindows.contains( flag ) )
+ if ( !aFile.isEmpty() )
{
- QMap<int, int> winMap;
- currentWindows( winMap );
+ QString command = QString("execfile(\"%1\")").arg(aFile);
- myWindows.insert( flag, new SalomeApp_WidgetContainer( flag, desktop() ) );
- if ( winMap.contains( flag ) )
- desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] );
+ PythonConsole* pyConsole = pythonConsole();
- myWindows[flag]->setResizeEnabled( true );
- myWindows[flag]->setCloseMode( QDockWindow::Always );
- myWindows[flag]->setName( QString( "dock_window_%1" ).arg( flag ) );
+ if ( pyConsole )
+ pyConsole->exec( command );
}
-
- 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.
+/*!Gets file filter.
+ *\retval QString "(*.hdf)"
*/
-void SalomeApp_Application::removeWindow( const int flag, const int studyId )
+QString SalomeApp_Application::getFileFilter() const
{
- 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 );
-
- return aVM;
-}
-
-/*!Create view manager.*/
-SUIT_ViewManager* SalomeApp_Application::createViewManager( const QString& vmType )
-{
- SUIT_ResourceMgr* resMgr = resourceMgr();
-
- SUIT_ViewManager* viewMgr = 0;
- if ( vmType == GLViewer_Viewer::Type() )
- {
- viewMgr = new GLViewer_ViewManager( activeStudy(), desktop() );
- new SalomeApp_GLSelector( (GLViewer_Viewer2d*)viewMgr->getViewModel(), mySelMgr );
- }
- else if ( vmType == Plot2d_Viewer::Type() )
- {
- viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() );
- viewMgr->setViewModel( new SPlot2d_Viewer() );// custom view model, which extends SALOME_View interface
- }
- else if ( vmType == OCCViewer_Viewer::Type() )
- {
- viewMgr = new OCCViewer_ViewManager( activeStudy(), desktop() );
- SOCC_Viewer* vm = new SOCC_Viewer();
- vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
- vm->setTrihedronSize( resMgr->integerValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) );
- int u( 1 ), v( 1 );
- vm->isos( u, v );
- u = resMgr->integerValue( "OCCViewer", "iso_number_u", u );
- v = resMgr->integerValue( "OCCViewer", "iso_number_v", v );
- vm->setIsos( u, v );
- viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface
- new SalomeApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr );
- }
- else if ( vmType == SVTK_Viewer::Type() )
- {
- viewMgr = new SVTK_ViewManager( activeStudy(), desktop() );
- SVTK_Viewer* vm = dynamic_cast<SVTK_Viewer*>( viewMgr->getViewModel() );
- if( vm )
- {
- vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
- vm->setTrihedronSize( resMgr->integerValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ) );
- new SalomeApp_VTKSelector( vm, mySelMgr );
- }
- }
-
- if ( !viewMgr )
- return 0;
-
- addViewManager( viewMgr );
- SUIT_ViewWindow* viewWin = viewMgr->createViewWindow();
-
- if ( viewWin && desktop() )
- viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) );
-
- connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
- this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
-
- return viewMgr;
-}
-
-void SalomeApp_Application::onCloseView( SUIT_ViewManager* theVM )
-{
- removeViewManager( theVM );
-}
-
-/*!Private SLOT. On study created.*/
-void SalomeApp_Application::onStudyCreated( SUIT_Study* theStudy )
-{
- SUIT_DataObject* aRoot = 0;
- if ( theStudy && theStudy->root() )
- {
- aRoot = theStudy->root();
- //aRoot->setName( tr( "DATA_MODELS" ) );
- }
- if ( objectBrowser() != 0 )
- objectBrowser()->setRootObject( aRoot );
-
- activateModule( defaultModule() );
-
- activateWindows();
-}
-
-/*!Private SLOT. On study opened.*/
-void SalomeApp_Application::onStudyOpened( SUIT_Study* theStudy )
-{
- SUIT_DataObject* aRoot = 0;
- if ( theStudy && theStudy->root() )
- {
- aRoot = theStudy->root();
- //aRoot->dump();
- }
- if ( objectBrowser() != 0 ) {
- objectBrowser()->setRootObject( aRoot );
- }
-
- activateModule( defaultModule() );
-
- activateWindows();
-
- emit studyOpened();
-}
-
-void SalomeApp_Application::onStudySaved( SUIT_Study* )
-{
- emit studySaved();
-}
-
-/*!Private SLOT. On study closed.*/
-void SalomeApp_Application::onStudyClosed( SUIT_Study* )
-{
- emit studyClosed();
-
- activateModule( "" );
-
- // Bug 10396: remove all selectors
- delete mySelMgr;
- mySelMgr = new SalomeApp_SelectionMgr( this );
-
- saveWindowsGeometry();
-}
-
-/*!Private SLOT. On dump study.*/
-void SalomeApp_Application::onDumpStudy( )
-{
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
- if ( !appStudy ) return;
- _PTR(Study) aStudy = appStudy->studyDS();
-
- QStringList aFilters;
- aFilters.append( tr( "PYTHON_FILES_FILTER" ) );
-
- SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( desktop(), false, tr("PUBLISH_IN_STUDY"), true, true);
- fd->setCaption( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
- fd->setFilters( aFilters );
- fd->SetChecked(true);
- fd->exec();
- QString aFileName = fd->selectedFile();
- bool toPublish = fd->IsChecked();
- delete fd;
-
- if(!aFileName.isEmpty()) {
- QFileInfo aFileInfo(aFileName);
- aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish );
- }
-}
-
-/*!Private SLOT. On load script.*/
-void SalomeApp_Application::onLoadScript( )
-{
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
- if ( !appStudy ) return;
- _PTR(Study) aStudy = appStudy->studyDS();
-
- if ( aStudy->GetProperties()->IsLocked() ) {
- SUIT_MessageBox::warn1 ( desktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- return;
- }
-
- QStringList filtersList;
- filtersList.append(tr("PYTHON_FILES_FILTER"));
- filtersList.append(tr("ALL_FILES_FILTER"));
-
- QString aFile = SUIT_FileDlg::getFileName( desktop(), "", filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true );
-
- if ( !aFile.isEmpty() )
- {
- QString command = QString("execfile(\"%1\")").arg(aFile);
-
- PythonConsole* pyConsole = pythonConsole();
-
- if ( pyConsole )
- pyConsole->exec( command );
- }
-}
-
-/*!Private SLOT. On preferences.*/
-void SalomeApp_Application::onPreferences()
-{
- QApplication::setOverrideCursor( Qt::waitCursor );
-
- SalomeApp_PreferencesDlg* prefDlg = new SalomeApp_PreferencesDlg( preferences( true ), desktop());
-
- QApplication::restoreOverrideCursor();
-
- if ( !prefDlg )
- return;
-
- prefDlg->exec();
-
- delete prefDlg;
-}
-
-/*!Private SLOT. On open document with name \a aName.*/
-void SalomeApp_Application::onMRUActivated( QString aName )
-{
- onOpenDoc( aName );
-}
-
-/*!Private SLOT. On preferences changed.*/
-void SalomeApp_Application::onPreferenceChanged( QString& modName, QString& section, QString& param )
-{
- SalomeApp_Module* sMod = 0;
- CAM_Module* mod = module( modName );
- if ( mod && mod->inherits( "SalomeApp_Module" ) )
- sMod = (SalomeApp_Module*)mod;
-
- if ( sMod )
- sMod->preferencesChanged( section, param );
- else
- preferencesChanged( section, param );
-}
-
-/*!Gets file filter.
- *\retval QString "(*.hdf)"
- */
-QString SalomeApp_Application::getFileFilter() const
-{
- return "(*.hdf)";
-}
-
-/*!Remove all windows from study.*/
-void SalomeApp_Application::beforeCloseDoc( SUIT_Study* s )
-{
- CAM_Application::beforeCloseDoc( s );
-
- for ( WindowMap::ConstIterator itr = myWindows.begin(); s && itr != myWindows.end(); ++itr )
- removeWindow( itr.key(), s->id() );
-}
-
-/*!Update actions.*/
-void SalomeApp_Application::updateActions()
-{
- updateCommandsStatus();
-}
+ return "(*.hdf)";
+}
/*!Create window.*/
QWidget* SalomeApp_Application::createWindow( const int flag )
{
- QWidget* wid = 0;
+ QWidget* wid = LightApp_Application::createWindow(flag);
SUIT_ResourceMgr* resMgr = resourceMgr();
if ( flag == WT_ObjectBrowser )
{
- OB_Browser* ob = new OB_Browser( desktop() );
- ob->setAutoUpdate( true );
- ob->setAutoOpenLevel( 1 );
- ob->setCaption( tr( "OBJECT_BROWSER" ) );
- ob->listView()->setColumnWidth( 0, OBJECT_COLUMN_WIDTH );
- ob->resize( OBJECT_BROWSER_WIDTH, ob->height() );
- ob->setFilter( new SalomeApp_OBFilter( selectionMgr() ) );
-
- ob->setNameTitle( tr( "OBJ_BROWSER_NAME" ) );
+ OB_Browser* ob = (OB_Browser*)wid;
connect( ob->listView(), SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( onDblClick( QListViewItem* ) ) );
-
bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
for ( int i = SalomeApp_DataObject::CT_Value; i <= SalomeApp_DataObject::CT_RefEntry; i++ )
{
QString().sprintf( "visibility_column_%d", i ), true ) );
}
ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
-
- // Create OBSelector
- new SalomeApp_OBSelector( ob, mySelMgr );
-
- wid = ob;
-
- ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
else if ( flag == WT_PyConsole )
{
+ delete wid;
+ wid = 0;
PythonConsole* pyCons = new PythonConsole( desktop(), new SalomeApp_PyInterp() );
pyCons->setCaption( tr( "PYTHON_CONSOLE" ) );
- pyCons->setFont( resMgr->fontValue( "PyConsole", "font" ) );
wid = pyCons;
-
// pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
- else if ( flag == WT_LogWindow )
- {
- LogWindow* logWin = new LogWindow( desktop() );
- logWin->setCaption( tr( "LOG_WINDOW" ) );
- wid = logWin;
-
- logWin->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
- }
-
return wid;
}
-/*!Default windows(Object Browser, Python Console).
- * Adds to map \a aMap.
- */
-void SalomeApp_Application::defaultWindows( QMap<int, int>& aMap ) const
-{
- aMap.insert( WT_ObjectBrowser, Qt::DockLeft );
- aMap.insert( WT_PyConsole, Qt::DockBottom );
- // aMap.insert( WT_LogWindow, Qt::DockBottom );
-}
-
-/*!Default view manager.*/
-void SalomeApp_Application::defaultViewManagers( QStringList& ) const
-{
- /*!Do nothing.*/
-}
-
-/*!Gets preferences.
- * Create preferences, if \a crt = true.
- */
-SalomeApp_Preferences* SalomeApp_Application::preferences( const bool crt ) const
-{
- if ( myPrefs )
- return myPrefs;
-
- SalomeApp_Application* that = (SalomeApp_Application*)this;
-
- if ( !_prefs_ && crt )
- {
- _prefs_ = new SalomeApp_Preferences( resourceMgr() );
- that->createPreferences( _prefs_ );
- }
-
- that->myPrefs = _prefs_;
-
- QPtrList<SUIT_Application> appList = SUIT_Session::session()->applications();
- for ( QPtrListIterator<SUIT_Application> appIt ( appList ); appIt.current(); ++appIt )
- {
- if ( !appIt.current()->inherits( "SalomeApp_Application" ) )
- continue;
-
- SalomeApp_Application* app = (SalomeApp_Application*)appIt.current();
-
- QStringList modNameList;
- app->modules( modNameList, false );
- for ( QStringList::const_iterator it = modNameList.begin(); it != modNameList.end(); ++it )
- {
- int id = _prefs_->addPreference( *it );
- _prefs_->setItemProperty( id, "info", tr( "PREFERENCES_NOT_LOADED" ).arg( *it ) );
- }
-
- ModuleList modList;
- app->modules( modList );
- for ( ModuleListIterator itr( modList ); itr.current(); ++itr )
- {
- SalomeApp_Module* mod = 0;
- if ( itr.current()->inherits( "SalomeApp_Module" ) )
- mod = (SalomeApp_Module*)itr.current();
-
- if ( mod && !_prefs_->hasModule( mod->moduleName() ) )
- {
- int modCat = _prefs_->addPreference( mod->moduleName() );
- _prefs_->setItemProperty( modCat, "info", QString::null );
- mod->createPreferences();
- }
- }
- }
-
- connect( myPrefs, SIGNAL( preferenceChanged( QString&, QString&, QString& ) ),
- this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ) );
-
- return myPrefs;
-}
-
-/*!Add new module to application.*/
-void SalomeApp_Application::moduleAdded( CAM_Module* mod )
-{
- CAM_Application::moduleAdded( mod );
-
- SalomeApp_Module* salomeMod = 0;
- if ( mod && mod->inherits( "SalomeApp_Module" ) )
- salomeMod = (SalomeApp_Module*)mod;
-
- if ( myPrefs && salomeMod && !myPrefs->hasModule( salomeMod->moduleName() ) )
- {
- int modCat = myPrefs->addPreference( mod->moduleName() );
- myPrefs->setItemProperty( modCat, "info", QString::null );
- salomeMod->createPreferences();
- }
-}
-
/*!Create preferences.*/
-void SalomeApp_Application::createPreferences( SalomeApp_Preferences* pref )
+void SalomeApp_Application::createPreferences( LightApp_Preferences* pref )
{
+ LightApp_Application::createPreferences(pref);
+
if ( !pref )
return;
int salomeCat = pref->addPreference( tr( "PREF_CATEGORY_SALOME" ) );
-
- int genTab = pref->addPreference( tr( "PREF_TAB_GENERAL" ), salomeCat );
- int studyGroup = pref->addPreference( tr( "PREF_GROUP_STUDY" ), genTab );
- pref->setItemProperty( studyGroup, "columns", 1 );
-
- pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, SalomeApp_Preferences::Bool, "Study", "multi_file" );
- pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, SalomeApp_Preferences::Bool, "Study", "ascii_file" );
- int undoPref = pref->addPreference( tr( "PREF_UNDO_LEVEL" ), studyGroup, SalomeApp_Preferences::IntSpin, "Study", "undo_level" );
- pref->setItemProperty( undoPref, "min", 1 );
- pref->setItemProperty( undoPref, "max", 100 );
-
- int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab );
- pref->setItemProperty( extgroup, "columns", 1 );
- int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, SalomeApp_Preferences::File, "ExternalBrowser", "application" );
- pref->setItemProperty( apppref, "existing", true );
- pref->setItemProperty( apppref, "flags", QFileInfo::ExeUser );
-
- pref->addPreference( tr( "PREF_PARAM" ), extgroup, SalomeApp_Preferences::String, "ExternalBrowser", "parameters" );
-
- int pythonConsoleGroup = pref->addPreference( tr( "PREF_GROUP_PY_CONSOLE" ), genTab );
- pref->setItemProperty( pythonConsoleGroup, "columns", 1 );
- pref->addPreference( tr( "PREF_FONT" ), pythonConsoleGroup, SalomeApp_Preferences::Font, "PyConsole", "font" );
-
-
-
int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat );
int defCols = pref->addPreference( tr( "PREF_GROUP_DEF_COLUMNS" ), obTab );
for ( int i = SalomeApp_DataObject::CT_Value; i <= SalomeApp_DataObject::CT_RefEntry; i++ )
{
pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), defCols,
- SalomeApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
+ LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
}
pref->setItemProperty( defCols, "columns", 1 );
int objSetGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SETTINGS" ), obTab );
- pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, SalomeApp_Preferences::Bool, "ObjectBrowser", "auto_size" );
-
- int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat );
-
- int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), viewTab );
-
- int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), viewTab );
-
- int plot2dGroup = pref->addPreference( tr( "PREF_GROUP_PLOT2DVIEWER" ), viewTab );
-
- pref->setItemProperty( occGroup, "columns", 1 );
- pref->setItemProperty( vtkGroup, "columns", 1 );
- pref->setItemProperty( plot2dGroup, "columns", 1 );
-
- int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup,
- SalomeApp_Preferences::IntSpin, "OCCViewer", "trihedron_size" );
- pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
- SalomeApp_Preferences::Color, "OCCViewer", "background" );
-
- pref->setItemProperty( occTS, "min", 1 );
- pref->setItemProperty( occTS, "max", 150 );
-
- int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
- SalomeApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
- int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup,
- SalomeApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" );
-
- pref->setItemProperty( isoU, "min", 0 );
- pref->setItemProperty( isoU, "max", 100000 );
-
- pref->setItemProperty( isoV, "min", 0 );
- pref->setItemProperty( isoV, "max", 100000 );
-
- int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup,
- SalomeApp_Preferences::IntSpin, "VTKViewer", "trihedron_size" );
- pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup,
- SalomeApp_Preferences::Color, "VTKViewer", "background" );
-
- pref->setItemProperty( vtkTS, "min", 1 );
- pref->setItemProperty( vtkTS, "max", 150 );
-
- pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup,
- SalomeApp_Preferences::Bool, "Plot2d", "ShowLegend" );
-
- int legendPosition = pref->addPreference( tr( "PREF_LEGEND_POSITION" ), plot2dGroup,
- SalomeApp_Preferences::Selector, "Plot2d", "LegendPos" );
- QStringList aLegendPosList;
- aLegendPosList.append( tr("PREF_LEFT") );
- aLegendPosList.append( tr("PREF_RIGHT") );
- aLegendPosList.append( tr("PREF_TOP") );
- aLegendPosList.append( tr("PREF_BOTTOM") );
-
- QValueList<QVariant> anIndexesList;
- anIndexesList.append(0);
- anIndexesList.append(1);
- anIndexesList.append(2);
- anIndexesList.append(3);
-
- pref->setItemProperty( legendPosition, "strings", aLegendPosList );
- pref->setItemProperty( legendPosition, "indexes", anIndexesList );
-
- int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup,
- SalomeApp_Preferences::Selector, "Plot2d", "CurveType" );
- QStringList aCurveTypesList;
- aCurveTypesList.append( tr("PREF_POINTS") );
- aCurveTypesList.append( tr("PREF_LINES") );
- aCurveTypesList.append( tr("PREF_SPLINE") );
-
- anIndexesList.clear();
- anIndexesList.append(0);
- anIndexesList.append(1);
- anIndexesList.append(2);
-
- pref->setItemProperty( curveType, "strings", aCurveTypesList );
- pref->setItemProperty( curveType, "indexes", anIndexesList );
-
- int markerSize = pref->addPreference( tr( "PREF_MARKER_SIZE" ), plot2dGroup,
- SalomeApp_Preferences::IntSpin, "Plot2d", "MarkerSize" );
-
- pref->setItemProperty( markerSize, "min", 0 );
- pref->setItemProperty( markerSize, "max", 100 );
-
- QStringList aScaleModesList;
- aScaleModesList.append( tr("PREF_LINEAR") );
- aScaleModesList.append( tr("PREF_LOGARITHMIC") );
-
- anIndexesList.clear();
- anIndexesList.append(0);
- anIndexesList.append(1);
-
- int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup,
- SalomeApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
-
- pref->setItemProperty( horScale, "strings", aScaleModesList );
- pref->setItemProperty( horScale, "indexes", anIndexesList );
-
- int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup,
- SalomeApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
-
- pref->setItemProperty( verScale, "strings", aScaleModesList );
- pref->setItemProperty( verScale, "indexes", anIndexesList );
-
- pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup,
- SalomeApp_Preferences::Color, "Plot2d", "Background" );
-
- int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat );
- int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab );
- pref->setItemProperty( dirGroup, "columns", 1 );
- pref->addPreference( tr( "" ), dirGroup,
- SalomeApp_Preferences::DirList, "FileDlg", "QuickDirList" );
-}
-
-void SalomeApp_Application::preferencesChanged( const QString& sec, const QString& param )
-{
- SUIT_ResourceMgr* resMgr = resourceMgr();
- if ( !resMgr )
- return;
-
- if ( sec == QString( "OCCViewer" ) && param == QString( "trihedron_size" ) )
- {
- int sz = resMgr->integerValue( sec, param, -1 );
- QPtrList<SUIT_ViewManager> lst;
- viewManagers( OCCViewer_Viewer::Type(), lst );
- for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current() && sz >= 0; ++it )
- {
- SUIT_ViewModel* vm = it.current()->getViewModel();
- if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
- continue;
-
- OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
- occVM->setTrihedronSize( sz );
- occVM->getAISContext()->UpdateCurrentViewer();
- }
- }
-
- if ( sec == QString( "VTKViewer" ) && param == QString( "trihedron_size" ) )
- {
- int sz = resMgr->integerValue( sec, param, -1 );
- QPtrList<SUIT_ViewManager> lst;
- viewManagers( SVTK_Viewer::Type(), lst );
- for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current() && sz >= 0; ++it )
- {
- SUIT_ViewModel* vm = it.current()->getViewModel();
- if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
- continue;
-
- SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
- if( vtkVM )
- {
- vtkVM->setTrihedronSize( sz );
- vtkVM->Repaint();
- }
- }
- }
-
- if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) )
- {
- QPtrList<SUIT_ViewManager> lst;
- viewManagers( OCCViewer_Viewer::Type(), lst );
- int u = resMgr->integerValue( sec, "iso_number_u" );
- int v = resMgr->integerValue( sec, "iso_number_v" );
- for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it )
- ((OCCViewer_Viewer*)it.current())->setIsos( u, v );
- }
-
- if( sec=="ObjectBrowser" )
- {
- if( param=="auto_size" )
- {
- OB_Browser* ob = objectBrowser();
- if( !ob )
- return;
-
- bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
- ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
-
- updateObjectBrowser( false );
- }
- }
-
- if( sec=="PyConsole" )
- {
- if( param=="font" )
- if( pythonConsole() )
- pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) );
- }
+ pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool, "ObjectBrowser", "auto_size" );
}
/*!Update desktop title.*/
QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
if ( !sName.isEmpty() ) {
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
- _PTR(Study) stdDS = study->studyDS();
- if(stdDS) {
- if ( stdDS->GetProperties()->IsLocked() ) {
- aTitle += QString( " - [%1 (%2)]").arg( sName ).arg( tr( "STUDY_LOCKED" ) );
- } else {
- aTitle += QString( " - [%1]" ).arg( sName );
- }
+ if ( study ) {
+ _PTR(Study) stdDS = study->studyDS();
+ if(stdDS) {
+ if ( stdDS->GetProperties()->IsLocked() ) {
+ aTitle += QString( " - [%1 (%2)]").arg( sName ).arg( tr( "STUDY_LOCKED" ) );
+ } else {
+ aTitle += QString( " - [%1]" ).arg( sName );
+ }
+ }
}
}
}
desktop()->setCaption( aTitle );
}
-/*!Update windows after close document.*/
-void SalomeApp_Application::afterCloseDoc()
-{
- updateWindows();
-
- CAM_Application::afterCloseDoc();
-}
-
/*!Gets CORBA::ORB_var*/
CORBA::ORB_var SalomeApp_Application::orb()
{
return _lcc;
}
+/*!Return default engine IOR for light modules*/
QString SalomeApp_Application::defaultEngineIOR()
{
/// Look for a default module engine (needed for CORBAless modules to use SALOMEDS persistence)
return anIOR;
}
-/*!Adds icon names for modules.*/
-void SalomeApp_Application::moduleIconNames( QMap<QString, QString>& iconMap ) const
-{
- iconMap.clear();
-
- SUIT_ResourceMgr* resMgr = resourceMgr();
- if ( !resMgr )
- return;
-
- QStringList modList;
- modules( modList, false );
-
- for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it )
- {
- QString modName = *it;
- QString modIntr = moduleName( modName );
- QString modIcon = resMgr->stringValue( modIntr, "icon", QString::null );
-
- if ( modIcon.isEmpty() )
- continue;
-
- if ( SUIT_Tools::extension( modIcon ).isEmpty() )
- modIcon += QString( ".png" );
-
- iconMap.insert( modName, modIcon );
- }
-}
-
-/*!Update module action.*/
-void SalomeApp_Application::updateModuleActions()
-{
- QString modName;
- if ( activeModule() )
- modName = activeModule()->moduleName();
-
- if ( myActions.contains( modName ) )
- myActions[modName]->setOn( true );
-}
-
-/*!Gets current windows.
- *\param winMap - output current windows map.
- */
-void SalomeApp_Application::currentWindows( QMap<int, int>& winMap ) const
-{
- winMap.clear();
- if ( !activeStudy() )
- return;
-
- if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
- ((SalomeApp_Module*)activeModule())->windows( winMap );
- else
- defaultWindows( winMap );
-}
-
-/*!Gets current view managers.
- *\param lst - output current view managers list.
- */
-void SalomeApp_Application::currentViewManagers( QStringList& lst ) const
-{
- lst.clear();
- if ( !activeStudy() )
- return;
-
- if ( activeModule() && activeModule()->inherits( "SalomeApp_Module" ) )
- ((SalomeApp_Module*)activeModule())->viewManagers( lst );
- else
- defaultViewManagers( lst );
-}
-
-/*!Update windows.*/
-void SalomeApp_Application::updateWindows()
-{
- QMap<int, int> winMap;
- currentWindows( winMap );
-
- for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
- getWindow( it.key() );
-
- loadWindowsGeometry();
-
- for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
- setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) );
-}
-
-/*!Update view managers.*/
-void SalomeApp_Application::updateViewManagers()
-{
- QStringList lst;
- currentViewManagers( lst );
-
- for ( QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it )
- getViewManager( *it, true );
-}
-
-/*!Load windows geometry.*/
-void SalomeApp_Application::loadWindowsGeometry()
-{
- QtxDockAction* dockMgr = 0;
-
- QAction* a = action( ViewWindowsId );
- if ( a && a->inherits( "QtxDockAction" ) )
- dockMgr = (QtxDockAction*)a;
-
- if ( !dockMgr )
- return;
-
- QString modName;
- if ( activeModule() )
- modName = activeModule()->name("");
-
- QString section = QString( "windows_geometry" );
- if ( !modName.isEmpty() )
- section += QString( "." ) + modName;
-
- dockMgr->loadGeometry( resourceMgr(), section, false );
- dockMgr->restoreGeometry();
-}
-
-/*!Save windows geometry.*/
-void SalomeApp_Application::saveWindowsGeometry()
-{
- QtxDockAction* dockMgr = 0;
-
- QAction* a = action( ViewWindowsId );
- if ( a && a->inherits( "QtxDockAction" ) )
- dockMgr = (QtxDockAction*)a;
-
- if ( !dockMgr )
- return;
-
- QString modName;
- if ( activeModule() )
- modName = activeModule()->name("");
-
- QString section = QString( "windows_geometry" );
- if ( !modName.isEmpty() )
- section += QString( "." ) + modName;
-
- dockMgr->storeGeometry();
- dockMgr->saveGeometry( resourceMgr(), section, false );
-}
-
-/*!Activate windows.*/
-void SalomeApp_Application::activateWindows()
-{
- if ( activeStudy() )
- {
- for ( WindowMap::Iterator itr = myWindows.begin(); itr != myWindows.end(); ++itr )
- itr.data()->activate( activeStudy()->id() );
- }
-}
-
/*!Private SLOT. On preferences.*/
void SalomeApp_Application::onProperties()
{
updateActions();
}
-/*!*/
-QString SalomeApp_Application::getFileName( bool open, const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent )
-{
- if ( !parent )
- parent = desktop();
- QStringList fls = QStringList::split( ";;", filters, false );
- return SUIT_FileDlg::getFileName( parent, initial, fls, caption, open, true );
-}
-
-/*!*/
-QString SalomeApp_Application::getDirectory( const QString& initial, const QString& caption, QWidget* parent )
-{
- if ( !parent )
- parent = desktop();
- return SUIT_FileDlg::getExistingDirectory( parent, initial, caption, true );
-}
-
-/*!*/
-QStringList SalomeApp_Application::getOpenFileNames( const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent )
-{
- if ( !parent )
- parent = desktop();
- QStringList fls = QStringList::split( ";;", filters, false );
- return SUIT_FileDlg::getOpenFileNames( parent, initial, fls, caption, true );
-}
-
-/*!*/
+/*!Insert items in popup, which necessary for current application*/
void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title )
{
- CAM_Application::contextMenuPopup( type, thePopup, title );
+ LightApp_Application::contextMenuPopup( type, thePopup, title );
OB_Browser* ob = objectBrowser();
if ( !ob || type != ob->popupClientType() )
return;
- thePopup->insertSeparator();
- thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
-
// Get selected objects
SALOME_ListIO aList;
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(aList);
// "Delete reference" item should appear only for invalid references
if ( it.Value()->hasEntry() )
{
_PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() );
- if ( aSObject->ReferencedObject(anObj) == false || !QString(anObj->GetName().c_str()).isEmpty() )
- isInvalidRefs = false;
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(aSObject.get());
+ if( aSO )
+ if ( aSObject->ReferencedObject(anObj) == false || !QString(anObj->GetName().c_str()).isEmpty() )
+ isInvalidRefs = false;
}
}
}
}
-/*!Update obect browser*/
+/*!Update obect browser:
+ 1.if 'updateModels' true, update existing data models;
+ 2. update "non-existing" (not loaded yet) data models;
+ 3. update object browser if it existing */
void SalomeApp_Application::updateObjectBrowser( const bool updateModels )
{
// update existing data models (already loaded SComponents)
- if ( updateModels )
- {
- for ( ModuleListIterator it = modules(); it.current(); ++it )
- {
- CAM_DataModel* camDM = it.current()->dataModel();
- if ( camDM && camDM->inherits( "SalomeApp_DataModel" ) )
- ((SalomeApp_DataModel*)camDM)->update();
- }
- }
+ LightApp_Application::updateObjectBrowser(updateModels);
+
// update "non-existing" (not loaded yet) data models
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
if ( study )
_PTR(Study) stdDS = study->studyDS();
if( stdDS )
{
- for ( _PTR(SComponentIterator) it ( stdDS->NewComponentIterator() ); it->More(); it->Next() )
+ for ( _PTR(SComponentIterator) it ( stdDS->NewComponentIterator() ); it->More(); it->Next() )
{
_PTR(SComponent) aComponent ( it->Value() );
if ( aComponent->ComponentDataType() == "Interface Applicative" )
continue; // skip the magic "Interface Applicative" component
- SalomeApp_DataModel::BuildTree( aComponent, study->root(), study, /*skipExisitng=*/true );
+ SalomeApp_DataModel::BuildTree( aComponent, study->root(), study, /*skipExisitng=*/true );
}
}
}
}
}
-/*!Protected SLOT.On desktop activated.*/
-void SalomeApp_Application::onDesktopActivated()
-{
- CAM_Application::onDesktopActivated();
- SalomeApp_Module* aModule = dynamic_cast<SalomeApp_Module*>(activeModule());
- if(aModule)
- aModule->studyActivated();
-}
-
-/*!Create empty study.*/
-void SalomeApp_Application::createEmptyStudy()
-{
- CAM_Application::createEmptyStudy();
- if ( objectBrowser() )
- objectBrowser()->updateTree();
-}
-
-/*!Activate module \a mod.*/
-bool SalomeApp_Application::activateModule( CAM_Module* mod )
-{
- bool res = CAM_Application::activateModule( mod );
- if ( objectBrowser() )
- objectBrowser()->updateTree();
- return res;
-}
-
/*!Display Catalog Genenerator dialog */
void SalomeApp_Application::onCatalogGen()
{
regWnd->setActiveWindow();
}
-/*!return keyborad accelerators manager object */
-SUIT_Accel* SalomeApp_Application::accel() const
-{
- return myAccel;
-}
-
/*!find original object by double click on item */
void SalomeApp_Application::onDblClick( QListViewItem* it )
{
#endif // _MSC_VER > 1000
#include "SalomeApp.h"
-#include <CAM_Application.h>
+#include <LightApp_Application.h>
#include <CORBA.h>
class QComboBox;
class QDockWindow;
-class LogWindow;
-class OB_Browser;
-class PythonConsole;
+class LightApp_Preferences;
class SalomeApp_Module;
-class SalomeApp_Preferences;
-class SalomeApp_SelectionMgr;
-class SalomeApp_WidgetContainer;
-class SUIT_Accel;
class SALOME_LifeCycleCORBA;
#endif
/*!
- Description : Application containing SalomeApp module
+ Description : Application containing SalomeApp module or LightApp module
*/
-class SALOMEAPP_EXPORT SalomeApp_Application : public CAM_Application
+class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
{
Q_OBJECT
public:
- typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
-
- enum { ModulesListId = STD_Application::UserID, NewGLViewId,
- NewPlot2dId, NewOCCViewId, NewVTKViewId, DumpStudyId,
- LoadScriptId, PropertiesId, PreferencesId, MRUId,
- CatalogGenId, RegDisplayId, UserID };
+ enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
+ CatalogGenId, RegDisplayId, UserID };
public:
SalomeApp_Application();
virtual ~SalomeApp_Application();
-
- virtual QString applicationName() const;
- virtual QString applicationVersion() const;
-
- virtual CAM_Module* loadModule( const QString& );
- virtual bool activateModule( const QString& );
-
- virtual bool useStudy( const QString& );
-
- SalomeApp_SelectionMgr* selectionMgr() const;
-
- LogWindow* logWindow();
- OB_Browser* objectBrowser();
- PythonConsole* pythonConsole();
virtual void updateObjectBrowser( const bool = true );
- SalomeApp_Preferences* preferences() const;
-
virtual QString getFileFilter() const;
- virtual QString getFileName( bool open, const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent );
- virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
- virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent );
-
- SUIT_ViewManager* getViewManager( const QString&, const bool );
-
- void updateActions();
-
- QWidget* getWindow( const int, const int = -1 );
-
- QWidget* window( const int, const int = -1 ) const;
- void addWindow( QWidget*, const int, const int = -1 );
- void removeWindow( const int, const int = -1 );
-
- bool isWindowVisible( const int ) const;
- void setWindowShown( const int, const bool );
virtual void start();
virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
- virtual void createEmptyStudy();
-
- SUIT_Accel* accel() const;
-
static CORBA::ORB_var orb();
static SALOMEDSClient_StudyManager* studyMgr();
static SALOME_NamingService* namingService();
static SALOME_LifeCycleCORBA* lcc();
static QString defaultEngineIOR();
-signals:
- void studyOpened();
- void studySaved();
- void studyClosed();
-
public slots:
- virtual void onNewDoc();
- virtual void onOpenDoc();
- virtual void onHelpAbout();
- virtual void onHelpContentsModule();
virtual bool onOpenDoc( const QString& );
virtual void onLoadDoc();
virtual bool onLoadDoc( const QString& );
virtual void onCopy();
- virtual void onPaste();
-
-private slots:
- void onSelection();
- void onRefresh();
- void onDeleteReferences();
- void onDblClick( QListViewItem* );
+ virtual void onPaste();
protected:
virtual void createActions();
virtual SUIT_Study* createNewStudy();
virtual QWidget* createWindow( const int );
- virtual void defaultWindows( QMap<int, int>& ) const;
- virtual void defaultViewManagers( QStringList& ) const;
-
- virtual void setActiveStudy( SUIT_Study* );
virtual void updateCommandsStatus();
-
virtual void onSelectionChanged();
- virtual void beforeCloseDoc( SUIT_Study* );
- virtual void afterCloseDoc();
-
- virtual void moduleAdded( CAM_Module* );
- virtual bool activateModule( CAM_Module* = 0 );
-
- SalomeApp_Preferences* preferences( const bool ) const;
-
- virtual void createPreferences( SalomeApp_Preferences* );
- virtual void preferencesChanged( const QString&, const QString& );
+ virtual void createPreferences( LightApp_Preferences* );
virtual void updateDesktopTitle();
-protected slots:
- virtual void onDesktopActivated();
-
private slots:
- void onNewWindow();
- void onModuleActivation( QAction* );
- void onCloseView( SUIT_ViewManager* );
-
- void onStudyCreated( SUIT_Study* );
- void onStudyOpened( SUIT_Study* );
- void onStudySaved( SUIT_Study* );
- void onStudyClosed( SUIT_Study* );
-
+ void onDeleteReferences();
+ void onDblClick( QListViewItem* );
void onProperties();
void onDumpStudy();
void onLoadScript();
- void onPreferences();
- void onMRUActivated( QString );
-
void onCatalogGen();
void onRegDisplay();
-
- void onPreferenceChanged( QString&, QString&, QString& );
void onOpenWith();
-
-private:
- void updateWindows();
- void updateViewManagers();
- void updateModuleActions();
-
- void loadWindowsGeometry();
- void saveWindowsGeometry();
-
- void updatePreference( const QString&, const QString&, const QString& );
-
- QString defaultModule() const;
- void currentWindows( QMap<int, int>& ) const;
- void currentViewManagers( QStringList& ) const;
- SUIT_ViewManager* createViewManager( const QString& vmType );
- void moduleIconNames( QMap<QString, QString>& ) const;
-
- void activateWindows();
-
-private:
- typedef QMap<QString, QAction*> ActionMap;
- typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
-
-private:
- SalomeApp_Preferences* myPrefs;
- SalomeApp_SelectionMgr* mySelMgr;
- ActionMap myActions;
- WindowMap myWindows;
-
- SUIT_Accel* myAccel;
-
- static SalomeApp_Preferences* _prefs_;
};
#ifdef WIN32
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Study.h"
-#include "SalomeApp_RootObject.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Module.h"
#include "SalomeApp_Application.h"
-#include "SalomeApp_SelectionMgr.h"
#include "SalomeApp_Engine_i.hxx"
+#include "LightApp_RootObject.h"
+
#include <CAM_DataObject.h>
#include <SUIT_Application.h>
if ( componentObj->name() == aSName ) {
// mkr : modifications for update of already published in
// object browser, but not loaded yet components
- CAM_Application* anApp = dynamic_cast<CAM_Application*>
- (SUIT_Session::session()->activeApplication());
-
- // asv : corresponding DataObjects are DELETED before update (so they are re-built).
+ LightApp_Application* anApp = dynamic_cast<LightApp_Application*>
+ (SUIT_Session::session()->activeApplication() );
+ // asv : corresponding DataObjects are DELETED before update (so they are re-built).
if (anApp && !anApp->module(aSName)) { // if module is not loaded, delete it's DataObject
// jfa: remove children before DataObject deletion
DataObjectList chilren = componentObj->children(/*recursive=*/true);
componentObj->removeChild(itc.current());
// delete DataObject itself and re-create it and all its sub-objects
- delete componentObj;
+ delete componentObj;
// don't do anything here, because iterator may be corrupted (deleted object inside it)
break; // proceed to build_a_data_object code below
}
/*!Purpose : Constructor*/
//=======================================================================
SalomeApp_DataModel::SalomeApp_DataModel( CAM_Module* theModule )
-: CAM_DataModel( theModule )
+: LightApp_DataModel( theModule )
{
}
// Function : open
/*! Purpose : Open data model*/
//================================================================
-bool SalomeApp_DataModel::open( const QString&, CAM_Study* study )
+bool SalomeApp_DataModel::open( const QString& name, CAM_Study* study, QStringList )
{
SalomeApp_Study* aDoc = dynamic_cast<SalomeApp_Study*>( study );
if ( !aDoc )
if ( anId.isEmpty() )
return true; // Probably nothing to load
- QString anEngine = getModule()->engineIOR();
- if ( anEngine == "-1" ) {
- // Module doesn't have a CORBA engine and doesn't use
- // a default one -> SALOMEDS persistence cannot be used
- return false;
- }
-
- if ( anEngine.isEmpty() ) {
- // Module use a default engine
- //TODO: deside, if the below code has to be copyed in a light data model to avoid bulding of data tree twice
- anEngine = SalomeApp_Application::defaultEngineIOR();
- }
-
_PTR(Study) aStudy ( aDoc->studyDS() ); // shared_ptr cannot be used here
_PTR(SComponent) aSComp ( aStudy->FindComponentID( std::string( anId.latin1() ) ) );
+ if ( aSComp )
+ buildTree( aSComp, 0, aDoc );
- if ( aSComp ) {
- _PTR(StudyBuilder) aBuilder( aStudy->NewBuilder() );
- if ( aBuilder ) {
- try {
- aBuilder->LoadWith( aSComp, std::string( anEngine.latin1() ) );
- }
- catch( const SALOME::SALOME_Exception& ) {
- // Oops, something went wrong while loading -> return an error
- return false;
- }
-
- // Something has been read -> create data model tree
- buildTree( aSComp, 0, aDoc );
- }
- } else {
- // Don't return false here, for there might be no data
- // for a given component in the study yet
- }
-
- emit opened(); //TODO: is it really needed? to be removed maybe...
- return true;
-}
-
-//================================================================
-// Function : save
-/*! Purpose : Emit saved()*/
-//================================================================
-bool SalomeApp_DataModel::save()
-{
- emit saved();
- return true;
-}
-
-//================================================================
-// Function : saveAs
-/*! Purpose : Emit saved() */
-//================================================================
-bool SalomeApp_DataModel::saveAs( const QString&, CAM_Study* )
-{
- emit saved();
- return true;
-}
-
-//================================================================
-// Function : close
-/*! Purpose : Emit closed()*/
-//================================================================
-bool SalomeApp_DataModel::close()
-{
- emit closed();
+ QStringList listOfFiles;
+ LightApp_DataModel::open(name, study, listOfFiles);
return true;
}
// Function : update
/*! Purpose : Update application.*/
//================================================================
-void SalomeApp_DataModel::update( SalomeApp_DataObject*, SalomeApp_Study* study )
+void SalomeApp_DataModel::update( LightApp_DataObject*, LightApp_Study* study )
{
- SalomeApp_RootObject* studyRoot = 0;
+ SalomeApp_Study* aSStudy = dynamic_cast<SalomeApp_Study*>(study);
+ LightApp_RootObject* studyRoot = 0;
_PTR(SObject) sobj;
SalomeApp_DataObject* modelRoot = dynamic_cast<SalomeApp_DataObject*>( root() );
if ( !modelRoot ){ // not yet connected to a study -> try using <study> argument
- if ( !study )
- study = dynamic_cast<SalomeApp_Study*>( getModule()->getApp()->activeStudy() );
-
- if ( study ){
- studyRoot = dynamic_cast<SalomeApp_RootObject*>( study->root() );
- QString anId = getRootEntry( study );
+ if ( !aSStudy )
+ aSStudy = dynamic_cast<SalomeApp_Study*>( getModule()->getApp()->activeStudy() );
+ if ( aSStudy ){
+ studyRoot = dynamic_cast<LightApp_RootObject*>( aSStudy->root() );
+ QString anId = getRootEntry( aSStudy );
if ( !anId.isEmpty() ){ // if nothing is published in the study for this module -> do nothing
- _PTR(Study) aStudy ( study->studyDS() );
+ _PTR(Study) aStudy ( aSStudy->studyDS() );
sobj = aStudy->FindComponentID( std::string( anId.latin1() ) );
}
}
}
else{
- studyRoot = dynamic_cast<SalomeApp_RootObject*>( modelRoot->root() );
- study = studyRoot->study(); // <study> value should not change here theoretically, but just to make sure
- _PTR(Study) aStudy ( study->studyDS() );
-
- // modelRoot->object() cannot be reused here: it is about to be deleted by buildTree() soon
- sobj = aStudy->FindComponentID( std::string( modelRoot->entry().latin1() ) );
+ studyRoot = dynamic_cast<LightApp_RootObject*>( modelRoot->root() );
+ if ( studyRoot ) {
+ aSStudy = dynamic_cast<SalomeApp_Study*>( studyRoot->study() ); // <study> value should not change here theoretically, but just to make sure
+ if ( aSStudy ) {
+ _PTR(Study) aStudy ( aSStudy->studyDS() );
+ // modelRoot->object() cannot be reused here: it is about to be deleted by buildTree() soon
+ sobj = aStudy->FindComponentID( std::string( modelRoot->entry().latin1() ) );
+ }
+ }
}
- buildTree( sobj, studyRoot, study );
+ buildTree( sobj, studyRoot, aSStudy );
}
//================================================================
SalomeApp_Study* SalomeApp_DataModel::getStudy() const
{
if(!root()) return 0;
- SalomeApp_RootObject* aRoot = dynamic_cast<SalomeApp_RootObject*>( root()->root() );
+ LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root()->root() );
if ( !aRoot )
return 0;
- return aRoot->study();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( aRoot->study() );
+ if ( !aStudy )
+ return 0;
+ return aStudy;
}
//================================================================
}
return anEntry;
}
-
-//================================================================
-// Function : isModified
-/*! Purpose : default implementation, always returns false so as not to mask study's isModified()*/
-//================================================================
-bool SalomeApp_DataModel::isModified() const
-{
- return false;
-}
-
-//================================================================
-// Function : isSaved
-/*! Purpose : default implementation, always returns true so as not to mask study's isSaved()*/
-//================================================================
-bool SalomeApp_DataModel::isSaved() const
-{
- return true;
-}
-
-// BEGIN: methods to be used by CORBAless modules
-
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-std::vector<std::string> SalomeApp_DataModel::GetListOfFiles() const
- //(const int theStudyId, const char* theComponentName) const
-{
- SUIT_Study* anActiveStudy = getModule()->getApp()->activeStudy();
- if (anActiveStudy) {
- int aStudyId = anActiveStudy->id();
- SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
- if (aDefaultEngine) {
- return aDefaultEngine->GetListOfFiles(aStudyId, module()->name());
- }
- }
-
- std::vector<std::string> aListOfFiles;
- return aListOfFiles;
-}
-
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-void SalomeApp_DataModel::SetListOfFiles (const std::vector<std::string> theListOfFiles)
- //(const std::vector<std::string> theListOfFiles,
- // const int theStudyId,
- // const char* theComponentName)
-{
- SUIT_Study* anActiveStudy = getModule()->getApp()->activeStudy();
- if (anActiveStudy) {
- int aStudyId = anActiveStudy->id();
- SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
- if (aDefaultEngine) {
- aDefaultEngine->SetListOfFiles(theListOfFiles, aStudyId, module()->name());
- }
- }
-}
-
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : Static method. To be used by CORBAless modules*/
-//================================================================
-std::string SalomeApp_DataModel::GetTmpDir (const char* theURL,
- const bool isMultiFile)
-{
- std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL);
- std::string aTmpDir = isMultiFile ? anURLDir : SALOMEDS_Tool::GetTmpDir();
- return aTmpDir;
-}
-
-//================================================================
-// Function : RemoveTemporaryFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-void SalomeApp_DataModel::RemoveTemporaryFiles (const bool isMultiFile) const
-{
- if (isMultiFile)
- return;
-
- std::vector<std::string> aListOfFiles = GetListOfFiles();
- if (aListOfFiles.size() > 0) {
- std::string aTmpDir = aListOfFiles[0];
-
- const int n = aListOfFiles.size() - 1;
- SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
- aSeq->length(n);
- for (int i = 0; i < n; i++)
- aSeq[i] = CORBA::string_dup(aListOfFiles[i + 1].c_str());
-
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
- }
-}
-
-// END: methods to be used by CORBAless modules
#endif // _MSC_VER > 1000
#include "SalomeApp.h"
-#include "CAM_DataModel.h"
+#include "LightApp_DataModel.h"
#include "SALOMEDSClient.hxx"
class SalomeApp_Module;
class SalomeApp_Study;
class SalomeApp_DataObject;
-class SalomeApp_SelectionMgr;
// Class : SalomeApp_DataModel
/// Description : Base class of data model
-class SALOMEAPP_EXPORT SalomeApp_DataModel : public CAM_DataModel
+class SALOMEAPP_EXPORT SalomeApp_DataModel : public LightApp_DataModel
{
Q_OBJECT
SalomeApp_DataModel ( CAM_Module* theModule );
virtual ~SalomeApp_DataModel();
- /** @name These methods should be redefined in successors.*/
- //@{
- virtual bool open( const QString&, CAM_Study* );
- virtual bool save();
- virtual bool saveAs( const QString&, CAM_Study* );
- virtual bool close();
+ virtual bool open( const QString&, CAM_Study*, QStringList );
+ virtual void update( LightApp_DataObject* = 0, LightApp_Study* = 0 );
- virtual void update( SalomeApp_DataObject* = 0, SalomeApp_Study* = 0 );
-
- virtual bool isModified() const;
- virtual bool isSaved() const;
- //@}
-
-signals:
- void opened();
- void saved();
- void closed();
+ QString getRootEntry( SalomeApp_Study* ) const;
+ SalomeApp_Module* getModule() const;
protected:
- SalomeApp_Module* getModule() const;
SalomeApp_Study* getStudy() const;
virtual void buildTree(const _PTR(SObject)&, SUIT_DataObject*, SalomeApp_Study* );
-
- /** @name methods to be used by CORBAless modules*/
- //@{
- std::vector<std::string> GetListOfFiles () const;
- void SetListOfFiles (const std::vector<std::string> theListOfFiles);
-
- static std::string GetTmpDir (const char* theURL,
- const bool isMultiFile);
-
- void RemoveTemporaryFiles (const bool isMultiFile) const;
- //@}
- // END: methods to be used by CORBAless modules
-
-private:
- QString getRootEntry( SalomeApp_Study* ) const;
};
#endif
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Study.h"
-#include "SalomeApp_RootObject.h"
+#include "LightApp_RootObject.h"
#include <SUIT_Application.h>
#include <SUIT_ResourceMgr.h>
#include <SALOMEDSClient_AttributeTableOfReal.hxx>
#include <SALOMEDSClient_AttributeTableOfInteger.hxx>
-/*!
- Class: SalomeApp_DataObject::Key
- Level: Internal
-*/
-class SalomeApp_DataObject::Key : public SUIT_DataObjectKey
-{
-public:
- Key( const QString& );
- virtual ~Key();
-
- virtual bool isLess( const SUIT_DataObjectKey* ) const;
- virtual bool isEqual( const SUIT_DataObjectKey* ) const;
-
-private:
- QString myEntry;
-};
-
-/*!Constructor. Initialize by \a entry.*/
-SalomeApp_DataObject::Key::Key( const QString& entry )
-: SUIT_DataObjectKey(),
- myEntry( entry )
-{
-}
-
-/*!Destructor. Do nothing.*/
-SalomeApp_DataObject::Key::~Key()
-{
-}
-
-/*!Checks: Is current key less than \a other.*/
-bool SalomeApp_DataObject::Key::isLess( const SUIT_DataObjectKey* other ) const
-{
- Key* that = (Key*)other;
- return myEntry < that->myEntry;
-}
-
-/*!Checks: Is current key equal with \a other.*/
-bool SalomeApp_DataObject::Key::isEqual( const SUIT_DataObjectKey* other ) const
-{
- Key* that = (Key*)other;
- return myEntry == that->myEntry;
-}
-
/*
Class: SalomeApp_DataObject
Level: Public
*/
/*!Constructor. Initialize by \a parent*/
SalomeApp_DataObject::SalomeApp_DataObject( SUIT_DataObject* parent )
-: CAM_DataObject( parent )
+: LightApp_DataObject( parent ),
+ CAM_DataObject( parent )
{
}
/*!Constructor. Initialize by \a parent and SObject*/
SalomeApp_DataObject::SalomeApp_DataObject( const _PTR(SObject)& sobj, SUIT_DataObject* parent )
-: CAM_DataObject( parent )
+: LightApp_DataObject( parent ),
+ CAM_DataObject( parent )
{
myObject = sobj;
}
return QString::null;
}
-/*!Create and return new key object.*/
-SUIT_DataObjectKey* SalomeApp_DataObject::key() const
-{
- QString str = entry();
- return new Key( str );
-}
-
/*!Gets name of object.*/
QString SalomeApp_DataObject::name() const
{
_PTR(AttributePixMap) aPixAttr ( anAttr );
if ( aPixAttr->HasPixMap() ){
QString pixmapName = QObject::tr( aPixAttr->GetPixMap().c_str() );
- SalomeApp_RootObject* aRoot = dynamic_cast<SalomeApp_RootObject*>( root() );
+ LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
if ( aRoot && aRoot->study() ) {
QPixmap pixmap = aRoot->study()->application()->resourceMgr()->loadPixmap( componentDataType(), pixmapName, false );
return pixmap;
return QString( "Object \'%1\', module \'%2\', ID=%3" ).arg( name() ).arg( componentDataType() ).arg( entry() );
}
-/*!Gets component object.
- *\retval SUIT_DataObject.
- */
-SUIT_DataObject* SalomeApp_DataObject::componentObject() const
-{
- SUIT_DataObject* compObj = 0; // for root object (invisible SALOME_ROOT_OBJECT)
-
- if ( parent() && parent() == root() )
- compObj = (SUIT_DataObject*)this; // for component-level objects
- else
- {
- compObj = parent(); // for lower level objects
- while ( compObj && compObj->parent() != root() )
- compObj = compObj->parent();
- }
-
- return compObj;
-}
-
/*!Get component type.*/
QString SalomeApp_DataObject::componentDataType() const
{
/*!Constructor.Initialize by \a parent.*/
SalomeApp_ModuleObject::SalomeApp_ModuleObject( SUIT_DataObject* parent )
-: SalomeApp_DataObject( parent ),
+: SalomeApp_DataObject( parent ),
CAM_RootObject( parent ),
CAM_DataObject( parent )
{
/*!Constructor.Initialize by \a parent and SObject.*/
SalomeApp_ModuleObject::SalomeApp_ModuleObject( const _PTR(SObject)& sobj, SUIT_DataObject* parent )
-: SalomeApp_DataObject( sobj, parent ),
+: SalomeApp_DataObject( sobj, parent ),
CAM_RootObject( 0, parent ),
CAM_DataObject( parent )
{
/*!Constructor.Initialize by \a parent and CAM_DataModel.*/
SalomeApp_ModuleObject::SalomeApp_ModuleObject( CAM_DataModel* dm, const _PTR(SObject)& sobj, SUIT_DataObject* parent )
-: SalomeApp_DataObject( sobj, parent ),
+: SalomeApp_DataObject( sobj, parent ),
CAM_RootObject( dm, parent ),
- CAM_DataObject( parent )
+ CAM_DataObject( parent )
{
}
SalomeApp_ModuleObject::~SalomeApp_ModuleObject()
{
}
+
+/*!Returns module name */
+QString SalomeApp_ModuleObject::name() const
+{
+ return SalomeApp_DataObject::name();
+}
+
#include "SalomeApp.h"
-#include "CAM_DataObject.h"
+#include "LightApp_DataObject.h"
#include "CAM_RootObject.h"
#include "SALOMEDSClient.hxx"
class SalomeApp_Study;
-class SALOMEAPP_EXPORT SalomeApp_DataObject : public virtual CAM_DataObject
+class SALOMEAPP_EXPORT SalomeApp_DataObject : public LightApp_DataObject
{
- class Key;
public:
enum { CT_Value, CT_Entry, CT_IOR, CT_RefEntry };
virtual QString text( const int ) const;
virtual QColor color( const ColorRole ) const;
- virtual SUIT_DataObjectKey* key() const;
virtual QString entry() const;
/*! location of corresponding SALOMEDS::SObject */
bool isReference() const;
_PTR(SObject) referencedObject() const;
- SUIT_DataObject* componentObject() const;
/*! GEOM, SMESH, VISU, etc.*/
- QString componentDataType() const;
+ virtual QString componentDataType() const;
private:
QString ior( const _PTR(SObject)& ) const;
SalomeApp_ModuleObject( const _PTR(SObject)&, SUIT_DataObject* = 0 );
SalomeApp_ModuleObject( CAM_DataModel*, const _PTR(SObject)&, SUIT_DataObject* = 0 );
virtual ~SalomeApp_ModuleObject();
+
+ virtual QString name() const;
};
#endif
#include "SalomeApp_Module.h"
-#include "SalomeApp_Study.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Application.h"
-#include "SalomeApp_Preferences.h"
-#include "SalomeApp_UpdateFlags.h"
-#include "SalomeApp_Operation.h"
-#include "SalomeApp_SwitchOp.h"
-#include "SalomeApp_ShowHideOp.h"
+#include "SalomeApp_Selection.h"
-#include <OB_Browser.h>
+#include "LightApp_Operation.h"
+#include "LightApp_Preferences.h"
-#include <CAM_Study.h>
+#include "CAM_DataModel.h"
-#include <SUIT_MessageBox.h>
-#include <SUIT_ResourceMgr.h>
+#include "OB_Browser.h"
-#include <QtxPopupMgr.h>
-
-#include <SVTK_ViewWindow.h>
-#include <OCCViewer_ViewWindow.h>
-#include <OCCViewer_ViewPort3d.h>
-#include <GLViewer_ViewFrame.h>
-#include <GLViewer_ViewPort.h>
-#include <Plot2d_ViewWindow.h>
-#include <Plot2d_ViewFrame.h>
+#include <qstring.h>
+#include <qmap.h>
/*!Constructor.*/
SalomeApp_Module::SalomeApp_Module( const QString& name )
-: CAM_Module( name ),
-myPopupMgr( 0 ),
-mySwitchOp( 0 ),
-myDisplay( -1 ),
-myErase( -1 ),
-myDisplayOnly( -1 )
+: LightApp_Module( name )
{
}
/*!Destructor.*/
SalomeApp_Module::~SalomeApp_Module()
-{
- if ( mySwitchOp )
- delete mySwitchOp;
-}
-
-/*!Initialize module.*/
-void SalomeApp_Module::initialize( CAM_Application* app )
-{
- CAM_Module::initialize( app );
-
- SUIT_ResourceMgr* resMgr = app ? app->resourceMgr() : 0;
- if ( resMgr )
- resMgr->raiseTranslators( name() );
-}
-
-/*!Activate module.*/
-bool SalomeApp_Module::activateModule( SUIT_Study* study )
-{
- bool res = CAM_Module::activateModule( study );
-
- if ( res && application() && application()->resourceMgr() )
- application()->resourceMgr()->raiseTranslators( name() );
-
- if ( mySwitchOp == 0 )
- mySwitchOp = new SalomeApp_SwitchOp( this );
-
- return res;
-}
-
-/*!Deactivate module.*/
-bool SalomeApp_Module::deactivateModule( SUIT_Study* )
-{
- delete mySwitchOp;
- mySwitchOp = 0;
-
- return true;
-}
-
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::selectionChanged()
-{
-}
-
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::MenuItem()
-{
-}
-
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::windows( QMap<int, int>& ) const
-{
-}
-
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::viewManagers( QStringList& ) const
-{
-}
-
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::createPreferences()
-{
-}
-
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::preferencesChanged( const QString&, const QString& )
{
}
return (SalomeApp_Application*)application();
}
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::onModelOpened()
-{
-}
-
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::onModelSaved()
-{
-}
-
-/*!NOT IMPLEMENTED*/
-void SalomeApp_Module::onModelClosed()
-{
-}
-
-/*!Gets popup manager.(create if not exist)*/
-QtxPopupMgr* SalomeApp_Module::popupMgr()
-{
- if ( !myPopupMgr )
- {
- myPopupMgr = new QtxPopupMgr( 0, this );
-
- QPixmap p;
- SUIT_Desktop* d = application()->desktop();
-
- QAction
- *disp = createAction( -1, tr( "TOP_DISPLAY" ), p, tr( "MEN_DISPLAY" ), tr( "STB_DISPLAY" ),
- 0, d, false, this, SLOT( onShowHide() ) ),
- *erase = createAction( -1, tr( "TOP_ERASE" ), p, tr( "MEN_ERASE" ), tr( "STB_ERASE" ),
- 0, d, false, this, SLOT( onShowHide() ) ),
- *dispOnly = createAction( -1, tr( "TOP_DISPLAY_ONLY" ), p, tr( "MEN_DISPLAY_ONLY" ), tr( "STB_DISPLAY_ONLY" ),
- 0, d, false, this, SLOT( onShowHide() ) );
- myDisplay = actionId( disp );
- myErase = actionId( erase );
- myDisplayOnly = actionId( dispOnly );
-
- myPopupMgr->insert( disp, -1, 0 );
- myPopupMgr->insert( erase, -1, 0 );
- myPopupMgr->insert( dispOnly, -1, 0 );
- myPopupMgr->insert( separator(), -1, 0 );
-
- QString uniform = "( count( $component ) = 1 ) and ( component != activeModule ) and ( activeModule = '%1' )";
- uniform = uniform.arg( name() );
- myPopupMgr->setRule( disp, QString( "( not isVisible ) and " ) + uniform, true );
- myPopupMgr->setRule( erase, QString( "( isVisible ) and " ) + uniform, true );
- myPopupMgr->setRule( dispOnly, uniform, true );
- }
- return myPopupMgr;
-}
-
-/*!Gets preferences.*/
-SalomeApp_Preferences* SalomeApp_Module::preferences() const
-{
- SalomeApp_Preferences* pref = 0;
- if ( getApp() )
- pref = getApp()->preferences();
- return pref;
-}
-
/*!Create new instance of data model and return it.*/
CAM_DataModel* SalomeApp_Module::createDataModel()
{
return new SalomeApp_DataModel(this);
}
-/*!Update object browser.*/
-void SalomeApp_Module::updateObjBrowser( bool updateDataModel, SUIT_DataObject* root )
+/*!Create and return instance of LightApp_Selection.*/
+LightApp_Selection* SalomeApp_Module::createSelection() const
{
- if( updateDataModel )
- if( CAM_DataModel* aDataModel = dataModel() )
- if( SalomeApp_DataModel* aModel = dynamic_cast<SalomeApp_DataModel*>( aDataModel ) )
- aModel->update( 0, dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
- getApp()->objectBrowser()->updateTree( root );
-}
-
-/*!Context menu popup.*/
-void SalomeApp_Module::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ )
-{
- SalomeApp_Selection* sel = createSelection();
- sel->init( client, getApp()->selectionMgr() );
- popupMgr()->updatePopup( menu, sel );
- delete sel;
-}
-
-/*!Create and return instance of SalomeApp_Selection.*/
-SalomeApp_Selection* SalomeApp_Module::createSelection() const
-{
- return new SalomeApp_Selection();
-}
-
-/*!Add preference to preferences.*/
-int SalomeApp_Module::addPreference( const QString& label )
-{
- SalomeApp_Preferences* pref = preferences();
- if ( !pref )
- return -1;
-
- int catId = pref->addPreference( moduleName(), -1 );
- if ( catId == -1 )
- return -1;
-
- return pref->addPreference( label, catId );
-}
-
-/*!Add preference to preferences.*/
-int SalomeApp_Module::addPreference( const QString& label, const int pId, const int type,
- const QString& section, const QString& param )
-{
- SalomeApp_Preferences* pref = preferences();
- if ( !pref )
- return -1;
-
- return pref->addPreference( moduleName(), label, pId, type, section, param );
-}
-
-/*!Gets property of preferences.*/
-QVariant SalomeApp_Module::preferenceProperty( const int id, const QString& prop ) const
-{
- QVariant var;
- SalomeApp_Preferences* pref = preferences();
- if ( pref )
- var = pref->itemProperty( id, prop );
- return var;
-}
-
-
-/*!Set property of preferences.*/
-void SalomeApp_Module::setPreferenceProperty( const int id, const QString& prop, const QVariant& var )
-{
- SalomeApp_Preferences* pref = preferences();
- if ( pref )
- pref->setItemProperty( id, prop, var );
-}
-
-/*!
- * \brief Update something in accordance with update flags
- * \param theFlags - update flags
-*
-* Update viewer or/and object browser etc. in accordance with update flags ( see
-* SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method for their
-* own purposes
-*/
-void SalomeApp_Module::update( const int theFlags )
-{
- if ( theFlags & UF_Model )
- {
- if( CAM_DataModel* aDataModel = dataModel() )
- if( SalomeApp_DataModel* aModel = dynamic_cast<SalomeApp_DataModel*>( aDataModel ) )
- aModel->update( 0, dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
- }
- if ( theFlags & UF_ObjBrowser )
- getApp()->objectBrowser()->updateTree( 0 );
- if ( theFlags & UF_Controls )
- updateControls();
- if ( theFlags & UF_Viewer )
- {
- if ( SUIT_ViewManager* viewMgr = getApp()->activeViewManager() )
- if ( SUIT_ViewWindow* viewWnd = viewMgr->getActiveView() )
- {
- if ( viewWnd->inherits( "SVTK_ViewWindow" ) )
- ( (SVTK_ViewWindow*)viewWnd )->Repaint();
- else if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
- ( (OCCViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
- else if ( viewWnd->inherits( "Plot2d_ViewWindow" ) )
- ( (Plot2d_ViewWindow*)viewWnd )->getViewFrame()->Repaint();
- else if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
- ( (GLViewer_ViewFrame*)viewWnd )->getViewPort()->onUpdate();
- }
- }
-}
-
-/*!
- * \brief Updates controls
-*
-* Updates (i.e. disable/enable) controls states (menus, tool bars etc.). This method is
-* called from update( UF_Controls ). You may redefine it in concrete module.
-*/
-void SalomeApp_Module::updateControls()
-{
-}
-
-/*!
- * \brief Starts operation with given identifier
- * \param id - identifier of operation to be started
-*
-* Module stores operations in map. This method starts operation by id.
-* If operation isn't in map, then it will be created by createOperation method
-* and will be inserted to map
-*/
-void SalomeApp_Module::startOperation( const int id )
-{
- SalomeApp_Operation* op = 0;
- if( myOperations.contains( id ) )
- op = myOperations[ id ];
- else
- {
- op = createOperation( id );
- if( op )
- {
- myOperations.insert( id, op );
- op->setModule( this );
- connect( op, SIGNAL( stopped( SUIT_Operation* ) ), this, SLOT( onOperationStopped( SUIT_Operation* ) ) );
- connect( op, SIGNAL( destroyed() ), this, SLOT( onOperationDestroyed() ) );
- }
- }
-
- if( op )
- op->start();
-}
-
-/*!
- * \brief Creates operation with given identifier
- * \param id - identifier of operation to be started
- * \return Pointer on created operation or NULL if operation is not created
-*
-* Creates operation with given id. You should not call this method, it will be called
-* automatically from startOperation. You may redefine this method in concrete module to
-* create operations.
-*/
-SalomeApp_Operation* SalomeApp_Module::createOperation( const int id ) const
-{
- if( id==-1 )
- return 0;
-
- if( id==myDisplay )
- return new SalomeApp_ShowHideOp( SalomeApp_ShowHideOp::DISPLAY );
- else if( id==myErase )
- return new SalomeApp_ShowHideOp( SalomeApp_ShowHideOp::ERASE );
- else if( id==myDisplayOnly )
- return new SalomeApp_ShowHideOp( SalomeApp_ShowHideOp::DISPLAY_ONLY );
- else
- return 0;
-}
-
-/*!
- * \brief Virtual protected slot called when operation stopped
- * \param theOp - stopped operation
-*
-* Virtual protected slot called when operation stopped. Redefine this slot if you want to
-* perform actions after stopping operation
-*/
-void SalomeApp_Module::onOperationStopped( SUIT_Operation* /*theOp*/ )
-{
-}
-
-/*!
- * \brief Virtual protected slot called when operation destroyed
- * \param theOp - destroyed operation
-*
-* Virtual protected slot called when operation destroyed. Redefine this slot if you want to
-* perform actions after destroying operation. Base implementation removes pointer on
-* destroyed operation from the map of operations
-*/
-void SalomeApp_Module::onOperationDestroyed()
-{
- const QObject* s = sender();
- if( s && s->inherits( "SalomeApp_Operation" ) )
- {
- const SalomeApp_Operation* op = ( SalomeApp_Operation* )s;
- MapOfOperation::const_iterator anIt = myOperations.begin(),
- aLast = myOperations.end();
- for( ; anIt!=aLast; anIt++ )
- if( anIt.data()==op )
- {
- myOperations.remove( anIt.key() );
- break;
- }
- }
-}
-
-SalomeApp_Displayer* SalomeApp_Module::displayer()
-{
- return 0;
-}
-
-void SalomeApp_Module::onShowHide()
-{
- if( !sender()->inherits( "QAction" ) || !popupMgr() )
- return;
-
- QAction* act = ( QAction* )sender();
- int id = actionId( act );
- if( id!=-1 )
- startOperation( id );
+ return LightApp_Module::createSelection();//new SalomeApp_Selection();
}
#define SALOMEAPP_MODULE_H
#include "SalomeApp.h"
-#include "SalomeApp_Selection.h"
-#include <CAM_Module.h>
+#include <LightApp_Module.h>
#include <string>
-class QDockWindow;
-
-class CAM_Study;
-
-class QtxPopupMgr;
-
-class SUIT_Operation;
-class SUIT_Convertor;
-class SUIT_ViewModel;
-class SUIT_DataObject;
-
-class SalomeApp_DataModel;
+class CAM_DataModel;
class SalomeApp_Application;
-class SalomeApp_Preferences;
-class SalomeApp_SelectionManager;
-class SalomeApp_Operation;
-class SalomeApp_SwitchOp;
-class SalomeApp_Displayer;
+class LightApp_Operation;
+class LightApp_Selection;
+
+class QString;
/*!
* \brief Base class for all salome modules
*/
-class SALOMEAPP_EXPORT SalomeApp_Module : public CAM_Module
+class SALOMEAPP_EXPORT SalomeApp_Module : public LightApp_Module
{
Q_OBJECT
SalomeApp_Module( const QString& );
virtual ~SalomeApp_Module();
- virtual void initialize( CAM_Application* );
- virtual void windows( QMap<int, int>& ) const;
- virtual void viewManagers( QStringList& ) const;
- virtual SalomeApp_Displayer* displayer();
-
/*! engineIOR() should be a pure virtual method, to avoid logical errors!\n
* Implementation in derived classes can return the following values:\n
* module`s engine IOR - means that this is a standard SALOME module with a CORBA engine
- * \li "" (empty string) - means that this is a light module, default engine should be used for interaction with SALOMEDS persistence
- * \li "-1" - means that this is a light module, SALOMEDS persistence is not used at all\n
+ * \li "" (empty string) - means that this not correct SALOME module
*/
virtual QString engineIOR() const = 0;
-
- virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
-
- virtual void createPreferences();
/*! Convenient shortcuts*/
-
- SalomeApp_Application* getApp() const;
-
- virtual void update( const int );
- // Update viewer or/and object browser etc. in accordance with update flags
- // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
- // for their own purposes
-
- void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
- // Update object bropwser ( for updating model or whole object browser use update() method
- // can be used )
-
- virtual void selectionChanged();
- virtual void preferencesChanged( const QString&, const QString& );
- virtual void studyActivated() {};
-
-public slots:
- virtual bool activateModule( SUIT_Study* );
- virtual bool deactivateModule( SUIT_Study* );
-
- void MenuItem();
-
-protected slots:
- virtual void onModelSaved();
- virtual void onModelOpened();
- virtual void onModelClosed();
- virtual void onOperationStopped( SUIT_Operation* );
- virtual void onOperationDestroyed();
- virtual void onShowHide();
+ SalomeApp_Application* getApp() const;
protected:
- QtxPopupMgr* popupMgr();
- SalomeApp_Preferences* preferences() const;
-
virtual CAM_DataModel* createDataModel();
- virtual SalomeApp_Selection* createSelection() const;
- virtual void updateControls();
+ virtual LightApp_Selection* createSelection() const;
- /*! Module stores operations in map. This method starts operation by id.
- * If operation isn't in map, then it will be created by createOperation method
- * and will be inserted to map
- */
- void startOperation( const int );
-
- /*! Create operation by its id. You must not call this method, it will be called automatically
- * by startOperation. Please redefine this method in current module
- */
- virtual SalomeApp_Operation* createOperation( const int ) const;
-
- int addPreference( const QString& label );
- int addPreference( const QString& label, const int pId, const int = -1,
- const QString& section = QString::null,
- const QString& param = QString::null );
- QVariant preferenceProperty( const int, const QString& ) const;
- void setPreferenceProperty( const int, const QString&, const QVariant& );
-
-private:
- typedef QMap<int,SalomeApp_Operation*> MapOfOperation;
-
-private:
- QtxPopupMgr* myPopupMgr;
- MapOfOperation myOperations;
- SalomeApp_SwitchOp* mySwitchOp;
- int myDisplay, myErase, myDisplayOnly;
};
#endif
#include <utilities.h>
#include <Container_init_python.hxx>
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
+
+#include <string>
+#include <vector>
+
+#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
+
+#include <cStringIO.h>
/*!
* constructor : multi Python interpreter, one per SALOME study.
return true;
}
+
+void SalomeApp_PyInterp::init_python()
+{
+ /*
+ * Initialize the main state (_gtstate) if not already done
+ * The lock is released on init_python output
+ * It is the caller responsability to acquire it if needed
+ */
+ MESSAGE("PyInterp_base::init_python");
+ ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main
+ SCRUTE(KERNEL_PYTHON::_gtstate);
+// if(!_gtstate){
+// PyReleaseLock aReleaseLock;
+// Py_Initialize(); // Initialize the interpreter
+// PyEval_InitThreads(); // Initialize and acquire the global interpreter lock
+// PySys_SetArgv(_argc,_argv); // initialize sys.argv
+// _gtstate = PyThreadState_Get();
+// }
+}
+
SalomeApp_PyInterp();
virtual ~SalomeApp_PyInterp();
+ virtual void init_python();
+
protected:
virtual bool initContext();
};
#include "SalomeApp_Module.h"
#include "SalomeApp_DataModel.h"
-#include "SalomeApp_RootObject.h"
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Application.h"
+#include "SalomeApp_Engine_i.hxx"
+
+#include "LightApp_RootObject.h"
#include <OB_Browser.h>
#include <SUIT_ResourceMgr.h>
+#include <qptrlist.h>
+
#include "utilities.h"
+#include "string.h"
+#include "vector.h"
+
+#include "SALOMEDS_Tool.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOME_Exception)
/*!
Constructor.
*/
SalomeApp_Study::SalomeApp_Study( SUIT_Application* app )
-: CAM_Study( app )
+: LightApp_Study( app )
{
}
setStudyName( aName );
// create myRoot
- setRoot( new SalomeApp_RootObject( this ) );
+ setRoot( new LightApp_RootObject( this ) );
CAM_Study::createDocument();
-
emit created( this );
}
setStudyDS( study );
- setRoot( new SalomeApp_RootObject( this ) ); // create myRoot
+ setRoot( new LightApp_RootObject( this ) ); // create myRoot
// update loaded data models: call open() and update() on them.
ModelList dm_s;
setStudyDS( study );
- setRoot( new SalomeApp_RootObject( this ) ); // create myRoot
+ setRoot( new LightApp_RootObject( this ) ); // create myRoot
//SRN: BugID IPAL9021, put there the same code as in a method openDocument
// update loaded data models: call open() and update() on them.
ModelList dm_s;
dataModels( dm_s );
+
for ( ModelListIterator it( dm_s ); it.current(); ++it )
openDataModel( studyName(), it.current() );
//=======================================================================
// name : saveDocumentAs
-/*! Purpose : Save document */
+/*! Purpose : Save document*/
//=======================================================================
bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
{
ModelList list; dataModels( list );
SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
- for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() )
- aModel->saveAs( theFileName, this );
+ QStringList listOfFiles;
+ for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() ) {
+ listOfFiles.clear();
+ aModel->saveAs( theFileName, this, listOfFiles );
+ if ( !listOfFiles.isEmpty() )
+ saveModuleData(aModel->module()->name(), listOfFiles);
+ }
// save SALOMEDS document
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
SalomeApp_Application::studyMgr()->SaveAs ( theFileName.latin1(), studyDS(), isMultiFile );
bool res = CAM_Study::saveDocumentAs( theFileName ); //SRN: BugID IPAL9377, removed usage of uninitialized variable <res>
-
+ res = res && saveStudyData(theFileName);
if ( res )
emit saved( this );
//=======================================================================
// name : saveDocument
-/*! Purpose : Save document */
+/*! Purpose : Save document*/
//=======================================================================
-void SalomeApp_Study::saveDocument()
+bool SalomeApp_Study::saveDocument()
{
ModelList list; dataModels( list );
SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
- for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() )
- aModel->save();
-
- CAM_Study::saveDocument();
+ QStringList listOfFiles;
+ for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() ) {
+ listOfFiles.clear();
+ aModel->save(listOfFiles);
+ if ( !listOfFiles.isEmpty() )
+ saveModuleData(aModel->module()->name(), listOfFiles);
+ }
// save SALOMEDS document
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if( !resMgr )
- return;
-
+ return false;
+
bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ),
isAscii = resMgr->booleanValue( "Study", "ascii_file", true );
isAscii ? SalomeApp_Application::studyMgr()->SaveASCII( studyDS(), isMultiFile ) :
SalomeApp_Application::studyMgr()->Save ( studyDS(), isMultiFile );
- emit saved( this );
+ bool res = CAM_Study::saveDocument();
+
+ res = res && saveStudyData(studyName());
+ if ( res )
+ emit saved( this );
+
+ return res;
}
//================================================================
// Function : closeDocument
-/*! Purpose : Close document */
+/*! Purpose : Close document*/
//================================================================
void SalomeApp_Study::closeDocument(bool permanently)
{
- // Inform everybody that this study is going to close when it's most safe to,
- // i.e. in the very beginning
- emit closed( this );
+ LightApp_Study::closeDocument(permanently);
// close SALOMEDS document
_PTR(Study) studyPtr = studyDS();
SALOMEDSClient_Study* aStudy = 0;
setStudyDS( _PTR(Study)(aStudy) );
}
-
- CAM_Study::closeDocument(permanently);
}
//================================================================
// Function : isModified
-/*! Purpose : Check data model on modifications.*/
+// Purpose :
//================================================================
bool SalomeApp_Study::isModified() const
{
bool isAnyChanged = studyDS() && studyDS()->IsModified();
- ModelList list; dataModels( list );
+ if (!isAnyChanged)
+ isAnyChanged = LightApp_Study::isModified();
- SalomeApp_DataModel* aModel = 0;
- for ( QPtrListIterator<CAM_DataModel> it( list ); it.current() && !isAnyChanged; ++it ){
- aModel = dynamic_cast<SalomeApp_DataModel*>( it.current() );
- if ( aModel )
- isAnyChanged = aModel->isModified();
- }
return isAnyChanged;
}
bool SalomeApp_Study::isSaved() const
{
bool isAllSaved = studyDS() && studyDS()->GetPersistentReference().size();
- ModelList list; dataModels( list );
+ if (!isAllSaved)
+ isAllSaved = LightApp_Study::isModified();
- SalomeApp_DataModel* aModel = 0;
- for ( QPtrListIterator<CAM_DataModel> it( list ); it.current() && isAllSaved; ++it ){
- aModel = dynamic_cast<SalomeApp_DataModel*>( it.current() );
- if ( aModel )
- isAllSaved = aModel->isSaved();
- }
return isAllSaved;
}
+//=======================================================================
+// name : saveModuleData
+/*! Purpose : save list file for module 'theModuleName' */
+//=======================================================================
+void SalomeApp_Study::saveModuleData( QString theModuleName, QStringList theListOfFiles )
+{
+ int aNb = theListOfFiles.count();
+ if ( aNb == 0 )
+ return;
+
+ std::vector<std::string> aListOfFiles ( aNb );
+ int anIndex = 0;
+ for ( QStringList::Iterator it = theListOfFiles.begin(); it != theListOfFiles.end(); ++it ) {
+ if ( (*it).isEmpty() )
+ continue;
+ aListOfFiles[anIndex] = (*it).latin1();
+ anIndex++;
+ }
+ SetListOfFiles(theModuleName, aListOfFiles);
+}
+
+//=======================================================================
+// name : openModuleData
+/*! Purpose : gets list of file for module 'theModuleNam' */
+//=======================================================================
+void SalomeApp_Study::openModuleData( QString theModuleName, QStringList& theListOfFiles )
+{
+ std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName );
+
+ int i, aLength = aListOfFiles.size() - 1;
+ if ( aLength < 0 )
+ return;
+
+ //Get a temporary directory for saved a file
+ theListOfFiles.append(aListOfFiles[0].c_str());
+
+ for(i = 0; i < aLength; i++)
+ theListOfFiles.append(aListOfFiles[i+1].c_str());
+}
+
+//=======================================================================
+// name : saveStudyData
+/*! Purpose : save data from study */
+//=======================================================================
+bool SalomeApp_Study::saveStudyData( const QString& theFileName )
+{
+ ModelList list; dataModels( list );
+ SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
+ std::vector<std::string> listOfFiles(0);
+ for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() )
+ SetListOfFiles(aModel->module()->name(), listOfFiles);
+ return true;
+}
+
+//=======================================================================
+// name : openStudyData
+/*! Purpose : open data for study */
+//=======================================================================
+bool SalomeApp_Study::openStudyData( const QString& theFileName )
+{
+ return true;
+}
+
/*!
Set studyDS.
*/
CAM_Study::dataModelInserted(dm);
- // Create SComponent for module, using default engine (CORBAless)
- SalomeApp_Module* aModule = (SalomeApp_Module*)(dm->module());
- if (aModule) {
- QString anEngineIOR = aModule->engineIOR();
- if (anEngineIOR.isEmpty()) { // CORBAless module
- // Check SComponent existance
- _PTR(SComponent) aComp = studyDS()->FindComponent(dm->module()->name());
- if (!aComp) {
- // Create SComponent
- _PTR(StudyBuilder) aBuilder = studyDS()->NewBuilder();
- aComp = aBuilder->NewComponent(dm->module()->name());
-
- // Set default engine IOR
- aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().latin1());
+ // addComponent(dm);
+}
+
+/*!
+ Create SComponent for module, using default engine (CORBAless)
+*/
+void SalomeApp_Study::addComponent(const CAM_DataModel* dm)
+{
+ SalomeApp_Module* aModule = dynamic_cast<SalomeApp_Module*>( dm->module() );
+ // 1. aModule == 0 means that this is a light module (no CORBA enigine)
+ if (!aModule) {
+ // Check SComponent existance
+ _PTR(Study) aStudy = studyDS();
+ if (!aStudy)
+ return;
+ _PTR(SComponent) aComp = aStudy->FindComponent(dm->module()->name());
+ if (!aComp) {
+ // Create SComponent
+ _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+ aComp = aBuilder->NewComponent(dm->module()->name());
+ aBuilder->SetName(aComp, dm->module()->moduleName());
+ QString anIconName = dm->module()->iconName();
+ if (!anIconName.isEmpty()) {
+ _PTR(AttributePixMap) anAttr = aBuilder->FindOrCreateAttribute(aComp, "AttributePixMap");
+ if (anAttr)
+ anAttr->SetPixMap(anIconName);
}
+ // Set default engine IOR
+ aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().latin1());
+ SalomeApp_DataModel::BuildTree( aComp, root(), this, /*skipExisitng=*/true );
}
}
}
if (!dm)
return false;
- SalomeApp_DataModel* aDM = (SalomeApp_DataModel*)(dm);
- if (aDM && aDM->open(studyName, this)) {
+ // SalomeApp_DataModel* aDM = (SalomeApp_DataModel*)(dm);
+ SalomeApp_Module* aModule = dynamic_cast<SalomeApp_Module*>( dm->module() );
+ _PTR(Study) aStudy = studyDS(); // shared_ptr cannot be used here
+ _PTR(SComponent) aSComp;
+ QString anEngine;
+ // 1. aModule == 0 means that this is a light module (no CORBA enigine)
+ if (!aModule) {
+ anEngine = SalomeApp_Application::defaultEngineIOR();
+ aSComp = aStudy->FindComponent(dm->module()->name());
+ }
+ else {
+ SalomeApp_DataModel* aDM = dynamic_cast<SalomeApp_DataModel*>( dm );
+ if ( aDM ) {
+ QString anId = aDM->getRootEntry( this );
+ if ( anId.isEmpty() )
+ return true; // Probably nothing to load
+ anEngine = aDM->getModule()->engineIOR();
+ if ( anEngine.isEmpty() )
+ return false;
+ aSComp = aStudy->FindComponentID( std::string( anId.latin1() ) );
+ }
+ }
+ if ( aSComp ) {
+ _PTR(StudyBuilder) aBuilder( aStudy->NewBuilder() );
+ if ( aBuilder ) {
+ try {
+ aBuilder->LoadWith( aSComp, std::string( anEngine.latin1() ) );
+ }
+ catch( const SALOME::SALOME_Exception& ) {
+ // Oops, something went wrong while loading -> return an error
+ return false;
+ }
+ // Something has been read -> create data model tree
+ //SalomeApp_DataModel* aDM = dynamic_cast<SalomeApp_DataModel*>( dm );
+ // aDM->buildTree( aSComp, 0, this );
+ }
+ } else {
+ // Don't return false here, for there might be no data
+ // for a given component in the study yet
+ }
+ QStringList listOfFiles;
+ openModuleData(dm->module()->name(), listOfFiles);
+ if (dm && dm->open(studyName, this, listOfFiles)) {
+ // Remove the files and temporary directory, created
+ // for this module by LightApp_Engine_i::Load()
+ bool isMultiFile = false; // TODO: decide, how to access this parameter
+ RemoveTemporaryFiles( dm->module()->name(), isMultiFile );
+
// Something has been read -> create data model tree
- aDM->update(NULL, this);
+ LightApp_DataModel* aDM = dynamic_cast<LightApp_DataModel*>( dm );
+ if ( aDM )
+ aDM->update(NULL, this);
return true;
}
-
return false;
}
return newName;
}
+//================================================================
+// Function : GetListOfFiles
+/*! Purpose : to be used by CORBAless modules*/
+//================================================================
+std::vector<std::string> SalomeApp_Study::GetListOfFiles( const char* theModuleName ) const
+{
+ SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
+ if (aDefaultEngine)
+ return aDefaultEngine->GetListOfFiles(id(), theModuleName);
+
+ std::vector<std::string> aListOfFiles;
+ return aListOfFiles;
+}
+
+//================================================================
+// Function : SetListOfFiles
+/*! Purpose : to be used by CORBAless modules*/
+//================================================================
+void SalomeApp_Study::SetListOfFiles ( const char* theModuleName,
+ const std::vector<std::string> theListOfFiles )
+{
+ SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
+ if (aDefaultEngine)
+ aDefaultEngine->SetListOfFiles(theListOfFiles, id(), theModuleName);
+}
+
+//================================================================
+// Function : GetTmpDir
+/*! Purpose : to be used by CORBAless modules*/
+//================================================================
+std::string SalomeApp_Study::GetTmpDir ( const char* theURL, const bool isMultiFile )
+{
+ std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL);
+ std::string aTmpDir = isMultiFile ? anURLDir : SALOMEDS_Tool::GetTmpDir();
+ return aTmpDir;
+}
+
+//================================================================
+// Function : RemoveTemporaryFiles
+/*! Purpose : to be used by CORBAless modules*/
+//================================================================
+void SalomeApp_Study::RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const
+{
+ if (isMultiFile)
+ return;
+
+ std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName );
+ if (aListOfFiles.size() > 0) {
+ std::string aTmpDir = aListOfFiles[0];
+
+ const int n = aListOfFiles.size() - 1;
+ SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
+ aSeq->length(n);
+ for (int i = 0; i < n; i++)
+ aSeq[i] = CORBA::string_dup(aListOfFiles[i + 1].c_str());
+
+ SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
+ }
+}
+
+// END: methods to be used by CORBAless modules
+
void SalomeApp_Study::deleteReferencesTo( _PTR( SObject ) obj )
{
_PTR(StudyBuilder) sb = studyDS()->NewBuilder();
}
}
}
+
+//================================================================
+// Function : referencedToEntry
+/*! Purpose : Return referenced entry from entry*/
+//================================================================
+QString SalomeApp_Study::referencedToEntry( const QString& entry )
+{
+ _PTR(SObject) obj = studyDS()->FindObjectID( entry );
+ _PTR(SObject) refobj;
+
+ if( obj && obj->ReferencedObject( refobj ) )
+ return refobj->GetID();
+ return LightApp_Study::referencedToEntry( entry );
+}
+
+//================================================================
+// Function : componentDataType
+/*! Purpose : Return component data type from entry*/
+//================================================================
+QString SalomeApp_Study::componentDataType( const QString& entry )
+{
+ _PTR(SObject) obj( studyDS()->FindObjectID( entry ) );
+ if ( !obj )
+ return LightApp_Study::componentDataType( entry );
+ return obj->GetFatherComponent()->ComponentDataType().c_str();
+}
#include "SalomeApp.h"
-#include <CAM_Study.h>
+#include <LightApp_Study.h>
#ifdef WIN32
#pragma warning( disable:4251 )
#include "SALOMEDSClient.hxx"
-class SALOMEAPP_EXPORT SalomeApp_Study : public CAM_Study
+class SALOMEAPP_EXPORT SalomeApp_Study : public LightApp_Study
{
Q_OBJECT
virtual bool openDocument( const QString& );
virtual bool loadDocument( const QString& );
- virtual void saveDocument();
+ virtual bool saveDocument();
virtual bool saveDocumentAs( const QString& );
virtual void closeDocument(bool permanently = true);
virtual bool isSaved() const;
virtual bool isModified() const;
+ virtual void addComponent ( const CAM_DataModel* dm);
+
_PTR(Study) studyDS() const;
+ virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile);
+
// to delete all references to object, whose have the same component
void deleteReferencesTo( _PTR( SObject ) );
-signals:
- void saved( SUIT_Study* );
- void opened( SUIT_Study* );
- void closed( SUIT_Study* );
- void created( SUIT_Study* );
+ virtual QString componentDataType( const QString& );
+ virtual QString referencedToEntry( const QString& );
+
+protected:
+ virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles );
+ virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles );
+ virtual bool saveStudyData ( const QString& theFileName );
+ virtual bool openStudyData ( const QString& theFileName );
+
+ virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
+ virtual void SetListOfFiles ( const char* theModuleName,
+ const std::vector<std::string> theListOfFiles);
+ virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile) const;
protected:
virtual void dataModelInserted( const CAM_DataModel* );
_PTR(Study) myStudyDS;
};
-
#ifdef WIN32
#pragma warning( default:4251 )
#endif
#include "SalomeApp_TypeFilter.h"
-#include "SalomeApp_DataOwner.h"
+#include "LightApp_DataOwner.h"
#include "SalomeApp_Study.h"
#include <SALOMEDS_SObject.hxx>
*/
bool SalomeApp_TypeFilter::isOk( const SUIT_DataOwner* sOwner ) const
{
- const SalomeApp_DataOwner* owner = dynamic_cast<const SalomeApp_DataOwner*> ( sOwner );
+ const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*> ( sOwner );
SalomeApp_Study* aDoc = getStudy();
if (owner && aDoc && aDoc->studyDS())
OCCViewer = $(SUITRoot)/resources
VTKViewer = $(SUITRoot)/resources
SVTK = $(SUITRoot)/resources
+LightApp = $(SUITRoot)/resources
SalomeApp = $(SUITRoot)/resources
GEOM = $(GEOM_ROOT_DIR)/share/salome/resources
SMESH = $(SMESH_ROOT_DIR)/share/salome/resources
<parameter name="xterm" value="no"/>
<parameter name="portkill" value="no"/>
<parameter name="killall" value="no"/>
- <parameter name="modules" value="GEOM,SMESH,VISU,SUPERV,MED,COMPONENT"/>
+ <parameter name="modules" value="GEOM,LIGHT,SMESH,VISU,SUPERV,MED,COMPONENT,HELLO"/>
<parameter name="pyModules" value=""/>
<parameter name="embedded" value="SalomeAppEngine,study"/>
<parameter name="standalone" value="pyContainer,cppContainer,registry,moduleCatalog"/>
<parameter name="OCCViewer" value="${SUITRoot}/resources"/>
<parameter name="VTKViewer" value="${SUITRoot}/resources"/>
<parameter name="SVTK" value="${SUITRoot}/resources"/>
+ <parameter name="LightApp" value="${SUITRoot}/resources"/>
<parameter name="SalomeApp" value="${SUITRoot}/resources"/>
<parameter name="OB" value="${SUITRoot}/resources"/>
<parameter name="CAM" value="${SUITRoot}/resources"/>
<parameter name="GEOM" value="${GEOM_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="LIGHT" value="${LIGHT_ROOT_DIR}/share/salome/resources"/>
<parameter name="SMESH" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
<parameter name="VISU" value="${VISU_ROOT_DIR}/share/salome/resources"/>
<parameter name="SUPERV" value="${SUPERV_ROOT_DIR}/share/salome/resources"/>
<parameter name="MED" value="${MED_ROOT_DIR}/share/salome/resources"/>
<parameter name="StdMeshers" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
<parameter name="COMPONENT" value="${COMPONENT_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="HELLO" value="${HELLO1_ROOT_DIR}/share/salome/resources"/>
<parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources"/>
<parameter name="GHS3DPlugin" value="${GHS3DPLUGIN_ROOT_DIR}/share/salome/resources"/>
<parameter name="ToolsGUI" value="${SUITRoot}/resources"/>
<parameter name="name" value="Geometry"/>
<parameter name="icon" value="ModuleGeom.png"/>
</section>
+ <section name="LIGHT">
+ <parameter name="name" value="Light"/>
+ <parameter name="icon" value="LIGHT.png"/>
+ </section>
<section name="SMESH">
<parameter name="name" value="Mesh"/>
<parameter name="icon" value="ModuleMesh.png"/>
<parameter name="name" value="Med"/>
<parameter name="icon" value="ModuleMed.png"/>
</section>
+ <section name="HELLO">
+ <parameter name="name" value="Hello"/>
+ <parameter name="icon" value="HELLO.png"/>
+ </section>
<!-- values below this line are just an example, they are not used -->
<section name="application">
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
-msgid "ABOUT"
-msgstr "icon_about.png"
-
-msgid "ABOUT_SPLASH"
-msgstr "icon_about.png"
-
-msgid "APP_DEFAULT_ICO"
-msgstr "icon_default.png"
-
-msgid "APP_MODULE_ICO"
-msgstr "icon_module.png"
-
-msgid "APP_MODULE_BIG_ICO"
-msgstr "icon_module_big.png"
-
-msgid "ICON_SELECT"
-msgstr "icon_select.png"
-
-msgid "APP_BASE_LOGO"
-msgstr "icon_applogo.png"
-
//=======================================================================================
-msgid "SalomeApp_Application::OBJECT_BROWSER"
-msgstr "Object Browser"
-
msgid "SalomeApp_Application::PYTHON_CONSOLE"
msgstr "Python Console"
-msgid "SalomeApp_Application::LOG_WINDOW"
-msgstr "Message Window"
-
-msgid "SalomeApp_Application::DATA_MODELS"
-msgstr "Data models"
-
-msgid "SalomeApp_Application::NEW_WINDOW_0"
-msgstr "GL view"
-
-msgid "SalomeApp_Application::NEW_WINDOW_1"
-msgstr "Plot2d view"
-
-msgid "SalomeApp_Application::NEW_WINDOW_2"
-msgstr "OCC view"
-
-msgid "SalomeApp_Application::NEW_WINDOW_3"
-msgstr "VTK view"
-
msgid "SalomeApp_Application::TOT_DESK_FILE_DUMP_STUDY"
msgstr "Dump study"
msgid "SalomeApp_Application::TOT_FILE_DESK_PREFERENCES"
msgstr "Preferences"
-msgid "SalomeApp_Application::MEN_DESK_PREFERENCES"
-msgstr "Preferences..."
-
-msgid "SalomeApp_Application::PRP_DESK_PREFERENCES"
-msgstr "Allow to change the preferences"
-
msgid "SalomeApp_Application::MEN_DESK_TOOLS"
msgstr "Tools"
msgid "SalomeApp_Application::PRP_DESK_PROPERTIES"
msgstr "Edits study properties"
-msgid "SalomeApp_Application::MEN_REFRESH"
-msgstr "Refresh"
+msgid "SalomeApp_Application::PREF_CATEGORY_SALOME"
+msgstr "SALOME"
+
+msgid "SalomeApp_Application::PREF_TAB_OBJBROWSER"
+msgstr "Object browser"
msgid "SalomeApp_Application::MEN_OPENWITH"
msgstr "Activate Module"
msgid "SalomeApp_Application::MEN_VIEW_WNDS"
msgstr "Windows"
-msgid "SalomeApp_Application::PRP_MODULE"
-msgstr "Switch to the module \"%1\""
-
-msgid "SalomeApp_Application::PRP_APP_MODULE"
-msgstr "Switch to SALOME platform neutral point"
-
-msgid "SalomeApp_Application::INF_TOOLBAR_MODULES"
-msgstr "Modules"
-
-msgid "SalomeApp_Application::INF_CANCELLED"
-msgstr "Module activation cancelled"
-
-//=======================================================================================
-
-msgid "SalomeApp_Application::MEN_DESK_MODULE_HELP"
-msgstr "Module Help"
-
//=======================================================================================
-msgid "SalomeApp_Application::PREFERENCES_NOT_LOADED"
-msgstr "Preferences for module \"<b>%1</b>\" will be available when the module will be loaded"
-
-msgid "SalomeApp_Application::PREF_FONT"
-msgstr "Font"
-
-msgid "SalomeApp_Application::PREF_CATEGORY_SALOME"
-msgstr "SALOME"
-
-msgid "SalomeApp_Application::PREF_TAB_GENERAL"
-msgstr "General"
-
-msgid "SalomeApp_Application::PREF_TAB_OBJBROWSER"
-msgstr "Object browser"
-
-msgid "SalomeApp_Application::PREF_GROUP_EXT_BROWSER"
-msgstr "External browser"
-
-msgid "SalomeApp_Application::PREF_APP"
-msgstr "Application"
-
-msgid "SalomeApp_Application::PREF_PARAM"
-msgstr "Parameters"
-
msgid "SalomeApp_Application::PREF_GROUP_DEF_COLUMNS"
msgstr "Default columns"
msgid "SalomeApp_Application::PREF_AUTO_SIZE"
msgstr "Auto size columns"
-msgid "SalomeApp_Application::PREF_GROUP_STUDY"
-msgstr "Study properties"
-
-msgid "SalomeApp_Application::PREF_GROUP_PY_CONSOLE"
-msgstr "Python console properties"
-
-msgid "SalomeApp_Application::PREF_TAB_VIEWERS"
-msgstr "Viewers"
-
-msgid "SalomeApp_Application::PREF_GROUP_OCCVIEWER"
-msgstr "OCC Viewer 3d"
-
-msgid "SalomeApp_Application::PREF_MULTI_FILE"
-msgstr "Multi file save"
-
-msgid "SalomeApp_Application::PREF_ASCII_FILE"
-msgstr "ASCII save"
-
-msgid "SalomeApp_Application::PREF_UNDO_LEVEL"
-msgstr "Undo level"
-
-msgid "SalomeApp_Application::PREF_GROUP_VTKVIEWER"
-msgstr "VTK Viewer 3d"
-
-msgid "SalomeApp_Application::PREF_VIEWER_BACKGROUND"
-msgstr "Background color"
-
-msgid "SalomeApp_Application::PREF_TRIHEDRON_SIZE"
-msgstr "Trihedron size"
-
-msgid "SalomeApp_Application::PREF_ISOS_U"
-msgstr "Number of isolines along U"
-
-msgid "SalomeApp_Application::PREF_ISOS_V"
-msgstr "Number of isolines along V"
-
-msgid "SalomeApp_Application::PREF_TRIHEDRON_SHOW"
-msgstr "Show trihedron"
-
-msgid "SalomeApp_Application::PREF_GROUP_PLOT2DVIEWER"
-msgstr "Plot2d Viewer"
-
-msgid "SalomeApp_Application::PREF_SHOW_LEGEND"
-msgstr "Show legend"
-
-msgid "SalomeApp_Application::PREF_LEGEND_POSITION"
-msgstr "Legend position:"
-
-msgid "SalomeApp_Application::PREF_LEFT"
-msgstr "Left"
-
-msgid "SalomeApp_Application::PREF_RIGHT"
-msgstr "Right"
-
-msgid "SalomeApp_Application::PREF_TOP"
-msgstr "Top"
-
-msgid "SalomeApp_Application::PREF_BOTTOM"
-msgstr "Bottom"
-
-msgid "SalomeApp_Application::PREF_CURVE_TYPE"
-msgstr "Curve type:"
-
-msgid "SalomeApp_Application::PREF_POINTS"
-msgstr "Points"
-
-msgid "SalomeApp_Application::PREF_LINES"
-msgstr "Lines"
-
-msgid "SalomeApp_Application::PREF_SPLINE"
-msgstr "Spline"
-
-msgid "SalomeApp_Application::PREF_MARKER_SIZE"
-msgstr "Marker size:"
-
-msgid "SalomeApp_Application::PREF_LINEAR"
-msgstr "Linear"
-
-msgid "SalomeApp_Application::PREF_LOGARITHMIC"
-msgstr "Logarithmic"
-
-msgid "SalomeApp_Application::PREF_HOR_AXIS_SCALE"
-msgstr "Horizontal axis scale:"
-
-msgid "SalomeApp_Application::PREF_VERT_AXIS_SCALE"
-msgstr "Vertical axis scale:"
-
-msgid "SalomeApp_Application::PREF_TAB_DIRECTORIES"
-msgstr "Directories"
-
-msgid "SalomeApp_Application::PREF_GROUP_DIRECTORIES"
-msgstr "Quick directory list"
-
//=======================================================================================
msgid "SalomeApp_Application::OBJ_BROWSER_NAME"
//=======================================================================================
-msgid "SalomeApp_ModuleDlg::CAPTION"
-msgstr "Activate module"
-
-msgid "SalomeApp_ModuleDlg::NEW"
-msgstr "&New"
-
-msgid "SalomeApp_ModuleDlg::OPEN"
-msgstr "&Open"
-
-msgid "SalomeApp_ModuleDlg::LOAD"
-msgstr "&Load"
-
-msgid "SalomeApp_ModuleDlg::CANCEL"
-msgstr "&Cancel"
-
-msgid "SalomeApp_ModuleDlg::ActivateComponent_DESCRIPTION"
-msgstr "Create, open or load study."
-
-//=======================================================================================
-
-msgid "SalomeApp_PreferencesDlg::CAPTION"
-msgstr "Preferences"
-
-//=======================================================================================
-
msgid "SalomeApp_StudyPropertiesDlg::PRP_MODE_FROM_SCRATCH"
msgstr "from scratch"
msgid "SalomeApp_Application::PUBLISH_IN_STUDY"
msgstr "Publish in study"
-msgid "SalomeApp_Application::ACTIVATING_MODULE"
-msgstr "Trying to activate module \"%1\""
-