// 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 <qlayout.h>
#include <qlabel.h>
#include <qlineedit.h>
if ( aTxt.isNull() || aTxt.isEmpty() ) return false;
if ( aTxt.find( "Unknown" ) < 0 ) {
- //cout<<" ===> Set new value!"<<endl;
return myPort->Input( Supervision.getEngine()->StringValue( aTxt ) );
}
return false;
}
-/**
- * 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();
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();
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;
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);
}
/**
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();
}
* 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();
}
}
}
-/**
- * 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)
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();
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 );
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);
}
/**
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(),
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();
}
* 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();
}
// 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();
}
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);
}
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();
}
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 );
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();
}