X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ImportImageOp.cxx;h=d68840a8b22a5026b0a4858622e89a91a08861ca;hb=d6e19029f8b41f295db878e9aecf451c2edda4af;hp=6d661e9a59191a78da913ef19e6759224277d71d;hpb=c6ea841032889efc8150795a11f81106f7149dcd;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx index 6d661e9a..d68840a8 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx @@ -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(); } @@ -348,9 +350,22 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags, { HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel(); + if( !myIsEdit ) + { + QString aFilePath = aPanel->getFileName(); + if( aFilePath.isEmpty() ) + { + theErrorMsg = tr( "SELECT_IMAGE_FILE" ).arg( aFilePath ); + return false; + } + } + QString anImageName = aPanel->getImageName(); if( anImageName.isEmpty() ) + { + theErrorMsg = tr( "SELECT_IMAGE_NAME" ).arg( anImageName ); return false; + } if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anImageName ) ) { @@ -495,22 +510,35 @@ 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( isApplyAndClose() ) + { + commitDocOperation(); // to save the modifications in the data model + return true; + } if( SetNextFile() ) { theErrorMsg = ""; - commitDocOperation(); // to save the modifications in the data model + module()->updateObjBrowser(); return false; // and to continue the operation } + /*if( myFiles.count() > 1 ) + { + setIsApplyAndClose( true ); + }*/ return true; } @@ -538,7 +566,7 @@ bool HYDROGUI_ImportImageOp::isReferenceCorrect() const return isCorrect; } -void HYDROGUI_ImportImageOp::onApply() +void HYDROGUI_ImportImageOp::apply() { HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel(); @@ -554,7 +582,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 +656,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 +809,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 );