Salome HOME
0052660: Plot2D Viewer: Plot2d_Curve can't be selected
[modules/gui.git] / src / CAM / CAM_Module.cxx
index 4901a9a42ee75e4f503c4677525658c6c7d28221..5d7d569de4a9ea0170d0079bd71e953f3a454d77 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -232,6 +232,15 @@ bool CAM_Module::isSelectionCompatible()
  */
 bool CAM_Module::activateModule( SUIT_Study* /*study*/ )
 {
+  // IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys
+  // after activate/deactivate modules
+  for ( QMap<QPair<int, QAction*>, QKeySequence>::Iterator it = myActionShortcutMap.begin(); it != myActionShortcutMap.end(); ++it )
+  {
+    myActionMap.insert( it.key().first, it.key().second );
+    // Reset actions accelerator keys
+    it.key().second->setShortcut( it.value() );
+  }
+  myActionShortcutMap.clear();
   return true;
 }
 
@@ -249,6 +258,14 @@ bool CAM_Module::activateModule( SUIT_Study* /*study*/ )
  */
 bool CAM_Module::deactivateModule( SUIT_Study* )
 {
+  // IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys
+  // after activate/deactivate modules
+  myActionShortcutMap.clear();
+  for ( QMap<int, QAction*>::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it )
+  {
+    myActionShortcutMap.insert( qMakePair( it.key(), it.value() ), it.value()->shortcut() );
+  }
+  myActionMap.clear();
   return true;
 }
 
@@ -396,17 +413,18 @@ QtxActionToolMgr* CAM_Module::toolMgr() const
 
   If the toolbar has been already created, its ID is just returned.
 
-  \param name toolbar name
+  \param title toolbar title
+  \param name toolbar name (identifier)
   \return toolbar ID or -1 if toolbar could not be created
 */
-int CAM_Module::createTool( const QString& name )
+int CAM_Module::createTool( const QString& title, const QString& name )
 {
   if ( !toolMgr() )
     return -1;
 
   ActionMgrLocker lock( toolMgr(), !myToolShown );
 
-  return toolMgr()->createToolBar( name, myToolShown );
+  return toolMgr()->createToolBar( title, name );
 }
 
 /*!
@@ -571,12 +589,12 @@ int CAM_Module::createTool( const int id, const QString& tBar, const int idx )
   \return menu item ID or -1 if menu item could not be added
 */
 int CAM_Module::createMenu( const QString& subMenu, const int menu,
-                            const int id, const int group, const int idx )
+                            const int id, const int group, const int idx, QMenu * menuObj )
 {
   if ( !menuMgr() )
     return -1;
   
-  return menuMgr()->insert( subMenu, menu, group, id, idx );
+  return menuMgr()->insert( subMenu, menu, group, id, idx, menuObj );
 }
 
 /*!
@@ -1046,6 +1064,37 @@ void CAM_Module::updateModuleVisibilityState() {
 
 }
 
+/*!
+  \brief Activate GUI operation of module by its ID.
+  This method is called from CAM_Application::startOperation().
+  \param actionId is a numerical unique operation id.
+*/
+bool CAM_Module::activateOperation( int actionId )
+{
+  return false;
+}
+
+/*!
+  \brief Activate GUI operation of module by its ID.
+  This method is called from CAM_Application::startOperation().
+  \param actionId is a string unique operation id.
+*/
+bool CAM_Module::activateOperation( const QString& actionId )
+{
+  return false;
+}
+
+/*!
+  \brief Activate GUI operation of module by its ID and \a pluginName.
+  This method is called from CAM_Application::startOperation().
+  \param actionId is a string unique operation id.
+  \param pluginName is a name of a plugin where the operation is implemented.
+*/
+bool CAM_Module::activateOperation( const QString& actionId, const QString& pluginName )
+{
+  return false;
+}
+
 
 /*!
   \brief Connect data model of the module to the active study