LIB_SRC = SUPERVGUI.cxx \
SUPERVGUI_DataModel.cxx \
+ SUPERVGUI_Selection.cxx \
SUPERVGUI_ArrayView.cxx \
SUPERVGUI_Canvas.cxx \
SUPERVGUI_CanvasArray.cxx \
using namespace std;
#include "SUPERVGUI.h"
#include "SUPERVGUI_DataModel.h"
+#include "SUPERVGUI_Selection.h"
#include "SALOMEDSClient.hxx"
#include <boost/shared_ptr.hpp>
createSupervAction( 309, "ADDNODE" );
createSupervAction( 310, "STEPBYSTEP" );
+ createSupervAction( 311, "POP_RENAME" );
+ createSupervAction( 312, "POP_DISPLAY" );
+ createSupervAction( 313, "POP_DELETE" );
+
// ----- create menu -----------------
int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 );
createMenu( 301, fileId, 10 );
createTool( 307, executionId );
createTool( 308, executionId );
+ // ----- create popup for object browser items -------------
+ QtxPopupMgr* mgr = popupMgr();
+ mgr->insert( action( 311 ), -1, -1 ); // rename dataflow
+ mgr->setRule( action( 311 ), "$type in {'Dataflow'} and selcount=1", true );
+ mgr->insert( action( 312 ), -1, -1 ); // display dataflow
+ mgr->setRule( action( 312 ), "$type in {'Dataflow'} and selcount=1", true );
+ mgr->insert( separator(), -1, -1 ); // -----------
+ mgr->insert( action( 313 ), -1, -1 ); // delete object
+ mgr->setRule( action( 313 ), "$client in {'ObjectBrowser'} and $type in {'Dataflow' 'SupervisorObject'} and selcount>0", true );
}
bool SUPERVGUI::activateModule( SUIT_Study* theStudy )
return new SUPERVGUI_DataModel( this );
}
+SalomeApp_Selection* SUPERVGUI::createSelection() const
+{
+ return new SUPERVGUI_Selection();
+}
+
SUIT_ViewWindow* SUPERVGUI::createGraph() {
SUPERVGraph_ViewManager* aVM = new SUPERVGraph_ViewManager( study, application()->desktop(), new SUPERVGraph_Viewer() );
SUIT_ViewWindow* aVW = aVM->createViewWindow();
if ( !w ) return;
study = w->getViewManager()->study();
- if (!study) {
- cout<<" setMain(...) : NULL study!";
+ if (!study)
return;
- }
if(SUPERVGraph_ViewFrame* supervFrame = dynamic_cast<SUPERVGraph_ViewFrame*>(w)){
SUPERVGraph_View* view = supervFrame->getViewWidget();
/** Returns:
- theIsOwner = true if Selected object belongs to Suipervision.
+ theIsOwner = true if Selected object belongs to Supervision.
theIsDataflow = true if Selected object is Dataflow
*/
-void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, bool& theIsOwner, bool& theIsDataflow) {
+void SUPERVGUI::whatIsSelected(const _PTR(SObject)& theObj, bool& theIsOwner, bool& theIsDataflow) {
theIsOwner = false;
theIsDataflow = false;
- if (theObj.IsNull()) return;
-
- _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS();
- _PTR(SObject) obj ( aStudy->FindObjectID( theObj->getEntry() ) );
-
- if ( obj ) {
- _PTR(SComponent) comp ( obj->GetFatherComponent() );
+ if ( theObj ) {
+ _PTR(SComponent) comp ( theObj->GetFatherComponent() );
if ( comp ) {
_PTR(GenericAttribute) anAttr;
if (comp->FindAttribute(anAttr, "AttributeName")) {
_PTR(AttributeName) aName ( anAttr );
QString compName(aName->Value().c_str());
- if ( compName.compare( (( CAM_Application* )application())->moduleTitle( moduleName() ) ) == 0 ) {
+ if ( compName.compare( moduleName() ) == 0 ) {
_PTR(GenericAttribute) anAttr;
- if (obj->FindAttribute(anAttr, "AttributeIOR")) {
+ if (theObj->FindAttribute(anAttr, "AttributeIOR")) {
_PTR(AttributeIOR) anIOR ( anAttr );
SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value().c_str());
if (!SUPERV_isNull(aDataFlow)) {
theIsDataflow = true;
}
}
- CORBA::String_var anObjectID = obj->GetID().c_str();
+ CORBA::String_var anObjectID = theObj->GetID().c_str();
CORBA::String_var aComponentID = comp->GetID().c_str();
- if (strcmp(anObjectID, aComponentID)) theIsOwner = true;
+ if (strcmp(anObjectID, aComponentID))
+ theIsOwner = true;
}
}
}
SALOME_ListIteratorOfListIO It( aList );
for(;It.More();It.Next()) {
Handle(SALOME_InteractiveObject) anIObj = It.Value();
- bool aIsOwner, aIsDataflow;
- whatIsSelected(anIObj, aIsOwner, aIsDataflow);
+ //bool aIsOwner, aIsDataflow;
+ //whatIsSelected(anIObj, aIsOwner, aIsDataflow);
_PTR(SObject) aObj ( aStudy->FindObjectID( anIObj->getEntry() ) );
if ( aObj ) {
}
}
(( SalomeApp_Application* )application())->selectionMgr()->clearSelected();
+ updateObjBrowser();
}
void SUPERVGUI::OnGUIEvent()
case 310:
stepByStep();
return(false);
-
+
+ case 311:
+ renameDataflow();
+ return(false);
+
+ case 312:
+ displayDataflow();
+ return(false);
+
+ case 313:
+ deleteObject();
+ return(false);
+
default:
QMessageBox::warning(application()->desktop(), "Supervision Error", "Unknown Command From Salome");
return(false);
theIsOwner = true if Selected object belongs to Suipervision.
theIsDataflow = true if Selected object is Dataflow
*/
- void whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, bool& theIsOwner, bool& theIsDataflow);
+ void whatIsSelected(const _PTR(SObject)& theObj, bool& theIsOwner, bool& theIsDataflow);
/* asv : bug [VSR Bugs and Improvements in Supervisor] 1.8 : when exporting a file,
a backup copy of an existing file must be created (in case Export fails..)
protected:
virtual CAM_DataModel* createDataModel();
+ virtual SalomeApp_Selection* createSelection() const;
private:
void loadEngine(SALOME_NamingService* namingService);
--- /dev/null
+#include "SUPERVGUI_Selection.h"
+#include "SUPERVGUI.h"
+
+#include <SalomeApp_DataOwner.h>
+#include <SalomeApp_Study.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewModel.h>
+
+#include <SALOMEDSClient_SObject.hxx>
+#include <SALOMEDSClient_Study.hxx>
+#include <SALOMEDS_SObject.hxx>
+#include <SALOME_Prs.h>
+#include <SALOME_InteractiveObject.hxx>
+
+#include <SOCC_Prs.h>
+
+#include <OCCViewer_ViewModel.h>
+
+SUPERVGUI_Selection::SUPERVGUI_Selection()
+{
+}
+
+SUPERVGUI_Selection::~SUPERVGUI_Selection()
+{
+}
+
+QtxValue SUPERVGUI_Selection::param( const int ind, const QString& p ) const
+{
+ QtxValue val( SalomeApp_Selection::param( ind, p ) );
+ if ( !val.isValid() ) {
+ if ( p == "type" ) val = QtxValue( typeName( ind ) );
+ }
+
+ //printf( "--> param() : [%s] = %s\n", p.latin1(), val.toString ().latin1() );
+
+ return val;
+}
+
+QString SUPERVGUI_Selection::typeName( const int index ) const
+{
+ if ( isComponent( index ) )
+ return "Component";
+
+ _PTR(SObject) anIObj = getObject( index );
+ if ( anIObj ) {
+ bool aIsOwner, aIsDataflow;
+ SUPERVGUI::Supervision()->whatIsSelected(anIObj, aIsOwner, aIsDataflow);
+ if ( aIsDataflow ) //selected dataflow object
+ return "Dataflow";
+ if ( aIsOwner ) //selected object belongs to Supervisor
+ return "SupervisorObject";
+ }
+ return "Unknown";
+}
+
+bool SUPERVGUI_Selection::isComponent( const int index ) const
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+ (SUIT_Session::session()->activeApplication()->activeStudy());
+
+ if ( appStudy && index >= 0 && index < count() ) {
+ _PTR(Study) study = appStudy->studyDS();
+ QString anEntry = entry( index );
+
+ if ( study && !anEntry.isNull() ) {
+ _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );
+ if ( aSO && aSO->GetFatherComponent() )
+ return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR();
+ }
+ }
+ return false;
+}
+
+_PTR(SObject) SUPERVGUI_Selection::getObject( const int index ) const
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+ (SUIT_Session::session()->activeApplication()->activeStudy());
+
+ if ( appStudy && index >= 0 && index < count() ) {
+ _PTR(Study) study = appStudy->studyDS();
+ QString anEntry = entry( index );
+
+ if ( study && !anEntry.isNull() ) {
+ _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );
+ return aSO;
+ }
+ }
+
+ _PTR(SObject) aObj1;
+ return aObj1;
+}
--- /dev/null
+// 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_Selection.h
+// Author : Margarita KARPUNINA
+// Module : SUPERV
+
+#ifndef SUPERVGUI_SELECTION_HeaderFile
+#define SUPERVGUI_SELECTION_HeaderFile
+
+#include <SalomeApp_Selection.h>
+
+#include <SALOMEconfig.h>
+
+#include "SALOMEDSClient.hxx"
+#include <boost/shared_ptr.hpp>
+using namespace boost;
+
+class SALOME_InteractiveObject;
+
+class SUPERVGUI_Selection : public SalomeApp_Selection
+{
+public:
+ SUPERVGUI_Selection();
+ virtual ~SUPERVGUI_Selection();
+
+ virtual QtxValue param( const int, const QString& ) const;
+
+private:
+ QString typeName( const int ) const;
+
+ bool isComponent( const int ) const;
+ _PTR(SObject) getObject( const int ) const;
+};
+
+#endif
msgid "STB_STEPBYSTEP"
msgstr "Step by Step execution"
+msgid "TOP_POP_RENAME"
+msgstr "Rename Dataflow"
+
+msgid "MEN_POP_RENAME"
+msgstr "Rename"
+
+msgid "STB_POP_RENAME"
+msgstr "Rename Dataflow"
+
+msgid "TOP_POP_DISPLAY"
+msgstr "Display Dataflow"
+
+msgid "MEN_POP_DISPLAY"
+msgstr "Display"
+
+msgid "STB_POP_DISPLAY"
+msgstr "Display Dataflow"
+
+msgid "TOP_POP_DELETE"
+msgstr "Delete object(s)"
+
+msgid "MEN_POP_DELETE"
+msgstr "Delete"
+
+msgid "STB_POP_DELETE"
+msgstr "Delete object(s)"
+
msgid "TOP_KILL"
msgstr "Kill Running"