Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISUGUI / VisuGUI_Tools.cxx
index 9c3f70881ed72efe05b0831931d1b28c6264c463..83eab7448da805b5fd5b2f614c54af15ac54f798 100644 (file)
@@ -102,7 +102,18 @@ namespace VISU
   CheckLock( _PTR(Study) theStudy )
   {
     if(IsStudyLocked(theStudy))
-      throw std::runtime_error(QObject::tr("WRN_STUDY_LOCKED").latin1());
+      {
+       SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+         (SUIT_Session::session()->activeApplication());
+       if (anApp)
+         {
+           SUIT_MessageBox::warn1(anApp->desktop(),
+                                   QObject::tr("WRN_VISU_WARNING"),
+                                   QObject::tr("WRN_STUDY_LOCKED"),
+                                   QObject::tr("BUT_OK"));
+           return true;
+         }
+      }
     return false;
   }
 
@@ -399,9 +410,6 @@ namespace VISU
       _PTR(SObject) aChildSObject = aChildIter->Value();
       
       CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject);
-      VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(aChildObj);
-      if( !CORBA::is_nil( aRemovableObject ) ) 
-       study->deleteReferencesTo( aChildSObject );
       ErasePrs(theModule, aChildObj);
     }
 
@@ -411,7 +419,6 @@ namespace VISU
 
       VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
       if (!CORBA::is_nil(aRemovableObject)) {
-       study->deleteReferencesTo( theSObject );
         aRemovableObject->RemoveFromStudy();
       }
     } else {
@@ -651,7 +658,7 @@ namespace VISU
       else
       {
        SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate );
-       return dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() );
+       return aViewManager ? dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() ) : 0;
       }
     }
     return NULL;
@@ -960,7 +967,7 @@ namespace VISU
               int theDisplaying)
   {
     if ( theDisplaying == VISU::eErase ) {
-      if ( plotCurve )
+      if ( plotCurve && aPlot )
         aPlot->eraseCurve( plotCurve, false );
     }
     else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
@@ -983,12 +990,14 @@ namespace VISU
           plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
         }
         plotCurve->setAutoAssign( theCurve->IsAuto() );
-        aPlot->displayCurve( plotCurve, false );
+       if( aPlot )
+         aPlot->displayCurve( plotCurve, false );
       }
       else {
         Plot2d_Curve* crv = theCurve->CreatePresentation();
         if ( crv ) {
-          aPlot->displayCurve( crv, false );
+         if( aPlot )
+           aPlot->displayCurve( crv, false );
           theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
           theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
           SALOMEDS::Color newColor;