]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx
The actual version updates the status bar with the highlighted object ... Also it...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsKernelEditorGraphic / GPortModel.cxx
index abb6945db8c7bc903b5a513c5a5951570f06424d..acef109612295c56b8a24831a0ffa5eba3c9a68c 100644 (file)
@@ -45,6 +45,7 @@ namespace bbtk
        {               
                _parentBox = NULL;
                _portType=-1;
+               _posInBox=0;
        }
 
        //=========================================================================
@@ -57,14 +58,15 @@ namespace bbtk
        {
                _parentBox = blackBox;
                _portType = portType;
+               _posInBox = pos;
 
-               updatePortPosition(pos);
+               updatePortPosition();
 
        }
 
        //=========================================================================
 
-       void GPortModel::updatePortPosition(int pos)
+       void GPortModel::updatePortPosition()
        {
                double xInic, yInic,zInic,xFin,yFin,zFin;
                _parentBox->getInicPoint(xInic,yInic,zInic);
@@ -73,15 +75,15 @@ namespace bbtk
                double posX=xInic,posY=yInic,posZ=zInic;
                if(_portType==GOUTPUTPORT)
                {
-                       posY = yInic+PORT_HEIGHT;
+                       posY = yFin;
                }
                else if(_portType==GINPUTPORT)
                {
-                       posY = yFin;
+                       posY = yInic+PORT_HEIGHT;
                }
 
-               //Usually pos begins in 0
-               posX = xInic + PORT_WIDTH + pos*2*PORT_WIDTH;
+               //Attribute '_posInBox' starts with value 0 and it represents the position of the port in the box from left to right
+               posX = xInic + PORT_WIDTH + _posInBox*2*PORT_WIDTH;
                
                setInicPoint(posX,posY,posZ);
 
@@ -90,8 +92,6 @@ namespace bbtk
 
                setFinalPoint(posX,posY,posZ);          
                
-               setChanged();
-               notifyObservers();
        }
 
        //=========================================================================
@@ -101,6 +101,31 @@ namespace bbtk
                return _portType;
        }
 
+       //=========================================================================
+       
+       std::string GPortModel::getStatusText()
+       {
+               std::string temp = "Name:";
+               
+               temp+=_bbtkName;
+               temp+=" Type:";
+               temp+=_bbtkType;
+               temp+=" Box:";
+               temp+=_parentBox->getBBTKType();                
+               if(_portType==GOUTPUTPORT)
+               {
+                       temp+=" [Output Port]";
+               }
+               else if(_portType==GINPUTPORT)
+               {
+                       temp+=" [Input Port]";
+               }
+
+               return temp;
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF