X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSUPERVGUI%2FSUPERVGUI_BrowseNodeDlg.cxx;h=655c710ecf877bcc68c48459629339938a208e44;hb=cbb0219fe6d6bf11f98f2306c2855fef1eaa2d44;hp=dd0939e97fdef71e409a0505fbfb0d70fc164fcc;hpb=e4b2f8f88a294e451364a8b84d170a59dcbb5d3f;p=modules%2Fsuperv.git diff --git a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx index dd0939e..655c710 100644 --- a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx @@ -9,12 +9,12 @@ // Module : SUPERV using namespace std; + #include "SUPERVGUI_BrowseNodeDlg.h" -#include "SUPERVGUI_Node.h" #include "SUPERVGUI_CanvasNode.h" -#include "SUPERVGUI_Port.h" #include "SUPERVGUI_CanvasPort.h" #include "SUPERVGUI.h" + #include #include #include @@ -88,25 +88,12 @@ bool SUPERVGUI_PortField::eventFilter( QObject* o, QEvent* e ) } -/** - * Constructor (SUPERVGUI_Node) - */ -SUPERVGUI_BrowseNodeDlg::SUPERVGUI_BrowseNodeDlg( SUPERVGUI_Node* theNode ) - : QDialog( theNode, 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) -{ - myNode = theNode; - myNodeCanvas = 0; - - init(); -} - /** * 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 ) { - myNode = 0; myNodeCanvas = theNode; init(); @@ -118,11 +105,7 @@ void SUPERVGUI_BrowseNodeDlg::init() setSizeGripEnabled( true ); myPortsList.setAutoDelete( true ); - SUPERV_CNode aEngine; - if (myNode != 0) - aEngine = myNode->getEngine(); - else - aEngine = myNodeCanvas->getEngine(); + SUPERV_CNode aEngine = myNodeCanvas->getEngine(); mySelection = SALOME_Selection::Selection( Supervision.getActiveStudy()->getSelection() ); // mySelection->ClearIObjects(); @@ -151,7 +134,8 @@ void SUPERVGUI_BrowseNodeDlg::init() if ( ports[i]->IsInput() ) { if ( !ports[i]->IsGate() ) { // not a gate SUPERVGUI_PortField* aField = new SUPERVGUI_PortField( aInBox, ports[i] ); - if ( aField->isEditable() ) myIsEditable = true; + if ( aField->isEditable() ) + myIsEditable = true; myPortsList.append( aField ); if ( !myActiveField ) myActiveField = aField; @@ -197,10 +181,7 @@ void SUPERVGUI_BrowseNodeDlg::init() aBtnLayout->addStretch(); connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); - if (myNode != 0) - myNode->getMain()->lockedGraph(true); - else - myNodeCanvas->getMain()->lockedGraph(true); + myNodeCanvas->getMain()->lockedGraph(true); } /** @@ -228,17 +209,10 @@ void SUPERVGUI_BrowseNodeDlg::accept() { for ( aField = myPortsList.first(); aField; aField = myPortsList.next() ) { aField->setNewValue(); } - if (myNode != 0) - myNode->sync(); - else { - myNodeCanvas->sync(); - myNodeCanvas->getMain()->getCanvas()->update(); - } + myNodeCanvas->sync(); + myNodeCanvas->getMain()->getCanvas()->update(); } - if (myNode != 0) - myNode->getMain()->lockedGraph(false); - else - myNodeCanvas->getMain()->lockedGraph(false); + myNodeCanvas->getMain()->lockedGraph(false); QDialog::accept(); close(); } @@ -248,10 +222,7 @@ void SUPERVGUI_BrowseNodeDlg::accept() { * Closes and destroys dialog */ void SUPERVGUI_BrowseNodeDlg::reject() { - if (myNode != 0) - myNode->getMain()->lockedGraph(false); - else - myNodeCanvas->getMain()->lockedGraph(false); + myNodeCanvas->getMain()->lockedGraph(false); QDialog::reject(); close(); } @@ -304,31 +275,6 @@ void SUPERVGUI_BrowseNodeDlg::onSelectionChanged() } } -/** - * Constructor (SUPERVGUI_PortIn) - */ -SUPERVGUI_GetValueDlg::SUPERVGUI_GetValueDlg( SUPERVGUI_PortIn* thePort ) - : QDialog( thePort, 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) -{ - myPort = thePort; - myPortESNode = 0; - myPortCanvas = 0; - - init(); -} - -/** - * Constructor (SUPERVGUI_PortInESNode) - */ -SUPERVGUI_GetValueDlg::SUPERVGUI_GetValueDlg( SUPERVGUI_PortInESNode* thePort ) - : QDialog( thePort, 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) -{ - myPort = 0; - myPortESNode = thePort; - myPortCanvas = 0; - - init(); -} /** * Constructor (SUPERVGUI_CanvasPort) @@ -336,8 +282,6 @@ SUPERVGUI_GetValueDlg::SUPERVGUI_GetValueDlg( SUPERVGUI_PortInESNode* thePort ) SUPERVGUI_GetValueDlg::SUPERVGUI_GetValueDlg( SUPERVGUI_CanvasPort* thePort ) : QDialog( QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) { - myPort = 0; - myPortESNode = 0; myPortCanvas = thePort; init(); @@ -369,14 +313,8 @@ void SUPERVGUI_GetValueDlg::init() QLabel* aInfoLab = new QLabel( tr( "ENTER_OR_SELECT_LBL" ), aBox ); QFont fnt = aInfoLab->font(); fnt.setBold( true ); aInfoLab->setFont( fnt ); aBoxLayout->addMultiCellWidget( aInfoLab, 0, 0, 0, 1 ); - SUPERV_Port aEngine; - if (myPort != 0) - aEngine = myPort->getPort(); - else if (myPortESNode != 0) - aEngine = myPortESNode->getPort(); - else { - aEngine = myPortCanvas->getEngine(); - } + SUPERV_Port aEngine = myPortCanvas->getEngine(); + myField = new SUPERVGUI_PortField( aBox, aEngine ); bool myIsEditable = myField->isEditable(); aBoxLayout->addWidget( myField->myLabel, 1, 0 ); @@ -407,12 +345,8 @@ void SUPERVGUI_GetValueDlg::init() myField->updateGUI(); connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); - if (myPort != 0) - myPort->getMain()->lockedGraph(true); - else if (myPortESNode != 0) - myPortESNode->getMain()->lockedGraph(true); - else - myPortCanvas->getMain()->lockedGraph(true); + + myPortCanvas->getMain()->lockedGraph(true); } /** @@ -427,14 +361,16 @@ SUPERVGUI_GetValueDlg::~SUPERVGUI_GetValueDlg() { void SUPERVGUI_GetValueDlg::accept() { if ( myField->setNewValue() ) { - if (myPort != 0) - myPort->sync(); - else if (myPortESNode != 0) - myPortESNode->sync(); - else { - myPortCanvas->sync(); - myPortCanvas->getMain()->getCanvas()->update(); - } + myPortCanvas->sync(); + + // asv : 19.11.04 : fix for 6170, last comment of it about BrowsePort - update node status + // asv : 13.12.04 : commented out sync() of Node. See 2.21. + //if ( myPortCanvas->parent() && myPortCanvas->parent()->inherits( "SUPERVGUI_CanvasNode" ) ) { + // SUPERVGUI_CanvasNode* aNode = (SUPERVGUI_CanvasNode*)myPortCanvas->parent(); + // aNode->sync(); + //} + + myPortCanvas->getMain()->getCanvas()->update(); } else { if ( QMessageBox::warning( QAD_Application::getDesktop(), @@ -443,12 +379,8 @@ void SUPERVGUI_GetValueDlg::accept() { return; } - if (myPort != 0) - myPort->getMain()->lockedGraph(false); - else if (myPortESNode != 0) - myPortESNode->getMain()->lockedGraph(false); - else - myPortCanvas->getMain()->lockedGraph(false); + myPortCanvas->getMain()->lockedGraph(false); + QDialog::accept(); close(); } @@ -457,12 +389,7 @@ void SUPERVGUI_GetValueDlg::accept() { * Closes and destroys dialog */ void SUPERVGUI_GetValueDlg::reject() { - if (myPort != 0) - myPort->getMain()->lockedGraph(false); - else if (myPortESNode != 0) - myPortESNode->getMain()->lockedGraph(false); - else - myPortCanvas->getMain()->lockedGraph(false); + myPortCanvas->getMain()->lockedGraph(false); QDialog::reject(); close(); } @@ -500,18 +427,9 @@ void SUPERVGUI_GetValueDlg::onSelectionChanged() // Stream Ports // ---------------------------- -SUPERVGUI_StreamInDlg::SUPERVGUI_StreamInDlg(SUPERVGUI_StreamPortIn* thePort) - :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - myPort = thePort; - myPortCanvas = 0; - init(); -} - SUPERVGUI_StreamInDlg::SUPERVGUI_StreamInDlg(SUPERVGUI_CanvasStreamPortIn* thePort) :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) { - myPort = 0; myPortCanvas = thePort; init(); } @@ -591,10 +509,7 @@ void SUPERVGUI_StreamInDlg::setData() { SUPERV::KindOfInterpolation aInterpolat; SUPERV::KindOfExtrapolation aExtrapolat; - if (myPort != 0) - myPort->getStreamPort()->Params(aSchema, aInterpolat, aExtrapolat); - else - myPortCanvas->getStreamEngine()->Params(aSchema, aInterpolat, aExtrapolat); + myPortCanvas->getStreamEngine()->Params(aSchema, aInterpolat, aExtrapolat); mySchemaCombo->setCurrentItem((int)aSchema); myInterCombo->setCurrentItem((int)aInterpolat); @@ -602,30 +517,17 @@ void SUPERVGUI_StreamInDlg::setData() { } void SUPERVGUI_StreamInDlg::accept() { - if (myPort != 0) - myPort->getStreamPort()->SetParams((SUPERV::KindOfSchema) mySchemaCombo->currentItem(), - (SUPERV::KindOfInterpolation) myInterCombo->currentItem(), - (SUPERV::KindOfExtrapolation) myExterCombo->currentItem()); - else - myPortCanvas->getStreamEngine()->SetParams((SUPERV::KindOfSchema) mySchemaCombo->currentItem(), - (SUPERV::KindOfInterpolation) myInterCombo->currentItem(), - (SUPERV::KindOfExtrapolation) myExterCombo->currentItem()); + myPortCanvas->getStreamEngine()->SetParams((SUPERV::KindOfSchema) mySchemaCombo->currentItem(), + (SUPERV::KindOfInterpolation) myInterCombo->currentItem(), + (SUPERV::KindOfExtrapolation) myExterCombo->currentItem()); QDialog::accept(); } //------------------------------------------------------------------------- -SUPERVGUI_StreamOutDlg::SUPERVGUI_StreamOutDlg(SUPERVGUI_StreamPortOut* thePort) - :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - myPort = thePort; - myPortCanvas = 0; - init(); -} SUPERVGUI_StreamOutDlg::SUPERVGUI_StreamOutDlg(SUPERVGUI_CanvasStreamPortOut* thePort) :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) { - myPort = 0; myPortCanvas = thePort; init(); } @@ -646,11 +548,7 @@ void SUPERVGUI_StreamOutDlg::init() myValEdit = new QLineEdit( aCtrlPane, "ValEdit" ); myValEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myValEdit->setValidator( new QIntValidator(this) ); - SUPERV_StreamPort aEngine; - if (myPort != 0) - aEngine = myPort->getStreamPort(); - else - aEngine = myPortCanvas->getStreamEngine(); + SUPERV_StreamPort aEngine = myPortCanvas->getStreamEngine(); myValEdit->setText(QString("%1").arg(aEngine->NumberOfValues())); aCtrlLayout->addWidget(myValEdit, 0, 1); TopLayout->addWidget( aCtrlPane ); @@ -683,10 +581,7 @@ void SUPERVGUI_StreamOutDlg::accept() { QString aStr = myValEdit->text(); if (!aStr.isEmpty()) aRes = aStr.toLong(); - if (myPort != 0) - myPort->getStreamPort()->SetNumberOfValues(aRes); - else - myPortCanvas->getStreamEngine()->SetNumberOfValues(aRes); + myPortCanvas->getStreamEngine()->SetNumberOfValues(aRes); QDialog::accept(); }