Salome HOME
Copyrights update 2015.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Selection.cxx
index ea8bf0317c19b3830abdec24ee16db29ec52e6a9..b40dabd2079207db160448e0efac8f7f2d7c0bac 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  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
@@ -80,8 +80,10 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
       return;
     _PTR(Study) aStudy = aSStudy->studyDS();
 
-    for( int i=0, n=count(); i<n; i++ )
+    for( int i=0, n=count(); i<n; i++ ) {
       myTypes.append( typeName( type( entry( i ), aStudy ) ) );
+      myControls.append( controlMode( i ) );
+    }
   }
 }
 
@@ -122,7 +124,6 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
   else if ( p=="labeledTypes" )         val = QVariant( labeledTypes( ind ) );
   else if ( p=="shrinkMode" )           val = QVariant( shrinkMode( ind ) );
   else if ( p=="entityMode" )           val = QVariant( entityMode( ind ) );
-  else if ( p=="controlMode" )          val = QVariant( controlMode( ind ) );
   else if ( p=="isNumFunctor" )         val = QVariant( isNumFunctor( ind ) );
   else if ( p=="displayMode" )          val = QVariant( displayMode( ind ) );
   else if ( p=="isComputable" )         val = QVariant( isComputable( ind ) );
@@ -143,6 +144,21 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
     return LightApp_Selection::parameter( ind, p );
 }
 
+//=======================================================================
+//function : parameter
+//purpose  :
+//=======================================================================
+QVariant SMESHGUI_Selection::parameter( const QString& p ) const
+{
+  QVariant val;
+  if ( p=="controlMode" ) val = QVariant( controlMode() );
+
+  if ( val.isValid() )
+    return val;
+  else
+    return LightApp_Selection::parameter( p );
+}
+
 //=======================================================================
 //function : getVtkOwner
 //purpose  : 
@@ -318,6 +334,23 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
   return mode;
 }
 
+//=======================================================================
+//function : controlMode
+//purpose  : gets global control mode; return SMESH_Actor::eControl
+//=======================================================================
+QString SMESHGUI_Selection::controlMode() const
+{
+  if( myControls.count() > 0 ) {
+    QString mode = myControls[0];
+    for( int ind = 1; ind < myControls.count(); ind++ ) {
+      if( mode != myControls[ind] )
+        return "eNone";
+    }
+    return mode;
+  }
+  return "eNone";
+}
+
 bool SMESHGUI_Selection::isNumFunctor( int ind ) const
 {
   bool result = false;