- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- if(Sel->IObjectCount() == 0)
- return;
-
- if(QAD_MessageBox::warn2(QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_REALLY_DELETE"), tr("GEOM_BUT_YES"), tr("GEOM_BUT_NO"), 1, 0, 0) != 1)
- return;
-
- int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount();
-
- Standard_Boolean found;
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
-
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() );
- op->start();
- Standard_Boolean deleted = false;
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- if(IObject->hasEntry()) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry());
-
- /* Erase child graphical objects */
- SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
- for(; it->More();it->Next()) {
- SALOMEDS::SObject_var CSO= it->Value();
- if(CSO->FindAttribute(anAttr, "AttributeIOR") ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- /* Delete child(s) shape in Client : */
- const TCollection_AsciiString ASCior(anIOR->Value()) ;
- myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(ASCior);
-
- for(int i = 0; i < nbSf; i++) {
- QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i);
- if(sf->getTypeView() == VIEW_OCC) {
- OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
- Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
- Handle(GEOM_AISShape) Result = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), found);
- if(found)
- myContext->Erase(Result, true, false);
- }
- else if(sf->getTypeView() == VIEW_VTK) {
- //vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer();
- VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
- GEOM_Actor* ac = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), found);
- if(found) {
- //Renderer->RemoveActor(ac);
- if(ac->hasIO())
- myRenderInter->Remove(ac->getIO());
- }
- }
- }
+ SALOME_ListIO selected;
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( app ) {
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( aSelMgr && appStudy ) {
+ aSelMgr->selectedObjects( selected, QString::null, false );
+ if ( !selected.IsEmpty() ) {
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
+ if ( aLocked ) {
+ SUIT_MessageBox::warning ( app->desktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
+ return;