return new CAF_Application();
}
+/*!
+ Default constructor
+*/
CAF_Application::CAF_Application()
: STD_Application()
{
}
-CAF_Application::CAF_Application( const Handle(TDocStd_Application)& app )
+/*!
+ Constructor with OCAF application
+ \param app - OCAF application
+*/
+CAF_Application::CAF_Application( const Handle( TDocStd_Application )& app )
: STD_Application(),
myStdApp( app )
{
}
+/*!
+ Destructor
+*/
CAF_Application::~CAF_Application()
{
}
+/*!
+ \return application name
+*/
QString CAF_Application::applicationName() const
{
return QString( "CAFApplication" );
}
-Handle(TDocStd_Application) CAF_Application::stdApp() const
+/*!
+ \return OCAF application
+*/
+Handle( TDocStd_Application ) CAF_Application::stdApp() const
{
return myStdApp;
}
+/*!
+ \return file filters for open/save document
+*/
QString CAF_Application::getFileFilter() const
{
if ( stdApp().IsNull() )
return filters.join( ";;" );
}
+/*!
+ Creates actions of application
+*/
void CAF_Application::createActions()
{
STD_Application::createActions();
redo->setEnabled( cafStudy && cafStudy->canRedo() );
}
+/*!
+ SLOT: called by clicking on Help->About in main menu
+*/
void CAF_Application::onHelpAbout()
{
SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" );
}
+/*!
+ Creates new study
+*/
SUIT_Study* CAF_Application::createNewStudy()
{
return new CAF_Study( this );
}
+/*!
+ Sets OCAF application
+*/
void CAF_Application::setStdApp( const Handle(TDocStd_Application)& app )
{
myStdApp = app;
#include <TDocStd_Document.hxx>
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
+/*!
+ Default constructor
+*/
CAF_Operation::CAF_Operation(SUIT_Application* theApp)
:SUIT_Operation(theApp)
{
}
+/*!
+ Destructor
+*/
CAF_Operation::~CAF_Operation()
{
}
+/*!
+ \return OCAF document
+*/
Handle(TDocStd_Document) CAF_Operation::stdDoc() const
{
Handle(TDocStd_Document) doc;
#include <Standard_ErrorHandler.hxx>
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
+/*!
+ Constructor
+*/
CAF_Study::CAF_Study(SUIT_Application* theApp)
: SUIT_Study( theApp ),
myModifiedCnt( 0 )
{
}
+/*!
+ Constructor
+*/
CAF_Study::CAF_Study(SUIT_Application* theApp, Handle (TDocStd_Document)& aStdDoc)
: SUIT_Study( theApp ),
myStdDoc( aStdDoc ),
{
}
+/*!
+ Destructor
+*/
CAF_Study::~CAF_Study()
{
}
+/*!
+ \return OCAF document
+*/
Handle(TDocStd_Document) CAF_Study::stdDoc() const
{
return myStdDoc;
}
+/*!
+ Sets new OCAF document
+ \param aStdDoc - new OCAF document
+*/
void CAF_Study::setStdDoc( Handle(TDocStd_Document)& aStdDoc )
{
myStdDoc = aStdDoc;
}
+/*!
+ Custom document initialization
+*/
void CAF_Study::createDocument()
{
SUIT_Study::createDocument();
}
}
+/*!
+ Close document
+*/
void CAF_Study::closeDocument( bool permanent )
{
Handle(TDocStd_Application) app = stdApp();
SUIT_Study::closeDocument( permanent );
}
+/*!
+ Open document
+ \param fname - name of file
+*/
bool CAF_Study::openDocument( const QString& fname )
{
Handle(TDocStd_Application) app = stdApp();
return status && SUIT_Study::openDocument( fname );
}
+/*!
+ Save document with other name
+ \param fname - name of file
+*/
bool CAF_Study::saveDocumentAs( const QString& fname )
{
Handle(TDocStd_Application) app = stdApp();
return status;
}
+/*!
+ Open OCAF transaction
+*/
bool CAF_Study::openTransaction()
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
bool res = true;
return res;
}
+/*!
+ Abort OCAF transaction
+*/
bool CAF_Study::abortTransaction()
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
bool res = true;
- try {
+ try {
myStdDoc->AbortCommand();
update();
}
return res;
}
+/*!
+ Commit OCAF transaction
+*/
bool CAF_Study::commitTransaction( const QString& name )
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
bool res = true;
- try {
+ try {
myStdDoc->CommitCommand();
if ( canUndo() )
return res;
}
+/*!
+ \return true, if there is opened OCAF transaction
+*/
bool CAF_Study::hasTransaction() const
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
return myStdDoc->HasOpenCommand();
}
/*!
- Returns whether the document was saved in file. [ public ]
+ \return whether the document was saved in file. [ public ]
*/
bool CAF_Study::isSaved() const
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
return myStdDoc->IsSaved();
}
/*!
- Returns whether the document is modified. [ public ]
+ \return whether the document is modified. [ public ]
*/
bool CAF_Study::isModified() const
{
- if ( myStdDoc.IsNull() )
+ if ( myStdDoc.IsNull() )
return false;
// return myStdDoc->IsModified();
}
/*!
- Check if possible to perform 'undo' command. [ public ]
+ \return true if possible to perform 'undo' command. [ public ]
*/
bool CAF_Study::canUndo() const
{
}
/*!
- Check if possible to perform 'redo' command. [ public ]
+ \return true if possible to perform 'redo' command. [ public ]
*/
bool CAF_Study::canRedo() const
{
}
/*!
- Returns the list of names of 'undo' actions available. [ public ]
+ \return the list of names of 'undo' actions available. [ public ]
*/
QStringList CAF_Study::undoNames() const
{
}
/*!
- Returns the list of names of 'redo' actions available. [ public ]
+ \return the list of names of 'redo' actions available. [ public ]
*/
QStringList CAF_Study::redoNames() const
{
}
/*!
- Returns the standard OCAF application from owner application. [ protected ]
+ \return the standard OCAF application from owner application. [ protected ]
*/
Handle(TDocStd_Application) CAF_Study::stdApp() const
{
}
/*!
- Returns the application casted to type CAF_Application. [ protected ]
+ \return the application casted to type CAF_Application. [ protected ]
*/
CAF_Application* CAF_Study::cafApplication() const
{
return result;
}
+/*!
+ Converts Qt color to OCC color
+*/
Quantity_Color CAF_Tools::color( const QColor& c )
{
Quantity_Color aColor;
return aColor;
}
+/*!
+ Converts OCC color to Qt color
+*/
QColor CAF_Tools::color( const Quantity_Color& c )
{
return QColor ( int( c.Red() * 255 ),
return module;
}
-/**@name Activate module group.*/
+/*! @name Activate module group. */
//@{
/*!Activate module with name \a modName.
*\param modName - module name.
/*!Create empty study.*/
void CAM_Application::createEmptyStudy()
{
- SUIT_Study* study = activeStudy();
-
+ /*SUIT_Study* study = */activeStudy();
STD_Application::createEmptyStudy();
}
{
}
+/*!
+ Default implementation, does nothing.
+ Can be used for creation of root object.
+*/
void CAM_DataModel::initialize()
{
- //! Default implementation, does nothing.\n
- //! Can be used for creation of root object.
}
/*!Get root object.
int LightApp_Application::lastStudyId = 0;
+/*!
+ \return last global id of study
+*/
int LightApp_Application::studyId()
{
return LightApp_Application::lastStudyId;
return new LightApp_Application();
}
+/*! \var global preferences of LightApp */
LightApp_Preferences* LightApp_Application::_prefs_ = 0;
-/*
- Class : LightApp_Application
- Description : Application containing LightApp module
+/*!
+ \class LightApp_Application
+ Application containing LightApp module
*/
/*!Constructor.*/
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();
createViewManager( type );
}
-//=======================================================================
-// name : onNewDoc
-/*! Purpose : SLOT. Create new document*/
-//=======================================================================
+/*!
+ SLOT: Creates new document
+*/
void LightApp_Application::onNewDoc()
{
SUIT_Study* study = activeStudy();
}
}
-//=======================================================================
-// name : onOpenDoc
-/*! Purpose : SLOT. Open new document*/
-//=======================================================================
+/*!
+ SLOT: Opens new document
+*/
void LightApp_Application::onOpenDoc()
{
SUIT_Study* study = activeStudy();
}
#include "SUIT_MessageBox.h"
-/*! Purpose : SLOT. Open new document with \a aName.*/
+
+/*!
+ SLOT: Opens new document.
+ \param aName - name of file
+*/
bool LightApp_Application::onOpenDoc( const QString& aName )
{
bool isAlreadyOpen = false;
return res;
}
-//=======================================================================
-// name : onHelpAbout
-/*! Purpose : SLOT. Display "About" message box*/
-//=======================================================================
+/*!
+ SLOT: Displays "About" message box
+*/
void LightApp_Application::onHelpAbout()
{
LightApp_AboutDlg* dlg = new LightApp_AboutDlg( applicationName(), applicationVersion(), desktop() );
delete dlg;
}
-/*!SLOT. Load document with \a aName.*/
+/*!
+ SLOT: Loads document
+ \param aName - name of document
+*/
bool LightApp_Application::onLoadDoc( const QString& aName )
{
bool res = CAM_Application::onLoadDoc( aName );
return res;
}
-/*!Private SLOT. Selection.*/
+/*!
+ Private SLOT: Called on selection is changed
+ Dispatchs active module that selection is changed
+*/
void LightApp_Application::onSelection()
{
onSelectionChanged();
((LightApp_Module*)activeModule())->selectionChanged();
}
-/*!Set active study.
- *\param study - SUIT_Study.
- */
+/*!
+ Sets active study.
+ \param study - SUIT_Study.
+*/
void LightApp_Application::setActiveStudy( SUIT_Study* study )
{
CAM_Application::setActiveStudy( study );
activateWindows();
}
-//=======================================================================
-// name : updateCommandsStatus
-/*! Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu*/
-//=======================================================================
+/*!
+ Enables/Disables menu items and toolbar buttons. Rebuild menu
+*/
void LightApp_Application::updateCommandsStatus()
{
CAM_Application::updateCommandsStatus();
#endif
}
-// Helps to execute command
+/*!
+ \class RunBrowser
+ Runs system command in separate thread
+*/
class RunBrowser: public QThread {
public:
LightApp_Application* myLApp;
};
-//=======================================================================
-// name : onHelpContentsModule
-/*! Purpose : SLOT. Display help contents for choosen module*/
-//=======================================================================
+/*!
+ SLOT: Displays help contents for choosen module
+*/
void LightApp_Application::onHelpContentsModule()
{
const QAction* obj = (QAction*) sender();
}
}
-//=======================================================================
-// name : onHelpContextModule
-/*! Purpose : SLOT. Display help contents for choosen dialog*/
-//=======================================================================
+/*!
+ SLOT: Displays help contents for choosen dialog
+*/
void LightApp_Application::onHelpContextModule(const QString& theComponentName, const QString& theFileName)
{
QCString dir = getenv( theComponentName + "_ROOT_DIR");
}
}
-/*!Sets enable or disable some actions on selection changed.*/
+/*!
+ Sets enable or disable some actions on selection changed.
+*/
void LightApp_Application::onSelectionChanged()
{
}
-/*!Return window.
- *\param flag - key for window
- *\param studyId - study id
- * Flag used how identificator of window in windows list.
- */
+/*!
+ \return window by key
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
QWidget* LightApp_Application::window( const int flag, const int studyId ) const
{
QWidget* wid = 0;
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.
- */
+/*!
+ Adds window to application.
+ \param wid - QWidget
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
void LightApp_Application::addWindow( QWidget* wid, const int flag, const int studyId )
{
if ( !wid )
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.
- */
+/*!
+ Removes window from application.
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
void LightApp_Application::removeWindow( const int flag, const int studyId )
{
if ( !myWindows.contains( flag ) )
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.
- */
+/*!
+ Gets window.
+ \param flag - key for window
+ \param studyId - study id
+ Flag used how identificator of window in windows list.
+*/
QWidget* LightApp_Application::getWindow( const int flag, const int studyId )
{
QWidget* wid = window( flag, studyId );
return wid;
}
-/*!Check is window visible?(with identificator \a type)*/
+/*!
+ \return is window visible
+ \param type - flag of window
+*/
bool LightApp_Application::isWindowVisible( const int type ) const
{
bool res = false;
return res;
}
-/*!Sets window show or hide.
- *\param type - window identificator.
- *\param on - true/false (window show/hide)
- */
+/*!
+ Sets window show or hide.
+ \param type - window identificator.
+ \param on - true/false (window show/hide)
+*/
void LightApp_Application::setWindowShown( const int type, const bool on )
{
if ( !desktop() || !myWindows.contains( type ) )
}
}
-/*!Gets "ObjectBrowser".*/
+/*!
+ \return Object Browser
+*/
OB_Browser* LightApp_Application::objectBrowser()
{
OB_Browser* ob = 0;
return ob;
}
-/*!Gets "LogWindow".*/
+/*!
+ \return Log Window
+*/
LogWindow* LightApp_Application::logWindow()
{
LogWindow* lw = 0;
}
#ifndef DISABLE_PYCONSOLE
-/*!Get "PythonConsole"*/
+/*!
+ \return Python Console
+*/
PythonConsole* LightApp_Application::pythonConsole()
{
PythonConsole* console = 0;
}
#endif
-/*!Update obect browser*/
+/*!
+ Updates object browser and maybe data models
+ \param updateModels - if it is true, then data models are updated
+*/
void LightApp_Application::updateObjectBrowser( const bool updateModels )
{
// update existing data models
}
}
-/*!Gets preferences.*/
+/*!
+ \return preferences
+*/
LightApp_Preferences* LightApp_Application::preferences() const
{
return preferences( false );
}
-/*!Gets view manager*/
+/*!
+ \return first view manager of some type
+ \param vmType - type of view manager
+ \param create - is it necessary to create view manager in case, when there is no manager of such type
+*/
SUIT_ViewManager* LightApp_Application::getViewManager( const QString& vmType, const bool create )
{
SUIT_ViewManager* aVM = viewManager( vmType );
return aVM;
}
-/*!Create view manager.*/
+/*!
+ Creates view manager of some type
+ \param vmType - type of view manager
+*/
SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType )
{
SUIT_ResourceMgr* resMgr = resourceMgr();
return viewMgr;
}
-//=======================================================================
-// name : onCloseView
-/*! Purpose : SLOT. Remove view manager from application*/
-//=======================================================================
+/*!
+ SLOT: Removes view manager from application
+*/
void LightApp_Application::onCloseView( SUIT_ViewManager* theVM )
{
removeViewManager( theVM );
}
-/*!Protected SLOT. On study created.*/
+/*!
+ Protected SLOT: On study created.
+ \param theStudy - just created study
+*/
void LightApp_Application::onStudyCreated( SUIT_Study* theStudy )
{
SUIT_DataObject* aRoot = 0;
activateWindows();
}
-/*!Protected SLOT. On study opened.*/
+/*!
+ Protected SLOT: On study opened.
+ \param theStudy - just opened study
+*/
void LightApp_Application::onStudyOpened( SUIT_Study* theStudy )
{
SUIT_DataObject* aRoot = 0;
return "(*.hdf)";
}
-/*! Gets file name*/
+/*!
+ Shows file dialog and return user selected file name
+*/
QString LightApp_Application::getFileName( bool open, const QString& initial, const QString& filters,
const QString& caption, QWidget* parent )
{
updateCommandsStatus();
}
-//=======================================================================
-// name : createNewStudy
-/*! Purpose : Create new study*/
-//=======================================================================
+/*!
+ Creates new study
+*/
SUIT_Study* LightApp_Application::createNewStudy()
{
LightApp_Application::lastStudyId++;
return aStudy;
}
-/*!Create window.*/
+/*!
+ Creates window by flag.
+ \param flag - identificator of window type
+*/
QWidget* LightApp_Application::createWindow( const int flag )
{
QWidget* wid = 0;
return wid;
}
-/*!Default windows(Object Browser, Python Console).
- * Adds to map \a aMap.
+/*!
+ \return default windows( Object Browser, Python Console )
+ Adds to map \a aMap.
*/
void LightApp_Application::defaultWindows( QMap<int, int>& aMap ) const
{
// aMap.insert( WT_LogWindow, Qt::DockBottom );
}
-/*!Default view manager.*/
+/*!Default view managers*/
void LightApp_Application::defaultViewManagers( QStringList& ) const
{
/*!Do nothing.*/
}
-/*!Gets preferences.
- * Create preferences, if \a crt = true.
- */
+/*!
+ \return preferences.
+ Create preferences, if \a crt = true.
+*/
LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
{
if ( myPrefs )
return myPrefs;
}
-/*!Add new module to application.*/
+/*!
+ Adds new module to application
+*/
void LightApp_Application::moduleAdded( CAM_Module* mod )
{
CAM_Application::moduleAdded( mod );
}
}
-/*!Create preferences.*/
+/*!
+ Create preferences
+*/
void LightApp_Application::createPreferences( LightApp_Preferences* pref )
{
if ( !pref )
"ObjectBrowser", "auto_size" );
}
-/*!Changed preferences */
+/*!
+ Changes appearance of application according to changed preferences
+ \param sec - section
+ \param param - name of changed parameter
+*/
void LightApp_Application::preferencesChanged( const QString& sec, const QString& param )
{
SUIT_ResourceMgr* resMgr = resourceMgr();
#endif
}
-/*!Save preferences */
+/*!
+ Saves preferences
+*/
void LightApp_Application::savePreferences()
{
saveWindowsGeometry();
}
}
-/*!Update desktop title.*/
+/*!
+ Updates desktop title
+*/
void LightApp_Application::updateDesktopTitle() {
QString aTitle = applicationName();
QString aVer = applicationVersion();
desktop()->setCaption( aTitle );
}
-/*!Update windows after close document.*/
+/*!
+ Updates windows after close document
+*/
void LightApp_Application::afterCloseDoc()
{
updateWindows();
CAM_Application::afterCloseDoc();
}
-/*!Update module action.*/
+/*!
+ Updates actions of active module
+*/
void LightApp_Application::updateModuleActions()
{
QString modName;
myActions[modName]->setOn( true );
}
-/*!Gets current windows.
- *\param winMap - output current windows map.
- */
+/*!
+ Gets current windows.
+ \param winMap - output current windows map.
+*/
void LightApp_Application::currentWindows( QMap<int, int>& winMap ) const
{
winMap.clear();
defaultWindows( winMap );
}
-/*!Gets current view managers.
- *\param lst - output current view managers list.
- */
+/*!
+ Gets current view managers.
+ \param lst - output current view managers list.
+*/
void LightApp_Application::currentViewManagers( QStringList& lst ) const
{
lst.clear();
defaultViewManagers( lst );
}
-/*!Update windows.*/
+/*!
+ Updates windows
+*/
void LightApp_Application::updateWindows()
{
QMap<int, int> winMap;
}
}
-/*!Update view managers.*/
+/*!
+ Updates view managers
+*/
void LightApp_Application::updateViewManagers()
{
QStringList lst;
getViewManager( *it, true );
}
-/*!Load windows geometry.*/
+/*!
+ Loads windows geometry
+*/
void LightApp_Application::loadWindowsGeometry()
{
bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
dockMgr->restoreGeometry();
}
-/*!Save windows geometry.*/
+/*!
+ Saves windows geometry
+*/
void LightApp_Application::saveWindowsGeometry()
{
bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
dockMgr->saveGeometry( resourceMgr(), section, false );
}
-/*!Activate windows.*/
+/*!
+ Activates windows
+*/
void LightApp_Application::activateWindows()
{
if ( activeStudy() )
}
}
-/*!Adds icon names for modules.*/
+/*!
+ Adds icon names for modules
+*/
void LightApp_Application::moduleIconNames( QMap<QString, QString>& iconMap ) const
{
iconMap.clear();
}
}
-/*!Insert items in popup, which necessary for current application*/
+/*!
+ Inserts items in popup, which necessary for current application
+*/
void LightApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title )
{
CAM_Application::contextMenuPopup( type, thePopup, title );
thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
}
-/*!Create empty study.*/
+/*!
+ Create empty study
+*/
void LightApp_Application::createEmptyStudy()
{
CAM_Application::createEmptyStudy();
objectBrowser()->updateTree();
}
-/*!Activate module \a mod.*/
+/*!
+ Activates module
+ \param mod - module to be activated
+*/
bool LightApp_Application::activateModule( CAM_Module* mod )
{
bool res = CAM_Application::activateModule( mod );
return res;
}
-/*!return keyborad accelerators manager object */
+/*!
+ \return keyborad accelerators manager object
+*/
SUIT_Accel* LightApp_Application::accel() const
{
return myAccel;
}
-/*! remove dead widget container from map */
+/*!
+ Removes dead widget container from map
+*/
void LightApp_Application::onWCDestroyed( QObject* ob )
{
// remove destroyed widget container from windows map
}
}
-/*! redefined to connect */
+/*!
+ Connects just added view manager
+*/
void LightApp_Application::addViewManager( SUIT_ViewManager* vm )
{
connect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
STD_Application::addViewManager( vm );
}
-/*! redefined to remove view manager from memory */
+/*!
+ Remove view manager from memory
+*/
void LightApp_Application::removeViewManager( SUIT_ViewManager* vm )
{
disconnect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
delete vm;
}
-/*! rename active window of desktop */
+/*!
+ Renames active window of desktop
+*/
void LightApp_Application::onRenameWindow()
{
if( !desktop() )
w->setCaption( name );
}
+/*!
+ \return if the library of module exists
+ \param moduleTitle - title of module
+*/
bool LightApp_Application::isLibExists( const QString& moduleTitle ) const
{
if( moduleTitle.isEmpty() )
return false;
}
-/*! default name for an active study */
+/*!
+ \return default name for an active study
+*/
void LightApp_Application::setDefaultStudyName( const QString& theName )
{
QStringList anInfoList;
}
}
+/*!
+ Custom event handler
+*/
bool LightApp_Application::event( QEvent* e )
{
if( e && e->type()==2000 )
#include <SUIT_Session.h>
#include <SUIT_DataObject.h>
-//=======================================================================
-// name : LightApp_DataModel::LightApp_DataModel
-/*!Purpose : Constructor*/
-//=======================================================================
+/*!
+ Constructor
+*/
LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule )
: CAM_DataModel( theModule )
{
}
-//=======================================================================
-// name : LightApp_DataModel::~LightApp_DataModel
-/*! Purpose : Destructor*/
-//=======================================================================
+/*!
+ Destructor
+*/
LightApp_DataModel::~LightApp_DataModel()
{
}
-//================================================================
-// Function : open
-/*! Purpose : Emit opened()*/
-//================================================================
+/*!
+ Emit opened()
+*/
bool LightApp_DataModel::open( const QString&, CAM_Study* study, QStringList )
{
emit opened(); //TODO: is it really needed? to be removed maybe...
return true;
}
-//================================================================
-// Function : save
-/*! Purpose : Emit saved()*/
-//================================================================
+/*!
+ Emit saved()
+*/
bool LightApp_DataModel::save( QStringList& )
{
emit saved();
return true;
}
-//================================================================
-// Function : saveAs
-/*! Purpose : Emit saved()*/
-//================================================================
+/*!
+ Emit saved()
+*/
bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList& )
{
emit saved();
return true;
}
-//================================================================
-// Function : close
-/*! Purpose : Emit closed()*/
-//================================================================
+/*!
+ Emit closed()
+*/
bool LightApp_DataModel::close()
{
emit closed();
return true;
}
-//================================================================
-// Function : build
-/*! Purpose : Build whole data model tree */
-//================================================================
+/*!
+ Build whole data model tree
+*/
void LightApp_DataModel::build()
{
}
-//================================================================
-// Function : updateWidgets
-/*! Purpose : Update data model presentation in some widgets
- * (for example, in object browser*/
-//================================================================
+/*!
+ Updates data model presentation in some widgets (for example, in object browser
+*/
void LightApp_DataModel::updateWidgets()
{
LightApp_Application* app = dynamic_cast<LightApp_Application*>( module()->application() );
app->objectBrowser()->updateTree( 0, false );
}
-//================================================================
-// Function : update
-/*! Purpose : Update application (empty virtual function).*/
-//================================================================
+/*!
+ Default behaviour of data model update for light modules
+*/
void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* )
{
LightApp_ModuleObject* modelRoot = dynamic_cast<LightApp_ModuleObject*>( root() );
delete it.current();
}
-//================================================================
-// Function : getModule
-/*! Purpose : gets module*/
-//================================================================
-
+/*!
+ \return corresponding module
+*/
LightApp_Module* LightApp_DataModel::getModule() const
{
return dynamic_cast<LightApp_Module*>( module() );
}
-//================================================================
-// Function : getStudy
-/*! Purpose : gets study */
-//================================================================
+/*!
+ \return corresponding study
+*/
LightApp_Study* LightApp_DataModel::getStudy() const
{
LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root()->root() );
return aRoot->study();
}
-//================================================================
-// Function : isModified
-/*! Purpose : default implementation, always returns false so as not to mask study's isModified()*/
-//================================================================
+/*!
+ default implementation, always returns false so as not to mask study's isModified()
+*/
bool LightApp_DataModel::isModified() const
{
return false;
}
-//================================================================
-// Function : isSaved
-/*! Purpose : default implementation, always returns true so as not to mask study's isSaved()*/
-//================================================================
+/*!
+ default implementation, always returns true so as not to mask study's isSaved()
+*/
bool LightApp_DataModel::isSaved() const
{
return true;
return myEntry == that->myEntry;
}
-/*
- Class: LightApp_DataObject
- Level: Public
-*/
/*!Constructor. Initialize by \a parent*/
LightApp_DataObject::LightApp_DataObject( SUIT_DataObject* parent )
: CAM_DataObject( parent ), myCompObject( 0 ), myCompDataType( "" )
return myCompDataType;
}
-/*
- Class: LightApp_ModuleObject
- Level: Public
-*/
+
/*!Constructor.Initialize by \a parent.*/
LightApp_ModuleObject::LightApp_ModuleObject( SUIT_DataObject* parent )
#include <qlineedit.h>
#include <qlabel.h>
-/*
- Class : LightApp_Dialog
- Description : Base class for all dialogs
+/*!
+ Constructor
*/
-
-//=======================================================================
-// name : LightApp_Dialog
-// Purpose : Constructor
-//=======================================================================
LightApp_Dialog::LightApp_Dialog( QWidget* parent, const char* name, bool modal,
bool allowResize, const int f, WFlags wf )
: QtxDialog( parent, name, modal, allowResize, f, wf ),
setObjectPixmap( "LightApp", tr( "ICON_SELECT" ) );
}
-//=======================================================================
-// name : ~LightApp_Dialog
-// Purpose : Destructor
-//=======================================================================
+/*!
+ Destructor
+*/
LightApp_Dialog::~LightApp_Dialog()
{
}
-//=======================================================================
-// name : show
-// Purpose :
-//=======================================================================
+/*!
+ Show dialog
+*/
void LightApp_Dialog::show()
{
QtxDialog::show();
}
-//=======================================================================
-// name : isExclusive
-// Purpose :
-//=======================================================================
+/*!
+ \return isExclusive status of selection buttons
+*/
bool LightApp_Dialog::isExclusive() const
{
return myIsExclusive;
}
-//=======================================================================
-// name : updateButtons
-// Purpose :
-//=======================================================================
+/*!
+ Updates "on" state of buttons according to special button
+ \param _id - id of special button (if it is -1, then first selected button will be treated as special)
+*/
void LightApp_Dialog::updateButtons( const int _id )
{
if( !myIsExclusive )
}
}
-//=======================================================================
-// name : setExclusive
-// Purpose :
-//=======================================================================
+/*!
+ Sets isExclusive status of selection buttons
+ \param ex - new value of isExclusive status
+*/
void LightApp_Dialog::setExclusive( const bool ex )
{
myIsExclusive = ex;
updateButtons();
}
-//=======================================================================
-// name : showObject
-// Purpose :
-//=======================================================================
+/*!
+ Shows object selection widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::showObject( const int id )
{
setObjectShown( id, true );
}
-//=======================================================================
-// name : hideObject
-// Purpose :
-//=======================================================================
+/*!
+ Hides object selection widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::hideObject( const int id )
{
setObjectShown( id, false );
}
-//=======================================================================
-// name : setObjectShown
-// Purpose :
-//=======================================================================
+/*!
+ Shows/hides object selection widget
+ \param id - identificator of object selection widget
+ \param shown - if it is true, widget will be shown
+*/
void LightApp_Dialog::setObjectShown( const int id, const bool shown )
{
if( myObjects.contains( id ) && isObjectShown( id )!=shown )
}
}
-//=======================================================================
-// name : isObjectShown
-// Purpose :
-//=======================================================================
+/*!
+ \return isShown state of object selection widget
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::isObjectShown( const int id ) const
{
return myObjects.contains( id ) && myObjects[ id ].myEdit->isShown();
}
-//=======================================================================
-// name : setObjectEnabled
-// Purpose :
-//=======================================================================
+/*!
+ Change enable state of object selection widget
+ \param id - identificator of object selection widget
+ \param en - new value of enable state
+*/
void LightApp_Dialog::setObjectEnabled( const int id, const bool en )
{
if( myObjects.contains( id ) && isObjectEnabled( id )!=en )
}
}
-//=======================================================================
-// name : isObjectEnabled
-// Purpose :
-//=======================================================================
+/*!
+ \return enable state of object selection widget
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::isObjectEnabled( const int id ) const
{
return myObjects.contains( id ) && myObjects[ id ].myEdit->isEnabled();
}
-//=======================================================================
-// name : selectObject
-// Purpose :
-//=======================================================================
+/*!
+ Passes to all active widgets name, type and id of selected object
+ \param name - name of selected object
+ \param type - type of selected object
+ \param id - id of selected object
+ \param update - is need to update selection description string
+*/
void LightApp_Dialog::selectObject( const QString& name, const int type, const QString& id, const bool update )
{
QStringList names; names.append( name );
selectObject( names, types, ids, update );
}
-//=======================================================================
-// name : selectObject
-// Purpose :
-//=======================================================================
+/*!
+ Passes to all active widgets names, types and ids of selected objects
+ \param _names - names of selected objects
+ \param _types - types of selected objects
+ \param _ids - ids of selected objects
+ \param update - is need to update selection description string
+*/
void LightApp_Dialog::selectObject( const QStringList& _names,
const TypesList& _types,
const QStringList& _ids,
selectObject( anIt.key(), _names, _types, _ids, update );
}
-//=======================================================================
-// name : hasSelection
-// Purpose :
-//=======================================================================
+/*!
+ \return true if widget has selection
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::hasSelection( const int id ) const
{
return myObjects.contains( id ) && !myObjects[ id ].myIds.isEmpty();
}
-//=======================================================================
-// name : clearSelection
-// Purpose :
-//=======================================================================
+/*!
+ Clears selection of widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::clearSelection( const int id )
{
if( id==-1 )
}
}
-//=======================================================================
-// name : objectWg
-// Purpose :
-//=======================================================================
+/*!
+ \return object selection widget
+ \param theId - identificator of object selection widget
+ \param theWgId may be "Label", "Btn" or "Control"
+*/
QWidget* LightApp_Dialog::objectWg( const int theId, const int theWgId ) const
{
QWidget* aResWg = 0;
return aResWg;
}
-//=======================================================================
-// name : objectText
-// Purpose :
-//=======================================================================
+/*!
+ \return object selection widget text
+ \param theId - identificator of object selection widget
+*/
QString LightApp_Dialog::objectText( const int theId ) const
{
return myObjects.contains( theId ) ? myObjects[ theId ].myEdit->text() : "";
}
-//=======================================================================
-// name : setObjectText
-// Purpose :
-//=======================================================================
+/*!
+ Sets object selection widget text
+ \param theId - identificator of object selection widget
+ \param theText - new text
+*/
void LightApp_Dialog::setObjectText( const int theId, const QString& theText )
{
if ( myObjects.contains( theId ) )
myObjects[ theId ].myEdit->setText( theText );
}
-//=======================================================================
-// name : selectedObject
-// Purpose :
-//=======================================================================
+/*!
+ \return objects selected by widget
+ \param id - identificator of object selection widget
+ \param list - list to be filled by selected objects
+*/
void LightApp_Dialog::selectedObject( const int id, QStringList& list ) const
{
if( myObjects.contains( id ) )
list = myObjects[ id ].myIds;
}
-//=======================================================================
-// name : selectedObject
-// Purpose :
-//=======================================================================
+/*!
+ \return selected object id
+ \param id - identificator of object selection widget
+*/
QString LightApp_Dialog::selectedObject( const int id ) const
{
if ( myObjects.contains( id ) && myObjects[ id ].myIds.count() > 0 )
return "";
}
-//=======================================================================
-// name : objectSelection
-// Purpose :
-//=======================================================================
+/*!
+ \return all selected objects
+ \param objs - map: widget id -> string id to be filled with selected objects
+*/
void LightApp_Dialog::objectSelection( SelectedObjects& objs ) const
{
//objs.clear();
}
}
-//=======================================================================
-// name : createObject
-// Purpose :
-//=======================================================================
+/*!
+ Creates object selection widget
+ \return id
+ \label - label text
+ \parent - parent object
+ \id - proposed id for widget (if it is less than 0, the free id will be used)
+*/
int LightApp_Dialog::createObject( const QString& label, QWidget* parent, const int id )
{
int nid = id;
return nid;
}
-//=======================================================================
-// name : renameObject
-// Purpose :
-//=======================================================================
+/*!
+ Changes label of object selection widget
+ \param id - identificator of object selection widget
+ \param label - new text of label
+*/
void LightApp_Dialog::renameObject( const int id, const QString& label )
{
if( myObjects.contains( id ) )
myObjects[ id ].myLabel->setText( label );
}
-//=======================================================================
-// name : setObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Sets possible types for widget
+ \param id - identificator of object selection widget
+ \param type1,... - type
+*/
void LightApp_Dialog::setObjectType( const int id, const int type1, ... )
{
TypesList types;
setObjectType( id, types );
}
-//=======================================================================
-// name : setObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Sets possible types for widget
+ \param id - identificator of object selection widget
+ \param list - list of possible types
+*/
void LightApp_Dialog::setObjectType( const int id, const TypesList& list )
{
if( !myObjects.contains( id ) )
updateObject( id );
}
-//=======================================================================
-// name : addObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Adds new possible types to object selection widget
+ \param id - identificator of object selection widget
+ \param type1, ... - new types
+*/
void LightApp_Dialog::addObjectType( const int id, const int type1, const int, ... )
{
TypesList types; objectTypes( id, types );
setObjectType( id, types );
}
-//=======================================================================
-// name : addObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Adds new possible types to object selection widget
+ \param id - identificator of object selection widget
+ \param list - new types
+*/
void LightApp_Dialog::addObjectType( const int id, const TypesList& list )
{
TypesList types = list; objectTypes( id, types );
setObjectType( id, types );
}
-//=======================================================================
-// name : addObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Adds new possible type to object selection widget
+ \param id - identificator of object selection widget
+ \param type - new type
+*/
void LightApp_Dialog::addObjectType( const int id, const int type )
{
TypesList types; objectTypes( id, types );
setObjectType( id, types );
}
-//=======================================================================
-// name : removeObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Clears list of possibles types for object selection widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::removeObjectType( const int id )
{
TypesList types;
setObjectType( id, types );
}
-//=======================================================================
-// name : removeObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Removes types from list of possibles for object selection widget
+ \param id - identificator of object selection widget
+ \param list - list of types to be removed
+*/
void LightApp_Dialog::removeObjectType( const int id, const TypesList& list )
{
if( !myObjects.contains( id ) )
updateObject( id );
}
-//=======================================================================
-// name : removeObjectType
-// Purpose :
-//=======================================================================
+/*!
+ Removes type from list of possibles for object selection widget
+ \param id - identificator of object selection widget
+ \param type - type to be removed
+*/
void LightApp_Dialog::removeObjectType( const int id, const int type )
{
TypesList list; list.append( type );
removeObjectType( id, list );
}
-//=======================================================================
-// name : hasObjectType
-// Purpose :
-//=======================================================================
+/*!
+ \return true if widget has such type
+ \param id - identificator of object selection widget
+ \param type - type to be checked
+*/
bool LightApp_Dialog::hasObjectType( const int id, const int type ) const
{
if( myObjects.contains( id ) )
return false;
}
-//=======================================================================
-// name : objectTypes
-// Purpose :
-//=======================================================================
+/*!
+ Returns list of possible types for widget
+ \param id - identificator of object selection widget
+ \param list - list to be filled with possible types
+*/
void LightApp_Dialog::objectTypes( const int id, TypesList& list ) const
{
if( myObjects.contains( id ) )
}
}
-//=======================================================================
-// name : onToggled
-// Purpose :
-//=======================================================================
+/*!
+ SLOT: called if selection button is clicked
+*/
void LightApp_Dialog::onToggled( bool on )
{
QButton* but = ( QButton* )sender();
emit objectDeactivated( id );
}
-//=======================================================================
-// name : updateObject
-// Purpose :
-//=======================================================================
+/*!
+ Updates selection description of widget
+ \param id - identificator of object selection widget
+ \param emit_signal - if it is true, the signal "selection changed" is emitted
+*/
void LightApp_Dialog::updateObject( const int id, bool emit_signal )
{
if( hasSelection( id ) )
}
}
-//=======================================================================
-// name : filterTypes
-// Purpose :
-//=======================================================================
+/*!
+ Finds in list possible types
+ \param id - identificator of object selection widget
+ \param names - list of selected objects names
+ \param types - list of selected objects types
+ \param ids - list of selected objects ids
+*/
void LightApp_Dialog::filterTypes( const int id, QStringList& names, TypesList& types, QStringList& ids ) const
{
if( !myObjects.contains( id ) )
ids = new_ids;
}
-//=======================================================================
-// name : resMgr
-// Purpose :
-//=======================================================================
+/*!
+ \return global resource manager
+*/
SUIT_ResourceMgr* LightApp_Dialog::resMgr() const
{
return SUIT_Session::session()->resourceMgr();
}
-//=======================================================================
-// name : setObjectPixmap
-// Purpose :
-//=======================================================================
+/*!
+ Sets pixmap for all object selection button
+ \param p - image
+*/
void LightApp_Dialog::setObjectPixmap( const QPixmap& p )
{
myPixmap = p;
( ( QToolButton* )anIt.data().myBtn )->setIconSet( p );
}
-//=======================================================================
-// name : setObjectPixmap
-// Purpose :
-//=======================================================================
+/*!
+ Sets pixmap all for object selection button
+ \param section - name of section of resource manager
+ \param file - name of file
+*/
void LightApp_Dialog::setObjectPixmap( const QString& section, const QString& file )
{
SUIT_ResourceMgr* mgr = resMgr();
setObjectPixmap( mgr->loadPixmap( section, file ) );
}
-//=======================================================================
-// name : multipleSelection
-// Purpose :
-//=======================================================================
+/*!
+ \return true, if it is enable multiple selection
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::multipleSelection( const int id ) const
{
return nameIndication( id )!=OneName;
}
-//=======================================================================
-// name : nameIndication
-// Purpose :
-//=======================================================================
+/*!
+ \return type of name indication
+ \param id - identificator of object selection widget
+*/
LightApp_Dialog::NameIndication LightApp_Dialog::nameIndication( const int id ) const
{
if( myObjects.contains( id ) )
return OneNameOrCount;
}
-//=======================================================================
-// name : setNameIndication
-// Purpose :
-//=======================================================================
+/*!
+ Sets type of name indication
+ \param id - identificator of object selection widget
+ \param ni - new type of name indication
+*/
void LightApp_Dialog::setNameIndication( const int id, const NameIndication ni )
{
if( id==-1 )
}
}
-//=======================================================================
-// name : selectionDescription
-// Purpose :
-//=======================================================================
+/*!
+ \return string representation of selection by selection data
+ \param names - list of selected objects names
+ \param types - list of selected objects types
+ \param ni - type of name indication
+*/
QString LightApp_Dialog::selectionDescription( const QStringList& names, const TypesList& types, const NameIndication ni ) const
{
if( names.count()!=types.count() )
return QString::null;
}
-//=======================================================================
-// name : countOfTypes
-// Purpose :
-//=======================================================================
+/*!
+ \return string representation of count of types
+ \param types - list of types
+*/
QString LightApp_Dialog::countOfTypes( const TypesList& types ) const
{
QMap<int, int> typesCount;
return typeCount.join( ", " );
}
-//=======================================================================
-// name : typeName
-// Purpose :
-//=======================================================================
+/*!
+ \return reference to type name
+ \param type - integer id of type
+*/
QString& LightApp_Dialog::typeName( const int type )
{
return myTypeNames[ type ];
}
-//=======================================================================
-// name : typeName
-// Purpose :
-//=======================================================================
+/*!
+ \return const reference to type name
+ \param type - integer id of type
+*/
const QString& LightApp_Dialog::typeName( const int type ) const
{
return myTypeNames[ type ];
}
-//=======================================================================
-// name : activateObject
-// Purpose :
-//=======================================================================
+/*!
+ Activates object selection widget
+ \param id - identificator of object selection widget
+*/
void LightApp_Dialog::activateObject( const int theId )
{
if ( myObjects.contains( theId ) && !myObjects[ theId ].myBtn->isOn() )
myObjects[ theId ].myBtn->toggle();
}
-//=======================================================================
-// name : deactivateAll
-// Purpose :
-//=======================================================================
+/*!
+ Deactivates all object selection widgets
+*/
void LightApp_Dialog::deactivateAll()
{
ObjectMap::iterator anIt = myObjects.begin(),
}
}
-//=======================================================================
-// name : selectObject
-// Purpose :
-//=======================================================================
+/*!
+ Passes to widget name, type and id of selected object
+ \param id - identificator of object selection widget
+ \param name - name of selected object
+ \param type - type of selected object
+ \param selid - id of selected object
+ \param update - is need to update selection description string
+*/
void LightApp_Dialog::selectObject( const int id, const QString& name, const int type, const QString& selid, const bool update )
{
QStringList names; names.append( name );
selectObject( id, names, types, ids, update );
}
-//=======================================================================
-// name : selectObject
-// Purpose :
-//=======================================================================
+/*!
+ Passes to widget names, types and ids of selected objects
+ \param id - identificator of object selection widget
+ \param _names - names of selected object
+ \param _types - types of selected object
+ \param _ids - ids of selected object
+ \param update - is need to update selection description string
+*/
void LightApp_Dialog::selectObject( const int id, const QStringList& _names, const TypesList& _types,
const QStringList& _ids, const bool update )
{
emit selectionChanged( id );
}
-//=======================================================================
-// name : setReadOnly
-// Purpose :
-//=======================================================================
+/*!
+ Sets read only state of object selection line edit
+ \param id - identificator of object selection widget
+ \param ro - new read only state
+*/
void LightApp_Dialog::setReadOnly( const int id, const bool ro )
{
if( myObjects.contains( id ) )
myObjects[ id ].myEdit->setReadOnly( nameIndication( id )==ListOfNames || nameIndication( id )==OneName ? ro : true );
}
-//=======================================================================
-// name : isReadOnly
-// Purpose :
-//=======================================================================
+/*!
+ \return read only state of object selection line edit
+ \param id - identificator of object selection widget
+*/
bool LightApp_Dialog::isReadOnly( const int id ) const
{
if( myObjects.contains( id ) )
else
return true;
}
-
-//=======================================================================
-// name : onTextChanged
-// Purpose :
-//=======================================================================
+
+/*!
+ SLOT: called if text of object selection line edit is changed
+*/
void LightApp_Dialog::onTextChanged( const QString& text )
{
if( myIsBusy )
class SUIT_ResourceMgr;
-/*
- Class : LightApp_Dialog
- Description : Base class for all LightApp dialogs
+/*!
+ \class LightApp_Dialog
+ Base class for all LightApp dialogs.
+ Provides standard widget for object selection: line edit, button;
+ it is necessary to call corresponding methods on selection change.
+ Standard dialog provides filtering, selection string representation,
+ possibility to indicate necessary selection by text with list of ids.
*/
class LIGHTAPP_EXPORT LightApp_Dialog : public QtxDialog
{
#include "SALOME_InteractiveObject.hxx"
#endif
+/*!
+ Default constructor
+*/
LightApp_Displayer::LightApp_Displayer()
{
}
+/*!
+ Destructor
+*/
LightApp_Displayer::~LightApp_Displayer()
{
}
+/*!
+ Displays object in view
+ \param entry - object entry
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void LightApp_Displayer::Display( const QString& entry, const bool updateViewer, SALOME_View* theViewFrame )
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
}
}
+/*!
+ Redisplays object in view
+ \param entry - object entry
+ \param updateViewer - is it necessary to update viewer
+*/
void LightApp_Displayer::Redisplay( const QString& entry, const bool updateViewer )
{
// Remove the object permanently (<forced> == true)
}
}
+/*!
+ Erases object in view
+ \param entry - object entry
+ \param forced - deletes object from viewer (otherwise it will be erased, but cached)
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void LightApp_Displayer::Erase( const QString& entry, const bool forced,
const bool updateViewer, SALOME_View* theViewFrame )
{
}
}
+/*!
+ Erases all objects in view
+ \param forced - deletes objects from viewer
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void LightApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
}
}
+/*!
+ \return true if object is displayed in viewer
+ \param entry - object entry
+ \param theViewFrame - view
+*/
bool LightApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
return res;
}
+/*!
+ Updates active view
+*/
void LightApp_Displayer::UpdateViewer() const
{
SALOME_View* vf = GetActiveView();
vf->Repaint();
}
+/*!
+ \return presentation of object, built with help of CreatePrs method
+ \param entry - object entry
+ \param theViewFrame - view
+ \sa CreatePrs()
+*/
SALOME_Prs* LightApp_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame )
{
SALOME_Prs* prs = 0;
return prs;
}
+/*!
+ \return active view
+*/
SALOME_View* LightApp_Displayer::GetActiveView()
{
SUIT_Session* session = SUIT_Session::session();
return 0;
}
-bool LightApp_Displayer::canBeDisplayed( const QString&, const QString& ) const
+/*!
+ \return true, if object can be displayed in this type of viewer
+ \param entry - object entry
+ \param viewer_type - type of viewer
+*/
+bool LightApp_Displayer::canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const
{
return true;
}
+/*!
+ \return true, if object can be displayed in any type of viewer
+ \param entry - object entry
+*/
bool LightApp_Displayer::canBeDisplayed( const QString& entry ) const
{
QString viewerType;
return !viewerType.isNull() && canBeDisplayed( entry, viewerType );
}
+/*!
+ \return displayer, corresponding to module
+ \param mod_name - name of module
+ \param load - is module has to be forced loaded
+*/
LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, const bool load )
{
SUIT_Session* session = SUIT_Session::session();
using namespace std;
-//================================================================
-// Function : SaveDatasInFile
-/*! Purpose : save in file 'theFileName' datas from this driver*/
-//================================================================
+/*!
+ Save in file 'theFileName' datas from this driver
+*/
bool LightApp_Driver::SaveDatasInFile( const char* theFileName, bool isMultiFile )
{
int aNbModules = 0;
return true;
}
-//=======================================================================
-// name : ReaDatasFromFile
-/*! Purpose : filling current driver from file 'theFileName'*/
-//=======================================================================
+/*!
+ Filling current driver from file 'theFileName'
+*/
bool LightApp_Driver::ReadDatasFromFile( const char* theFileName, bool isMultiFile )
{
#ifdef WNT
return true;
}
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : returns temp directory for path 'theURL'*/
-//================================================================
+/*!
+ \return temp directory for path 'theURL'
+*/
std::string LightApp_Driver::GetTmpDir (const char* theURL, const bool isMultiFile)
{
std::string anURLDir = GetDirFromPath(theURL);
return aTmpDir;
}
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : returns list of files for module with name 'theModuleName'*/
-//================================================================
+/*!
+ \return list of files for module with name 'theModuleName'
+*/
LightApp_Driver::ListOfFiles LightApp_Driver::GetListOfFiles( const char* theModuleName )
{
ListOfFiles aListOfFiles;
return aListOfFiles;
}
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : sets list of files for module with name 'theModuleName'*/
-//================================================================
+/*!
+ Sets list of files for module with name 'theModuleName'
+*/
void LightApp_Driver::SetListOfFiles( const char* theModuleName, const ListOfFiles theListOfFiles )
{
std::string aName (theModuleName);
myMap[aName] = theListOfFiles;
}
-//============================================================================
-// function : PutFilesToStream
-/*! Purpose : converts files which was created from module <theModuleName> into a byte sequence unsigned char*/
-//============================================================================
+/*!
+ Converts files which was created from module <theModuleName> into a byte sequence unsigned char
+*/
void LightApp_Driver::PutFilesToStream( const std::string& theModuleName, unsigned char*& theBuffer,
long& theBufferSize, bool theNamesOnly )
{
theBufferSize = aBufferSize;
}
-//============================================================================
-// function : PutStreamToFile
-/*! Purpose : converts a byte sequence <theBuffer> to files and return list of them*/
-//============================================================================
+/*!
+ Converts a byte sequence <theBuffer> to files and return list of them
+*/
LightApp_Driver::ListOfFiles LightApp_Driver::PutStreamToFiles( const unsigned char* theBuffer,
const long theBufferSize, bool theNamesOnly )
{
return aFiles;
}
-//============================================================================
-// function : RemoveFiles
-/*! Purpose : Remove files. First item in <theFiles> is a directory with slash at the end.
- Other items are names of files. If <IsDirDeleted> is true,
- then the directory is also deleted.
+/*!
+ Remove files. First item in <theFiles> is a directory with slash at the end.
+ Other items are names of files. If <IsDirDeleted> is true,
+ then the directory is also deleted.
*/
-//============================================================================
void LightApp_Driver::RemoveFiles( const ListOfFiles& theFiles, const bool IsDirDeleted)
{
int i, aLength = theFiles.size() - 1;
}
}
-//============================================================================
-// function : RemoveTemporaryFiles
-/*! Purpose : removes files which was created from module theModuleName if
- <IsDirDeleted> is true tmp directory is also deleted if it is empty*/
-//============================================================================
+/*!
+ Removes files which was created from module theModuleName if
+ <IsDirDeleted> is true tmp directory is also deleted if it is empty
+*/
void LightApp_Driver::RemoveTemporaryFiles( const char* theModuleName, const bool IsDirDeleted )
{
std::string aModuleName(theModuleName);
}
-//============================================================================
-// function : ClearDriverContents
-/*! Purpose : clear map of list files*/
-//============================================================================
+/*!
+ Clears map of list files
+*/
void LightApp_Driver::ClearDriverContents()
{
std::map<std::string, ListOfFiles>::iterator it;
SetIsTemporary( false );
}
-//============================================================================
-// function : GetTempDir
-/*! Purpose : return a temp directory to store created files like "/tmp/sub_dir/" */
-//============================================================================
+/*!
+ \return a temp directory to store created files like "/tmp/sub_dir/"
+*/
std::string LightApp_Driver::GetTmpDir()
{
if ( myTmpDir.length() != 0 )
return aTmpDir.ToCString();
}
-//============================================================================
-// function : GetDirFromPath
-/*! Purpose : returns the dir by the path*/
-//============================================================================
+/*!
+ \return the dir by the path
+*/
std::string LightApp_Driver::GetDirFromPath( const std::string& thePath ) {
if(thePath == "")
return "";
}
+/*!
+ Constructor
+ \param entry - entry of object
+*/
LightApp_GLOwner::LightApp_GLOwner( const char* entry )
: GLViewer_Owner()
{
setEntry( entry );
}
+/*!
+ Destructor
+*/
LightApp_GLOwner::~LightApp_GLOwner()
{
}
+/*!
+ \return entry
+*/
const char* LightApp_GLOwner::entry() const
{
return myEntry.c_str();
}
+/*!
+ Sets new entry
+ \param entry - entry of object
+*/
void LightApp_GLOwner::setEntry( const char* entry )
{
myEntry = entry;
using namespace std;
-//================================================================
-// Function : SaveDatasInFile
-/*! Purpose : save in file 'theFileName' datas from this driver*/
-//================================================================
+/*!
+ Saves in file 'theFileName' datas from this driver
+*/
bool LightApp_HDFDriver::SaveDatasInFile( const char* theFileName, bool isMultiFile )
{
bool isASCII = false;
return !isError;
}
-//=======================================================================
-// Function : ReadDatasFromFile
-/*! Purpose : filling current driver from file 'theFileName'*/
-//=======================================================================
+/*!
+ Filling current driver from file 'theFileName'
+*/
bool LightApp_HDFDriver::ReadDatasFromFile( const char* theFileName, bool isMultiFile )
{
bool isASCII = false;
}
}
+/*!
+ Must be redefined in order to use standard displayer mechanism
+ \return displayer of module
+*/
LightApp_Displayer* LightApp_Module::displayer()
{
return 0;
}
+/*!
+ SLOT: called on activating of standard operations show/hide
+*/
void LightApp_Module::onShowHide()
{
if( !sender()->inherits( "QAction" ) || !popupMgr() )
startOperation( id );
}
+/*!
+ virtual SLOT: called on view manager adding
+*/
void LightApp_Module::onViewManagerAdded( SUIT_ViewManager* )
{
}
+/*!
+ virtual SLOT: called on view manager removing
+*/
void LightApp_Module::onViewManagerRemoved( SUIT_ViewManager* )
{
}
class QString;
class QVariant;
-/*
- Class : LightApp_Module
- Description : Base class for all light modules
+/*!
+ \class LightApp_Module
+ Base class for all light modules
*/
class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
return myLineEdit->text();
}
+/*!
+ Accepts if name isn't empty
+*/
void LightApp_NameDlg::accept()
{
if ( name().stripWhiteSpace().isEmpty() )
class QLineEdit;
class QPushButton;
-//=================================================================================
-// class : LightApp_NameDlg
-/*! purpose : Common <Rename> dialog box class*/
-//=================================================================================
+/*!
+ \class LightApp_NameDlg
+ Common <Rename> dialog box class
+*/
class LIGHTAPP_EXPORT LightApp_NameDlg : public QDialog
{
Q_OBJECT
setDialogActive( false );
}
-//=======================================================================
-// name : abortOperation
-// Purpose : Hide dialog box (if it is exists)
-//=======================================================================
/*!
* \brief Performs actions needed for aborting operation
*
class LightApp_Dialog;
class SUIT_Desktop;
-/*
- Class : LightApp_Operation
- Description : Base class for all operations
-*/
-
/*!
- * \brief Base class for all operations
- *
- * Base class for all operations (see SUIT_Operation for more description)
+ \class LightApp_Operation
+ \brief Base class for all operations
+ Base class for all operations (see SUIT_Operation for more description)
*/
class LIGHTAPP_EXPORT LightApp_Operation : public SUIT_Operation
{
return id;
}
-/*
+/*!
Checks: is preferences has module with name \a mod.
*/
bool LightApp_Preferences::hasModule( const QString& mod ) const
#include <SALOME_ListIteratorOfListIO.hxx>
#endif
+/*!
+ Constructor
+*/
LightApp_ShowHideOp::LightApp_ShowHideOp( ActionType type )
: LightApp_Operation(),
myActionType( type )
{
}
+/*!
+ Destructor
+*/
LightApp_ShowHideOp::~LightApp_ShowHideOp()
{
}
+/*!
+ Makes show/hide operation
+*/
void LightApp_ShowHideOp::startOperation()
{
LightApp_Application* app = dynamic_cast<LightApp_Application*>( application() );
emit created( this );
}
-//=======================================================================
-// name : openDocument
-/*! Purpose : Open document*/
-//=======================================================================
+/*!
+ Opens document
+*/
bool LightApp_Study::openDocument( const QString& theFileName )
{
myDriver->ClearDriverContents();
return res;
}
-//=======================================================================
-// name : loadDocument
-/*! Purpose : Load document */
-//=======================================================================
+/*!
+ Loads document
+*/
bool LightApp_Study::loadDocument( const QString& theStudyName )
{
myDriver->ClearDriverContents();
return res;
}
-//=======================================================================
-// name : saveDocumentAs
-/*! Purpose : Save document */
-//=======================================================================
+/*!
+ Saves document
+*/
bool LightApp_Study::saveDocumentAs( const QString& theFileName )
{
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
return res;
}
-//=======================================================================
-// name : saveDocument
-/*! Purpose : Save document */
-//=======================================================================
+/*!
+ Saves document
+*/
bool LightApp_Study::saveDocument()
{
ModelList list; dataModels( list );
return res;
}
-//================================================================
-// Function : closeDocument
-/*! Purpose : Close document */
-//================================================================
+/*!
+ Closes document
+*/
void LightApp_Study::closeDocument(bool permanently)
{
// Inform everybody that this study is going to close when it's most safe to,
myDriver->ClearDriverContents();
}
-//================================================================
-// Function : referencedToEntry
-/*! Purpose : Return current entry*/
-//================================================================
+/*!
+ \return real entry by entry of reference
+ \param entry - entry of reference object
+*/
QString LightApp_Study::referencedToEntry( const QString& entry ) const
{
return entry;
}
-//================================================================
-// Function : children
-/*! Purpose : Return entries of children of object*/
-//================================================================
+/*!
+ \return entries of object children
+*/
void LightApp_Study::children( const QString&, QStringList& ) const
{
}
-//================================================================
-// Function : isComponent
-/*! Purpose : Return true if entry corresponds to component*/
-//================================================================
+/*!
+ \return true if entry corresponds to component
+*/
bool LightApp_Study::isComponent( const QString& entry ) const
{
if( !root() )
return false;
}
-//================================================================
-// Function : componentDataType
-/*! Purpose : Return component data type from entry*/
-//================================================================
+/*!
+ \return component data type for entry
+*/
QString LightApp_Study::componentDataType( const QString& entry ) const
{
LightApp_DataObject* aCurObj;
return "";
}
-//================================================================
-// Function : isModified
-// Purpose :
-//================================================================
+/*!
+ \return true if study is modified
+*/
bool LightApp_Study::isModified() const
{
bool isAnyChanged = CAM_Study::isModified();
return isAnyChanged;
}
-//================================================================
-// Function : isSaved
-/*! Purpose : Check: data model is saved?*/
-//================================================================
+/*!
+ \return true if data model is saved
+*/
bool LightApp_Study::isSaved() const
{
return CAM_Study::isSaved();
}
-//=======================================================================
-// name : addComponent
-/*! Purpose : Create SComponent for module, necessary for SalomeApp study */
-//=======================================================================
+/*!
+ Creates SComponent for module, necessary for SalomeApp study
+*/
void LightApp_Study::addComponent(const CAM_DataModel* dm)
{
}
-//=======================================================================
-// name : saveModuleData
-/*! Purpose : save list file for module 'theModuleName' */
-//=======================================================================
+/*!
+ Saves list file for module 'theModuleName'
+*/
void LightApp_Study::saveModuleData(QString theModuleName, QStringList theListOfFiles)
{
int aNb = theListOfFiles.count();
myDriver->SetListOfFiles(theModuleName, aListOfFiles);
}
-//=======================================================================
-// name : openModuleData
-/*! Purpose : gets list of file for module 'theModuleNam' */
-//=======================================================================
+/*!
+ Gets list of file for module 'theModuleNam'
+*/
void LightApp_Study::openModuleData(QString theModuleName, QStringList& theListOfFiles)
{
std::vector<std::string> aListOfFiles = myDriver->GetListOfFiles(theModuleName);
theListOfFiles.append(aListOfFiles[i+1].c_str());
}
-//=======================================================================
-// name : saveStudyData
-/*! Purpose : save data from study */
-//=======================================================================
+/*!
+ Saves data from study
+*/
bool LightApp_Study::saveStudyData( const QString& theFileName )
{
ModelList list; dataModels( list );
return aRes;
}
-//=======================================================================
-// name : openStudyData
-/*! Purpose : open data for study */
-//=======================================================================
+/*!
+ Opens data for study
+*/
bool LightApp_Study::openStudyData( const QString& theFileName )
{
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
return aRes;
}
-//================================================================
-// Function : openDataModel
-/*! Purpose : Open data model */
-//================================================================
+/*!
+ Opens data model
+*/
bool LightApp_Study::openDataModel( const QString& studyName, CAM_DataModel* dm )
{
if (!dm)
return false;
}
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ \return temporary directory for saving files of modules
+*/
std::string LightApp_Study::GetTmpDir (const char* theURL,
const bool isMultiFile)
{
return myDriver->GetTmpDir(theURL, isMultiFile);
}
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ \return list of files necessary for module
+ \param theModuleName - name of module
+*/
std::vector<std::string> LightApp_Study::GetListOfFiles(const char* theModuleName) const
{
std::vector<std::string> aListOfFiles;
return aListOfFiles;
}
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ Sets list of files necessary for module
+ \param theModuleName - name of module
+ \param theListOfFiles - list of files
+*/
void LightApp_Study::SetListOfFiles (const char* theModuleName, const std::vector<std::string> theListOfFiles)
{
myDriver->SetListOfFiles(theModuleName, theListOfFiles);
}
-//================================================================
-// Function : RemoveTemporaryFiles
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ Removes temporary files
+*/
void LightApp_Study::RemoveTemporaryFiles (const char* theModuleName, const bool isMultiFile) const
{
if (isMultiFile)
myDriver->RemoveTemporaryFiles(theModuleName, isDirDeleted);
}
-//================================================================
-// Function : components
-/*! Purpose : to be used by modules*/
-//================================================================
+/*!
+ Fills list with components names
+ \param comp - list to be filled
+*/
void LightApp_Study::components( QStringList& comp ) const
{
DataObjectList children = root()->children();
//
// See http://www.salome-platform.org/
//
-/**
-* LIGHT LightApp
-*
-* Copyright (C) 2005 CEA/DEN, EDF R&D
-*
-*
-*
-* File : LightApp_SwitchOp.h
-* Author : Sergey LITONIN
-* Module : LIGHT
-*/
#include "LightApp_SwitchOp.h"
#include "LightApp_Module.h"
//
// See http://www.salome-platform.org/
//
-/**
-* LIGHT LightApp
-*
-* Copyright (C) 2005 CEA/DEN, EDF R&D
-*
-*
-*
-* File : LightApp_SwitchOp.h
-* Author : Sergey LITONIN
-* Module : LIGHT
-*/
-
-
#ifndef LightApp_SwitchOp_H
#define LightApp_SwitchOp_H
#ifndef LightApp_UpdateFlags_H
#define LightApp_UpdateFlags_H
-/*
- Enum : UpdateFlags
- Description : Enumeration for update flags. First byte is reserved for LightApp_Module.
- Modules derived from this model must use other 3 bytes to define their
- own update flags
+/*!
+ \enum UpdateFlags
+ Enumeration for update flags. First byte is reserved for LightApp_Module.
+ Modules derived from this model must use other 3 bytes to define their
+ own update flags
*/
typedef enum
{
}
+/*!
+ \return active SVTK view window
+*/
SVTK_ViewWindow*
LightApp_SVTKDataOwner
::GetActiveViewWindow() const
#include <QtxActionMenuMgr.h>
#include <QtxActionToolMgr.h>
+/*!
+ Default constructor
+*/
SUIT_Application::SUIT_Application()
: QObject( 0 ),
myStudy( 0 ),
{
}
+/*!
+ Destructor
+*/
SUIT_Application::~SUIT_Application()
{
delete myStudy;
setDesktop( 0 );
}
+/*!
+ \return main window of application (desktop)
+*/
SUIT_Desktop* SUIT_Application::desktop()
{
return myDesktop;
}
+/*!
+ \return FALSE if application can not be closed (because of non saved data for example).
+ This method called by SUIT_Session whin closing of application was requested.
+*/
bool SUIT_Application::isPossibleToClose()
{
return true;
}
+/*!
+ Performs some finalization of life cycle of this application.
+ For instance, the application can force its documents(s) to close.
+*/
void SUIT_Application::closeApplication()
{
emit applicationClosed( this );
}
+/*!
+ \return active Study. If Application supports wirking with several studies this method should be redefined
+*/
SUIT_Study* SUIT_Application::activeStudy() const
{
return myStudy;
}
+/*!
+ \return version of application
+*/
QString SUIT_Application::applicationVersion() const
{
return QString::null;
}
+/*!
+ Shows the application's main widget. For non GUI application must be redefined.
+*/
void SUIT_Application::start()
{
if ( desktop() )
desktop()->show();
}
+/*!
+ Opens document into active Study. If Study is empty - creates it.
+ \param theFileName - name of document file
+*/
bool SUIT_Application::useFile( const QString& theFileName )
{
createEmptyStudy();
return status;
}
+/*!
+ Opens other study into active Study. If Study is empty - creates it.
+ \param theName - name of study
+*/
bool SUIT_Application::useStudy( const QString& theName )
{
return false;
}
+/*!
+ Creates new empty Study if active Study = 0
+*/
void SUIT_Application::createEmptyStudy()
{
if ( !activeStudy() )
setActiveStudy( createNewStudy() );
}
+/*!
+ \return number of Studies.
+ Must be redefined in Applications which support several studies for one Application instance.
+*/
int SUIT_Application::getNbStudies() const
{
return activeStudy() ? 1 : 0;
}
+/*!
+ \return global resource manager
+*/
SUIT_ResourceMgr* SUIT_Application::resourceMgr() const
{
if ( !SUIT_Session::session() )
}
#define DEFAULT_MESSAGE_DELAY 3000
+
+/*!
+ Puts the message to the status bar
+ \param msg - text of message
+ \param msec - time in milliseconds, after that the status label will be cleared
+*/
void SUIT_Application::putInfo ( const QString& msg, const int msec )
{
if ( !desktop() )
QTimer::singleShot( msec <= 0 ? DEFAULT_MESSAGE_DELAY : msec, myStatusLabel, SLOT( clear() ) );
}
+/*!
+ Initialize with application arguments
+ \param argc - number of application arguments
+ \param argv - array of application arguments
+*/
SUIT_Application* SUIT_Application::startApplication( int argc, char** argv ) const
{
return startApplication( name(), argc, argv );
}
+/*!
+ Initialize with application name and arguments
+ \param name - name of application
+ \param argc - number of application arguments
+ \param argv - array of application arguments
+*/
SUIT_Application* SUIT_Application::startApplication( const QString& name, int argc, char** argv ) const
{
SUIT_Session* session = SUIT_Session::session();
return session->startApplication( name, argc, argv );
}
+/*!
+ Sets the main window of application
+ \param desk - new main window (desktop)
+*/
void SUIT_Application::setDesktop( SUIT_Desktop* desk )
{
if ( myDesktop == desk )
connect( myDesktop, SIGNAL( activated() ), this, SLOT( onDesktopActivated() ) );
}
+/*!
+ Creates new instance of study.
+ By default, it is called from createEmptyStudy()
+ \sa createEmptyStudy()
+*/
SUIT_Study* SUIT_Application::createNewStudy()
{
return new SUIT_Study( this );
}
+/*!
+ Sets study as active
+ \param study - instance of study to be set as active
+*/
void SUIT_Application::setActiveStudy( SUIT_Study* study )
{
if ( myStudy == study )
myStudy = study;
}
+/*!
+ Creates new toolbar
+ \return identificator of new toolbar in tool manager
+ \param name - name of new toolbar
+*/
int SUIT_Application::createTool( const QString& name )
{
if ( !desktop() || !desktop()->toolMgr() )
return desktop()->toolMgr()->createToolBar( name );
}
+/*!
+ Creates new toolbutton
+ \return SUIT identificator of new action
+ \param a - action
+ \param tBar - identificator of toolbar
+ \param id - proposed SUIT identificator of action (if it is -1, then must be use any free)
+ \param idx - index in toolbar
+*/
int SUIT_Application::createTool( QAction* a, const int tBar, const int id, const int idx )
{
if ( !desktop() || !desktop()->toolMgr() )
return intId != -1 ? regId : -1;
}
+/*!
+ Creates new toolbutton
+ \return SUIT identificator of new action
+ \param a - action
+ \param tBar - name of toolbar
+ \param id - proposed SUIT identificator of action (if it is -1, then must be use any free)
+ \param idx - index in toolbar
+*/
int SUIT_Application::createTool( QAction* a, const QString& tBar, const int id, const int idx )
{
if ( !desktop() || !desktop()->toolMgr() )
return intId != -1 ? regId : -1;
}
+/*!
+ Creates new toolbutton
+ \return "id" if all right or -1 otherwise
+ \param id - SUIT identificator of action
+ \param tBar - identificator of toolbar
+ \param idx - index in toolbar
+*/
int SUIT_Application::createTool( const int id, const int tBar, const int idx )
{
if ( !desktop() || !desktop()->toolMgr() )
return intId != -1 ? id : -1;
}
+/*!
+ Creates new toolbutton
+ \return "id" if all right or -1 otherwise
+ \param id - SUIT identificator of action
+ \param tBar - name of toolbar
+ \param idx - index in toolbar
+*/
int SUIT_Application::createTool( const int id, const QString& tBar, const int idx )
{
if ( !desktop() || !desktop()->toolMgr() )
return intId != -1 ? id : -1;
}
+/*!
+ Creates new menu item
+ \return identificator of new action in menu manager
+ \param subMenu - menu text of new item
+ \param menu - identificator of parent menu item
+ \param id - proposed identificator of action
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( const QString& subMenu, const int menu,
const int id, const int group, const int index )
{
return desktop()->menuMgr()->insert( subMenu, menu, group, id, index );
}
+/*!
+ Creates new menu item
+ \return identificator of new action in menu manager
+ \param subMenu - menu text of new item
+ \param menu - menu text of parent menu item
+ \param id - proposed identificator of action
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( const QString& subMenu, const QString& menu,
const int id, const int group, const int index )
{
return desktop()->menuMgr()->insert( subMenu, menu, group, id, index );
}
+/*!
+ Creates new menu item
+ \return SUIT identificator of new action
+ \param a - action
+ \param menu - identificator of parent menu item
+ \param id - proposed SUIT identificator of action
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( QAction* a, const int menu, const int id, const int group, const int index )
{
if ( !a || !desktop() || !desktop()->menuMgr() )
return intId != -1 ? regId : -1;
}
+/*!
+ Creates new menu item
+ \return SUIT identificator of new action
+ \param a - action
+ \param menu - menu text of parent menu item
+ \param id - proposed SUIT identificator of action
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( QAction* a, const QString& menu, const int id, const int group, const int index )
{
if ( !a || !desktop() || !desktop()->menuMgr() )
return intId != -1 ? regId : -1;
}
+/*!
+ Creates new menu item
+ \return identificator of new action in menu manager
+ \param id - SUIT identificator of action
+ \param menu - menu text of parent menu item
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( const int id, const int menu, const int group, const int index )
{
if ( !desktop() || !desktop()->menuMgr() )
return intId != -1 ? id : -1;
}
+/*!
+ Creates new menu item
+ \return identificator of new action in menu manager
+ \param id - SUIT identificator of action
+ \param menu - menu text of parent menu item
+ \param group - group in menu manager
+ \param index - index in menu
+*/
int SUIT_Application::createMenu( const int id, const QString& menu, const int group, const int index )
{
if ( !desktop() || !desktop()->menuMgr() )
return intId != -1 ? id : -1;
}
+/*!
+ Show/hide menu item corresponding to action
+ \param a - action
+ \param on - if it is true, the item will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setMenuShown( QAction* a, const bool on )
{
setMenuShown( actionId( a ), on );
}
+/*!
+ Show/hide menu item corresponding to action
+ \param id - identificator of action in menu manager
+ \param on - if it is true, the item will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setMenuShown( const int id, const bool on )
{
if ( desktop() && desktop()->menuMgr() )
desktop()->menuMgr()->setShown( id, on );
}
+/*!
+ Show/hide tool button corresponding to action
+ \param a - action
+ \param on - if it is true, the button will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setToolShown( QAction* a, const bool on )
{
setToolShown( actionId( a ), on );
}
+/*!
+ Show/hide menu item corresponding to action
+ \param id - identificator of action in tool manager
+ \param on - if it is true, the button will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setToolShown( const int id, const bool on )
{
if ( desktop() && desktop()->toolMgr() )
desktop()->toolMgr()->setShown( id, on );
}
+/*!
+ Show/hide both menu item and tool button corresponding to action
+ \param a - action
+ \param on - if it is true, the item will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setActionShown( QAction* a, const bool on )
{
setMenuShown( a, on );
setToolShown( a, on );
}
+/*!
+ Show/hide both menu item and tool button corresponding to action
+ \param id - identificator in both menu manager and tool manager
+ \param on - if it is true, the item will be shown, otherwise it will be hidden
+*/
void SUIT_Application::setActionShown( const int id, const bool on )
{
setMenuShown( id, on );
setToolShown( id, on );
}
+/*!
+ \return action by it's SUIT identificator
+ \param id - SUIT identificator
+*/
QAction* SUIT_Application::action( const int id ) const
{
QAction* a = 0;
return a;
}
+/*!
+ \return SUIT identificator of action
+ \param a - action
+*/
int SUIT_Application::actionId( const QAction* a ) const
{
int id = -1;
return id;
}
+/*!
+ Creates action and registers it both in menu manager and tool manager
+ \return new instance of action
+ \param id - proposed SUIT identificator
+ \param text - description
+ \param icon - icon for toolbar
+ \param menu - menu text
+ \param tip - tool tip
+ \param key - shortcut
+ \param parent - parent object
+ \param toggle - if it is TRUE the action will be a toggle action, otherwise it will be a command action
+ \param reciever - object that contains slot
+ \param member - slot to be called when action is activated
+*/
QAction* SUIT_Application::createAction( const int id, const QString& text, const QIconSet& icon,
const QString& menu, const QString& tip, const int key,
QObject* parent, const bool toggle, QObject* reciever, const char* member )
return a;
}
+/*!
+ Registers action both in menu manager and tool manager
+ \param id - proposed SUIT identificator (if it is -1, auto generated one is used)
+ \param a - action
+*/
int SUIT_Application::registerAction( const int id, QAction* a )
{
int ident = actionId( a );
return ident;
}
+/*!
+ \return global action used as separator
+*/
QAction* SUIT_Application::separator()
{
return QtxActionMgr::separator();
}
+/*!
+ SLOT: it is called when desktop is activated
+*/
+
void SUIT_Application::onDesktopActivated()
{
emit activated( this );
myCheck = on;
}
+/*!
+ \return the opened state of the object (used in Object Browser).
+*/
bool SUIT_DataObject::isOpen() const
{
return myOpen;
}
+/*!
+ Sets the opened state of the object (used in Object Browser).
+*/
void SUIT_DataObject::setOpen( const bool on )
{
myOpen = on;
#define _typeinfo type_info
#endif
-//********************************************************************
-// SUIT_DataOwner class
-//********************************************************************
-
-
/*! Constructor*/
SUIT_DataOwner::SUIT_DataOwner()
{
return p1.isNull() && p2.isNull();
}
-//********************************************************************
-/*! \class SUIT_DataOwnerPtrList
- * implements value list with unique items (uniqueness is
- * provided by operator==())
- */
-//********************************************************************
+/*!
+ \class SUIT_DataOwnerPtrList
+ implements value list with unique items (uniqueness is
+ provided by operator==())
+*/
-//====================================================================
-//! Constructor (default)
-//====================================================================
+/*!
+ Constructor (default)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList()
: QValueList<SUIT_DataOwnerPtr>(),
mySkipEqual( true )
{
}
-//====================================================================
-//! Constructor (default)
-//====================================================================
+/*!
+ Constructor (default)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqual )
: QValueList<SUIT_DataOwnerPtr>(),
mySkipEqual( skipAllEqual )
{
}
-//====================================================================
-//! Constructor (copy)
-//====================================================================
+/*!
+ Constructor (copy)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l )
: QValueList<SUIT_DataOwnerPtr>( l ),
mySkipEqual( true )
{
}
-//====================================================================
-//! Constructor (copy)
-//====================================================================
+/*!
+ Constructor (copy)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqual )
: QValueList<SUIT_DataOwnerPtr>(),
mySkipEqual( skipAllEqual )
}
#ifndef QT_NO_STL
-//====================================================================
-//! Constructor (from stl)
-//====================================================================
+/*!
+ Constructor (from stl)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l )
: QValueList<SUIT_DataOwnerPtr>( l ),
mySkipEqual( true )
#endif
#ifndef QT_NO_STL
-//====================================================================
-//! Constructor (from stl)
-//====================================================================
+/*!
+ Constructor (from stl)
+*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l, const bool skipAllEqual )
: QValueList<SUIT_DataOwnerPtr>(),
mySkipEqual( skipAllEqual )
}
#endif
-//====================================================================
-//! Appends an item to the list
-//====================================================================
+/*!
+ Appends an item to the list
+*/
SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x )
{
if( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator==
return it;
}
-//====================================================================
-//! Clear list
-//====================================================================
+/*!
+ Clear list
+*/
void SUIT_DataOwnerPtrList::clear()
{
if( mySkipEqual )
QValueList<SUIT_DataOwnerPtr>::clear();
}
-//====================================================================
-//! Remove an item from the list
-//====================================================================
+/*!
+ Remove an item from the list
+*/
uint SUIT_DataOwnerPtrList::remove(const SUIT_DataOwnerPtr& x )
{
if( mySkipEqual && myMap.contains(x) )
return QValueList<SUIT_DataOwnerPtr>::remove( x );
}
-//====================================================================
-//!
-//====================================================================
+/*!
+ Operator < allows to order suit data owners for map
+*/
bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 )
{
return p1.get()<p2.get();
//
// See http://www.salome-platform.org/
//
-/********************************************************************
-** Class: SUIT_MessageBox
-** Descr: Message dialog box for SUIT-based application
-** Module: SUIT
-** Created: UI team, 02.10.00
-*********************************************************************/
+
+/*!
+ \class: SUIT_MessageBox
+ Message dialog box for SUIT-based application
+ Module: SUIT
+ Created: UI team, 02.10.00
+*/
#include "SUIT_MessageBox.h"
#include "SUIT_OverrideCursor.h"
//
// See http://www.salome-platform.org/
//
-/********************************************************************
-** Class: SUIT_MessageBox
-** Descr: Message dialog box for SUIT-based application
-** Module: SUIT
-** Created: UI team, 02.10.00
-*********************************************************************/
+
#ifndef SUIT_MESSAGEBOX_H
#define SUIT_MESSAGEBOX_H
#define SUIT_NO 4
#define SUIT_HELP 5
+/*!
+ \class SUIT_MessageBox
+ \brief Message dialog box for SUIT-based application
+*/
class SUIT_EXPORT SUIT_MessageBox
{
public:
//
// See http://www.salome-platform.org/
//
-/**
-* SALOME SalomeApp
-*
-* Copyright (C) 2005 CEA/DEN, EDF R&D
-*
-*
-*
-* File : SUIT_Operation.h
-* Author : Unknown
-* Module : SALOME
+
+/*!
+ SALOME SalomeApp
+
+ Copyright (C) 2005 CEA/DEN, EDF R&D
+
+ File : SUIT_Operation.h
+ Author : Unknown
+ Module : SALOME
*/
#include "SUIT_Operation.h"
#include "SUIT_Application.h"
/*!
- * \brief Constructor
- * \param SUIT_Application - application for this operation
-*
-* Constructs an empty operation. Constructor should work very fast because many
-* operators may be created after starting application but only several from them
-* may be used. As result this constructor stores given application in myApp field
-* and set Waiting status.
+ \brief Constructor
+ \param SUIT_Application - application for this operation
+
+ Constructs an empty operation. Constructor should work very fast because many
+ operators may be created after starting application but only several from them
+ may be used. As result this constructor stores given application in myApp field
+ and set Waiting status.
*/
SUIT_Operation::SUIT_Operation( SUIT_Application* app )
: QObject(),
//
// See http://www.salome-platform.org/
//
-/**
-* SALOME SalomeApp
-*
-* Copyright (C) 2005 CEA/DEN, EDF R&D
-*
-*
-*
-* File : SUIT_Operation.h
-* Author : Unknown
-* Module : SALOME
-*/
#ifndef SUIT_OPERATION_H
#define SUIT_OPERATION_H
class SUIT_Application;
/*!
+ \class SUIT_Operation
* \brief Base class for all operations
*
* Base class for all operations. If you perform an action it is reasonable to create
return path( docSection, prefix, id );
}
+#include <unistd.h>
/*!
Returns the user file name for specified application
*/
{
}
+/*!
+ Custom document initialization to be performed \n
+ within onNewDoc() handler can be put here
+*/
void SUIT_Study::createDocument()
{
- /*! Custom document initialization to be performed \n
- * within onNewDoc() handler can be put here
- */
}
/*!
myStudy = NULL;
}
+/*! invoke method of SUIT_PopupClient, which notifies about popup*/
void SUIT_ViewManager::onContextMenuRequested( QContextMenuEvent* e )
{
- /*! invoke method of SUIT_PopupClient, which notifies about popup*/
contextMenuRequest( e );
}
{
}
+/*!
+ Sets new view manager for window
+ \param theManager - new view manager
+*/
void SUIT_ViewWindow::setViewManager( SUIT_ViewManager* theManager )
{
myManager = theManager;
}
+/*!
+ \return view manager of window
+*/
SUIT_ViewManager* SUIT_ViewWindow::getViewManager() const
{
return myManager;
}
+/*!
+ \return QImage, containing all scene rendering in window
+*/
QImage SUIT_ViewWindow::dumpView()
{
return QImage();
}
+/*!
+ Saves scene rendering in window to file
+ \param fileName - name of file
+ \param format - string contains name of format (for example, "BMP"(default) or "JPEG", "JPG")
+*/
bool SUIT_ViewWindow::dumpViewToFormat( const QString& fileName, const QString& format )
{
QImage img = dumpView();
qApp->postEvent( this, new QCustomEvent( DUMP_EVENT ) );
}
+/*!
+ \return filters for image files
+*/
QString SUIT_ViewWindow::filter() const
{
return tr( "TLT_IMAGE_FILES" );
{
}
+/*!
+ \return string containing visual parameters of window
+*/
QString SUIT_ViewWindow::getVisualParameters()
{
return "empty";
}
-
+
+/*!
+ Sets visual parameters of window by its string representation
+ \param parameters - string with visual parameters
+*/
void SUIT_ViewWindow::setVisualParameters( const QString& parameters )
{
}
// Module : SALOME
// $Header$
-/* --- Definition macros file to print informations if _DEBUG_ is defined --- */
+/*! --- Definition macros file to print informations if _DEBUG_ is defined --- */
#ifndef UTILITIES_H
#define UTILITIES_H
#include "LocalTraceBufferPool.hxx"
-/** \file utilities.h
+/*! \file utilities.h
* For each message to put in the trace, a specific ostingstream object is \n
* created and destroyed automatically at the end of the message macro. \n
* The insert function of LocalTraceBufferPool class gets a buffer in a \n
std::cerr << "ABORT return code= "<< code << std::endl; \
std::exit(code);}
-/* --- To print date and time of compilation of current source --- */
+/*! --- To print date and time of compilation of current source --- */
#if defined ( __GNUC__ )
#define COMPILER "g++"
<< " at " << __TIME__ << MESS_END }
#ifdef _DEBUG_
-/** @name the following MACROS are useful at debug time*/
+/*! @name the following MACROS are useful at debug time*/
//@{
#define MESSAGE(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
#define SCRUTE(var) {MESS_BEGIN("- Trace ") << #var << "=" << var <<MESS_END}