using namespace std;
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDS_Study.hxx"
+#include <boost/shared_ptr.hpp>
+using namespace boost;
+
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+#include "SalomeApp_Study.h"
+#include "SUIT_Session.h"
+
+#include "SALOME_ListIO.hxx"
+
#include "SUPERVGUI_BrowseNodeDlg.h"
#include "SUPERVGUI_CanvasNode.h"
#include "SUPERVGUI_CanvasPort.h"
if ( !myIsEditable ) return false;
QString aTxt = myValue->text();
- if ( aTxt.isNull() || aTxt.isEmpty() ) return false;
+ //mkr : fix for bug IPAL9441
+ //if ( aTxt.isNull() || aTxt.isEmpty() ) return false;
if ( aTxt.find( "Unknown" ) < 0 ) {
- return myPort->Input( Supervision.getEngine()->StringValue( aTxt ) );
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return false;
+ }
+ return myPort->Input( aSupMod->getEngine()->StringValue( aTxt ) );
}
return false;
}
* Constructor (SUPERVGUI_CanvasNode)
*/
SUPERVGUI_BrowseNodeDlg::SUPERVGUI_BrowseNodeDlg( SUPERVGUI_CanvasNode* theNode )
- : QDialog( QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+ : QDialog( SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{
myNodeCanvas = theNode;
SUPERV_CNode aEngine = myNodeCanvas->getEngine();
- mySelection = SALOME_Selection::Selection( Supervision.getActiveStudy()->getSelection() );
-// mySelection->ClearIObjects();
-
setName( "SUPERVGUI_BrowseNodeDlg" );
setCaption( tr( "TIT_BROWSENODE" ) + aEngine->Name() );
if ( !myIsEditable )
aBtnLayout->addStretch();
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( aSupMod ) connect( (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+ else MESSAGE("NULL Supervision module!");
+
myNodeCanvas->getMain()->lockedGraph(true);
}
void SUPERVGUI_BrowseNodeDlg::onSelectionChanged()
{
if ( myActiveField ) {
- if( mySelection->IObjectCount() == 1 ) {
- Handle( SALOME_InteractiveObject ) anIO = mySelection->firstIObject();
+
+ SALOME_ListIO aList;
+ aList.Clear();
+
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))
+ ->selectionMgr()->selectedObjects( aList );
+
+ if( aList.Extent() == 1 ) {
+ Handle( SALOME_InteractiveObject ) anIO = aList.First();
if ( anIO->hasEntry() ) {
- SALOMEDS::SObject_var aObj = Supervision.getActiveStudy()->
- getStudyDocument()->FindObjectID( anIO->getEntry() );
+ _PTR(SObject) aObj ( dynamic_cast<SalomeApp_Study*>( aSupMod->getActiveStudy() )->
+ studyDS()->FindObjectID( anIO->getEntry() ) );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- Standard_CString ior = "";
+ _PTR(GenericAttribute) anAttr;
+ QString ior("");
if (aObj->FindAttribute( anAttr, "AttributeIOR" ) ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
- ior = anIOR->Value();
+ _PTR(AttributeIOR) anIOR ( anAttr );
+ ior = anIOR->Value().c_str();
}
else {
- ior = aObj->GetStudy()->ConvertObjectToIOR( aObj );
+ SALOMEDS_Study* aSStudy = dynamic_cast<SALOMEDS_Study*>( aObj->GetStudy().get() );
+ SALOMEDS_SObject* aSSObj = dynamic_cast<SALOMEDS_SObject*>( aObj.get() );
+ if ( aSStudy && aSSObj )
+ ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str();
}
myActiveField->setData( ior );
}
* Constructor (SUPERVGUI_CanvasPort)
*/
SUPERVGUI_GetValueDlg::SUPERVGUI_GetValueDlg( SUPERVGUI_CanvasPort* thePort )
- : QDialog( QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+ : QDialog( SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{
myPortCanvas = thePort;
myOKBtn = 0;
setSizeGripEnabled( true );
- mySelection = SALOME_Selection::Selection( Supervision.getActiveStudy()->getSelection() );
-// mySelection->ClearIObjects();
-
setName( "SUPERVGUI_GetValueDlg" );
setCaption( tr( "TIT_SETVALUE_PORT" ) );
aBtnLayout->addStretch();
myField->updateGUI();
- connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( aSupMod ) connect( (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+ else MESSAGE("NULL Supervision module!");
+
myPortCanvas->getMain()->lockedGraph(true);
}
myPortCanvas->getMain()->getCanvas()->update();
}
else {
- if ( QMessageBox::warning( QAD_Application::getDesktop(),
+ if ( QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(),
tr( "ERROR" ), tr( "MSG_CANT_SETVAL" ),
QMessageBox::Retry, QMessageBox::Abort) == QMessageBox::Retry )
return;
*/
void SUPERVGUI_GetValueDlg::onSelectionChanged()
{
- if( mySelection->IObjectCount() == 1 ) {
- Handle( SALOME_InteractiveObject ) anIO = mySelection->firstIObject();
+ SALOME_ListIO aList;
+ aList.Clear();
+
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))
+ ->selectionMgr()->selectedObjects( aList );
+
+ if( aList.Extent() == 1 ) {
+ Handle( SALOME_InteractiveObject ) anIO = aList.First();
if ( anIO->hasEntry() ) {
- SALOMEDS::SObject_var aObj = Supervision.getActiveStudy()->
- getStudyDocument()->FindObjectID( anIO->getEntry() );
+ _PTR(SObject) aObj ( dynamic_cast<SalomeApp_Study*>( aSupMod->getActiveStudy() )->
+ studyDS()->FindObjectID( anIO->getEntry() ) );
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
- Standard_CString ior = "";
+ _PTR(GenericAttribute) anAttr;
+ QString ior("");
if (aObj->FindAttribute( anAttr, "AttributeIOR" ) ) {
- anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
- ior = anIOR->Value();
+ _PTR(AttributeIOR) anIOR ( anAttr );
+ ior = anIOR->Value().c_str();
}
else {
- ior = aObj->GetStudy()->ConvertObjectToIOR( aObj );
+ SALOMEDS_Study* aSStudy = dynamic_cast<SALOMEDS_Study*>( aObj->GetStudy().get() );
+ SALOMEDS_SObject* aSSObj = dynamic_cast<SALOMEDS_SObject*>( aObj.get() );
+ if ( aSStudy && aSSObj )
+ ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str();
}
myField->setData( ior );
}
// ----------------------------
SUPERVGUI_StreamInDlg::SUPERVGUI_StreamInDlg(SUPERVGUI_CanvasStreamPortIn* thePort)
- :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+ :QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
myPortCanvas = thePort;
init();
//-------------------------------------------------------------------------
SUPERVGUI_StreamOutDlg::SUPERVGUI_StreamOutDlg(SUPERVGUI_CanvasStreamPortOut* thePort)
- :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+ :QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
myPortCanvas = thePort;
init();