Salome HOME
Fix for the bug #42: point C is not activated, but point C is shown in preview in...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index 986dce2d55a4fbe05289291e97d8d25ff8030184..b36585e22f5de3e928030780271e0b060830d6c4 100644 (file)
@@ -199,7 +199,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
 
   bool anIsImage = false;
   bool anIsImportedImage = false;
-  bool anIsCompositeImage = false;
+  bool anIsImageHasRefs = false;
   bool anIsFusedImage = false;
   bool anIsCutImage = false;
   bool anIsSplittedImage = false;
@@ -228,8 +228,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( anObject );
         if( !anImage.IsNull() )
         {
-          anIsImportedImage = anImage->HasTrsfPoints() && !anImage->IsSelfSplitted();
-          anIsCompositeImage = anImage->NbReferences() > 0;
+          anIsImportedImage = anImage->HasLocalPoints() && !anImage->IsSelfSplitted();
+          anIsImageHasRefs = anImage->HasReferences();
           if( HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory() )
           {
             if( ImageComposer_Operator* anOperator = aFactory->Operator( anImage ) )
@@ -243,7 +243,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
                 anIsSplittedImage = true;
             }
           }
-          anIsMustBeUpdatedImage = anImage->MustBeUpdated();
+          anIsMustBeUpdatedImage = anImage->IsMustBeUpdated();
         }
       }
       else if( anObject->GetKind() == KIND_POLYLINE )
@@ -300,7 +300,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     {
       if( anIsImportedImage )
         theMenu->addAction( action( EditImportedImageId ) );
-      else if( anIsCompositeImage )
+      else if( anIsImageHasRefs )
       {
         if( anIsFusedImage )
           theMenu->addAction( action( EditFusedImageId ) );
@@ -314,6 +314,12 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       theMenu->addAction( action( ExportImageId ) );
       theMenu->addSeparator();
 
+      if( anIsImageHasRefs )
+      {
+        theMenu->addAction( action( RemoveImageRefsId ) );
+        theMenu->addSeparator();
+      }
+
       theMenu->addAction( action( FuseImagesId ) );
       theMenu->addAction( action( CutImagesId ) );
       theMenu->addAction( action( SplitImageId ) );
@@ -396,7 +402,7 @@ void HYDROGUI_Module::update( const int flags )
     // the selection in the object browser.
     // Note: processEvents() should be called after updateGV(),
     // otherwise the application crashes from time to time.
-    qApp->processEvents(); 
+    //RKV: qApp->processEvents(); 
     getApp()->updateObjectBrowser( true );
   }
 
@@ -580,10 +586,12 @@ void HYDROGUI_Module::removeObjectShape( const int                       theView
     return;
 
   ListOfShapes& aViewShapes = myShapesMap[ theViewId ];
+  Handle(HYDROData_Entity) anObject;
   for ( int i = 0; i < aViewShapes.length(); )
   {
     HYDROGUI_Shape* aShape = aViewShapes.at( i );
-    if ( aShape && IsEqual( aShape->getObject(), theObject ) )
+    anObject = aShape->getObject();
+    if ( aShape && (!anObject.IsNull()) && IsEqual( anObject, theObject ) )
     {
       delete aShape;
       aViewShapes.removeAt( i );
@@ -641,7 +649,7 @@ void HYDROGUI_Module::customEvent( QEvent* e )
           //aViewPort->setViewLabelPosition( GraphicsView_ViewPort::VLP_BottomLeft, true );
         }
 
-        if( aRole != VMR_TransformImage )
+        if( aRole != VMR_TransformImage && aRole != VMR_ReferenceImage )
           update( UF_Viewer );
 
         aViewer->activateTransform( GraphicsView_Viewer::FitAll );