Salome HOME
Merge remote-tracking branch 'origin/BR_IMPROVEMENTS' into BR_v14_rc
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageOp.cxx
index 6d661e9a59191a78da913ef19e6759224277d71d..a3d2c72e040aaed1a8d230cd4604687abf75e997 100644 (file)
@@ -74,7 +74,8 @@ void HYDROGUI_ImportImageOp::startOperation()
 
   if( myIsEdit )
   {
-    myEditedObject = Handle(HYDROData_Image)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+    if ( isApplyAndClose() )
+      myEditedObject = Handle(HYDROData_Image)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
     if( !myEditedObject.IsNull() )
     {
       QImage anImage = myEditedObject->Image();
@@ -258,7 +259,8 @@ void HYDROGUI_ImportImageOp::abortOperation()
 
 void HYDROGUI_ImportImageOp::commitOperation()
 {
-  closePreview();
+  if ( isApplyAndClose() )
+    closePreview();
 
   HYDROGUI_Operation::commitOperation();
 }
@@ -495,14 +497,18 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags,
   }
    
   // must be done after all checks and before calling SetVisible() method below
-  closePreview();
+  if ( isApplyAndClose() )
+    closePreview();
 
   if( !myIsEdit )
     module()->setObjectVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), anImageObj, true );
 
   anImageObj->Update();
 
-  theUpdateFlags = UF_Model | UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced;
+  theUpdateFlags = UF_Model;
+  if ( isApplyAndClose() )
+    theUpdateFlags |= UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced;
+
 
   if( SetNextFile() )
   {
@@ -538,7 +544,7 @@ bool HYDROGUI_ImportImageOp::isReferenceCorrect() const
   return isCorrect;
 }
 
-void HYDROGUI_ImportImageOp::onApply()
+void HYDROGUI_ImportImageOp::apply()
 {
   HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
 
@@ -554,7 +560,7 @@ void HYDROGUI_ImportImageOp::onApply()
                     QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) == QMessageBox::Yes;
   }
   if ( aCanApply )
-    HYDROGUI_Operation::onApply();
+    HYDROGUI_Operation::apply();
   else {
     aPanel->setRefImageName( "" );
     onRefImageActivated( aPanel->getRefImageName() );
@@ -628,6 +634,7 @@ void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage )
           }
           
           myPreviewPrs->setIsTransformationPointPreview( true );
+          myPreviewPrs->setTransformationPointCursorShape( module()->getPrefEditCursor().shape() );
         }
         connect( aViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ),
                  this, SLOT( onPointSelected() ) );
@@ -780,6 +787,8 @@ void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
 
     myRefPreviewPrs->setIsByTwoPoints( aPanel->isByTwoPoints() );
 
+    myRefPreviewPrs->setTransformationPointCursorShape( module()->getPrefEditCursor().shape() );
+
     // Add the new reference image presentation to the appropriate view
     aViewPort->addItem( myRefPreviewPrs );