]> Creatis software - cpPlugins.git/commitdiff
More on graph editor
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 13 Jan 2016 23:37:37 +0000 (18:37 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 13 Jan 2016 23:37:37 +0000 (18:37 -0500)
appli/cpPipelineEditor/QNEBlock.cxx
appli/cpPipelineEditor/QNEBlock.h
appli/cpPipelineEditor/QNEConnection.cxx
appli/cpPipelineEditor/QNEPort.cxx
appli/cpPipelineEditor/QNEPort.h
appli/cpPipelineEditor/QNodesEditor.cxx
appli/cpPipelineEditor/QNodesEditor.h
lib/cpPlugins/Interface/Workspace.cxx

index 2b7ed51f6bc52f5580e4f9d6145f5086d0af1773..67f4a9bd477d873a924b5e357298233797170128 100644 (file)
@@ -33,6 +33,7 @@
 #include <QStyleOptionGraphicsItem>\r
 \r
 #include "QNEPort.h"\r
+#include "QNEConnection.h"\r
 \r
 // -------------------------------------------------------------------------\r
 PipelineEditor::QNEBlock::\r
@@ -95,6 +96,13 @@ PipelineEditor::QNEInputPort* PipelineEditor::QNEBlock::
 addInputPort( const QString& txt )\r
 {\r
   QNEInputPort* ip = new QNEInputPort( this );\r
+  ip->setExtendedName(\r
+    (\r
+      txt.toStdString( ) +\r
+      std::string( "@" ) +\r
+      this->namePort( ).toStdString( )\r
+      ).c_str( )\r
+    );\r
   ip->setName( txt );\r
   this->m_InputPorts[ txt.toStdString( ) ] = ip;\r
   this->_configPort( ip );\r
@@ -106,12 +114,49 @@ PipelineEditor::QNEOutputPort* PipelineEditor::QNEBlock::
 addOutputPort( const QString& txt )\r
 {\r
   QNEOutputPort* op = new QNEOutputPort( this );\r
+  op->setExtendedName(\r
+    (\r
+      txt.toStdString( ) +\r
+      std::string( "@" ) +\r
+      this->namePort( ).toStdString( )\r
+      ).c_str( )\r
+    );\r
   op->setName( txt );\r
   this->m_OutputPorts[ txt.toStdString( ) ] = op;\r
   this->_configPort( op );\r
   return( op );\r
 }\r
 \r
+// -------------------------------------------------------------------------\r
+bool PipelineEditor::QNEBlock::\r
+extendInputPort( const QString& txt, QNEConnection* conn )\r
+{\r
+  auto p = this->m_InputPorts.find( txt.toStdString( ) );\r
+  auto i = this->m_ExtInputPorts.find( txt.toStdString( ) );\r
+  if( p != this->m_InputPorts.end( ) && i == this->m_ExtInputPorts.end( ) )\r
+  {\r
+    this->m_ExtInputPorts[ txt.toStdString( ) ] = conn;\r
+    return( true );\r
+  }\r
+  else\r
+    return( false );\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+bool PipelineEditor::QNEBlock::\r
+extendOutputPort( const QString& txt, QNEConnection* conn )\r
+{\r
+  auto p = this->m_OutputPorts.find( txt.toStdString( ) );\r
+  auto i = this->m_ExtOutputPorts.find( txt.toStdString( ) );\r
+  if( p != this->m_OutputPorts.end( ) && i == this->m_ExtOutputPorts.end( ) )\r
+  {\r
+    this->m_ExtOutputPorts[ txt.toStdString( ) ] = conn;\r
+    return( true );\r
+  }\r
+  else\r
+    return( false );\r
+}\r
+\r
 // -------------------------------------------------------------------------\r
 PipelineEditor::QNEInputPort* PipelineEditor::QNEBlock::\r
 inputPort( const QString& txt )\r
@@ -134,6 +179,13 @@ outputPort( const QString& txt )
     return( NULL );\r
 }\r
 \r
+// -------------------------------------------------------------------------\r
+QString PipelineEditor::QNEBlock::\r
+namePort( ) const\r
+{\r
+  return( this->m_NamePort->name( ) );\r
+}\r
+\r
 // -------------------------------------------------------------------------\r
 const PipelineEditor::QNEInputPort* PipelineEditor::QNEBlock::\r
 inputPort( const QString& txt ) const\r
@@ -157,10 +209,25 @@ outputPort( const QString& txt ) const
 }\r
 \r
 // -------------------------------------------------------------------------\r
-const QString& PipelineEditor::QNEBlock::\r
-namePort( ) const\r
+const PipelineEditor::QNEConnection* PipelineEditor::QNEBlock::\r
+extendedInputPort( const QString& txt ) const\r
 {\r
-  return( this->m_NamePort->name( ) );\r
+  auto i = this->m_ExtInputPorts.find( txt.toStdString( ) );\r
+  if( i != this->m_ExtInputPorts.end( ) )\r
+    return( i->second );\r
+  else\r
+    return( NULL );\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+const PipelineEditor::QNEConnection* PipelineEditor::QNEBlock::\r
+extendedOutputPort( const QString& txt ) const\r
+{\r
+  auto i = this->m_ExtOutputPorts.find( txt.toStdString( ) );\r
+  if( i != this->m_ExtOutputPorts.end( ) )\r
+    return( i->second );\r
+  else\r
+    return( NULL );\r
 }\r
 \r
 // -------------------------------------------------------------------------\r
@@ -210,11 +277,13 @@ _configPort( QNEPort* port )
   port->setBlock( this );\r
 \r
   QFontMetrics fm( this->scene( )->font( ) );\r
-  int w = fm.width( port->name( ) );\r
+  int w = fm.width( port->name( ) ) + ( 4 * port->radius( ) );\r
   int h = fm.height( );\r
   if( w > this->m_Width - this->m_HorzMargin )\r
     this->m_Width = w + this->m_HorzMargin;\r
-  this->m_Height += h;\r
+  this->m_Height = this->m_InputPorts.size( ) + this->m_OutputPorts.size( );\r
+  this->m_Height += 4;\r
+  this->m_Height *= h;\r
 \r
   QPainterPath pth;\r
   pth.addRoundedRect(\r
@@ -232,10 +301,28 @@ _configPort( QNEPort* port )
     if( p == NULL )\r
       continue;\r
 \r
-    if( dynamic_cast< QNEOutputPort* >( p ) != NULL )\r
-      p->setPos( this->m_Width / 2 + port->radius( ), y );\r
-    else\r
-      p->setPos( -this->m_Width / 2 - port->radius( ), y );\r
+    if( dynamic_cast< QNENamePort* >( i ) != NULL )\r
+      i->setPos( -this->m_Width / 2 + port->radius( ), y );\r
+    else if( dynamic_cast< QNETypePort* >( i ) != NULL )\r
+    {\r
+      i->setPos( -this->m_Width / 2 + port->radius( ), y );\r
+      y += h;\r
+    }\r
+    else if( dynamic_cast< QNEInputPort* >( i ) != NULL )\r
+      i->setPos( -this->m_Width / 2 - 2 * port->radius( ), y );\r
+    else if( dynamic_cast< QNEOutputPort* >( i ) != NULL )\r
+      i->setPos( this->m_Width / 2, y );\r
+\r
+    /* TODO\r
+       QNEPort* p = dynamic_cast< QNEPort* >( i );\r
+       if( p == NULL )\r
+       continue;\r
+\r
+       if( dynamic_cast< QNEOutputPort* >( p ) != NULL )\r
+       p->setPos( this->m_Width / 2 + port->radius( ), y );\r
+       else\r
+       p->setPos( -this->m_Width / 2 - port->radius( ), y );\r
+    */\r
     y += h;\r
 \r
   } // rof\r
index d1a398ee81330715559be639ebf10dc88a896abe..8e95ce0863e1fc32df85f97d413b2baa47e3c2b2 100644 (file)
@@ -37,6 +37,7 @@ namespace PipelineEditor
   class QNETypePort;\r
   class QNEInputPort;\r
   class QNEOutputPort;\r
+  class QNEConnection;\r
 \r
   class QNEBlock\r
     : public QGraphicsPathItem\r
@@ -58,17 +59,23 @@ namespace PipelineEditor
     void setNamePort( const QString& txt );\r
     QNEInputPort* addInputPort( const QString& txt );\r
     QNEOutputPort* addOutputPort( const QString& txt );\r
+\r
+    bool extendInputPort( const QString& txt, QNEConnection* conn );\r
+    bool extendOutputPort( const QString& txt, QNEConnection* conn );\r
+\r
     QNEInputPort* inputPort( const QString& txt );\r
     QNEOutputPort* outputPort( const QString& txt );\r
 \r
-    const QString& namePort( ) const;\r
+    QString namePort( ) const;\r
     const QNEInputPort* inputPort( const QString& txt ) const;\r
     const QNEOutputPort* outputPort( const QString& txt ) const;\r
+    const QNEConnection* extendedInputPort( const QString& txt ) const;\r
+    const QNEConnection* extendedOutputPort( const QString& txt ) const;\r
 \r
     inline int type( ) const\r
       { return( this->Type ); }\r
 \r
-    void paint(\r
+    virtual void paint(\r
       QPainter* painter,\r
       const QStyleOptionGraphicsItem* option,\r
       QWidget* widget\r
@@ -91,6 +98,8 @@ namespace PipelineEditor
     QNETypePort* m_TypePort;\r
     std::map< std::string, QNEInputPort* >  m_InputPorts;\r
     std::map< std::string, QNEOutputPort* > m_OutputPorts;\r
+    std::map< std::string, QNEConnection* > m_ExtOutputPorts;\r
+    std::map< std::string, QNEConnection* > m_ExtInputPorts;\r
 \r
     TFilter::Pointer m_Filter;\r
   };\r
index df84c8186102373ffdbd5ee5777280bc06a3d947..c79bb7ed27e02d6b7c5d1af662d3a7671665ab71 100644 (file)
@@ -101,8 +101,14 @@ setPort2( QNEInputPort* p )
 void PipelineEditor::QNEConnection::\r
 updatePosFromPorts( )\r
 {\r
-  this->m_Pos1 = this->m_Port1->scenePos( );\r
-  this->m_Pos2 = this->m_Port2->scenePos( );\r
+  if( this->m_Port1 != NULL )\r
+    this->m_Pos1 =\r
+      this->m_Port1->scenePos( ) +\r
+      QPointF( this->m_Port1->radius( ), this->m_Port1->radius( ) );\r
+  if( this->m_Port2 != NULL )\r
+    this->m_Pos2 =\r
+      this->m_Port2->scenePos( ) +\r
+      QPointF( this->m_Port2->radius( ), this->m_Port2->radius( ) );\r
 }\r
 \r
 // -------------------------------------------------------------------------\r
index 6aa653b1a1987f14f1b8efcabd5397e3ae5a8445..7b71975d3eb636981a46523ecf454f6fd5a62814 100644 (file)
@@ -29,6 +29,7 @@
 \r
 #include <QGraphicsScene>\r
 #include <QFontMetrics>\r
+#include <QPainter>\r
 #include <QPen>\r
 \r
 // -------------------------------------------------------------------------\r
@@ -39,12 +40,11 @@ QNEPort( QGraphicsItem* parent, QGraphicsScene* scene )
     m_Margin( 2 )\r
 {\r
   this->m_Label = new QGraphicsTextItem( this );\r
+  this->m_ExtendedLabel = new QGraphicsTextItem( this );\r
+  this->setExtend( false );\r
 \r
   QPainterPath p;\r
-  p.addEllipse(\r
-    -this->m_Radius, -this->m_Radius,\r
-    2 * this->m_Radius, 2 * this->m_Radius\r
-    );\r
+  p.addEllipse( 0, 0, 2 * this->m_Radius, 2 * this->m_Radius );\r
 \r
   this->setPath( p );\r
   this->setPen( QPen( Qt::darkRed ) );\r
@@ -69,15 +69,50 @@ setBlock( QNEBlock* b )
 void PipelineEditor::QNEPort::\r
 setName( const QString& n )\r
 {\r
-  this->m_Name = n;\r
   this->m_Label->setPlainText( n );\r
+  this->_updateLabels( );\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+void PipelineEditor::QNEPort::\r
+setExtendedName( const QString& n )\r
+{\r
+  this->m_ExtendedLabel->setPlainText( n );\r
+  this->_updateLabels( );\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+void PipelineEditor::QNEPort::\r
+setExtend( bool extend )\r
+{\r
+  // Do nothing!\r
+  this->m_IsExtended = false;\r
+  this->m_ExtendedLabel->setVisible( false );\r
 }\r
 \r
 // -------------------------------------------------------------------------\r
 void PipelineEditor::QNEPort::\r
-setPtr( quint64 p )\r
+paint(\r
+  QPainter* painter,\r
+  const QStyleOptionGraphicsItem* option,\r
+  QWidget* widget\r
+  )\r
 {\r
-  this->m_Ptr = p;\r
+  Q_UNUSED( option );\r
+  Q_UNUSED( widget );\r
+\r
+  if( this->isExtended( ) )\r
+  {\r
+    painter->setPen( QPen( Qt::darkBlue ) );\r
+    painter->setBrush( Qt::blue );\r
+  }\r
+  else\r
+  {\r
+    painter->setPen( QPen( Qt::darkRed ) );\r
+    painter->setBrush( Qt::red );\r
+\r
+  } // fi\r
+  painter->drawPath( this->path( ) );\r
 }\r
 \r
 // -------------------------------------------------------------------------\r
@@ -95,13 +130,12 @@ PipelineEditor::QNENamePort::
 \r
 // -------------------------------------------------------------------------\r
 void PipelineEditor::QNENamePort::\r
-setName( const QString& n )\r
+_updateLabels( )\r
 {\r
-  this->Superclass::setName( n );\r
-\r
   QFont font( this->scene( )->font( ) );\r
   font.setBold( true );\r
   this->m_Label->setFont( font );\r
+  this->m_ExtendedLabel->setFont( font );\r
   this->setPath( QPainterPath( ) );\r
 }\r
 \r
@@ -127,13 +161,12 @@ PipelineEditor::QNETypePort::
 \r
 // -------------------------------------------------------------------------\r
 void PipelineEditor::QNETypePort::\r
-setName( const QString& n )\r
+_updateLabels( )\r
 {\r
-  this->Superclass::setName( n );\r
-\r
   QFont font( this->scene( )->font( ) );\r
   font.setItalic( true );\r
   this->m_Label->setFont( font );\r
+  this->m_ExtendedLabel->setFont( font );\r
   this->setPath( QPainterPath( ) );\r
 }\r
 \r
@@ -162,15 +195,27 @@ PipelineEditor::QNEInputPort::
 \r
 // -------------------------------------------------------------------------\r
 void PipelineEditor::QNEInputPort::\r
-setName( const QString& n )\r
+_updateLabels( )\r
 {\r
-  this->Superclass::setName( n );\r
-\r
   QFontMetrics fm( this->scene( )->font( ) );\r
-  QRect r = fm.boundingRect( this->m_Name );\r
-  int rm = this->m_Radius + this->m_Margin;\r
-  int h = -this->m_Label->boundingRect( ).height( ) / 2;\r
-  this->m_Label->setPos( rm, h );\r
+  this->m_Label->setPos( this->m_Radius * 2, -fm.height( ) / 2 );\r
+  this->m_ExtendedLabel->setPos(\r
+    -fm.width( this->extendedName( ) ) - this->m_Radius * 2,\r
+    -fm.height( ) / 2\r
+    );\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+void PipelineEditor::QNEInputPort::\r
+setExtend( bool extend )\r
+{\r
+  if( this->m_Connection == NULL )\r
+  {\r
+    this->m_IsExtended = extend;\r
+    this->m_ExtendedLabel->setVisible( extend );\r
+  }\r
+  else\r
+    this->Superclass::setExtend( false );\r
 }\r
 \r
 // -------------------------------------------------------------------------\r
@@ -227,17 +272,22 @@ PipelineEditor::QNEOutputPort::
 \r
 // -------------------------------------------------------------------------\r
 void PipelineEditor::QNEOutputPort::\r
-setName( const QString& n )\r
+_updateLabels( )\r
 {\r
-  this->Superclass::setName( n );\r
-\r
   QFontMetrics fm( this->scene( )->font( ) );\r
-  QRect r = fm.boundingRect( this->m_Name );\r
-  int rm = this->m_Radius + this->m_Margin;\r
-  int h = -this->m_Label->boundingRect( ).height( ) / 2;\r
   this->m_Label->setPos(\r
-    -rm - this->m_Label->boundingRect( ).width( ), h\r
+    -fm.width( this->name( ) ) - this->m_Radius * 2, -fm.height( ) / 2\r
     );\r
+  this->m_ExtendedLabel->setPos( this->m_Radius * 2, -fm.height( ) / 2 );\r
+\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+void PipelineEditor::QNEOutputPort::\r
+setExtend( bool extend )\r
+{\r
+  this->m_IsExtended = extend;\r
+  this->m_ExtendedLabel->setVisible( extend );\r
 }\r
 \r
 // -------------------------------------------------------------------------\r
index 383167b9bfcc39d977b4024b612afa43fafaafda..e10af5ef87c1d0fcc69ac06bd01a69d8d028fe5b 100644 (file)
@@ -54,28 +54,41 @@ namespace PipelineEditor
       { return( this->m_Block ); }\r
 \r
     virtual void setName( const QString& n );\r
-    inline const QString& name( ) const\r
-      { return( this->m_Name ); }\r
-\r
-    void setPtr( quint64 p );\r
-    inline quint64 ptr( )\r
-      { return( this->m_Ptr ); }\r
+    virtual void setExtendedName( const QString& n );\r
+    inline QString name( ) const\r
+      { return( this->m_Label->toPlainText( ) ); }\r
+    inline QString extendedName( ) const\r
+      { return( this->m_ExtendedLabel->toPlainText( ) ); }\r
 \r
     inline int radius( ) const\r
       { return( this->m_Radius ); }\r
 \r
+    inline bool isExtended( ) const\r
+      { return( this->m_IsExtended ); }\r
+    virtual void setExtend( bool extend );\r
+\r
     virtual bool isConnected( QNEPort* other ) = 0;\r
     inline int type( ) const\r
       { return( this->Type ); }\r
 \r
+    virtual void paint(\r
+      QPainter* painter,\r
+      const QStyleOptionGraphicsItem* option,\r
+      QWidget* widget\r
+      );\r
+\r
+  protected:\r
+    virtual void _updateLabels( ) { }\r
+\r
   protected:\r
     QNEBlock* m_Block;\r
 \r
-    QString            m_Name;\r
+    int  m_Radius;\r
+    int  m_Margin;\r
+    bool m_IsExtended;\r
+\r
     QGraphicsTextItem* m_Label;\r
-    int                m_Radius;\r
-    int                m_Margin;\r
-    quint64            m_Ptr;\r
+    QGraphicsTextItem* m_ExtendedLabel;\r
   };\r
 \r
   /**\r
@@ -93,11 +106,12 @@ namespace PipelineEditor
     QNENamePort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
     virtual ~QNENamePort( );\r
 \r
-    virtual void setName( const QString& n );\r
-\r
     virtual bool isConnected( QNEPort* other );\r
     inline int type( ) const\r
       { return( this->Type ); }\r
+\r
+  protected:\r
+    virtual void _updateLabels( );\r
   };\r
 \r
   /**\r
@@ -115,11 +129,12 @@ namespace PipelineEditor
     QNETypePort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
     virtual ~QNETypePort( );\r
 \r
-    virtual void setName( const QString& n );\r
-\r
     virtual bool isConnected( QNEPort* other );\r
     inline int type( ) const\r
       { return( this->Type ); }\r
+\r
+  protected:\r
+    virtual void _updateLabels( );\r
   };\r
 \r
   /**\r
@@ -137,7 +152,7 @@ namespace PipelineEditor
     QNEInputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
     virtual ~QNEInputPort( );\r
 \r
-    virtual void setName( const QString& n );\r
+    virtual void setExtend( bool extend );\r
 \r
     virtual bool isConnected( QNEPort* other );\r
     inline int type( ) const\r
@@ -153,6 +168,7 @@ namespace PipelineEditor
 \r
   protected:\r
     QVariant itemChange( GraphicsItemChange change, const QVariant& value );\r
+    virtual void _updateLabels( );\r
 \r
   protected:\r
     QNEConnection* m_Connection;\r
@@ -173,7 +189,7 @@ namespace PipelineEditor
     QNEOutputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
     virtual ~QNEOutputPort( );\r
 \r
-    virtual void setName( const QString& n );\r
+    virtual void setExtend( bool extend );\r
 \r
     virtual bool isConnected( QNEPort* other );\r
     inline int type( ) const\r
@@ -186,6 +202,7 @@ namespace PipelineEditor
 \r
   protected:\r
     QVariant itemChange( GraphicsItemChange change, const QVariant& value );\r
+    virtual void _updateLabels( );\r
 \r
   protected:\r
     QVector< QNEConnection* > m_Connections;\r
index 99db8a6becab35b054a29b09592da756009c1df6..46508ca6fb92cbfe69c34430d3e1e9260126e8d4 100644 (file)
 #include "QNEConnection.h"\r
 #include "QNEBlock.h"\r
 \r
+// -------------------------------------------------------------------------\r
+#define PipelineEditor_QNodesEditor_Callback_SWITCH( E, e )             \\r
+  case QEvent::E:                                                       \\r
+  {                                                                     \\r
+    Q##E##Event* evt = dynamic_cast< Q##E##Event* >( e );               \\r
+    if( evt != NULL )                                                   \\r
+      this->_##E##_cbk( evt );                                          \\r
+  }                                                                     \\r
+  break\r
+\r
+// -------------------------------------------------------------------------\r
+#define PipelineEditor_QNodesEditor_Callback_CODE( E )                  \\r
+  void PipelineEditor::QNodesEditor::_##E##_cbk( Q##E##Event* evt )\r
+\r
 // -------------------------------------------------------------------------\r
 PipelineEditor::QNodesEditor::\r
 QNodesEditor( QObject* parent )\r
@@ -177,6 +191,7 @@ _CreateBlock( TFilter* f, const QPointF& pnt )
 }\r
 \r
 // -------------------------------------------------------------------------\r
+/* TODO\r
 void PipelineEditor::QNodesEditor::\r
 _DoubleClick( QGraphicsSceneMouseEvent* evt, QGraphicsItem* item )\r
 {\r
@@ -227,7 +242,6 @@ _DoubleClick( QGraphicsSceneMouseEvent* evt, QGraphicsItem* item )
     } // fi\r
   }\r
   break;\r
-  /* TODO:\r
      case Qt::RightButton:\r
      {\r
      }\r
@@ -236,11 +250,11 @@ _DoubleClick( QGraphicsSceneMouseEvent* evt, QGraphicsItem* item )
      {\r
      }\r
      break;\r
-  */\r
   default:\r
     break;\r
   } // hctiws\r
 }\r
+  */\r
 \r
 // -------------------------------------------------------------------------\r
 bool PipelineEditor::QNodesEditor::\r
@@ -249,375 +263,334 @@ eventFilter( QObject* o, QEvent* e )
   // Event type\r
   switch( int( e->type( ) ) )\r
   {\r
-  case QEvent::GraphicsSceneContextMenu:\r
-  {\r
-    QGraphicsSceneContextMenuEvent* evt =\r
-      dynamic_cast< QGraphicsSceneContextMenuEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneDragEnter:\r
-  {\r
-    QGraphicsSceneDragDropEvent* evt =\r
-      dynamic_cast< QGraphicsSceneDragDropEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneDragLeave:\r
-  {\r
-    QGraphicsSceneDragDropEvent* evt =\r
-      dynamic_cast< QGraphicsSceneDragDropEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneDragMove:\r
-  {\r
-    QGraphicsSceneDragDropEvent* evt =\r
-      dynamic_cast< QGraphicsSceneDragDropEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneDrop:\r
-  {\r
-    QGraphicsSceneDragDropEvent* evt =\r
-      dynamic_cast< QGraphicsSceneDragDropEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneHelp:\r
-  {\r
-    QGraphicsSceneHelpEvent* evt =\r
-      dynamic_cast< QGraphicsSceneHelpEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneHoverEnter:\r
-  {\r
-    QGraphicsSceneHoverEvent* evt =\r
-      dynamic_cast< QGraphicsSceneHoverEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneHoverLeave:\r
-  {\r
-    QGraphicsSceneHoverEvent* evt =\r
-      dynamic_cast< QGraphicsSceneHoverEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneHoverMove:\r
-  {\r
-    QGraphicsSceneHoverEvent* evt =\r
-      dynamic_cast< QGraphicsSceneHoverEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneMouseDoubleClick:\r
-  {\r
-    QGraphicsSceneMouseEvent* evt =\r
-      dynamic_cast< QGraphicsSceneMouseEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-      QGraphicsItem* item = this->itemAt( evt->scenePos( ) );\r
-      if( item != NULL )\r
-      {\r
-        this->_DoubleClick( evt, item );\r
-        return( true );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneContextMenu, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneDragEnter, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneDragLeave, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneDragMove, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneDrop, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneHelp, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneHoverEnter, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneHoverLeave, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneHoverMove, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneMouseDoubleClick, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneMouseMove, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneMousePress, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneMouseRelease, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneMove, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneResize, e );\r
+    PipelineEditor_QNodesEditor_Callback_SWITCH( GraphicsSceneWheel, e );\r
+  default:\r
+    break;\r
+  } // hctiws\r
 \r
-      } // fi\r
+  return( this->Superclass::eventFilter( o, e ) );\r
+}\r
 \r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneMouseMove:\r
-  {\r
-    QGraphicsSceneMouseEvent* evt =\r
-      dynamic_cast< QGraphicsSceneMouseEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-      if( this->m_Conn )\r
-      {\r
-        if( this->m_Conn->port1( ) == NULL )\r
-          this->m_Conn->setPos1( evt->scenePos( ) );\r
-        else if( this->m_Conn->port2( ) == NULL )\r
-          this->m_Conn->setPos2( evt->scenePos( ) );\r
-        this->m_Conn->updatePath( );\r
-        return( true );\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneContextMenu )\r
+{\r
+}\r
 \r
-      } // fi\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneDragEnter )\r
+{\r
+}\r
 \r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneMousePress:\r
-  {\r
-    QGraphicsSceneMouseEvent* evt =\r
-      dynamic_cast< QGraphicsSceneMouseEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-      switch( evt->button( ) )\r
-      {\r
-      case Qt::LeftButton:\r
-      {\r
-        QNEOutputPort* port =\r
-          dynamic_cast< QNEOutputPort* >( this->itemAt( evt->scenePos( ) ) );\r
-        if( port != NULL )\r
-        {\r
-          if( port->block( ) != NULL )\r
-          {\r
-            this->m_Conn = new QNEConnection( 0, this->m_Scene );\r
-            this->m_Conn->setPort1( port );\r
-            this->m_Conn->setPos1( port->scenePos( ) );\r
-            this->m_Conn->setPos2( evt->scenePos( ) );\r
-            this->m_Conn->updatePath( );\r
-            return( true );\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneDragLeave )\r
+{\r
+}\r
 \r
-          } // fi\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneDragMove )\r
+{\r
+}\r
 \r
-        } // fi\r
-      }\r
-      break;\r
-      case Qt::RightButton:\r
-      {\r
-        QNEInputPort* in_port =\r
-          dynamic_cast< QNEInputPort* >( this->itemAt( evt->scenePos( ) ) );\r
-        QNEOutputPort* out_port =\r
-          dynamic_cast< QNEOutputPort* >( this->itemAt( evt->scenePos( ) ) );\r
-        if( in_port != NULL )\r
-        {\r
-          if( in_port->connection( ) == NULL && in_port->block( ) != NULL )\r
-          {\r
-            this->m_Conn = new QNEConnection( 0, this->m_Scene );\r
-            this->m_Conn->setPort2( in_port );\r
-            this->m_Conn->setPos1( evt->scenePos( ) );\r
-            this->m_Conn->setPos2( in_port->scenePos( ) );\r
-            this->m_Conn->updatePath( );\r
-            return( true );\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneDrop )\r
+{\r
+}\r
 \r
-          } // fi\r
-        }\r
-        else if( out_port != NULL && out_port->block( ) != NULL )\r
-        {\r
-          this->m_Conn = new QNEConnection( 0, this->m_Scene );\r
-          this->m_Conn->setPort1( out_port );\r
-          this->m_Conn->setPos1( out_port->scenePos( ) );\r
-          this->m_Conn->setPos2( evt->scenePos( ) );\r
-          this->m_Conn->updatePath( );\r
-          return( true );\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneHelp )\r
+{\r
+}\r
 \r
-        } // fi\r
-      }\r
-      break;\r
-      default:\r
-        break;\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneHoverEnter )\r
+{\r
+}\r
 \r
-      } // hctiws\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneHoverLeave )\r
+{\r
+}\r
 \r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneMouseRelease:\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneHoverMove )\r
+{\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneMouseDoubleClick )\r
+{\r
+  QGraphicsItem* item = this->itemAt( evt->scenePos( ) );\r
+  if( item == NULL )\r
+    return;\r
+\r
+  switch( evt->button( ) )\r
+  {\r
+  case Qt::LeftButton:\r
   {\r
-    QGraphicsSceneMouseEvent* evt =\r
-      dynamic_cast< QGraphicsSceneMouseEvent* >( e );\r
-    if( evt != NULL )\r
+    QNEBlock* block = dynamic_cast< QNEBlock* >( item );\r
+    QNEPort* port = dynamic_cast< QNEPort* >( item );\r
+    QNEConnection* conn = dynamic_cast< QNEConnection* >( item );\r
+\r
+    if( block != NULL )\r
     {\r
-      if( this->m_Conn != NULL && evt->button( ) == Qt::LeftButton )\r
+      QString old_name = block->namePort( );\r
+      bool ok;\r
+      QString new_name =\r
+        QInputDialog::getText(\r
+          dynamic_cast< QWidget* >( this->parent( ) ),\r
+          "Change filter name",\r
+          "Filter name:",\r
+          QLineEdit::Normal,\r
+          old_name,\r
+          &ok\r
+          );\r
+      if( ok && !new_name.isEmpty( ) && old_name != new_name )\r
       {\r
-        QNEInputPort* port2 =\r
-          dynamic_cast< QNEInputPort* >( this->itemAt( evt->scenePos( ) ) );\r
-        if( port2 != NULL )\r
+        ok = this->m_Graph->RenameVertex(\r
+          old_name.toStdString( ),\r
+          new_name.toStdString( )\r
+          );\r
+        if( ok )\r
         {\r
-          QNEOutputPort* port1 =\r
-            dynamic_cast< QNEOutputPort* >( this->m_Conn->port1( ) );\r
-          if( port1 != NULL )\r
-          {\r
-            if(\r
-              port1->block( ) != port2->block( ) &&\r
-              !port2->hasConnection( ) &&\r
-              !port1->isConnected( port2 )\r
-              )\r
-            {\r
-              this->m_Conn->setPos2( port2->scenePos( ) );\r
-              this->m_Conn->setPort2( port2 );\r
-              this->m_Conn->updatePath( );\r
-\r
-              this->m_Workspace->Connect(\r
-                port1->block( )->namePort( ).toStdString( ),\r
-                port2->block( )->namePort( ).toStdString( ),\r
-                port1->name( ).toStdString( ),\r
-                port2->name( ).toStdString( )\r
-                );\r
-              this->m_Graph->AddConnection(\r
-                port1->block( )->namePort( ).toStdString( ),\r
-                port2->block( )->namePort( ).toStdString( ),\r
-                this->m_Conn\r
-                );\r
-\r
-              this->m_Conn = NULL;\r
-              return( true );\r
-\r
-            } // fi\r
-\r
-          } // fi\r
+          block->setNamePort( new_name );\r
+          this->m_Workspace->GetGraph( )->RenameVertex(\r
+            old_name.toStdString( ),\r
+            new_name.toStdString( )\r
+            );\r
 \r
         } // fi\r
-        delete this->m_Conn;\r
-        this->m_Conn = NULL;\r
-        return( true );\r
-      }\r
-      else if( this->m_Conn != NULL && evt->button( ) == Qt::RightButton )\r
-      {\r
-        QNEOutputPort* port1 = this->m_Conn->port1( );\r
-        QNEInputPort* port2 = this->m_Conn->port2( );\r
 \r
-        if( port1 != NULL && port2 == NULL )\r
+      } // fi\r
+    }\r
+    else if( port != NULL )\r
+    {\r
+      if( evt->modifiers( ) == Qt::ControlModifier )\r
+      {\r
+        port->setExtend( !( port->isExtended( ) ) );\r
+        QNEInputPort* in_port = dynamic_cast< QNEInputPort* >( port );\r
+        QNEOutputPort* out_port = dynamic_cast< QNEOutputPort* >( port );\r
+        if( port->isExtended( ) )\r
         {\r
-          if(\r
-            dynamic_cast< QNEInputPort* >(\r
-              this->itemAt( evt->scenePos( ) )\r
-              ) == NULL\r
-            )\r
+          if( in_port != NULL )\r
           {\r
-            port2 = new QNEInputPort( NULL, this->m_Scene );\r
-            port2->setName( port1->name( ) );\r
-            port2->setPos( evt->scenePos( ) );\r
-            this->m_Conn->setPos2( evt->scenePos( ) );\r
-            this->m_Conn->setPort2( port2 );\r
-            this->m_Conn->updatePath( );\r
+            this->m_Workspace->AddInputPort(\r
+              in_port->extendedName( ).toStdString( ),\r
+              in_port->block( )->namePort( ).toStdString( ),\r
+              in_port->name( ).toStdString( )\r
+              );\r
           }\r
-          else\r
-            delete this->m_Conn;\r
-          this->m_Conn = NULL;\r
-          return( true );\r
+          else if( out_port != NULL )\r
+          {\r
+          } // fi\r
         }\r
-        else if( port1 == NULL && port2 != NULL )\r
+        else\r
         {\r
-          if(\r
-            dynamic_cast< QNEOutputPort* >(\r
-              this->itemAt( evt->scenePos( ) )\r
-              ) == NULL\r
-            )\r
+          if( in_port != NULL )\r
           {\r
-            port1 = new QNEOutputPort( NULL, this->m_Scene );\r
-            port1->setName( port2->name( ) );\r
-            port1->setPos( evt->scenePos( ) );\r
-            this->m_Conn->setPos1( evt->scenePos( ) );\r
-            this->m_Conn->setPort1( port1 );\r
-            this->m_Conn->updatePath( );\r
           }\r
-          else\r
-            delete this->m_Conn;\r
-          this->m_Conn = NULL;\r
-          return( true );\r
+          else if( out_port != NULL )\r
+          {\r
+          } // fi\r
 \r
         } // fi\r
+        this->m_Scene->update( );\r
+      }\r
+      else if( evt->modifiers( ) == Qt::NoModifier )\r
+      {\r
+        if( port->isExtended( ) )\r
+        {\r
+          QString old_name = port->extendedName( );\r
+          bool ok;\r
+          QString new_name =\r
+            QInputDialog::getText(\r
+              dynamic_cast< QWidget* >( this->parent( ) ),\r
+              "Change filter name",\r
+              "Filter name:",\r
+              QLineEdit::Normal,\r
+              old_name,\r
+              &ok\r
+              );\r
+          if( ok && !new_name.isEmpty( ) && old_name != new_name )\r
+          {\r
+            // TODO: port->setExtendedName( new_name );\r
+            /* TODO\r
+               ok = this->m_Graph->RenameVertex(\r
+               old_name.toStdString( ),\r
+               new_name.toStdString( )\r
+               );\r
+               if( ok )\r
+               {\r
+               block->setNamePort( new_name );\r
+               this->m_Workspace->GetGraph( )->RenameVertex(\r
+               old_name.toStdString( ),\r
+               new_name.toStdString( )\r
+               );\r
+\r
+               } // fi\r
+            */\r
+          } // fi\r
 \r
-      } // fi\r
+        } // fi\r
 \r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneMove:\r
-  {\r
-    QGraphicsSceneMoveEvent* evt =\r
-      dynamic_cast< QGraphicsSceneMoveEvent* >( e );\r
-    if( evt != NULL )\r
+      } // fi\r
+    }\r
+    else if( conn != NULL )\r
     {\r
     } // fi\r
   }\r
   break;\r
-  case QEvent::GraphicsSceneResize:\r
+  /* TODO:\r
+     case Qt::RightButton:\r
+     {\r
+     }\r
+     break;\r
+     case Qt::MiddleButton:\r
+     {\r
+     }\r
+     break;\r
+  */\r
+  default:\r
+    break;\r
+  } // hctiws\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneMouseMove )\r
+{\r
+  if( this->m_Conn != NULL )\r
   {\r
-    QGraphicsSceneResizeEvent* evt =\r
-      dynamic_cast< QGraphicsSceneResizeEvent* >( e );\r
-    if( evt != NULL )\r
-    {\r
-    } // fi\r
-  }\r
-  break;\r
-  case QEvent::GraphicsSceneWheel:\r
+    if( this->m_Conn->port1( ) == NULL )\r
+      this->m_Conn->setPos1( evt->scenePos( ) );\r
+    else if( this->m_Conn->port2( ) == NULL )\r
+      this->m_Conn->setPos2( evt->scenePos( ) );\r
+    this->m_Conn->updatePath( );\r
+\r
+  } // fi\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneMousePress )\r
+{\r
+  QNEInputPort* in_port =\r
+    dynamic_cast< QNEInputPort* >( this->itemAt( evt->scenePos( ) ) );\r
+  QNEOutputPort* out_port =\r
+    dynamic_cast< QNEOutputPort* >( this->itemAt( evt->scenePos( ) ) );\r
+  if( in_port == NULL && out_port == NULL )\r
+    return;\r
+\r
+  switch( evt->button( ) )\r
   {\r
-    QGraphicsSceneWheelEvent* evt =\r
-      dynamic_cast< QGraphicsSceneWheelEvent* >( e );\r
-    if( evt != NULL )\r
+  case Qt::LeftButton:\r
+  {\r
+    if( out_port != NULL )\r
     {\r
+      if( out_port->block( ) != NULL )\r
+      {\r
+        // Start new connection\r
+        this->m_Conn = new QNEConnection( 0, this->m_Scene );\r
+        this->m_Conn->setPort1( out_port );\r
+        this->m_Conn->setPos1( out_port->scenePos( ) );\r
+        this->m_Conn->setPos2( evt->scenePos( ) );\r
+        this->m_Conn->updatePosFromPorts( );\r
+        this->m_Conn->updatePath( );\r
+\r
+      } // fi\r
+\r
     } // fi\r
   }\r
   break;\r
   default:\r
     break;\r
+\r
   } // hctiws\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneMouseRelease )\r
+{\r
+  if( this->m_Conn == NULL )\r
+    return;\r
 \r
-  // Mouse event\r
-  /*\r
-    QGraphicsSceneMouseEvent* me =\r
-    dynamic_cast< QGraphicsSceneMouseEvent* >( e );\r
-    if( me != NULL )\r
+  switch( evt->button( ) )\r
+  {\r
+  case Qt::LeftButton:\r
+  {\r
+    QNEInputPort* port2 =\r
+      dynamic_cast< QNEInputPort* >( this->itemAt( evt->scenePos( ) ) );\r
+    if( port2 != NULL )\r
     {\r
-    } // fi\r
-  */\r
+      QNEOutputPort* port1 =\r
+        dynamic_cast< QNEOutputPort* >( this->m_Conn->port1( ) );\r
+      if( port1 != NULL )\r
+      {\r
+        if(\r
+          port1->block( ) != port2->block( ) &&\r
+          !port2->hasConnection( ) &&\r
+          !port1->isConnected( port2 ) &&\r
+          !port2->isExtended( )\r
+          )\r
+        {\r
+          this->m_Conn->setPos2( port2->scenePos( ) );\r
+          this->m_Conn->setPort2( port2 );\r
+          this->m_Conn->updatePosFromPorts( );\r
+          this->m_Conn->updatePath( );\r
 \r
-  /* TODO\r
-     switch( ( int ) e->type( ) )\r
-     {\r
-     case QEvent::GraphicsSceneMouseMove:\r
-     {\r
-     if( this->m_Conn )\r
-     {\r
-     this->m_Conn->setPos2( me->scenePos( ) );\r
-     this->m_Conn->updatePath( );\r
-     return( true );\r
-     }\r
-     break;\r
-     }\r
-     case QEvent::GraphicsSceneMouseRelease:\r
-     {\r
-     if( this->m_Conn && me->button( ) == Qt::LeftButton )\r
-     {\r
-     QGraphicsItem* item = itemAt( me->scenePos( ) );\r
-     if( item && item->type( ) == QNEPort::Type )\r
-     {\r
-     QNEPort* port1 = this->m_Conn->port1( );\r
-     QNEPort* port2 = ( QNEPort* ) item;\r
-     if( port1->block( ) != port2->block( ) && port1->isOutput( ) != port2->isOutput( ) && !port1->isConnected( port2 ) )\r
-     {\r
-     this->m_Conn->setPos2( port2->scenePos( ) );\r
-     this->m_Conn->setPort2( port2 );\r
-     this->m_Conn->updatePath( );\r
-     this->m_Conn = NULL;\r
-     return( true );\r
-     }\r
-     }\r
+          this->m_Workspace->Connect(\r
+            port1->block( )->namePort( ).toStdString( ),\r
+            port2->block( )->namePort( ).toStdString( ),\r
+            port1->name( ).toStdString( ),\r
+            port2->name( ).toStdString( )\r
+            );\r
+          this->m_Graph->AddConnection(\r
+            port1->block( )->namePort( ).toStdString( ),\r
+            port2->block( )->namePort( ).toStdString( ),\r
+            this->m_Conn\r
+            );\r
+        }\r
+        else\r
+          delete this->m_Conn;\r
+      }\r
+      else\r
+        delete this->m_Conn;\r
+    }\r
+    else\r
+      delete this->m_Conn;\r
+    this->m_Conn = NULL;\r
+  }\r
+  break;\r
+  default:\r
+    break;\r
+  } // hctisw\r
+}\r
 \r
-     delete this->m_Conn;\r
-     this->m_Conn = NULL;\r
-     return( true );\r
-     }\r
-     break;\r
-     }\r
-     } // hctiws\r
-  */\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneMove )\r
+{\r
+}\r
 \r
-  return( this->Superclass::eventFilter( o, e ) );\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneResize )\r
+{\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+PipelineEditor_QNodesEditor_Callback_CODE( GraphicsSceneWheel )\r
+{\r
 }\r
 \r
 // eof - $RCSfile$\r
index f338d91a8a08566c437ac41d50584079f946e8d0..d148bbe82aa5497a0f3fa1d5dfe19c324cd77919 100644 (file)
 class QGraphicsScene;\r
 class QGraphicsSceneMouseEvent;\r
 class QGraphicsItem;\r
+class QGraphicsSceneContextMenuEvent;\r
+class QGraphicsSceneDragDropEvent;\r
+class QGraphicsSceneHelpEvent;\r
+class QGraphicsSceneHoverEvent;\r
+class QGraphicsSceneMouseEvent;\r
+class QGraphicsSceneMoveEvent;\r
+class QGraphicsSceneResizeEvent;\r
+class QGraphicsSceneWheelEvent;\r
+\r
+// -------------------------------------------------------------------------\r
+#define PipelineEditor_QNodesEditor_Callback_DCL( E )   \\r
+  void _##E##_cbk( Q##E##Event* e );\r
 \r
 namespace PipelineEditor\r
 {\r
@@ -78,7 +90,36 @@ namespace PipelineEditor
     QGraphicsItem* itemAt( const QPointF& pos );\r
 \r
     inline void _CreateBlock( TFilter* f, const QPointF& pnt );\r
-    inline void _DoubleClick( QGraphicsSceneMouseEvent* evt, QGraphicsItem* item );\r
+\r
+  protected:\r
+    typedef QGraphicsSceneDragDropEvent QGraphicsSceneDragEnterEvent;\r
+    typedef QGraphicsSceneDragDropEvent QGraphicsSceneDragLeaveEvent;\r
+    typedef QGraphicsSceneDragDropEvent QGraphicsSceneDragMoveEvent;\r
+    typedef QGraphicsSceneDragDropEvent QGraphicsSceneDropEvent;\r
+    typedef QGraphicsSceneHoverEvent    QGraphicsSceneHoverEnterEvent;\r
+    typedef QGraphicsSceneHoverEvent    QGraphicsSceneHoverMoveEvent;\r
+    typedef QGraphicsSceneHoverEvent    QGraphicsSceneHoverLeaveEvent;\r
+    typedef QGraphicsSceneMouseEvent    QGraphicsSceneMouseDoubleClickEvent;\r
+    typedef QGraphicsSceneMouseEvent    QGraphicsSceneMouseMoveEvent;\r
+    typedef QGraphicsSceneMouseEvent    QGraphicsSceneMousePressEvent;\r
+    typedef QGraphicsSceneMouseEvent    QGraphicsSceneMouseReleaseEvent;\r
+\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneContextMenu );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneDragEnter );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneDragLeave );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneDragMove );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneDrop );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneHelp );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneHoverEnter );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneHoverLeave );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneHoverMove );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneMouseDoubleClick );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneMouseMove );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneMousePress );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneMouseRelease );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneMove );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneResize );\r
+    PipelineEditor_QNodesEditor_Callback_DCL( GraphicsSceneWheel );\r
 \r
   private:\r
     QGraphicsScene* m_Scene;\r
@@ -93,3 +134,25 @@ namespace PipelineEditor
 #endif // __PIPELINEEDITOR__QNODESEDITOR__H__\r
 \r
 // eof - $RCSfile$\r
+\r
+      /* TODO\r
+         case QEvent::GraphicsSceneContextMenu:\r
+         QGraphicsSceneContextMenuEvent* evt =\r
+         \r
+         case QEvent::GraphicsSceneDragEnter:\r
+         case QEvent::GraphicsSceneDragLeave:\r
+         case QEvent::GraphicsSceneDragMove:\r
+         case QEvent::GraphicsSceneDrop:\r
+         case QEvent::GraphicsSceneHelp:\r
+         case QEvent::GraphicsSceneHoverEnter:\r
+         case QEvent::GraphicsSceneHoverLeave:\r
+         case QEvent::GraphicsSceneHoverMove:\r
+         case QEvent::GraphicsSceneMouseDoubleClick:\r
+         case QEvent::GraphicsSceneMouseMove:\r
+         case QEvent::GraphicsSceneMousePress:\r
+         case QEvent::GraphicsSceneMouseRelease:\r
+         case QEvent::GraphicsSceneMove:\r
+         case QEvent::GraphicsSceneResize:\r
+         case QEvent::GraphicsSceneWheel:\r
+      */\r
+    \r
index 3c42481f7bcb6b797ab64e1ab63b1ef82e72eaf2..dfe66d9bf51ba197638a23eba5815f2ec7c20c93 100644 (file)
@@ -193,6 +193,8 @@ AddInputPort(
   const std::string& filter, const std::string& filter_input
   )
 {
+  std::cout << name << " " << filter << " " << filter_input << std::endl;
+
   this->m_InputPorts[ name ] = TGlobalPort( filter, filter_input );
 }