${Boost_INCLUDE_DIRS}
${QT_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/view
+ ${CMAKE_CURRENT_BINARY_DIR}
)
+# Process viewer:
+ADD_SUBDIRECTORY(view)
+
# additional preprocessor / compiler flags
ADD_DEFINITIONS(${CAS_DEFINITIONS})
ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
PV_I.h
PARAVIS_Gen_i.hh
PV_Events.h
- PV_Tools.h
)
+IF(NOT SALOME_PARAVIS_MINIMAL_CORBA)
+ LIST(APPEND _other_HEADERS PV_Tools.h)
+ENDIF()
+
# header files / to install
- SET(PVGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
+ SET(PVGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS} ${_ui_FORMS_HEADERS})
# --- resources ---
PVGUI_Module.cxx
PVGUI_Module_actions.cxx
PVGUI_Module_widgets.cxx
- # PVGUI_ViewManager.cxx
- # PVGUI_ViewModel.cxx
- # PVGUI_ViewWindow.cxx
- # PVGUI_OutputWindowAdapter.cxx
- PVGUI_ViewManager.cxx
- PVGUI_ViewModel.cxx
- PVGUI_ViewWindow.cxx
- PVGUI_OutputWindowAdapter.cxx
PVGUI_Tools.cxx
PVGUI_ParaViewSettingsPane.cxx
-- #PVGUI_MatplotlibMathTextUtilities.cxx
- #PV_Tools.cxx
- PARAVIS_Gen_i.cc
- PV_Tools.cxx
)
IF(NOT SALOME_PARAVIS_MINIMAL_CORBA)
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : PVGUI_Module.cxx
--// Author : Julia DOROVSKIKH
#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
#ifdef HAVE_FINITE
#include <vtkPython.h> // Python first
#include "PVGUI_Module.h"
-#include "SALOMEconfig.h"
-#ifdef WITH_VISU
-#include CORBA_CLIENT_HEADER(VISU_Gen)
+#ifdef PARAVIS_WITH_FULL_CORBA
+# include "PARAVIS_Gen_i.hh"
#endif
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
- //#include "PV_Tools.h"
-#include "PARAVIS_Gen_i.hh"
-
-#include "PV_Tools.h"
++#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
++#include CORBA_SERVER_HEADER(SALOMEDS)
#include "PVGUI_ViewModel.h"
#include "PVGUI_ViewManager.h"
#include <pqLoadDataReaction.h>
#include <vtkEventQtSlotConnect.h>
#include <pqPythonScriptEditor.h>
-#include <pqCollaborationBehavior.h>
#include <pqDataRepresentation.h>
#include <pqPipelineRepresentation.h>
- #include <pqLookupTableManager.h>
+ //#include <pqLookupTableManager.h>
#include <pqDisplayColorWidget.h>
#include <pqColorToolbar.h>
#include <pqScalarBarVisibilityReaction.h>
+ #include <pqStandardPropertyWidgetInterface.h>
+ #include <pqStandardViewFrameActionsImplementation.h>
+ #include <pqViewStreamingBehavior.h>
+
+ #include <PARAVIS_version.h>
+
+ #include <vtkPVConfig.h>
+#include <pqServerResource.h>
+#include <pqServerConnectReaction.h>
+#include <pqServerDisconnectReaction.h>
-#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
-
-#include <pqAlwaysConnectedBehavior.h>
#include <pqApplicationCore.h>
+ #include <pqAutoLoadPluginXMLBehavior.h>
+ #include <pqCommandLineOptionsBehavior.h>
+ #include <pqCrashRecoveryBehavior.h>
+ #include <pqDataTimeStepBehavior.h>
+ #include <pqDefaultViewBehavior.h>
+ #include <pqObjectPickingBehavior.h>
+ #include <pqPersistentMainWindowStateBehavior.h>
+ #include <pqPipelineContextMenuBehavior.h>
+ #include <pqPluginActionGroupBehavior.h>
+ #include <pqPluginDockWidgetsBehavior.h>
+ #include <pqPluginManager.h>
+ #include <pqSpreadSheetVisibilityBehavior.h>
+ #include <pqUndoRedoBehavior.h>
#include <pqServerManagerObserver.h>
+ #include <pqVerifyRequiredPluginBehavior.h>
+ #include <pqFixPathsInStateFilesBehavior.h>
+ #include <pqPluginSettingsBehavior.h>
+ #include <pqPropertiesPanel.h>
+
+ #include <pqApplyBehavior.h>
+
#include <vtkClientServerInterpreterInitializer.h>
+#include <vtkPVConfig.h>
- #include <PARAVIS_version.h>
-
- #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
+ // Trace related
+ #include <vtkNew.h>
+ #include <vtkSMTrace.h>
+ #include <vtkSMSessionProxyManager.h>
+ #include <vtkSMParaViewPipelineController.h>
//----------------------------------------------------------------------------
pqPVApplicationCore* PVGUI_Module::MyCoreApp = 0;
pvInit();
// Create GUI elements (menus, toolbars, dock widgets)
- //if ( !Implementation ){
- SalomeApp_Application* anApp = getApp();
- SUIT_Desktop* aDesktop = anApp->desktop();
+ SalomeApp_Application* anApp = getApp();
+ SUIT_Desktop* aDesktop = anApp->desktop();
- // connect(aDesktop, SIGNAL()
+ // Remember current state of desktop toolbars
+ QList<QToolBar*> foreignToolbars = aDesktop->findChildren<QToolBar*>();
- // Remember current state of desktop toolbars
- QList<QToolBar*> foreignToolbars = aDesktop->findChildren<QToolBar*>();
+ setupDockWidgets();
- // Simulate ParaView client main window
- //Implementation = new pqImplementation( aDesktop );
+ pvCreateActions();
+ pvCreateToolBars();
+ pvCreateMenus();
- setupDockWidgets();
-
- pvCreateActions();
- pvCreateToolBars();
- pvCreateMenus();
-
- QList<QDockWidget*> activeDocks = aDesktop->findChildren<QDockWidget*>();
- QList<QMenu*> activeMenus = aDesktop->findChildren<QMenu*>();
-
- // new pqParaViewBehaviors(anApp->desktop(), this);
- // Has to be replaced in order to exclude using of pqQtMessageHandlerBehaviour
- // Start pqParaViewBehaviors
- // Register ParaView interfaces.
- //pqPluginManager* pgm = pqApplicationCore::instance()->getPluginManager();
- pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();
-
- // Register standard types of property widgets.
- pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
- // Register standard types of view-frame actions.
- pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm));
-
- // Load plugins distributed with application.
- pqApplicationCore::instance()->loadDistributedPlugins();
-
- // Define application behaviors.
- //new pqQtMessageHandlerBehavior(this);
- new pqDataTimeStepBehavior(this);
- new pqSpreadSheetVisibilityBehavior(this);
- new pqPipelineContextMenuBehavior(this);
- new pqObjectPickingBehavior(this);
- new pqDefaultViewBehavior(this);
- new pqUndoRedoBehavior(this);
- new pqAlwaysConnectedBehavior(this);
- new pqCrashRecoveryBehavior(this);
- new pqAutoLoadPluginXMLBehavior(this);
- new pqPluginDockWidgetsBehavior(aDesktop);
- new pqVerifyRequiredPluginBehavior(this);
- new pqPluginActionGroupBehavior(aDesktop);
- new pqFixPathsInStateFilesBehavior(this);
- new pqCommandLineOptionsBehavior(this);
- new pqPersistentMainWindowStateBehavior(aDesktop);
- new pqCollaborationBehavior(this);
- new pqViewStreamingBehavior(this);
- new pqPluginSettingsBehavior(this);
-
- pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
- foreach (pqPropertiesPanel* ppanel, aDesktop->findChildren<pqPropertiesPanel*>())
- {
- applyBehavior->registerPanel(ppanel);
- }
+ QList<QDockWidget*> activeDocks = aDesktop->findChildren<QDockWidget*>();
+ QList<QMenu*> activeMenus = aDesktop->findChildren<QMenu*>();
+ PVGUI_Behaviors * behav = new PVGUI_Behaviors(this);
+ behav->instanciateAllBehaviors(aDesktop);
- // Setup quick-launch shortcuts.
- QShortcut *ctrlSpace = new QShortcut(Qt::CTRL + Qt::Key_Space, aDesktop);
- QObject::connect(ctrlSpace, SIGNAL(activated()),
- pqApplicationCore::instance(), SLOT(quickLaunch()));
+ // Setup quick-launch shortcuts.
+ QShortcut *ctrlSpace = new QShortcut(Qt::CTRL + Qt::Key_Space, aDesktop);
+ QObject::connect(ctrlSpace, SIGNAL(activated()),
+ pqApplicationCore::instance(), SLOT(quickLaunch()));
- // Find Plugin Dock Widgets
- QList<QDockWidget*> currentDocks = aDesktop->findChildren<QDockWidget*>();
- QList<QDockWidget*>::iterator i;
- for (i = currentDocks.begin(); i != currentDocks.end(); ++i) {
- if(!activeDocks.contains(*i)) {
- myDockWidgets[*i] = false; // hidden by default
- (*i)->hide();
- }
+ // Find Plugin Dock Widgets
+ QList<QDockWidget*> currentDocks = aDesktop->findChildren<QDockWidget*>();
+ QList<QDockWidget*>::iterator i;
+ for (i = currentDocks.begin(); i != currentDocks.end(); ++i) {
+ if(!activeDocks.contains(*i)) {
+ myDockWidgets[*i] = false; // hidden by default
+ (*i)->hide();
}
+ }
- // Find Plugin Menus
- QList<QMenu*> currentMenus = aDesktop->findChildren<QMenu*>();
- QList<QMenu*>::iterator im;
- for (im = currentMenus.begin(); im != currentMenus.end(); ++im) {
- if(!activeMenus.contains(*im)) {
- myMenus.append(*im);
- }
- }
+ // Find Plugin Menus
+ // [ABN] TODO: fix this - triggers a SEGFAULT at deactivation() time.
+ // QList<QMenu*> currentMenus = aDesktop->findChildren<QMenu*>();
+ // QList<QMenu*>::iterator im;
+ // for (im = currentMenus.begin(); im != currentMenus.end(); ++im) {
+ // if(!activeMenus.contains(*im)) {
+ // QString s = (*im)->title();
+ // std::cout << " MENU "<< s.toStdString() << std::endl;
+ // myMenus.append(*im);
+ // }
+ // }
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QString aPath = resMgr->stringValue("resources", "PARAVIS", QString());
- if (!aPath.isNull()) {
- MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewFilters.xml");
- MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewReaders.xml");
- MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewSources.xml");
- MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewWriters.xml");
- }
-
- // Force creation of engine
- PARAVIS::GetParavisGen(this);
- updateObjBrowser();
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ QString aPath = resMgr->stringValue("resources", "PARAVIS", QString());
+ if (!aPath.isNull()) {
+ MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewFilters.xml");
+ MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewReaders.xml");
+ MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewSources.xml");
+ MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewWriters.xml");
+ }
+
+ // Force creation of the PARAVIS engine
+ GetEngine();
+ updateObjBrowser();
- // Find created toolbars
- QCoreApplication::processEvents();
+ // Find created toolbars
+ QCoreApplication::processEvents();
- QList<QToolBar*> allToolbars = aDesktop->findChildren<QToolBar*>();
- foreach(QToolBar* aBar, allToolbars) {
- if (!foreignToolbars.contains(aBar)) {
- myToolbars[aBar] = true;
- myToolbarBreaks[aBar] = false;
- aBar->setVisible(false);
- aBar->toggleViewAction()->setVisible(false);
- }
+ QList<QToolBar*> allToolbars = aDesktop->findChildren<QToolBar*>();
+ foreach(QToolBar* aBar, allToolbars) {
+ if (!foreignToolbars.contains(aBar)) {
+ myToolbars[aBar] = true;
+ myToolbarBreaks[aBar] = false;
+ aBar->setVisible(false);
+ aBar->toggleViewAction()->setVisible(false);
}
- //}
+ }
updateMacros();
}
}
- void PVGUI_Module::execPythonCommand(const QString& cmd, bool inSalomeConsole)
- {
- if ( inSalomeConsole ) {
- if ( PyInterp_Dispatcher::Get()->IsBusy() ) return;
- SalomeApp_Application* app =
- dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication());
- PyConsole_Console* pyConsole = app->pythonConsole();
- if (pyConsole)
- pyConsole->exec(cmd);
- }
- else
- {
- SalomeApp_Application* app =
- dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication());
- PyConsole_Interp* pyInterp = app->pythonConsole()->getInterp();
- PyLockWrapper aGil;
- pyInterp->run(cmd.toStdString().c_str());
- // pqPythonManager* manager = qobject_cast<pqPythonManager*>
- // ( pqApplicationCore::instance()->manager( "PYTHON_MANAGER" ) );
- // if ( manager )
- // {
- // pqPythonDialog* pyDiag = manager->pythonShellDialog();
- // if ( pyDiag )
- // {
- // pqPythonShell* shell = pyDiag->shell();
- // if ( shell ) {
- // shell->executeScript(cmd);
- // }
- // }
- // }
- }
- }
-
/*!
- \brief Launches a tracing of current server
+ \brief Initialisation timer event - fired only once, after the GUI loop is ready.
+ See creation in initialize().
*/
-void PVGUI_Module::timerEvent(QTimerEvent* te )
+void PVGUI_Module::onInitTimer()
{
-//#ifndef WNT
-// if ( PyInterp_Dispatcher::Get()->IsBusy() )
-// {
-// // Reschedule for later
-// MESSAGE("interpreter busy -> rescheduling trace start.");
-// startTimer(500);
-// }
-// else
-// {
- MESSAGE("about to start trace....");
- startTrace();
- MESSAGE("trace STARTED....");
-// }
- killTimer( te->timerId() );
-//#endif
+#ifndef PARAVIS_WITH_FULL_CORBA
+ connectToExternalPVServer();
+#endif
-
- #ifndef WNT
- // if ( PyInterp_Dispatcher::Get()->IsBusy() )
- // {
- // // Reschedule for later
- // MESSAGE("interpreter busy -> rescheduling trace start.");
- // startTimer(500);
- // }
- // else
- // {
- MESSAGE("timerEvent(): About to start trace....");
- execPythonCommand("from paraview import smtrace;smtrace.start_trace()", false);
- MESSAGE("timerEvent(): Trace STARTED....");
- // }
- #endif
-
- MESSAGE("initialize(): Initializing PARAVIS's Python context ...");
- execPythonCommand("import paraview.servermanager as sm; sm.fromGUI=True", false);
- MESSAGE("initialize(): Initialized.");
}
/*!
//! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
void restoreCommonWindowsState();
- //! run Python command (either in SALOME's Python interpreter, or in ParaView's Python's interpreter)
- void execPythonCommand(const QString& cmd, bool inSalomeConsole=false);
-
+ //! Connect to the external PVServer, using the PARAVIS engine to launch it if it is not
+ //! already up.
+ bool connectToExternalPVServer();
+
private slots:
void showHelpForProxy( const QString&, const QString& );
//
#include "PVGUI_ParaViewSettingsPane.h"
- #include "ui_pqOptionsDialog.h"
+ #include "ui_pqCustomSettingsWidget.h"
- #include <pqOptionsContainer.h>
- #include <pqOptionsPage.h>
- #include <pqUndoStack.h>
- #include "pqApplicationCore.h"
- #include "pqApplicationOptions.h"
- #include "pqGlobalRenderViewOptions.h"
- #include "pqPluginManager.h"
- #include "pqViewOptionsInterface.h"
- #include "pqInterfaceTracker.h"
-
- #include <QAbstractItemModel>
- #include <QHeaderView>
- #include <QList>
- #include <QMap>
- #include <QString>
-
-
- class OptionsDialogModelItem
- {
- public:
- OptionsDialogModelItem();
- OptionsDialogModelItem(const QString &name);
- ~OptionsDialogModelItem();
-
- OptionsDialogModelItem *Parent;
- QString Name;
- QList<OptionsDialogModelItem *> Children;
- };
-
-
- class OptionsDialogModel : public QAbstractItemModel
- {
- public:
- OptionsDialogModel(QObject *parent=0);
- virtual ~OptionsDialogModel();
+ #include <QtxDialog.h>
- virtual int rowCount(const QModelIndex &parent=QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent=QModelIndex()) const;
- virtual QModelIndex index(int row, int column,
- const QModelIndex &parent=QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
-
- virtual QVariant data(const QModelIndex &index,
- int role=Qt::DisplayRole) const;
-
- QModelIndex getIndex(const QString &path) const;
- QString getPath(const QModelIndex &index) const;
- void addPath(const QString &path);
- bool removeIndex(const QModelIndex &index);
-
- private:
- QModelIndex getIndex(OptionsDialogModelItem *item) const;
+ #include <QString>
- private:
- OptionsDialogModelItem *Root;
- };
+ #include "pqActiveObjects.h"
+ #include "pqApplicationCore.h"
+ #include "pqProxyWidget.h"
+ #include "pqSearchBox.h"
+ #include "pqServer.h"
+ #include "pqSettings.h"
+ #include "pqUndoStack.h"
+ #include "vtkNew.h"
+ #include "vtkPVXMLElement.h"
+ #include "vtkSmartPointer.h"
+ #include "vtkSMProperty.h"
+ #include "vtkSMPropertyHelper.h"
+ #include "vtkSMPropertyIterator.h"
+ #include "vtkSMProxy.h"
+ #include "vtkSMProxyIterator.h"
+ #include "vtkSMSessionProxyManager.h"
+ #include "vtkSMSettings.h"
+
+ #include <QKeyEvent>
+ #include <QMap>
+ #include <QPushButton>
+ #include <QScrollArea>
+ #include <QSpacerItem>
+ #include <QVBoxLayout>
+ #include <QShowEvent>
+ #include <QHideEvent>
- class OptionsDialogForm : public Ui::pqOptionsFrame
-// This class is revisited to hack on the SALOME's Preferences "Default" button
-// to ParaView's "Default" behavior.
+ class PVGUI_ParaViewSettingsPane::pqInternals
{
public:
- OptionsDialogForm();
- ~OptionsDialogForm();
- pqInternals()
- {
- // Get the containing preference tab to identify when it has focus
-
- }
- ~pqInternals();
-
+ Ui::CustomSettingsWidget Ui;
- QMap<QString, pqOptionsPage *> Pages;
- OptionsDialogModel *Model;
- int ApplyUseCount;
- //bool ApplyNeeded;
+ // Map from tab indices to stack widget indices. This is needed because there
+ // are more widgets in the stacked widgets than just what we add.
+ QMap<int, int> TabToStackedWidgets;
};
+ bool PVGUI_ParaViewSettingsPane::ShowRestartRequired = false;
//----------------------------------------------------------------------------
- OptionsDialogModelItem::OptionsDialogModelItem()
- : Name(), Children()
- {
- this->Parent = 0;
- }
-
- OptionsDialogModelItem::OptionsDialogModelItem(const QString &name)
- : Name(name), Children()
- {
- this->Parent = 0;
- }
-
- OptionsDialogModelItem::~OptionsDialogModelItem()
- {
- QList<OptionsDialogModelItem *>::Iterator iter = this->Children.begin();
- for( ; iter != this->Children.end(); ++iter)
- {
- delete *iter;
- }
- }
-
-
- //----------------------------------------------------------------------------
- OptionsDialogModel::OptionsDialogModel(QObject *parentObject)
- : QAbstractItemModel(parentObject)
- {
- this->Root = new OptionsDialogModelItem();
- }
-
- OptionsDialogModel::~OptionsDialogModel()
- {
- delete this->Root;
- }
-
- int OptionsDialogModel::rowCount(const QModelIndex &parentIndex) const
- {
- OptionsDialogModelItem *item = this->Root;
- if(parentIndex.isValid())
- {
- item = reinterpret_cast<OptionsDialogModelItem *>(
- parentIndex.internalPointer());
- }
-
- return item->Children.size();
- }
-
- int OptionsDialogModel::columnCount(const QModelIndex &) const
- {
- return 1;
- }
-
- QModelIndex OptionsDialogModel::index(int row, int column,
- const QModelIndex &parentIndex) const
- {
- OptionsDialogModelItem *item = this->Root;
- if(parentIndex.isValid())
- {
- item = reinterpret_cast<OptionsDialogModelItem *>(
- parentIndex.internalPointer());
- }
-
- if(column == 0 && row >= 0 && row < item->Children.size())
- {
- return this->createIndex(row, column, item->Children[row]);
- }
-
- return QModelIndex();
- }
-
- QModelIndex OptionsDialogModel::parent(const QModelIndex &child) const
- {
- if(child.isValid())
- {
- OptionsDialogModelItem *item =
- reinterpret_cast<OptionsDialogModelItem *>(child.internalPointer());
- return this->getIndex(item->Parent);
- }
-
- return QModelIndex();
- }
-
- QVariant OptionsDialogModel::data(const QModelIndex &idx, int role) const
- {
- if(idx.isValid())
+ PVGUI_ParaViewSettingsPane::PVGUI_ParaViewSettingsPane(QWidget *widgetParent)
+ : QtxUserDefinedContent(widgetParent),
+ Internals (new PVGUI_ParaViewSettingsPane::pqInternals())
+ {
+ Ui::CustomSettingsWidget &ui = this->Internals->Ui;
+ ui.setupUi(this);
+ ui.tabBar->setDocumentMode(false);
+ ui.tabBar->setDrawBase(false);
+ ui.tabBar->setExpanding(false);
+ ui.tabBar->setUsesScrollButtons(true);
+
+ // Hide restart message
+ ui.restartRequiredLabel->setVisible(PVGUI_ParaViewSettingsPane::ShowRestartRequired);
+
+ QList<vtkSMProxy*> proxies_to_show;
+
+ pqServer* server = pqActiveObjects::instance().activeServer();
+ vtkNew<vtkSMProxyIterator> iter;
+ iter->SetSession(server->session());
+ iter->SetModeToOneGroup();
+ for (iter->Begin("settings"); !iter->IsAtEnd(); iter->Next())
{
- OptionsDialogModelItem *item =
- reinterpret_cast<OptionsDialogModelItem *>(idx.internalPointer());
- if(role == Qt::DisplayRole || role == Qt::ToolTipRole)
+ vtkSMProxy* proxy = iter->GetProxy();
+ if (proxy)
{
- return QVariant(item->Name);
+ proxies_to_show.push_back(proxy);
}
}
--- /dev/null
- #include <pqStandardViewModules.h>
+// Copyright (C) 2010-2014 CEA/DEN, EDF R&D
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+// Author: Adrien Bruneton (CEA)
+
+#include "PVGUI_Behaviors.h"
+
+#include <SUIT_Desktop.h>
+#include <SalomeApp_Module.h>
+
+#include <pqInterfaceTracker.h>
+#include <pqApplicationCore.h>
+#include <pqPluginManager.h>
- #include <pqDeleteBehavior.h>
+#include <pqStandardPropertyWidgetInterface.h>
++#include <pqStandardViewFrameActionsImplementation.h>
++#include <pqPropertiesPanel.h>
+
+#include <pqAlwaysConnectedBehavior.h>
+#include <pqAutoLoadPluginXMLBehavior.h>
+#include <pqCommandLineOptionsBehavior.h>
+#include <pqCrashRecoveryBehavior.h>
+#include <pqDataTimeStepBehavior.h>
+#include <pqDefaultViewBehavior.h>
- #include <pqPVNewSourceBehavior.h>
+#include <pqObjectPickingBehavior.h>
+#include <pqPersistentMainWindowStateBehavior.h>
+#include <pqPipelineContextMenuBehavior.h>
+#include <pqPluginActionGroupBehavior.h>
+#include <pqPluginDockWidgetsBehavior.h>
- #include <pqViewFrameActionsBehavior.h>
+#include <pqSpreadSheetVisibilityBehavior.h>
+#include <pqUndoRedoBehavior.h>
- // * adds support for standard paraview views.
- pgm->addInterface(new pqStandardViewModules(pgm));
+#include <pqViewStreamingBehavior.h>
+#include <pqCollaborationBehavior.h>
++#include <pqVerifyRequiredPluginBehavior.h>
++#include <pqPluginSettingsBehavior.h>
++#include <pqFixPathsInStateFilesBehavior.h>
++#include <pqApplyBehavior.h>
+
+bool PVGUI_Behaviors::hasMinimalInstanciated = false;
+
+PVGUI_Behaviors::PVGUI_Behaviors(SalomeApp_Module * parent)
+ : QObject(static_cast<QObject *>(parent))
+{
+}
+
+/**! Instanciate minimal ParaView behaviors needed when using an instance of PVViewer.
+ * This method should be updated at each new version of ParaView with what is found in
+ * Qt/ApplicationComponents/pqParaViewBehaviors.cxx
+ */
+void PVGUI_Behaviors::instanciateMinimalBehaviors(SUIT_Desktop * desk)
+{
+ hasMinimalInstanciated = true;
+
+ // Register ParaView interfaces.
+ pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();
+
- new pqViewFrameActionsBehavior(this); // button above the view port controlling selection and camera undos
++ // Register standard types of property widgets.
+ pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
++ // Register standard types of view-frame actions.
++ pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm));
+
+ // Load plugins distributed with application.
+ pqApplicationCore::instance()->loadDistributedPlugins();
+
- new pqPVNewSourceBehavior(this); // new source is made active, ...
+ new pqDefaultViewBehavior(this); // shows a 3D view as soon as a server connection is made
+ new pqAlwaysConnectedBehavior(this); // client always connected to a server
- new pqObjectPickingBehavior(this); // NEW in 4.1
- new pqDeleteBehavior(this);
+ new pqAutoLoadPluginXMLBehavior(this); // auto load plugins
++ new pqVerifyRequiredPluginBehavior(this);
++ new pqPluginSettingsBehavior(this);
++ new pqFixPathsInStateFilesBehavior(this);
++ new pqCrashRecoveryBehavior(this);
++ new pqCommandLineOptionsBehavior(this);
+}
+
+/**! Instanciate usual ParaView behaviors.
+ * This method should be updated at each new version of ParaView with what is found in
+ * Qt/ApplicationComponents/pqParaViewBehaviors.cxx
+ */
+void PVGUI_Behaviors::instanciateAllBehaviors(SUIT_Desktop * desk)
+{
+ // "new pqParaViewBehaviors(anApp->desktop(), this);"
+ // -> (which loads all standard ParaView behaviors at once) has to be replaced in order to
+ // exclude using of pqQtMessageHandlerBehaviour
+
+ // Define application behaviors.
+ if (!hasMinimalInstanciated)
+ instanciateMinimalBehaviors(desk);
+ //new pqQtMessageHandlerBehavior(this); // THIS ONE TO EXCLUDE !! see comment above
+ new pqDataTimeStepBehavior(this);
+ new pqSpreadSheetVisibilityBehavior(this);
+ new pqPipelineContextMenuBehavior(this);
- new pqCrashRecoveryBehavior(this);
+ new pqUndoRedoBehavior(this);
- //new pqVerifyRequiredPluginBehavior(this);
+ new pqPluginDockWidgetsBehavior(desk);
- //new pqFixPathsInStateFilesBehavior(this);
- new pqCommandLineOptionsBehavior(this);
+ new pqPluginActionGroupBehavior(desk);
- //new pqMultiServerBehavior(this);
+ new pqPersistentMainWindowStateBehavior(desk);
+ new pqObjectPickingBehavior(desk);
+ new pqCollaborationBehavior(this);
+ new pqViewStreamingBehavior(this);
+
++ pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
++ foreach (pqPropertiesPanel* ppanel, desk->findChildren<pqPropertiesPanel*>())
++ {
++ applyBehavior->registerPanel(ppanel);
++ }
++
+}