]> Creatis software - cpPlugins.git/blobdiff - lib/cpPipelineEditor/Port.cxx
Windows compilation is broken.
[cpPlugins.git] / lib / cpPipelineEditor / Port.cxx
index ab478c298343960aa6bd064649c0fef71a5d4869..b0278eaecf1524078fc92462ed445170953c42e7 100644 (file)
@@ -1,8 +1,14 @@
 #include "Port.h"\r
 #include "Connection.h"\r
+#include "Block.h"\r
+#include "Editor.h"\r
+\r
+#include <cpPlugins/DataObjectVisualizationQtDialog.h>\r
 \r
 #include <QGraphicsScene>\r
+#include <QGraphicsSceneContextMenuEvent>\r
 #include <QFontMetrics>\r
+#include <QMenu>\r
 #include <QPainter>\r
 #include <QPen>\r
 \r
@@ -120,37 +126,6 @@ isConnected( Port* other )
   return( false );\r
 }\r
 \r
-// -------------------------------------------------------------------------\r
-cpPipelineEditor::TypePort::\r
-TypePort( QGraphicsItem* parent, QGraphicsScene* scene )\r
-  : Superclass( parent, scene )\r
-{\r
-}\r
-\r
-// -------------------------------------------------------------------------\r
-cpPipelineEditor::TypePort::\r
-~TypePort( )\r
-{\r
-}\r
-\r
-// -------------------------------------------------------------------------\r
-void cpPipelineEditor::TypePort::\r
-_updateLabels( )\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
-// -------------------------------------------------------------------------\r
-bool cpPipelineEditor::TypePort::\r
-isConnected( Port* other )\r
-{\r
-  return( false );\r
-}\r
-\r
 // -------------------------------------------------------------------------\r
 cpPipelineEditor::InputPort::\r
 InputPort( QGraphicsItem* parent, QGraphicsScene* scene )\r
@@ -292,4 +267,50 @@ itemChange( GraphicsItemChange change, const QVariant& value )
   return( value );\r
 }\r
 \r
+// -------------------------------------------------------------------------\r
+void cpPipelineEditor::OutputPort::\r
+contextMenuEvent( QGraphicsSceneContextMenuEvent* evt )\r
+{\r
+  if( this->m_Block == NULL )\r
+    return;\r
+  \r
+  QMenu menu;\r
+  QAction* showAction = menu.addAction( "Show" );\r
+  QAction* hideAction = menu.addAction( "Hide" );\r
+  QAction* propertiesAction = menu.addAction( "Properties" );\r
+  QAction* selectedAction = menu.exec( evt->screenPos( ) );\r
+\r
+  if( selectedAction == showAction )\r
+  {\r
+    this->m_Block->editor( )->showOutputData(\r
+      this->m_Block->namePort( ).toStdString( ),\r
+      this->name( ).toStdString( )\r
+      );\r
+  }\r
+  else if( selectedAction == hideAction )\r
+  {\r
+    this->m_Block->editor( )->hideOutputData(\r
+      this->m_Block->namePort( ).toStdString( ),\r
+      this->name( ).toStdString( )\r
+      );\r
+  }\r
+  else if( selectedAction == propertiesAction )\r
+  {\r
+    auto filter = this->m_Block->filter( );\r
+    auto name = this->name( ).toStdString( );\r
+    if( filter != NULL )\r
+    {\r
+      auto output = filter->GetOutput( name );\r
+      if( output != NULL )\r
+      {\r
+        auto dlg = output->CreateQtDialog( );\r
+        dlg->exec( );\r
+\r
+      } // fi\r
+\r
+    } // fi\r
+\r
+  } // fi\r
+}\r
+\r
 // eof - $RCSfile$\r