// SUPERV SUPERVGUI : GUI for Supervisor component
//
-// Copyright (C) 2003 OPEN CASCADE
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SUPERVGUI_GanvasNodePrs.cxx
// Author : Natalia KOPNOVA
// Module : SUPERV
-using namespace std;
#include "SUPERVGUI_CanvasNodePrs.h"
#include "SUPERVGUI_CanvasNode.h"
#include "SUPERVGUI_CanvasPort.h"
#include "SUPERVGUI_Canvas.h"
+#include "SUPERVGUI_CanvasCellNodePrs.h"
+#include "SUPERVGUI_Main.h"
+
+#include "SUIT_ResourceMgr.h"
//#define CHECKTIME
#include <sys/timeb.h>
#endif
-#define PORT_MARGIN 2
+//#define PORT_MARGIN 2
#undef PORT_HEIGHT // to avoid warning message
#define PORT_HEIGHT LABEL_HEIGHT
#define TEXT_MARGIN 5
//=====================================================================
// Node presentation
//=====================================================================
-SUPERVGUI_CanvasNodePrs::SUPERVGUI_CanvasNodePrs(QCanvas* theCanvas,
- SUPERVGUI_CanvasNode* theNode):
+SUPERVGUI_CanvasNodePrs::SUPERVGUI_CanvasNodePrs( SUIT_ResourceMgr* mgr, QCanvas* theCanvas,
+ SUPERVGUI_CanvasNode* theNode,
+ bool theCellPrs):
QCanvasPolygonalItem(theCanvas),
- myNode(theNode)
+ myNode(theNode),
+ myMgr( mgr )
{
Trace("SUPERVGUI_CanvasNodePrs::SUPERVGUI_CanvasNodePrs");
myWidth = LABEL_WIDTH;
myLabelVisible = true;
myPortVisible = true;
+ myCellPrs = theCellPrs;
- myColor = MAIN_BACK;
+ myColor = mgr->colorValue( "SUPERVGraph", "NodeBody", DEF_MAIN_BACK );
- // create in/out connection points prs
- myPointIn = new SUPERVGUI_CanvasHookPrs(theCanvas, this, true);
- myPointOut = new SUPERVGUI_CanvasHookPrs(theCanvas, this, false);
+ if (!myCellPrs) {
+ // create in/out connection points prs
+ myPointIn = new SUPERVGUI_CanvasHookPrs(theCanvas, this, true);
+ myPointOut = new SUPERVGUI_CanvasHookPrs(theCanvas, this, false);
- setZ(0);
- setState(myNode->getEngine()->State());
- updatePorts();
+ setZ(0);
+ setState(myNode->getEngine()->State());
+ updatePorts();
+ }
}
SUPERVGUI_CanvasNodePrs::~SUPERVGUI_CanvasNodePrs()
{
- Trace("SUPERVGUI_CanvasNodePrs::~SUPERVGUI_CanvasNodePrs");
- if (myPointIn) delete myPointIn;
- if (myPointOut) delete myPointOut;
- hide();
+ if ( !myCellPrs ) {
+ if ( myPointIn ) {
+ delete myPointIn;
+ myPointIn = 0;
+ }
+ if ( myPointOut ) {
+ delete myPointOut;
+ myPointOut = 0;
+ }
+ }
}
int SUPERVGUI_CanvasNodePrs::rtti() const
}
}
- myPointIn->moveBy(dx, dy);
- myPointOut->moveBy(dx, dy);
+ if (!myCellPrs) {
+ myPointIn->moveBy(dx, dy);
+ myPointOut->moveBy(dx, dy);
+ }
}
void SUPERVGUI_CanvasNodePrs::setZ(double z)
myLabelVisible = b;
updatePorts();
- if (!isPortVisible()) updatePoints();
+ if (!isPortVisible() && !myCellPrs) updatePoints();
if (aDisp) {
show();
myPortVisible = b;
if (b) {
- myPointIn->hide();
- myPointOut->hide();
+ if (!myCellPrs) {
+ myPointIn->hide();
+ myPointOut->hide();
+ }
updateGates();
}
else {
- updatePoints();
-
- myPointIn->show();
- myPointOut->show();
+ if (!myCellPrs) {
+ updatePoints();
+
+ myPointIn->show();
+ myPointOut->show();
+ }
}
const QObjectList* list = myNode->children();
QFont saved = thePainter.font();
QFont f(saved);
if (f.pointSize() == -1) {
- f.setPixelSize(f.pixelSize()*aMat.m11());
+ f.setPixelSize((int)(f.pixelSize()*aMat.m11()));
}
else {
- f.setPointSize(f.pointSize()*aMat.m11());
+ f.setPointSize((int)(f.pointSize()*aMat.m11()));
}
thePainter.save();
QWMatrix m;
{
thePainter.setPen(pen());
thePainter.setBrush(nodeColor());
- drawShape(thePainter);
+ if ( !CORBA::is_nil( myNode->getMain()->getDataflow()->Node( myNode->name() ) ) ) // mkr : IPAL11360
+ drawShape(thePainter);
}
void SUPERVGUI_CanvasNodePrs::drawShape(QPainter& thePainter)
void SUPERVGUI_CanvasNodePrs::drawTitle(QPainter& thePainter)
{
QBrush saved = thePainter.brush();
- QBrush br(MAIN_TITLE);
+ QBrush br( myMgr->colorValue( "SUPERVGraph", "Title", DEF_MAIN_TITLE ) );
thePainter.setBrush(br);
drawTitleShape(thePainter);
thePainter.setBrush(saved);
++it;
if (obj->inherits("SUPERVGUI_CanvasPort")) {
aPort = (SUPERVGUI_CanvasPort*) obj;
- if (!aPort->getEngine()->IsGate()) {
+
+ SUPERV_Port aPortEng = aPort->getEngine();
+ // if ( CORBA::is_nil( aPortEng ) )
+ // printf ( "---\n port engine IS NIL ---\n\n" );
+
+ if ( !CORBA::is_nil( aPortEng ) && !aPortEng->IsGate() ) {
aPort->getPrs()->draw(thePainter);
}
}
QRect r = getGateRect();
// r.setHeight(r.height()+1);
thePainter.drawRect(r);
- int x0 = (r.left() + r.right())/2;
+ //int x0 = (r.left() + r.right())/2;
// thePainter.drawLine(x0, r.top(), x0, r.bottom());
const QObjectList* list = myNode->children();
myStatusColor = red;
break;
+ case SUPERV::LoadingState:
+ myStatus = "Loading";
+ myStatusColor = QColor(56,255,56);
+ break;
+
default:
myStatus = "No Status";
- myStatusColor = MAIN_BACK;
+ myStatusColor = myMgr->colorValue( "SUPERVGraph", "NodeBody", DEF_MAIN_BACK );
break;
}
- long sec = myNode->getEngine()->CpuUsed();
+ long sec = 0;
+ // IPAL9273, 9369, 9731
+ if ( theState != SUPERV_Kill && myNode->getMain()->getDataflow()->State() != SUPERV_Kill )
+ sec = myNode->getEngine()->CpuUsed();
char hms[9];
long s = sec/3600;
hms[0]=(char)(((s/10)%10)+48);
QString SUPERVGUI_CanvasPortPrs::getText() const
{
SUPERV_Port aPort = myPort->getEngine();
- QString aText = aPort->Name();
- if (aPort->IsParam() || aPort->IsInLine() || myPort->isStream())
- aText = aText + "=" + aPort->ToString();
+ QString aText;
+ if ( !CORBA::is_nil( aPort ) ) {
+ aText = aPort->Name();
+ if (aPort->IsParam() || aPort->IsInLine() || myPort->isStream()) {
+ // mkr : modifications to avoid displaying long IOR's values on nodes' ports,
+ // display ports type from corresponding XML catalog instead.
+ QString aPortValue = aPort->ToString();
+ QString aPortType = aPort->Type();
+ if ( aPortType.compare("string") // not "string" type
+ &&
+ aPortValue.find("IOR:") >= 0 ) // has IOR:... in value
+ aText = aText + "=" + aPortType;
+ else
+ aText = aText + "=" + aPortValue;
+ }
+ }
+ // printf( "--- return text of port : %s ---\n", aText.latin1() );
return aText;
}
SUPERVGUI_CanvasHookPrs::~SUPERVGUI_CanvasHookPrs()
{
hide();
- if (myLine) {
+ if ( myLine ) {
delete myLine;
myLine = 0;
}
QObject* SUPERVGUI_CanvasHookPrs::getObject() const
{
QObject* anObj = 0;
- if (myNodePrs)
+ if ( myNodePrs )
anObj = myNodePrs->getNode();
- else if (myPortPrs)
+ else if ( myPortPrs )
anObj = myPortPrs->getPort();
return anObj;
}