Salome HOME
Bug IPAL22876: TC6.5.0: Show error is absent in popup menu for multiply selection BR_siman_phase1 V6_5_BR V6_5_0 V6_5_0b2 V6_5_0b3 V6_5_0p1 V6_5_0rc1 V6_5_0rc2 mergeto_V6_main_05Jun12 start_BR_siman_phase1
authorouv <ouv@opencascade.com>
Sat, 12 May 2012 12:23:26 +0000 (12:23 +0000)
committerouv <ouv@opencascade.com>
Sat, 12 May 2012 12:23:26 +0000 (12:23 +0000)
src/VISUGUI/VisuGUI.cxx

index 47610c143dcb51e7d38f3aabf232651136f12022..a8c76b6b0a0274cb4f605f20199ee5464551464c 100644 (file)
@@ -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);
@@ -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);
       }
     }
   }