SUPERVGUI::SUPERVGUI(): QObject(),
- desktop(0),
- study(0),
- engine(0),
- browser(0)
- //info(0)
+ desktop(0),
+ study(0),
+ browser(0)
+ //info(0)
{
Trace("SUPERVGUI::SUPERVGUI")
if (factory==0) {
Trace("SUPERVGUI::~SUPERVGUI")
if (factory==1) {
factory = 0;
+ //if (!engine->_is_nil()) CORBA::release(engine);
//info->close();
- browser->close();
+ if (browser) browser->close();
MESSAGE("SUPERVGUI Info : factory destroy");
} else {
MESSAGE("SUPERVGUI Error : another call to factory destructor");
return;
};
- engine = new SUPERV::SuperG_var;
- *engine = aSuperVisionComponent;
+ // engine = new SUPERV::SuperG_var;
+ engine = aSuperVisionComponent;
}
/*
bool SUPERVGUI::information(SUPERV_CNode node, bool isReadOnly) {
return;
}
- SUPERV_Graph aGraph = (*Supervision.getEngine())->GraphE(f);
+ SUPERV_Graph aGraph = engine->GraphE(f);
//QFileInfo aFile(f);
//aGraph->SetName(aFile.baseName());
if (SUPERV_isNull(aGraph)) {
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return;
}
- aDataFlow = (*Supervision.getEngine())->getGraph(ior);
+ aDataFlow = engine->getGraph(ior);
if (SUPERV_isNull(aDataFlow)) {
QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
return;
return;
}
- SUPERV_Graph aGraph = (*Supervision.getEngine())->Graph(f);
+ SUPERV_Graph aGraph = engine->Graph(f);
//QFile aFile(f);
//aGraph->SetName(aFile.name());
if (SUPERV_isNull(aGraph)) {
SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
- Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
+ if (Sel->IObjectCount() == 1) {
+ Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
- // insert SUPERV-specific popup items here
+ // insert SUPERV-specific popup items here
- bool isDataflow, ownObj;
- whatIsSelected(anIObj, ownObj, isDataflow);
-
- if (isDataflow) {
- popup->insertItem(tr( "MSG_RENAME" ), this, SLOT(renameDataflow()));
- popup->insertItem("Display", this, SLOT(displayDataflow()));
- popup->insertSeparator();
+ bool isDataflow, ownObj;
+ whatIsSelected(anIObj, ownObj, isDataflow);
+
+ if (isDataflow) {
+ popup->insertItem(tr( "MSG_RENAME" ), this, SLOT(renameDataflow()));
+ popup->insertItem("Display", this, SLOT(displayDataflow()));
+ popup->insertSeparator();
+ }
+ if (ownObj)
+ popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
+ }
+ if (Sel->IObjectCount() > 1) {
+ int aIObjCount = 0;
+ SALOME_ListIteratorOfListIO It_forCheckOwner(Sel->StoredIObjects());
+ for(;It_forCheckOwner.More();It_forCheckOwner.Next()) {
+ Handle(SALOME_InteractiveObject) anIObj = It_forCheckOwner.Value();
+ bool aIsOwner, aIsDataflow;
+ whatIsSelected(anIObj, aIsOwner, aIsDataflow);
+
+ if (aIsOwner) aIObjCount++;
+ }
+ if (aIObjCount == Sel->IObjectCount()) //all selected objects belong to Supervision
+ popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
}
- if (ownObj)
- popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
}
SALOMEDS::GenericAttribute_var anAttr;
if (obj->FindAttribute(anAttr, "AttributeIOR")) {
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- SUPERV_Graph aDataFlow = (*Supervision.getEngine())->getGraph(anIOR->Value());
+ SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value());
if (!SUPERV_isNull(aDataFlow))
theIsDataflow = true;
}
void SUPERVGUI::deleteObject() {
SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
-
- Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
- bool aIsOwner, aIsDataflow;
- whatIsSelected(anIObj, aIsOwner, aIsDataflow);
-
- if (!aIsOwner) return;
-
+
if (QMessageBox::warning(QAD_Application::getDesktop(),
tr("WARNING"),
tr("MSG_ASK_DELETE"),
QMessageBox::No,
QMessageBox::Yes) == QMessageBox::No)
return;
-
- SALOMEDS::Study_var aStudy = study->getStudyDocument();
- SALOMEDS::SObject_var aObj = aStudy->FindObjectID( anIObj->getEntry() );
- if (!aObj->_is_nil()) {
- if (aIsDataflow) {
- SALOMEDS::GenericAttribute_var anAttr;
- if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- QString ior = anIOR->Value();
-
- SUPERVGUI_Main* aMain;
- for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
- if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
- aMain->setAsFromStudy(false);
- break;
+
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) anIObj = It.Value();
+ bool aIsOwner, aIsDataflow;
+ whatIsSelected(anIObj, aIsOwner, aIsDataflow);
+
+ SALOMEDS::Study_var aStudy = study->getStudyDocument();
+ SALOMEDS::SObject_var aObj = aStudy->FindObjectID( anIObj->getEntry() );
+ if (!aObj->_is_nil()) {
+ if (aIsDataflow) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
+ SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ QString ior = anIOR->Value();
+
+ SUPERVGUI_Main* aMain;
+ for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
+ if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
+ aMain->setAsFromStudy(false);
+ break;
+ }
}
- }
+ }
}
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
+ SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ op->start();
+ aBuilder->RemoveObjectWithChildren(aObj);
+ op->finish();
}
- QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
- SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
- op->start();
- aBuilder->RemoveObjectWithChildren(aObj);
- op->finish();
}
Sel->ClearIObjects() ;
}