return true;
}
-/*!
- Opens other study into active Study. If Study is empty - creates it.
- \param theName - name of study
-*/
-bool LightApp_Application::useStudy(const QString& theName)
-{
- createEmptyStudy();
- LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
- bool res = false;
- if (aStudy)
- res = aStudy->loadDocument( theName );
- updateDesktopTitle();
- updateCommandsStatus();
- return res;
-}
-
/*!Gets selection manager.*/
LightApp_SelectionMgr* LightApp_Application::selectionMgr() const
{
icon = resourceMgr()->loadPixmap( "LightApp", tr( "APP_MODULE_BIG_ICO" ), false ); // default icon for any module
bool cancelled = false;
+
while ( !modName.isEmpty() && !activeStudy() && !cancelled ){
LightApp_ModuleDlg aDlg( desktop(), modName, icon );
- int res = aDlg.exec();
+ QMap<int, QString> opmap = activateModuleActions();
+ for ( QMap<int, QString>::ConstIterator it = opmap.begin(); it != opmap.end(); ++it )
+ aDlg.addButton( it.value(), it.key() );
- switch ( res ){
- case 1:
- onNewDoc();
- break;
- case 2:
- onOpenDoc();
- break;
- case 3:
- //onLoadStudy();
- //break;
- case 0:
- default:
+ int res = aDlg.exec();
+ if ( res ) {
+ // some operation is selected
+ moduleActionSelected( res );
+ }
+ else {
+ // cancelled
putInfo( tr("INF_CANCELLED") );
LightApp_ModuleAction* moduleAction =
delete dlg;
}
-/*!
- SLOT: Loads document
- \param aName - name of document
-*/
-bool LightApp_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: Called on selection is changed
Dispatchs active module that selection is changed
}
//myWindows[flag]->setResizeEnabled( true );
- myWindows[flag]->setFeatures( QDockWidget::DockWidgetClosable );
+ myWindows[flag]->setFeatures( QDockWidget::AllDockWidgetFeatures );
myWindows[flag]->setObjectName( QString( "dock_window_%1" ).arg( flag ) );
//myWindows[flag]->setFixedExtentWidth( wid->width() );
//myWindows[flag]->setFixedExtentHeight( wid->height() );
desktop()->setWindowTitle( aTitle );
}
+/*!
+ \brief Get map of the operations which can be performed
+ on the module activation.
+
+ The method should return the map of the kind \c {<id>:<name>}
+ where \c <id> is an integer identifier of the operation and
+ \c <name> is a title for the button to be added to the
+ dialog box. After user selects the required operation by the
+ clicking the corresponding button in the dialog box, its identifier
+ is passed to the moduleActionSelected() method to process
+ the made choice.
+
+ \return map of the operations
+ \sa moduleActionSelected()
+*/
+QMap<int, QString> LightApp_Application::activateModuleActions() const
+{
+ QMap<int, QString> opmap;
+ opmap.insert( NewStudyId, tr( "ACTIVATE_MODULE_OP_NEW" ) );
+ opmap.insert( OpenStudyId, tr( "ACTIVATE_MODULE_OP_OPEN" ) );
+ return opmap;
+}
+
+/*!
+ \brief Called when the used selectes required operation chosen
+ from "Activate module" dialog box.
+
+ Performs the required operation according to the user choice.
+
+ \param id operation identifier
+ \sa activateModuleActions()
+*/
+void LightApp_Application::moduleActionSelected( const int id )
+{
+ switch ( id ) {
+ case NewStudyId:
+ onNewDoc();
+ break;
+ case OpenStudyId:
+ onOpenDoc();
+ break;
+ default:
+ break;
+ }
+}
+
/*!
Updates windows after close document
*/
#endif
PreferencesId, MRUId, ModulesListId, UserID };
+
+protected:
+ enum { NewStudyId = 1,
+ OpenStudyId };
+
public:
LightApp_Application();
virtual ~LightApp_Application();
virtual CAM_Module* loadModule( const QString& );
virtual bool activateModule( const QString& );
- virtual bool useStudy( const QString& );
-
LightApp_SelectionMgr* selectionMgr() const;
LogWindow* logWindow();
virtual void onOpenDoc();
virtual void onHelpAbout();
virtual bool onOpenDoc( const QString& );
- virtual bool onLoadDoc( const QString& );
protected:
virtual void createActions();
virtual void preferencesChanged( const QString&, const QString& );
virtual void savePreferences();
virtual void updateDesktopTitle();
-
+
+ virtual QMap<int, QString> activateModuleActions() const;
+ virtual void moduleActionSelected( const int );
+
protected slots:
virtual void onDesktopActivated();
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// File : LightApp_ModuleDlg.cxx
-// Author : Michael Zorin (mzn)
-// Module : LightApp
+// File : LightApp_ModuleDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
#include <LightApp_ModuleDlg.h>
-#include <QFrame>
#include <QLabel>
#include <QPushButton>
#include <QGridLayout>
+#include <QHBoxLayout>
-#ifndef WIN32
-using namespace std;
-#endif
-
-/*!Default icon*/
+/*!
+ \brief Pixmap used as default icon for the module.
+ \internal
+*/
static const char* const default_icon[] = {
"48 48 17 1",
". c None",
"................................................",
"................................................"};
-//==============================================================================================================================
/*!
- * LightApp_ModuleDlg::LightApp_ModuleDlg \n
- *
- * Constructor.
- */
-//==============================================================================================================================
-LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon )
- : QDialog ( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
+ \class LightApp_ModuleDlg
+ \brief A dialog box allowing to select study operation to be performed
+ on the module activating.
+
+ The dialog box is shown when the user tries to activate any module
+ while there is no opened study. The dialog box proposes user to select
+ one of the possible operations which should be done before module activating,
+ for example, create new study or open study from the file.
+ The available operations are assigned by adding the buttons with the unique
+ identifier to the dialog box. When the user clicks any operation button,
+ the dialog box sets its identifier as the return code and closes.
+
+ The typical usage of the dialog box:
+ \code
+ LightApp_ModuleDlg dlg( desktop() );
+ dlg.addButton( "New study", NewStudyId );
+ dlg.addButton( "Open study...", OpenStudyId );
+ int ret = dlg.exec();
+ switch( ret ) {
+ case NewStudyId:
+ // create new study
+ createNewStudy();
+ break;
+ case OpenStudyId:
+ // open study from the file
+ // ... show dialog box to choose the file
+ QString fileName = QFileDialog::getOpenFileName( desktop(), "Open File" );
+ if ( !fileName.isEmpty() )
+ openStudy( fileName );
+ break;
+ default:
+ // operation is cancelled
+ break;
+ }
+ \endcode
+
+ \sa addButton()
+*/
+
+/*!
+ \brief Constructor.
+ \param parent parent widget
+ \param component module name
+ \param icon module icon
+*/
+LightApp_ModuleDlg::LightApp_ModuleDlg( QWidget* parent,
+ const QString& component,
+ const QPixmap& icon )
+: QDialog ( parent )
{
- setObjectName( "ActivateModuleDlg" );
setModal( true );
- QPixmap defaultIcon( ( const char** ) default_icon );
+ QPixmap defaultIcon( default_icon );
setWindowTitle( tr( "CAPTION" ) );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this );
- ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 );
-
- // Module's name and icon
- myComponentFrame = new QFrame( this );
- myComponentFrame->setObjectName( "myComponentFrame" );
- myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) );
- myComponentFrame->setMinimumHeight( 100 );
- myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
- QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame );
- myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 );
-
- // --> icon
- myComponentIcon = new QLabel( myComponentFrame );
- myComponentIcon->setObjectName( "myComponentIcon" );
- myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
- myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon );
- myComponentIcon->setScaledContents( false );
- myComponentIcon->setAlignment( Qt::AlignCenter );
- // --> name
- myComponentLab = new QLabel( component, myComponentFrame );
- myComponentLab->setObjectName( "myComponentLab" );
- QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt );
- myComponentLab->setAlignment( Qt::AlignCenter );
-
- myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 );
- myComponentFrameLayout->addWidget( myComponentLab, 0, 1 );
-
- // Info
- QVBoxLayout* infoLayout = new QVBoxLayout();
- infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 );
-
- // --> top line
- QFrame* myLine1 = new QFrame( this );
- myLine1->setObjectName( "myLine1" );
- myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain );
- // --> info label
- myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this );
- myInfoLabel->setObjectName( "myInfoLabel" );
- myInfoLabel->setAlignment( Qt::AlignCenter );
- // --> bottom line
- QFrame* myLine2 = new QFrame( this );
- myLine2->setObjectName( "myLine2" );
- myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain );
-
- infoLayout->addStretch();
- infoLayout->addWidget( myLine1 );
- infoLayout->addWidget( myInfoLabel );
- infoLayout->addWidget( myLine2 );
- infoLayout->addStretch();
+ // icon
+ QLabel* iconLab = new QLabel( this );
+ iconLab->setFrameStyle( QFrame::Box | QFrame::Sunken );
+ iconLab->setMinimumSize( 70, 70 );
+ iconLab->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+ iconLab->setPixmap( !icon.isNull() ? icon : defaultIcon );
+ iconLab->setScaledContents( false );
+ iconLab->setAlignment( Qt::AlignCenter );
+
+ // info message
+ QLabel* infoLab = new QLabel( tr ( "DESCRIPTION" ).arg( component ), this );
+ infoLab->setTextFormat( Qt::RichText );
+ infoLab->setAlignment( Qt::AlignCenter );
// Buttons
- QHBoxLayout* btnLayout = new QHBoxLayout();
- btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );
-
- // --> New
- myNewBtn = new QPushButton( tr( "NEW" ), this );
- myNewBtn->setObjectName( "myNewBtn" );
- myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true );
- // --> Open
- myOpenBtn = new QPushButton( tr( "OPEN" ), this );
- myOpenBtn->setObjectName( "myOpenBtn" );
- myOpenBtn->setAutoDefault( true );
- // --> Load
- myLoadBtn = new QPushButton( tr( "LOAD" ), this );
- myLoadBtn->setObjectName( "myLoadBtn" );
- myLoadBtn->setAutoDefault( true );
- // --> Cancel
- myCancelBtn = new QPushButton( tr( "CANCEL" ), this );
- myCancelBtn->setObjectName( "myCancelBtn" );
- myCancelBtn->setAutoDefault( true );
-
- btnLayout->addWidget( myNewBtn );
- btnLayout->addWidget( myOpenBtn );
- btnLayout->addWidget( myLoadBtn );
- btnLayout->addStretch();
- btnLayout->addSpacing( 70 );
- btnLayout->addStretch();
- btnLayout->addWidget( myCancelBtn );
-
- ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 );
- ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 );
- ActivateModuleDlgLayout->addLayout( btnLayout, 1, 0, 1, 2 );
+ myButtonLayout = new QHBoxLayout();
+ myButtonLayout->setMargin( 0 );
+ myButtonLayout->setSpacing( 6 );
+
+ // <Cancel>
+ QPushButton* cancelBtn = new QPushButton( tr( "CANCEL" ), this );
+ myButtonLayout->addSpacing( 70 );
+ myButtonLayout->addStretch();
+ myButtonLayout->addWidget( cancelBtn );
+
+ QGridLayout* layout = new QGridLayout( this );
+ layout->setMargin( 11 );
+ layout->setSpacing( 6 );
+
+ layout->addWidget( iconLab, 0, 0 );
+ layout->addWidget( infoLab, 0, 1 );
+ layout->addLayout( myButtonLayout, 1, 0, 1, 2 );
// signals and slots connections
- connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( cancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+/*!
+ \brief Destructor.
+*/
+LightApp_ModuleDlg::~LightApp_ModuleDlg()
+{
+}
+
+/*!
+ \brief Add operation button to the dialog box.
+
+ If the parameter \a id is equal to -1, then the
+ button identifier is generated automatically.
+
+ \param button button text
+ \param id button identifier
+ \return button identifier
+*/
+int LightApp_ModuleDlg::addButton( const QString& button, const int id )
+{
+ static int lastId = 0;
+ int bid = id == -1 ? --lastId : id;
+
+ QPushButton* b = findButton( bid );
+ if ( b ) {
+ myButtons.remove( b );
+ delete b;
+ }
+
+ QPushButton* newButton = new QPushButton( button, this );
+
+ myButtons.insert( newButton, bid );
+ myButtonLayout->insertWidget( myButtonLayout->count()-3, newButton );
+ connect( newButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
+
+ return bid;
}
-//==============================================================================================================================
/*!
- * LightApp_ModuleDlg::onButtonClicked
- *
- * Buttons slot
- */
-//==============================================================================================================================
-void LightApp_ModuleDlg::onButtonClicked()
+ \brief Search button with the specified identifier.
+ \param id button identifier
+ \return button or 0 if \a id is invalid
+*/
+QPushButton* LightApp_ModuleDlg::findButton( const int id ) const
+{
+ QPushButton* btn = 0;
+ for ( ButtonMap::ConstIterator it = myButtons.begin();
+ it != myButtons.end() && !btn; ++it ) {
+ if ( it.value() == id )
+ btn = it.key();
+ }
+ return btn;
+}
+
+/*!
+ \brief Called when any dialog button (except \c Cancel)
+ is clicked.
+
+ Closes the dialog and sets its result code to the identifier
+ of the button clicked by the user.
+*/
+void LightApp_ModuleDlg::accept()
{
QPushButton* btn = ( QPushButton* )sender();
- if ( btn == myNewBtn )
- done( 1 );
- if ( btn == myOpenBtn )
- done( 2 );
- if ( btn == myLoadBtn )
- done( 3 );
+ done( myButtons[ btn ] );
}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// File : LightApp_ModuleDlg.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
-// File : LightApp_ModuleDlg.h
-// Author : Michael ZORIN (mzn)
-// Module : SALOME
#ifndef LIGHTAPP_MODULEDLG_H
#define LIGHTAPP_MODULEDLG_H
#include "LightApp.h"
+
#include <QDialog>
#include <QPixmap>
+#include <QMap>
-class QFrame;
-class QLabel;
class QPushButton;
+class QHBoxLayout;
-/*!
- \class LightApp_ModuleDlg
- Dialog allows to choose action on module activation when there is no document.
- It is possible to create new document, to open existing or to cancel module activation
-*/
class LIGHTAPP_EXPORT LightApp_ModuleDlg : public QDialog
{
Q_OBJECT
public:
- LightApp_ModuleDlg ( QWidget* parent, const QString& component, const QPixmap icon = QPixmap() ) ;
- ~LightApp_ModuleDlg ( ) { };
+ LightApp_ModuleDlg( QWidget*, const QString&, const QPixmap& = QPixmap() ) ;
+ ~LightApp_ModuleDlg();
+
+ int addButton( const QString&, const int = -1);
+
+public slots:
+ void accept();
-private slots:
- void onButtonClicked();
+private:
+ QPushButton* findButton( const int ) const;
+
+private:
+ typedef QMap<QPushButton*,int> ButtonMap;
private:
- QFrame* myComponentFrame;
- QLabel* myComponentLab;
- QLabel* myComponentIcon;
- QLabel* myInfoLabel;
- QPushButton* myNewBtn;
- QPushButton* myOpenBtn;
- QPushButton* myLoadBtn;
- QPushButton* myCancelBtn;
+ ButtonMap myButtons;
+ QHBoxLayout* myButtonLayout;
};
-#endif
+#endif // LIGHTAPP_MODULEDLG_H
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// File : LightApp_NameDlg.cxx
-// Author : Vadim SANDLER
-// $Header$
+// File : LightApp_NameDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
#include <LightApp_NameDlg.h>
#include <SUIT_Tools.h>
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SALOME SalomeApp : implementation of desktop and GUI kernel
+// File : LightApp_NameDlg.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
-// File : LightApp_NameDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
#ifndef LIGHTAPP_NAMEDLG_H
#define LIGHTAPP_NAMEDLG_H
<source>TOT_DESK_MRU</source>
<translation>Most recently used</translation>
</message>
+ <message>
+ <source>ACTIVATE_MODULE_OP_NEW</source>
+ <translation>&New</translation>
+ </message>
+ <message>
+ <source>ACTIVATE_MODULE_OP_OPEN</source>
+ <translation>&Open...</translation>
+ </message>
</context>
<context>
<name>LightApp_Module</name>
<context>
<name>LightApp_ModuleDlg</name>
<message>
- <source>NEW</source>
- <translation>&New</translation>
- </message>
- <message>
- <source>LOAD</source>
- <translation>&Load</translation>
- </message>
- <message>
- <source>OPEN</source>
- <translation>&Open</translation>
- </message>
- <message>
- <source>ActivateComponent_DESCRIPTION</source>
- <translation>Create, open or load study.</translation>
+ <source>DESCRIPTION</source>
+ <translation>You're activating module
+ <b>%1</b>.<br>Please, select required action by pressing the corresponding button below.</translation>
</message>
<message>
<source>CANCEL</source>
for ( int i = 0; l && i < l->count() && !s; i++ )
s = l->itemAt( i )->spacerItem();
- return s ? s->expandingDirections() & Qt::Vertical : false;
+ return s ? (bool)( s->expandingDirections() & Qt::Vertical ) : false;
}
/*!
-I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeApp_la_LDFLAGS=$(PYTHON_LIBS) $(QT_MT_LIBS)
libSalomeApp_la_LIBADD= $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSalomeDSClient \
- ../SUIT/libsuit.la ../STD/libstd.la ../CAM/libCAM.la \ #../ObjBrowser/libObjBrowser.la \
+ ../SUIT/libsuit.la ../STD/libstd.la ../CAM/libCAM.la \
../Prs/libSalomePrs.la ../SPlot2d/libSPlot2d.la ../GLViewer/libGLViewer.la \
../OCCViewer/libOCCViewer.la ../VTKViewer/libVTKViewer.la ../OBJECT/libSalomeObject.la \
../SVTK/libSVTK.la ../SOCC/libSOCC.la ../PyInterp/libPyInterp.la \
../PyConsole/libPyConsole.la ../LogWindow/libLogWindow.la \
../LightApp/libLightApp.la ../TOOLSGUI/libToolsGUI.la $(CAS_KERNEL)
+# QT 4 PORTING TODO
+#../ObjBrowser/libObjBrowser.la
+
EXTRA_DIST+=SalomeApp_PyInterp.h
studyName.replace( QRegExp(":"), "/" );
#endif
- if( LightApp_Application::onLoadDoc( studyName ) ) {
+ if ( onLoadDoc( studyName ) ) {
updateWindows();
updateViewManagers();
updateObjectBrowser( true );
}
}
-
/*!SLOT. Load document with \a aName.*/
bool SalomeApp_Application::onLoadDoc( const QString& aName )
{
- return LightApp_Application::onLoadDoc( aName );
+ bool res = true;
+ if ( !activeStudy() ) {
+ // if no study - load in current desktop
+ res = useStudy( aName );
+ }
+ else {
+ // if study exists - load in new desktop. Check: is the same file is loaded?
+ SUIT_Session* aSession = SUIT_Session::session();
+ QList<SUIT_Application*> aAppList = aSession->applications();
+ bool isAlreadyOpen = false;
+ SalomeApp_Application* aApp = 0;
+ for ( QList<SUIT_Application*>::iterator it = aAppList.begin();
+ it != aAppList.end() && !isAlreadyOpen; ++it ) {
+ aApp = dynamic_cast<SalomeApp_Application*>( *it );
+ if ( aApp && aApp->activeStudy()->studyName() == aName )
+ isAlreadyOpen = true;
+ }
+ if ( !isAlreadyOpen ) {
+ aApp = dynamic_cast<SalomeApp_Application*>( startApplication( 0, 0 ) );
+ if ( aApp )
+ res = aApp->useStudy( aName );
+ }
+ else {
+ aApp->desktop()->activateWindow();
+ }
+ }
+
+ return res;
}
/*!SLOT. Copy objects to study maneger from selection maneger..*/
return res;
}
+/*!
+ \brief Get map of the operations which can be performed
+ on the module activation.
+
+ The method should return the map of the kind \c {<id>:<name>}
+ where \c <id> is an integer identifier of the operation and
+ \c <name> is a title for the button to be added to the
+ dialog box. After user selects the required operation by the
+ clicking the corresponding button in the dialog box, its identifier
+ is passed to the moduleActionSelected() method to process
+ the made choice.
+
+ \return map of the operations
+ \sa moduleActionSelected()
+*/
+QMap<int, QString> SalomeApp_Application::activateModuleActions() const
+{
+ QMap<int, QString> opmap = LightApp_Application::activateModuleActions();
+ opmap.insert( LoadStudyId, tr( "ACTIVATE_MODULE_OP_LOAD" ) );
+ return opmap;
+}
+
+/*!
+ \brief Called when the used selectes required operation chosen
+ from "Activate module" dialog box.
+
+ Performs the required operation according to the user choice.
+
+ \param id operation identifier
+ \sa activateModuleActions()
+*/
+void SalomeApp_Application::moduleActionSelected( const int id )
+{
+ if ( id == LoadStudyId )
+ onLoadDoc();
+ else
+ LightApp_Application::moduleActionSelected( id );
+}
+
/*!Gets CORBA::ORB_var*/
CORBA::ORB_var SalomeApp_Application::orb()
{
updateObjectBrowser();
}
+/*!
+ Opens other study into active Study. If Study is empty - creates it.
+ \param theName - name of study
+*/
+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;
+}
CatalogGenId, RegDisplayId, SaveGUIStateId, FileLoadId, UserID };
enum { CloseUnload = STD_Application::CloseCancel+1 };
+protected:
+ enum { LoadStudyId = OpenStudyId + 1 };
+
public:
SalomeApp_Application();
virtual ~SalomeApp_Application();
virtual bool isPossibleToClose( bool& );
+ virtual bool useStudy( const QString& );
+
public slots:
virtual bool onOpenDoc( const QString& );
virtual void onLoadDoc();
virtual bool closeAction( const int, bool& );
virtual int closeChoice( const QString& );
+ virtual QMap<int, QString> activateModuleActions() const;
+ virtual void moduleActionSelected( const int );
+
private slots:
void onDeleteInvalidReferences();
void onDblClick( QListViewItem* );
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SALOME SalomeApp
+// File : SalomeApp_ListView.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
-// File : SalomeApp_ListView.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
#include "SalomeApp_ListView.h"
#include "SalomeApp_Application.h"
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SALOME SalomeApp
+// File : SalomeApp_ListView.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
-// File : SalomeApp_ListView.h
-// Author : Vadim SANDLER
-// Module : SALOME
#ifndef SALOMEAPP_LISTVIEW_H
#define SALOMEAPP_LISTVIEW_H
<source>TOT_DESK_MRU</source>
<translation>Most recently used</translation>
</message>
+ <message>
+ <source>ACTIVATE_MODULE_OP_LOAD</source>
+ <translation>Load...</translation>
+ </message>
</context>
<context>
<name>SalomeApp_StudyPropertiesDlg</name>