#include "HYDROGUI_Module.h"
#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
+#include "HYDROGUI_ListSelector.h"
#include <HYDROData_Entity.h>
*/
HYDROGUI_ZLevelsOp::HYDROGUI_ZLevelsOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule ),
- myZLevelsDlg( NULL )
+ myDlg( NULL )
{
setName( tr( "SET_Z_LEVELS" ) );
}
HYDROGUI_Operation::startOperation();
// Prepare the list of objects
- HYDROGUI_ZLevelsModel::Object2VisibleList anObject2VisibleList;
+ HYDROGUI_ListModel::Object2VisibleList anObject2VisibleList;
// get the document
Handle(HYDROData_Document) aDoc = doc();
Handle(HYDROData_Entity) anObject = anIter.Value();
if ( !anObject.IsNull() ) {
bool isVisible = module()->isObjectVisible( anActiveOCCViewId, anObject );
- anObject2VisibleList << HYDROGUI_ZLevelsModel::Object2Visible( anObject, isVisible );
+ anObject2VisibleList << HYDROGUI_ListModel::Object2Visible( anObject, isVisible );
}
}
}
// Show the dialog
- myZLevelsDlg = new HYDROGUI_ZLevelsDlg( module()->getApp()->desktop() );
- myZLevelsDlg->setModal( true );
- myZLevelsDlg->setObjects( anObject2VisibleList );
-
- //TODO: check
- connect( myZLevelsDlg, SIGNAL( applyOrder() ), this, SLOT( onApply() ) );
- connect( myZLevelsDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) );
+ if ( !myDlg ) {
+ myDlg = new HYDROGUI_ZLevelsDlg( module()->getApp()->desktop(), module() );
+ connect( myDlg, SIGNAL( applyOrder() ), this, SLOT( onApply() ) );
+ connect( myDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) );
+ }
+ myDlg->setObjects( anObject2VisibleList );
- myZLevelsDlg->exec();
+ myDlg->exec();
}
/**
*/
bool HYDROGUI_ZLevelsOp::processApply( int& theUpdateFlags,
- QString& theErrorMsg )
+ QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
{
bool aRes = false;
- if ( myZLevelsDlg ) {
+ if ( myDlg ) {
Handle(HYDROData_Document) aDoc = doc();
if( !aDoc.IsNull() ) {
- HYDROGUI_ZLevelsModel::ObjectList anObjects = myZLevelsDlg->getObjects();
+ HYDROGUI_ListModel::ObjectList anObjects = myDlg->getObjects();
HYDROData_SequenceOfObjects anOrderedObjects;
foreach ( const Handle(HYDROData_Entity) anObject, anObjects ) {
anOrderedObjects.Append( anObject );
aDoc->SetObjectsLayerOrder( anOrderedObjects );
- theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+ theUpdateFlags = UF_Model | UF_OCCViewer;
aRes = true;
}
}
return aRes;
}
+/**
+*/
+bool HYDROGUI_ZLevelsOp::isGranted() const
+{
+ return true;
+}
+
+/**
+*/
+void HYDROGUI_ZLevelsOp::processCancel()
+{
+ // Delete the dialog
+ if ( myDlg ) {
+ delete myDlg;
+ myDlg = 0;
+ }
+}
\ No newline at end of file