]> SALOME platform Git repositories - modules/gui.git/blobdiff - src/PVViewer/PVViewer_GUIElements.cxx
Salome HOME
Updated copyright comment
[modules/gui.git] / src / PVViewer / PVViewer_GUIElements.cxx
index 2a6d260ff815f0f1d7482d945c0c2faae0ebaf81..e4c0a1fe48c8ea19143d948021073d5b038c9321 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2024  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <pqServerResource.h>
 #include <pqSetName.h>
 #include <pqVCRToolbar.h>
+#include <pqPipelineSource.h>
+
+#include <vtkSMSessionProxyManager.h>
+#include <vtkSMProxyIterator.h>
+
+#include <vtkPVConfig.h>
 
 #include <QAction>
 #include <QCoreApplication>
 #include <QMenu>
 #include <QToolBar>
 
-
 PVViewer_GUIElements * PVViewer_GUIElements::theInstance = 0;
 
-PVViewer_GUIElements::PVViewer_GUIElements(QMainWindow* desk) :
-  myDesktop(desk),
+PVViewer_GUIElements::PVViewer_GUIElements(QMainWindow* desktop) :
   propertiesPanel(0),
   pipelineBrowserWidget(0),
+  pipelineModel(0),
   sourcesMenu(0),
   filtersMenu(0),
   macrosMenu(0),
-  myPVWidgetsFlag(false)
+  catalystMenu(0),
+  mainToolBar(0),
+  vcrToolbar(0),
+  timeToolbar(0),
+  colorToolbar(0),
+  reprToolbar(0),
+  cameraToolbar(0),
+  axesToolbar(0),
+  macrosToolbar(0),
+  commonToolbar(0),
+  dataToolbar(0),
+  myDesktop(desktop),
+  myPVWidgetsFlag(false),
+  mainAction(0),
+  vcrAction(0),
+  timeAction(0),
+  colorAction(0),
+  reprAction(0),
+  cameraAction(0),
+  axesAction(0),
+  macrosAction(0),
+  commonAction(0),
+  dataAction(0)
 {
 }
 
@@ -84,7 +111,10 @@ void PVViewer_GUIElements::buildPVWidgets()
 
     //Pipeline Browser
     if ( !pipelineBrowserWidget ) {
-      pipelineBrowserWidget  = new pqPipelineBrowserWidget(myDesktop);
+        pqPipelineModel* pipelineModel = new pqPipelineModel(*pqApplicationCore::instance()->getServerManagerModel(), this);
+        pipelineModel->setView(pqActiveObjects::instance().activeView());
+        pipelineBrowserWidget  = new pqPipelineBrowserWidget(myDesktop);
+        pipelineBrowserWidget->setModel(pipelineModel);
     }
 
     // Properties panel
@@ -110,6 +140,16 @@ void PVViewer_GUIElements::buildPVWidgets()
       pqParaViewMenuBuilders::buildMacrosMenu(*macrosMenu);
     }
 
+    // Catalyst Menu
+    if (!catalystMenu) {
+      catalystMenu = new QMenu(0);
+#if PARAVIEW_VERSION_MAJOR==5 && PARAVIEW_VERSION_MINOR<9
+      pqParaViewMenuBuilders::buildCatalystMenu(*catalystMenu, myDesktop);
+#else
+      pqParaViewMenuBuilders::buildCatalystMenu(*catalystMenu);
+#endif
+    }
+
     mainToolBar = new pqMainControlsToolbar(myDesktop)
       << pqSetName("MainControlsToolbar");
     mainToolBar->layout()->setSpacing(0);
@@ -211,12 +251,13 @@ void PVViewer_GUIElements::buildPVWidgets()
                                 Q_ARG( pqServerManagerModelItem* , NULL ) );
     }
     
+    //publishExistingSources();
     myPVWidgetsFlag = true;
   }
 }
 
 void PVViewer_GUIElements::setToolBarVisible(bool show)
-{  
+{
   QCoreApplication::processEvents();
   if (!myPVWidgetsFlag)
     return;
@@ -326,3 +367,27 @@ QMenu* PVViewer_GUIElements::getMacrosMenu()  {
   buildPVWidgets();
   return macrosMenu;
 }
+
+QMenu* PVViewer_GUIElements::getCatalystMenu()  {
+  buildPVWidgets();
+  return catalystMenu;
+}
+
+void PVViewer_GUIElements::publishExistingSources() {
+  vtkSMSessionProxyManager* pxm = pqActiveObjects::instance().proxyManager();
+  pqServerManagerModel* smmodel = pqApplicationCore::instance()->getServerManagerModel();
+  if( !pxm || !smmodel )
+    return;
+  vtkSMProxyIterator* iter = vtkSMProxyIterator::New();
+  iter->SetModeToOneGroup();
+  iter->SetSessionProxyManager( pxm );
+  for ( iter->Begin( "sources" ); !iter->IsAtEnd(); iter->Next() ) {
+    if ( pqProxy* item = smmodel->findItem<pqProxy*>( iter->GetProxy() ) ) {
+      pqPipelineSource* source = qobject_cast<pqPipelineSource*>( item );
+      QMetaObject::invokeMethod( smmodel,
+                                "sourceAdded",
+                                Qt::AutoConnection,
+                                Q_ARG( pqPipelineSource* , source ) );
+    }
+  }
+}