X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ImportImageOp.cxx;h=bf837ade79e883bcac198a7b6be658d5d2aa1fab;hb=a53349567d67f4df0ef737798a25c24d9dc8f08e;hp=b0cda46b7ed5ded76e3541e67a04096d35d74443;hpb=2cf9e838e652ae811d9b3931914771ad1836c6b8;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx index b0cda46b..bf837ade 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(); } @@ -274,6 +276,8 @@ HYDROGUI_InputPanel* HYDROGUI_ImportImageOp::createInputPanel() const connect( aPanel, SIGNAL( refImageActivated( const QString& ) ), SLOT( onRefImageActivated( const QString& ) ) ); connect( aPanel, SIGNAL( setCIsUsed( bool ) ), SLOT( onSetCIsUsed( bool ) ) ); + connect( aPanel, SIGNAL( filesSelected( const QStringList& ) ), + SLOT( onFilesSelected( const QStringList& ) ) ); return aPanel; } @@ -493,14 +497,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 = ""; + module()->updateObjBrowser(); + return false; // and to continue the operation + } + + /*if( myFiles.count() > 1 ) + { + setIsApplyAndClose( true ); + }*/ return true; } @@ -528,7 +553,7 @@ bool HYDROGUI_ImportImageOp::isReferenceCorrect() const return isCorrect; } -void HYDROGUI_ImportImageOp::onApply() +void HYDROGUI_ImportImageOp::apply() { HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel(); @@ -544,7 +569,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() ); @@ -618,6 +643,7 @@ void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage ) } myPreviewPrs->setIsTransformationPointPreview( true ); + myPreviewPrs->setTransformationPointCursorShape( module()->getPrefEditCursor().shape() ); } connect( aViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ), this, SLOT( onPointSelected() ) ); @@ -770,6 +796,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 ); @@ -881,3 +909,22 @@ void HYDROGUI_ImportImageOp::closeView( GraphicsView_ViewManager* &aViewMgr ) aViewMgr = 0; } } + +void HYDROGUI_ImportImageOp::onFilesSelected( const QStringList& theFileNames ) +{ + myFiles = theFileNames; + myFileIndex = -1; + SetNextFile(); +} + +bool HYDROGUI_ImportImageOp::SetNextFile() +{ + myFileIndex++; + bool isEnabledEdit = myFiles.count()==1 || myFileIndex==myFiles.count(); + bool isValid = ( myFileIndex>=0 && myFileIndex( inputPanel() ); + aPanel->ActivateFile( aFile, isEnabledEdit ); + return isValid; +}