-using namespace std;
-// File : SUPERVGUI.cxx
-// Created : 31 octobre 2001
-// Author : Francis KLOSS
-// Project : SALOME
-// Module : SUPERVGUI
-// Copyright : CEA
+// SUPERV SUPERVGUI : GUI for Supervisor component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SUPERVGUI.cxx
+// Author : Francis KLOSS
+// Module : SUPERV
+using namespace std;
#include "SUPERVGUI.h"
#include "QAD_Resource.h"
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");
//info = new SUPERVGUI_Information();
cursor = desktop->cursor();
connect(desktop->getMainFrame(), SIGNAL(windowActivated(QWidget*)), this, SLOT(setMain(QWidget*)));
+
+ int anId = 300;
+ parent->menuBar()->changeItem(anId,parent->getComponentUserName("SUPERV"));
+
};
}
VIEW_GRAPHSUPERV, false);
if (aStudyFrame) {
connect(aStudyFrame,
- SIGNAL(sfBeforeStudyFrameClosing(QAD_StudyFrame*)),
+ SIGNAL(sfStudyFrameClosing(QAD_StudyFrame*)),
&Supervision,
SLOT(onGraphClosed(QAD_StudyFrame*)));
}
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()));
}
if (comp->FindAttribute(anAttr, "AttributeName")) {
aName = SALOMEDS::AttributeName::_narrow(anAttr);
QString compName(aName->Value());
- if (compName.compare(STUDY_SUPERVISION) == 0) {
+ //if (compName.compare(STUDY_SUPERVISION) == 0) {
+ if (compName.compare(QAD_Application::getDesktop()->getComponentUserName("SUPERV")) == 0) {
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() ;
}
}
extern "C" void activeStudyChanged(QAD_Desktop* parent) {
- // Supervision.activeStudyChanged();
+ Supervision.activeStudyChanged();
}
extern "C" int supportedViewType()
{
return (int)VIEW_GRAPHSUPERV;
}
+
+extern "C" void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO )
+{
+}