X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_Operation.cxx;h=442b6e7d383eea1caf424124421c8c4d7390c704;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=de64a1878949e6d968c2e113e507a4ecb668d272;hpb=c0feddaa3edef4ba83d5ad4136e166d7b49ce564;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_Operation.cxx b/src/HYDROGUI/HYDROGUI_Operation.cxx index de64a187..442b6e7d 100644 --- a/src/HYDROGUI/HYDROGUI_Operation.cxx +++ b/src/HYDROGUI/HYDROGUI_Operation.cxx @@ -45,6 +45,7 @@ HYDROGUI_Operation::HYDROGUI_Operation( HYDROGUI_Module* theModule ) myModule( theModule ), myPanel( 0 ), myIsPrintErrorMessage( true ), + myIsTransactionOpened( false ), myPreviewManager( 0 ), myPreviewZLayer( -1 ) { @@ -143,13 +144,14 @@ OCCViewer_ViewManager* HYDROGUI_Operation::getPreviewManager() */ void HYDROGUI_Operation::setPreviewManager( OCCViewer_ViewManager* theManager ) { - if ( !theManager && myPreviewManager ) - module()->getOCCDisplayer()->RemoveZLayer( myPreviewManager, getPreviewZLayer() ); + //No good: preview Z layer could be used by usual presentations + //if ( !theManager && myPreviewManager ) + // module()->getOCCDisplayer()->RemoveZLayer( myPreviewManager, getPreviewZLayer() ); myPreviewManager = theManager; if ( myPreviewManager ) - setPreviewZLayer( module()->getOCCDisplayer()->AddTopZLayer( myPreviewManager ) ); + setPreviewZLayer( module()->getOCCDisplayer()->AddPreviewZLayer( myPreviewManager ) ); } void HYDROGUI_Operation::startOperation() @@ -231,7 +233,8 @@ void HYDROGUI_Operation::closeInputPanel() } bool HYDROGUI_Operation::processApply( int& theUpdateFlags, - QString& theErrorMsg ) + QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ) { return false; } @@ -242,23 +245,35 @@ void HYDROGUI_Operation::processCancel() void HYDROGUI_Operation::startDocOperation() { - // Open transaction in the model document + // Open transaction in the model document only if it not + // already opened by other operation (intended for nested operations) if ( !doc()->IsOperation() ) + { doc()->StartOperation(); + myIsTransactionOpened = true; + } } void HYDROGUI_Operation::abortDocOperation() { - // Abort transaction in the model document - if ( doc()->IsOperation() ) + // Abort transaction in the model document only if it was + // opened by this operation (intended for nested operations) + if ( myIsTransactionOpened && doc()->IsOperation() ) + { doc()->AbortOperation(); + myIsTransactionOpened = false; + } } void HYDROGUI_Operation::commitDocOperation() { - // Commit transaction in the model document - if ( doc()->IsOperation() ) + // Commit transaction in the model document only if it was + // opened by this operation (intended for nested operations) + if ( myIsTransactionOpened && doc()->IsOperation() ) + { doc()->CommitOperation( HYDROGUI_Tool::ToExtString( getName() ) ); + myIsTransactionOpened = false; + } } Handle_HYDROData_Document HYDROGUI_Operation::doc() const @@ -276,10 +291,11 @@ void HYDROGUI_Operation::onApply() QString anErrorMsg; bool aResult = false; - + QStringList aBrowseObjectsEntries; + try { - aResult = processApply( anUpdateFlags, anErrorMsg ); + aResult = processApply( anUpdateFlags, anErrorMsg, aBrowseObjectsEntries ); } catch ( Standard_Failure ) { @@ -299,6 +315,7 @@ void HYDROGUI_Operation::onApply() module()->update( anUpdateFlags ); commitDocOperation(); commit(); + browseObjects( aBrowseObjectsEntries ); } else { @@ -363,4 +380,9 @@ QString HYDROGUI_Operation::getHelpContext() const return QString(); } - +void HYDROGUI_Operation::browseObjects( const QStringList& theBrowseObjectsEntries ) +{ + bool isApplyAndClose = true; + bool isOptimizedBrowse = true; + module()->getApp()->browseObjects( theBrowseObjectsEntries, isApplyAndClose, isOptimizedBrowse ); +}