#include <SalomeApp_Module.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
+#include <SalomeApp_Notebook.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_DataOwner.h>
#include <SalomeApp_Tools.h>
#include <TColStd_MapOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+//#define WITHGENERICOBJ
+
//================================================================
// Function : getActiveView
// Purpose : Get active view window, returns 0 if no open study frame
// Purpose :
//================================================================
GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop )
- : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false )
+ : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), myNoteBook( 0 ), isPreview( false )
{
+ if( SalomeApp_Application* app = (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )
+ if( SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) )
+ myNoteBook = new SalomeApp_Notebook( appStudy );
}
//================================================================
if (myDisplayer)
delete myDisplayer;
- myOperation->Destroy();
+ if ( !CORBA::is_nil( myOperation ) )
+ myOperation->Destroy();
+
+ if( myNoteBook )
+ {
+ delete myNoteBook;
+ myNoteBook = 0;
+ }
}
//================================================================
addInStudy( obj, aName.toLatin1().constData() );
// updateView=false
display( obj, false );
+#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
obj->Destroy();
+#endif
}
else {
// asv : fix of PAL6454. If publish==false, then the original shape