Salome HOME
display isos on planar faces (on box for ex.). added
[modules/gui.git] / src / CAM / CAM_Module.cxx
index aed6c264602cb4759430bdbe63d5d1ad56fa4b82..46ac007ee1cd62d123514df846cc8fc9562998c8 100755 (executable)
@@ -8,6 +8,7 @@
 #include <QtxActionMenuMgr.h>
 #include <QtxActionToolMgr.h>
 
+/*!Icon.*/
 static const char* ModuleIcon[] = {
 "20 20 2 1",
 "      c None",
@@ -35,6 +36,7 @@ static const char* ModuleIcon[] = {
 
 QPixmap MYPixmap( ModuleIcon );
 
+/*!Constructor.*/
 CAM_Module::CAM_Module()
 : QObject(),
 myApp( 0 ),
@@ -43,6 +45,7 @@ myDataModel( 0 )
 {
 }
 
+/*!Constructor. initialize \a name.*/
 CAM_Module::CAM_Module( const QString& name )
 : QObject(),
 myApp( 0 ),
@@ -52,27 +55,34 @@ myDataModel( 0 )
 {
 }
 
+/*!Destructor. Remove data model.*/
 CAM_Module::~CAM_Module()
 {
   delete myDataModel;
   myDataModel = 0;
 }
 
+/*!Initialize application.*/
 void CAM_Module::initialize( CAM_Application* app )
 {
   myApp = app;
 }
 
+/*!\retval Module icon.*/
 QPixmap CAM_Module::moduleIcon() const
 {
   return myIcon;
 }
 
+/*!\retval Module name.*/
 QString CAM_Module::moduleName() const
 {
   return myName;
 }
 
+/*! \brief Return data model.
+ * Create data model, if it was't created before.
+ */
 CAM_DataModel* CAM_Module::dataModel() const
 {
   if ( !myDataModel )
@@ -84,19 +94,29 @@ CAM_DataModel* CAM_Module::dataModel() const
   return myDataModel;
 }
 
+/*!\retval CAM_Application pointer - application.*/
 CAM_Application* CAM_Module::application() const
 {
   return myApp;
 }
 
-void CAM_Module::activateModule( SUIT_Study* study )
+/*!Public slot
+ * \retval true.
+ */
+bool CAM_Module::activateModule( SUIT_Study* study )
 {
+  return true;
 }
 
-void CAM_Module::deactivateModule( SUIT_Study* )
+/*!Public slot
+ * \retval true.
+ */
+bool CAM_Module::deactivateModule( SUIT_Study* )
 {
+  return true;
 }
 
+/*!Public slot, remove data model from \a study.*/
 void CAM_Module::studyClosed( SUIT_Study* study )
 {
   CAM_Study* camDoc = dynamic_cast<CAM_Study*>( study );
@@ -107,25 +127,36 @@ void CAM_Module::studyClosed( SUIT_Study* study )
     camDoc->removeDataModel( dataModel() );
 }
 
+/*!Public slot, do nothing.*/
 void CAM_Module::studyChanged( SUIT_Study* , SUIT_Study* )
 {
 }
 
+/*!Create and return new instance of CAM_DataModel.*/
 CAM_DataModel* CAM_Module::createDataModel()
 { 
   return new CAM_DataModel( this );
 }
 
+/*!Sets module name to \a name.
+ * \param name - new name for module.
+ */
 void CAM_Module::setModuleName( const QString& name )
 {
   myName = name;
 }
 
+/*!Sets module icon to \a icon.
+ * \param icon - new icon for module.
+ */
 void CAM_Module::setModuleIcon( const QPixmap& icon )
 {
   myIcon = icon;
 }
 
+/*! Return menu manager pointer.
+ * \retval QtxActionMenuMgr pointer - menu manager.
+ */
 QtxActionMenuMgr* CAM_Module::menuMgr() const
 {
   QtxActionMenuMgr* mgr = 0;
@@ -134,6 +165,9 @@ QtxActionMenuMgr* CAM_Module::menuMgr() const
   return mgr;
 }
 
+/*! Return tool manager pointer.
+ * \retval QtxActionToolMgr pointer - tool manager.
+ */
 QtxActionToolMgr* CAM_Module::toolMgr() const
 {
   QtxActionToolMgr* mgr = 0;
@@ -142,6 +176,9 @@ QtxActionToolMgr* CAM_Module::toolMgr() const
   return mgr;
 }
 
+/*! Create tool bar with name \a name, if it was't created before.
+ * \retval -1 - if tool manager was't be created.
+ */
 int CAM_Module::createTool( const QString& name )
 {
   if ( !toolMgr() )
@@ -150,6 +187,15 @@ int CAM_Module::createTool( const QString& name )
   return toolMgr()->createToolBar( name );
 }
 
+/*! Create tool. Register action \a a with id \a id.
+ * Insert QAction to tool manager.
+ *\param a - QAction
+ *\param tBar - integer
+ *\param id   - integer
+ *\param idx  - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createTool( QAction* a, const int tBar, const int id, const int idx )
 {
   if ( !toolMgr() )
@@ -160,6 +206,15 @@ int CAM_Module::createTool( QAction* a, const int tBar, const int id, const int
   return intId != -1 ? regId : -1;
 }
 
+/*! Create tool. Register action \a a with id \a id.
+ * Insert QAction to tool manager.
+ *\param a - QAction
+ *\param tBar - QString&
+ *\param id   - integer
+ *\param idx  - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createTool( QAction* a, const QString& tBar, const int id, const int idx )
 {
   if ( !toolMgr() )
@@ -170,6 +225,15 @@ int CAM_Module::createTool( QAction* a, const QString& tBar, const int id, const
   return intId != -1 ? regId : -1;
 }
 
+/*! Create tool.
+ * Insert QAction with id \a id from action map(myActionMap) to tool manager.
+ *\param a - QAction
+ *\param tBar - integer
+ *\param id   - integer
+ *\param idx  - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createTool( const int id, const int tBar, const int idx )
 {
   if ( !toolMgr() )
@@ -179,6 +243,15 @@ int CAM_Module::createTool( const int id, const int tBar, const int idx )
   return intId != -1 ? id : -1;
 }
 
+/*! Create tool.
+ * Insert QAction with id \a id from action map(myActionMap) to tool manager.
+ *\param a - QAction
+ *\param tBar - QString&
+ *\param id   - integer
+ *\param idx  - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createTool( const int id, const QString& tBar, const int idx )
 {
   if ( !toolMgr() )
@@ -188,6 +261,16 @@ int CAM_Module::createTool( const int id, const QString& tBar, const int idx )
   return intId != -1 ? id : -1;
 }
 
+/*! Create menu.
+ * Insert submenu \a subMenu to menu manager.
+ *\param subMenu - QString&
+ *\param menu    - integer
+ *\param id      - integer
+ *\param group   - integer
+ *\param index   - integer
+ *\retval integer id of new menu in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createMenu( const QString& subMenu, const int menu,
                             const int id, const int group, const int index )
 {
@@ -197,6 +280,16 @@ int CAM_Module::createMenu( const QString& subMenu, const int menu,
   return menuMgr()->insert( subMenu, menu, group, index );
 }
 
+/*! Create menu.
+ * Insert submenu \a subMenu to menu manager.
+ *\param subMenu - QString&
+ *\param menu    - QString&
+ *\param id      - integer
+ *\param group   - integer
+ *\param index   - integer
+ *\retval integer id of new menu in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createMenu( const QString& subMenu, const QString& menu,
                             const int id, const int group, const int index )
 {
@@ -206,6 +299,17 @@ int CAM_Module::createMenu( const QString& subMenu, const QString& menu,
   return menuMgr()->insert( subMenu, menu, group, index );
 }
 
+
+/*! Create menu. Register action \a a with id \a id.
+ * Insert QAction to menu manager.
+ *\param a       - Qaction
+ *\param menu    - integer
+ *\param id      - integer
+ *\param group   - integer
+ *\param index   - integer
+ *\retval integer id of new menu in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int index )
 {
   if ( !a || !menuMgr() )
@@ -216,6 +320,16 @@ int CAM_Module::createMenu( QAction* a, const int menu, const int id, const int
   return intId != -1 ? regId : -1;
 }
 
+/*! Create menu. Register action \a a with id \a id.
+ * Insert QAction to menu manager.
+ *\param a       - Qaction
+ *\param menu    - QString&
+ *\param id      - integer
+ *\param group   - integer
+ *\param index   - integer
+ *\retval integer id of new menu in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int index )
 {
   if ( !a || !menuMgr() )
@@ -226,6 +340,15 @@ int CAM_Module::createMenu( QAction* a, const QString& menu, const int id, const
   return intId != -1 ? regId : -1;
 }
 
+/*! Create menu.
+ * Insert QAction with id \a id from action map(myActionMap) to menu manager.
+ *\param menu    - integer
+ *\param id      - integer
+ *\param group   - integer
+ *\param index   - integer
+ *\retval integer id of new menu in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createMenu( const int id, const int menu, const int group, const int index )
 {
   if ( !menuMgr() )
@@ -235,6 +358,15 @@ int CAM_Module::createMenu( const int id, const int menu, const int group, const
   return intId != -1 ? id : -1;
 }
 
+/*! Create menu.
+ * Insert QAction with id \a id from action map(myActionMap) to menu manager.
+ *\param menu    - QString&
+ *\param id      - integer
+ *\param group   - integer
+ *\param index   - integer
+ *\retval integer id of new menu in tool manager.
+ *\retval Return -1 if something wrong.
+ */
 int CAM_Module::createMenu( const int id, const QString& menu, const int group, const int index )
 {
   if ( !menuMgr() )
@@ -244,6 +376,9 @@ int CAM_Module::createMenu( const int id, const QString& menu, const int group,
   return intId != -1 ? id : -1;
 }
 
+/*!Sets menus shown to \a on floag.
+ *\param on - flag.
+ */
 void CAM_Module::setMenuShown( const bool on )
 {
   QtxActionMenuMgr* mMgr = menuMgr();
@@ -265,17 +400,28 @@ void CAM_Module::setMenuShown( const bool on )
     mMgr->update();
 }
 
+/*!Sets menu shown for QAction \a a to \a on flag.
+ * \param a - QAction
+ * \param on - flag
+ */
 void CAM_Module::setMenuShown( QAction* a, const bool on )
 {
   if ( menuMgr() )
     menuMgr()->setShown( menuMgr()->actionId( a ), on );
 }
 
+/*!Sets menu shown for action with id=\a id to \a on flag.
+ * \param id - id of action
+ * \param on - flag
+ */
 void CAM_Module::setMenuShown( const int id, const bool on )
 {
   setMenuShown( action( id ), on );
 }
 
+/*!Set tools shown to \a on flag.
+ *\param on - boolean flag.
+ */
 void CAM_Module::setToolShown( const bool on )
 {
   QtxActionToolMgr* tMgr = toolMgr();
@@ -297,17 +443,29 @@ void CAM_Module::setToolShown( const bool on )
     tMgr->update();
 }
 
+/*!Set tools shown for QAction \a a to \a on flag.
+ * \param a - QAction
+ * \param on - boolean flag
+ */
 void CAM_Module::setToolShown( QAction* a, const bool on )
 {
   if ( toolMgr() )
     toolMgr()->setShown( toolMgr()->actionId( a ), on );
 }
 
+/*!Set tools shown for action with id=\a id to \a on flag.
+ * \param id - integer action id
+ * \param on - boolean flag
+ */
 void CAM_Module::setToolShown( const int id, const bool on )
 {
   setToolShown( action( id ), on );
 }
 
+/*! Return action by id. 
+ * \param id - id of action.
+ * \retval QAction.
+ */
 QAction* CAM_Module::action( const int id ) const
 {
   QAction* a = 0;
@@ -316,6 +474,10 @@ QAction* CAM_Module::action( const int id ) const
   return a;
 }
 
+/*! Return id by action. 
+ * \param a - QAction.
+ * \retval id of action.
+ */
 int CAM_Module::actionId( const QAction* a ) const
 {
   int id = -1;
@@ -327,6 +489,18 @@ int CAM_Module::actionId( const QAction* a ) const
   return id;
 }
 
+/*! Create new instance of QtxAction and register action with \a id.
+ * \param id - id for new action.
+ * \param text - parameter for creation QtxAction
+ * \param icon - parameter for creation QtxAction
+ * \param menu - parameter for creation QtxAction
+ * \param tip  - tip status for QtxAction action.
+ * \param key  - parameter for creation QtxAction
+ * \param parent - parent for action
+ * \param toggle - parameter for creation QtxAction
+ * \param reciever - 
+ * \param member   - 
+ */
 QAction* CAM_Module::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 )
@@ -342,6 +516,11 @@ QAction* CAM_Module::createAction( const int id, const QString& text, const QIco
   return a;
 }
 
+/*! Register action in action map.
+ * \param id - id for action.
+ * \param a  - action
+ * \retval new id for action.
+ */
 int CAM_Module::registerAction( const int id, QAction* a )
 {
   int ident = -1;
@@ -355,7 +534,7 @@ int CAM_Module::registerAction( const int id, QAction* a )
   static int generatedId = -1;
   ident = id < 0 ? --generatedId : id;
 
-  myActionMap.insert( id, a );
+  myActionMap.insert( ident, a );
 
   if ( menuMgr() )
     menuMgr()->registerAction( a );
@@ -366,6 +545,7 @@ int CAM_Module::registerAction( const int id, QAction* a )
   return ident;
 }
 
+/*! Return qt action manager separator.*/
 QAction* CAM_Module::separator()
 {
   return QtxActionMgr::separator();