Salome HOME
Merge from V6_5_BR 05/06/2012
[modules/visu.git] / src / VISUGUI / VisuGUI.cxx
index 31d5ba4e482a271d1f9010050ce1029b72fa80a7..a8c76b6b0a0274cb4f605f20199ee5464551464c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  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
@@ -3528,7 +3528,7 @@ VisuGUI
   mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
   mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
 
-  aRule = "isPlot2dViewer and isVisible and selcount=1 and type='VISU::TCURVE' and hasDeviation";
+  aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation";
   mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::VisibleRule);
   aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation and isDeviationDisplayed";
   mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::ToggleRule);
@@ -4257,12 +4257,12 @@ void VisuGUI::createPreferences()
   setPreferenceProperty( representGr, "columns", 2 );
 
   QStringList mesh_modes;
-  mesh_modes.append( "Points" );
-  mesh_modes.append( "Wireframe" );
-  mesh_modes.append( "Insideframe" );
-  mesh_modes.append( "Surfaceframe" );
-  mesh_modes.append( "Surface" );
-  mesh_modes.append( "Feature edges" );
+  mesh_modes.append( tr("MEN_POINTS") );
+  mesh_modes.append( tr("MEN_WIREFRAME") );
+  mesh_modes.append( tr("MEN_INSIDEFRAME") );
+  mesh_modes.append( tr("MEN_SURFACEFRAME") );
+  mesh_modes.append( tr("MEN_SURFACE") );
+  mesh_modes.append( tr("VISU_FEATURE_EDGES") );
   QList<QVariant> mesh_indices;
   mesh_indices.append( 0 );
   mesh_indices.append( 1 );
@@ -4980,22 +4980,31 @@ bool VisuGUI::renameAllowed( const QString& entry) const {
 
 void VisuGUI::OnShowDeviation() {
 
-  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
-  if(aSelectionInfo.size() != 1)
+  if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
     return;
 
-  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
-  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
-  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
-  if(!aBase)
+  QAction* anAction = action(VISU_SHOW_DEVIATION);
+  if(!anAction)
     return;
 
-  if(aBase->GetType() == VISU::TCURVE) {
-    if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
+  bool anIsShow = anAction->isChecked();
+
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+
+  TSelectionInfo::iterator anIter = aSelectionInfo.begin();
+  for( ; anIter != aSelectionInfo.end(); anIter++ )
+  {
+    VISU::TSelectionItem aSelectionItem = *anIter;
+    Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+    VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+    if(aBase && aBase->GetType() == VISU::TCURVE) {
       // Curve object
       if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
-        aCurve->ShowDeviation(!aCurve->isDeviationShown());
-        PlotCurve(this, aCurve, VISU::eDisplay);
+        aCurve->ShowDeviation(anIsShow);
+        if( displayer()->IsDisplayed( anIO->getEntry() ) )
+          PlotCurve(this, aCurve, VISU::eDisplay);
       }
     }
   }