Salome HOME
ParaView dock widgets
[modules/paravis.git] / src / PVGUI / PVGUI_Module.cxx
1 // LIGHT : sample (no-corba-engine) SALOME module
2 //
3 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : PVGUI_Module.cxx
23 // Author : Julia DOROVSKIKH
24 //
25
26 #include "PVGUI_Module.h"
27 #include "PVGUI_ProcessModuleHelper.h"
28 #include "PVGUI_ViewModel.h"
29 #include "PVGUI_ViewManager.h"
30 #include "PVGUI_ViewWindow.h"
31
32 #include <SUIT_MessageBox.h>
33 #include <SUIT_Desktop.h>
34 #include <SUIT_Session.h>
35 #include <LightApp_Application.h>
36 #include <LightApp_SelectionMgr.h>
37 #include <QtxActionMenuMgr.h>
38
39 #include <QApplication>
40 #include <QDockWidget>
41 #include <QInputDialog>
42 #include <QStringList>
43 #include <QMenu>
44 #include <QIcon>
45 #include <QString>
46
47 #include <pqOptions.h>
48 #include <pqApplicationCore.h>
49 #include <pqActiveServer.h>
50 #include <pqComparativeVisPanel.h>
51 #include <pqMainWindowCore.h>
52 #include <pqObjectBuilder.h>
53 #include <pqPipelineBrowser.h>
54 #include <pqPipelineMenu.h>
55 #include <pqServer.h>
56 #include <pqServerManagerModel.h>
57 #include <pqServerResource.h>
58 #include <pqViewManager.h>
59 #include <vtkPVMain.h>
60 #include <vtkProcessModule.h>
61
62 /*
63  * Make sure all the kits register their classes with vtkInstantiator.
64  * Since ParaView uses Tcl wrapping, all of VTK is already compiled in
65  * anyway.  The instantiators will add no more code for the linker to
66  * collect.
67  */
68
69 #include <vtkCommonInstantiator.h>
70 #include <vtkFilteringInstantiator.h>
71 #include <vtkGenericFilteringInstantiator.h>
72 #include <vtkIOInstantiator.h>
73 #include <vtkImagingInstantiator.h>
74 #include <vtkInfovisInstantiator.h>
75 #include <vtkGraphicsInstantiator.h>
76
77 #include <vtkRenderingInstantiator.h>
78 #include <vtkVolumeRenderingInstantiator.h>
79 #include <vtkHybridInstantiator.h>
80 #include <vtkParallelInstantiator.h>
81
82 #include <vtkPVServerCommonInstantiator.h>
83 #include <vtkPVFiltersInstantiator.h>
84 #include <vtkPVServerManagerInstantiator.h>
85 #include <vtkClientServerInterpreter.h>
86
87
88 //----------------------------------------------------------------------------
89 // ClientServer wrapper initialization functions.
90 // Taken from ParaView sources (file pqMain.cxx)
91 extern "C" void vtkCommonCS_Initialize(vtkClientServerInterpreter*);
92 extern "C" void vtkFilteringCS_Initialize(vtkClientServerInterpreter*);
93 extern "C" void vtkGenericFilteringCS_Initialize(vtkClientServerInterpreter*);
94 extern "C" void vtkImagingCS_Initialize(vtkClientServerInterpreter*);
95 extern "C" void vtkInfovisCS_Initialize(vtkClientServerInterpreter*);
96 extern "C" void vtkGraphicsCS_Initialize(vtkClientServerInterpreter*);
97 extern "C" void vtkIOCS_Initialize(vtkClientServerInterpreter*);
98 extern "C" void vtkRenderingCS_Initialize(vtkClientServerInterpreter*);
99 extern "C" void vtkVolumeRenderingCS_Initialize(vtkClientServerInterpreter*);
100 extern "C" void vtkHybridCS_Initialize(vtkClientServerInterpreter*);
101 extern "C" void vtkWidgetsCS_Initialize(vtkClientServerInterpreter*);
102 extern "C" void vtkParallelCS_Initialize(vtkClientServerInterpreter*);
103 extern "C" void vtkPVServerCommonCS_Initialize(vtkClientServerInterpreter*);
104 extern "C" void vtkPVFiltersCS_Initialize(vtkClientServerInterpreter*);
105 extern "C" void vtkXdmfCS_Initialize(vtkClientServerInterpreter *);
106
107 //----------------------------------------------------------------------------
108 void ParaViewInitializeInterpreter(vtkProcessModule* pm)
109 {
110   // Initialize built-in wrapper modules.
111   vtkCommonCS_Initialize(pm->GetInterpreter());
112   vtkFilteringCS_Initialize(pm->GetInterpreter());
113   vtkGenericFilteringCS_Initialize(pm->GetInterpreter());
114   vtkImagingCS_Initialize(pm->GetInterpreter());
115   vtkInfovisCS_Initialize(pm->GetInterpreter());
116   vtkGraphicsCS_Initialize(pm->GetInterpreter());
117   vtkIOCS_Initialize(pm->GetInterpreter());
118   vtkRenderingCS_Initialize(pm->GetInterpreter());
119   vtkVolumeRenderingCS_Initialize(pm->GetInterpreter());
120   vtkHybridCS_Initialize(pm->GetInterpreter());
121   vtkWidgetsCS_Initialize(pm->GetInterpreter());
122   vtkParallelCS_Initialize(pm->GetInterpreter());
123   vtkPVServerCommonCS_Initialize(pm->GetInterpreter());
124   vtkPVFiltersCS_Initialize(pm->GetInterpreter());
125   vtkXdmfCS_Initialize(pm->GetInterpreter());
126 }
127
128 //////////////////////////////////////////////////////////////////////////////
129 // PVGUI_Module::pqImplementation
130
131 class PVGUI_Module::pqImplementation
132 {
133 public:
134   pqImplementation(QWidget* parent) :
135     //AssistantClient(0),
136     Core(parent)//,
137     //RecentFilesMenu(0),
138     //ViewMenu(0),
139     //ToolbarsMenu(0)
140   {
141   }
142
143   ~pqImplementation()
144   {
145     //delete this->ViewMenu;
146     //delete this->ToolbarsMenu;
147     //if(this->AssistantClient)
148     //  {
149     //  this->AssistantClient->closeAssistant();
150     //  delete this->AssistantClient;
151     //  }
152   }
153
154   //QPointer<QAssistantClient> AssistantClient;
155   //Ui::MainWindow UI;
156   pqMainWindowCore Core;
157   //pqRecentFilesMenu* RecentFilesMenu;
158   //pqViewMenu* ViewMenu;
159   //pqViewMenu* ToolbarsMenu;
160   //QLineEdit* CurrentTimeWidget;
161   //QSpinBox* CurrentTimeIndexWidget;
162   QPointer<pqServer> ActiveServer;
163   QString DocumentationDir;
164
165   static vtkPVMain* myPVMain;
166   static pqOptions* myPVOptions;
167   static PVGUI_ProcessModuleHelper* myPVHelper;
168 };
169
170
171 vtkPVMain*                 PVGUI_Module::pqImplementation::myPVMain = 0;
172 pqOptions*                 PVGUI_Module::pqImplementation::myPVOptions = 0;
173 PVGUI_ProcessModuleHelper* PVGUI_Module::pqImplementation::myPVHelper = 0;
174
175 /*!
176   \class PVGUI_Module
177   \brief Implementation of light (no-CORBA-engine) 
178          SALOME module wrapping ParaView GUI.
179 */
180
181 /*!
182   \brief Constructor. Sets the default name for the module.
183 */
184 PVGUI_Module::PVGUI_Module()
185   : LightApp_Module( "PARAVIS" ),
186     Implementation( 0 )
187 {
188 }
189
190 /*!
191   \brief Destructor.
192 */
193 PVGUI_Module::~PVGUI_Module()
194 {
195 }
196
197 /*!
198   \brief Initialize module. Creates menus, prepares context menu, etc.
199   \param app application instance
200 */
201 void PVGUI_Module::initialize( CAM_Application* app )
202 {
203   LightApp_Module::initialize( app );
204
205   /*
206   int i = 1;
207   while( i ){
208     i = i;
209   }
210   */
211
212   pvInit();
213
214   /*
215   createAction( lgLoadFile, tr( "TOP_LOAD_FILE" ), QIcon(), tr( "MEN_LOAD_FILE" ),
216                 tr( "STB_LOAD_FILE" ), 0, desk, false, this, SLOT( onLoadFile() ) );
217   createAction( lgDisplayLine, tr( "TOP_DISPLAY_LINE" ), QIcon(), tr( "MEN_DISPLAY_LINE" ),
218                 tr( "STB_DISPLAY_LINE" ), 0, desk, false, this, SLOT( onDisplayLine() ) );
219   createAction( lgEraseLine, tr( "TOP_ERASE_LINE" ), QIcon(), tr( "MEN_ERASE_LINE" ),
220                 tr( "STB_ERASE_LINE" ), 0, desk, false, this, SLOT( onEraseLine() ) );
221   createAction( lgSaveFile, tr( "TOP_SAVE_FILE" ), QIcon(), tr( "MEN_SAVE_FILE" ),
222                 tr( "STB_SAVE_FILE" ), 0, desk, false, this, SLOT( onSaveFile() ) );
223   createAction( lgEditLine, tr( "TOP_EDIT_LINE" ), QIcon(), tr( "MEN_EDIT_LINE" ),
224                 tr( "STB_EDIT_LINE" ), 0, desk, false, this, SLOT( onEditLine() ) );
225   createAction( lgAddLine,  tr( "TOP_ADD_LINE" ),  QIcon(), tr( "MEN_ADD_LINE" ),
226                 tr( "STB_ADD_LINE" ),  0, desk, false, this, SLOT( onAddLine() ) );
227   createAction( lgDelLine,  tr( "TOP_DEL_LINE" ),  QIcon(), tr( "MEN_DEL_LINE" ),
228                 tr( "STB_DEL_LINE" ),  0, desk, false, this, SLOT( onDelLine() ) );
229   createAction( lgClear,    tr( "TOP_CLEAR_ALL" ), QIcon(), tr( "MEN_CLEAR_ALL" ),
230                 tr( "STB_CLEAR_ALL" ), 0, desk, false, this, SLOT( onClear() ) );
231
232   int aFileMnu = createMenu( tr( "MEN_FILE" ), -1, -1 );
233   createMenu( separator(), aFileMnu, -1, 10 );
234   createMenu( lgLoadFile,  aFileMnu, 10 );
235   createMenu( lgSaveFile,  aFileMnu, 10 );
236
237   int aLightMnu = createMenu( tr( "MEN_LIGHT" ), -1, -1, 50 );
238   createMenu( lgAddLine,      aLightMnu, 10 );
239   createMenu( lgEditLine,     aLightMnu, 10 );
240   createMenu( lgDelLine,      aLightMnu, 10 );
241   createMenu( separator(),    aLightMnu, -1, 10 );
242   createMenu( lgClear,        aLightMnu, 10 );
243
244   QString rule = "(client='ObjectBrowser' or client='OCCViewer') and selcount=1 and type='TextLine' and !empty";
245
246   popupMgr()->insert ( action( lgDisplayLine ), -1, 0 );
247   popupMgr()->setRule( action( lgDisplayLine ), rule + " and !visible"  );
248
249   popupMgr()->insert ( action( lgEraseLine ), -1, 0 );
250   popupMgr()->setRule( action( lgEraseLine ), rule + " and activeView='OCCViewer' and visible"  );
251
252   rule = "client='ObjectBrowser' and selcount=1 and type='TextLine'";
253
254   popupMgr()->insert ( action( lgEditLine ), -1, 0 );
255   popupMgr()->setRule( action( lgEditLine ), rule  );
256
257   popupMgr()->insert ( action( lgAddLine ),  -1, 0 );
258   popupMgr()->setRule( action( lgAddLine ),  rule );
259
260   popupMgr()->insert ( separator(),          -1, 0 );
261
262   popupMgr()->insert ( action( lgDelLine ),  -1, 0 );
263   popupMgr()->setRule( action( lgDelLine ),  rule );
264
265   rule = "client='ObjectBrowser'";
266
267   popupMgr()->insert ( action( lgClear ),    -1, 0 );
268   popupMgr()->setRule( action( lgClear ),    rule );*/
269 }
270
271 /*!
272   \brief Get list of compliant dockable GUI elements
273   \param m map to be filled in ("type":"default_position")
274 */
275 void PVGUI_Module::windows( QMap<int, int>& m ) const
276 {
277   m.insert( LightApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
278   // TODO: creation of Python console leads to SIGSEGV on Python initialization...
279   //m.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
280   // ParaView diagnostic output redirected here
281   m.insert( LightApp_Application::WT_LogWindow, Qt::BottomDockWidgetArea );
282 }
283
284 /*!
285   \brief Create custom popup menu selection object.
286   \return new selected object
287 */
288 /*LightApp_Selection* PVGUI_Module::createSelection() const
289 {
290   return new PVGUI_Selection();
291 }*/
292
293 /*!
294   \brief Create data model.
295   \return module specific data model
296 */
297 /*CAM_DataModel* PVGUI_Module::createDataModel()
298 {
299   return new PVGUI_DataModel( this );
300 }*/
301
302 /*!
303   \brief Static method, performs initialization of ParaView session.
304   \return \c true if ParaView has been initialized successfully, otherwise false
305 */
306 bool PVGUI_Module::pvInit()
307 {
308   if ( !pqImplementation::myPVMain ){
309     // Obtain command-line arguments
310     int argc = 0;
311     QStringList args = QApplication::arguments();
312     char** argv = new char*[args.size()];
313     for ( QStringList::const_iterator it = args.begin(); argc < 1 && it != args.end(); it++, argc++ )
314       argv[argc] = strdup( (*it).toLatin1().constData() );
315
316     vtkPVMain::SetInitializeMPI(0);  // pvClient never runs with MPI.
317     vtkPVMain::Initialize(&argc, &argv); // Perform any initializations.
318
319     // TODO: Set plugin dir from preferences
320     //QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
321
322     pqImplementation::myPVMain = vtkPVMain::New();
323     if ( !pqImplementation::myPVOptions )
324       pqImplementation::myPVOptions = pqOptions::New();
325     if ( !pqImplementation::myPVHelper )
326       pqImplementation::myPVHelper = PVGUI_ProcessModuleHelper::New();
327
328     pqImplementation::myPVOptions->SetProcessType(vtkPVOptions::PVCLIENT);
329
330     // This creates the Process Module and initializes it.
331     int ret = pqImplementation::myPVMain->Initialize(pqImplementation::myPVOptions, 
332                                                      pqImplementation::myPVHelper, 
333                                                      ParaViewInitializeInterpreter,
334                                                      argc, argv);
335     if (!ret){
336       // Tell process module that we support Multiple connections.
337       // This must be set before starting the event loop.
338       vtkProcessModule::GetProcessModule()->SupportMultipleConnectionsOn();
339       ret = pqImplementation::myPVHelper->Run(pqImplementation::myPVOptions);
340     }
341
342     delete[] argv;
343     return !ret;
344   }
345   
346   return true;
347 }
348  
349 /*!
350   \brief Static method, cleans up ParaView session at application exit.
351 */
352 void PVGUI_Module::pvShutdown()
353 {
354   // TODO...
355 }  
356
357 /*!
358   \brief Shows (toShow = true) or hides ParaView view window
359 */
360 void PVGUI_Module::showView( bool toShow )
361 {
362   // TODO: check if ParaView view already exists
363   if ( !Implementation ){
364     LightApp_Application* anApp = getApp();
365     SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
366     PVGUI_ViewManager* viewMgr = new PVGUI_ViewManager( anApp->activeStudy(), anApp->desktop() );
367     anApp->addViewManager( viewMgr );
368     connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
369              anApp, SLOT( onCloseView( SUIT_ViewManager* ) ) );
370     //connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), vm, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
371     //connect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ), this, SLOT( onViewDeleted( SUIT_ViewWindow* ) ) );
372     SUIT_ViewWindow* wnd = viewMgr->createViewWindow();  
373
374     // Simulate ParaView client main window
375     Implementation = new pqImplementation( anApp->desktop() );
376     PVGUI_ViewWindow* pvWnd = dynamic_cast<PVGUI_ViewWindow*>( wnd );
377     pvWnd->setMultiViewManager( &Implementation->Core.multiViewManager() );
378
379     pvCreateActions();
380     setupDockWidgets();
381
382     // Now that we're ready, initialize everything ...
383     Implementation->Core.initializeStates();
384   }
385 }
386  
387 /*!
388   \brief Create actions for ParaView GUI operations
389   duplicating menus and toolbars in MainWindow class of
390   the standard ParaView GUI client application.
391
392   In particular, ParaView is responsible for updating "Sources" and "Filters" menus. 
393   For this, specific menu managers created by pqMainWindowCore class are used, and PVGUI_Module
394   is responsible for creation of corresponding QMenu objects only.
395 */
396 void PVGUI_Module::pvCreateActions()
397 {
398   // TODO...
399   SUIT_Desktop* desk = application()->desktop();
400
401   // Manage plug-ins
402   int actionManagePlugins = 999;
403   createAction( actionManagePlugins, tr( "TOP_MANAGE_PLUGINS" ), QIcon(), tr( "MEN_MANAGE_PLUGINS" ),
404                 tr( "STB_MANAGE_PLUGINS" ), 0, desk, false, &Implementation->Core, SLOT( onManagePlugins() ) );
405   int aPVMnu = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
406   createMenu( actionManagePlugins, aPVMnu, 10 );
407
408   // Install ParaView managers for "Sources" and "Filters" menus
409   QMenu* res = 0;
410   aPVMnu = createMenu( tr( "Sources" ), -1, -1, 60 );
411   res = getMenu( aPVMnu );
412   if ( res ){
413     Implementation->Core.setSourceMenu( res );
414     connect(&this->Implementation->Core,
415             SIGNAL(enableSourceCreate(bool)),
416             res,
417             SLOT(setEnabled(bool)));
418   }
419   aPVMnu = createMenu( tr( "Filters" ), -1, -1, 70 );
420   res = getMenu( aPVMnu );
421   if ( res ){
422     Implementation->Core.setFilterMenu( res );
423     connect(&this->Implementation->Core,
424             SIGNAL(enableFilterCreate(bool)),
425             res,
426             SLOT(setEnabled(bool)));
427   }
428 }
429
430
431 /*!
432   \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
433   ParaView pqMainWIndowCore class is fully responsible for these dock widgets' contents.
434 */
435 void PVGUI_Module::setupDockWidgets()
436 {
437   SUIT_Desktop* desk = application()->desktop();
438
439   // See ParaView src/Applications/Client/MainWindow.cxx
440   QDockWidget* pipelineBrowserDock = new QDockWidget( tr( "Pipeline Browser" ), desk );
441   pipelineBrowserDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
442   desk->addDockWidget( Qt::LeftDockWidgetArea, pipelineBrowserDock );
443   Implementation->Core.setupPipelineBrowser( pipelineBrowserDock );
444   pqPipelineBrowser *browser = Implementation->Core.pipelineBrowser();
445   Implementation->Core.pipelineMenu().setModels(browser->getModel(), browser->getSelectionModel());
446   // TODO...
447   /*connect(this->Implementation->UI.actionChangeInput, SIGNAL(triggered()),
448     browser, SLOT(changeInput()));
449   connect(this->Implementation->UI.actionDelete, SIGNAL(triggered()),
450     browser, SLOT(deleteSelected()));
451   pqPipelineBrowserContextMenu *browserMenu =
452     new pqPipelineBrowserContextMenu(browser);
453   browserMenu->setMenuAction(this->Implementation->UI.actionFileOpen);
454   browserMenu->setMenuAction(this->Implementation->UI.actionChangeInput);
455   browserMenu->setMenuAction(this->Implementation->UI.actionDelete);
456   browserMenu->setMenuAction(this->Implementation->UI.actionToolsCreateCustomFilter);*/
457
458   QDockWidget* objectInspectorDock = new QDockWidget( tr( "Object Inspector" ), desk );
459   objectInspectorDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
460   desk->addDockWidget( Qt::LeftDockWidgetArea, objectInspectorDock );
461   pqProxyTabWidget* const proxyTab = Implementation->Core.setupProxyTabWidget( objectInspectorDock );
462   // TODO...
463   /*  QObject::connect(
464     proxyTab->getObjectInspector(),
465     SIGNAL(helpRequested(QString)),
466     this,
467     SLOT(showHelpForProxy(QString)));
468
469   QObject::connect(
470     proxyTab->getObjectInspector(),
471     SIGNAL(preaccept()),
472     this,
473     SLOT(onPreAccept()));
474
475   QObject::connect(
476     proxyTab->getObjectInspector(),
477     SIGNAL(postaccept()),
478     this,
479     SLOT(onPostAccept()));*/
480
481   QDockWidget* statisticsViewDock  = new QDockWidget( tr( "Statistics View" ), desk );
482   statisticsViewDock->setAllowedAreas( Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
483   desk->addDockWidget( Qt::BottomDockWidgetArea, statisticsViewDock );
484   Implementation->Core.setupStatisticsView( statisticsViewDock );
485
486   QDockWidget* animationPanelDock  = new QDockWidget( tr( "Animation Inspector" ), desk );
487   desk->addDockWidget( Qt::LeftDockWidgetArea, animationPanelDock );
488   pqAnimationPanel* animation_panel = Implementation->Core.setupAnimationPanel( animationPanelDock );
489   // TODO...
490   /*  animation_panel->setCurrentTimeToolbar(
491       this->Implementation->UI.currentTimeToolbar);*/
492
493   QDockWidget* lookmarkBrowserDock = new QDockWidget( tr( "Lookmark Browser" ), desk );
494   QSizePolicy sp( QSizePolicy::Preferred, QSizePolicy::Preferred );
495   sp.setHorizontalStretch( 0 );
496   sp.setVerticalStretch( 0 );
497   lookmarkBrowserDock->setSizePolicy( sp );
498   lookmarkBrowserDock->setFloating( false );
499   desk->addDockWidget( Qt::RightDockWidgetArea, lookmarkBrowserDock );
500   Implementation->Core.setupLookmarkBrowser( lookmarkBrowserDock );
501
502   QDockWidget* lookmarkInspectorDock = new QDockWidget( tr( "Lookmark Inspector" ), desk );
503   lookmarkInspectorDock->setAllowedAreas( Qt::RightDockWidgetArea );
504   desk->addDockWidget( Qt::RightDockWidgetArea, lookmarkInspectorDock );
505   Implementation->Core.setupLookmarkInspector( lookmarkInspectorDock );
506
507   QDockWidget* comparativePanelDock  = new QDockWidget( tr( "Comparative View Inspector" ), desk );
508   desk->addDockWidget( Qt::LeftDockWidgetArea, comparativePanelDock );
509   pqComparativeVisPanel* cv_panel    = new pqComparativeVisPanel( comparativePanelDock );
510   comparativePanelDock->setWidget(cv_panel);
511
512   QDockWidget* animationViewDock     = new QDockWidget( tr( "Animation View" ), desk );
513   desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock );
514   Implementation->Core.setupAnimationView( animationViewDock );
515
516   QDockWidget* selectionInspectorDock = new QDockWidget( tr( "Selection Inspector" ), desk );
517   selectionInspectorDock->setAllowedAreas( Qt::AllDockWidgetAreas );
518   desk->addDockWidget( Qt::LeftDockWidgetArea, selectionInspectorDock );
519   Implementation->Core.setupSelectionInspector( selectionInspectorDock );
520
521   // Setup the statusbar ...
522   Implementation->Core.setupProgressBar( desk->statusBar() );
523
524   // Set up the dock window corners to give the vertical docks more room.
525   desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
526   desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
527
528   // Setup the default dock configuration ...
529   lookmarkBrowserDock->hide();
530   lookmarkInspectorDock->hide();
531   statisticsViewDock->hide();
532   animationPanelDock->hide();
533   comparativePanelDock->hide();
534   animationViewDock->hide();
535   selectionInspectorDock->hide();
536 }
537
538 /*!
539   \brief Returns the ParaView multi-view manager.
540 */
541 pqViewManager* PVGUI_Module::getMultiViewManager() const
542 {
543   pqViewManager* aMVM = 0; 
544   if ( Implementation )
545     aMVM = &Implementation->Core.multiViewManager();
546   return aMVM;
547 }
548
549 QMenu* PVGUI_Module::getMenu( const int id )
550 {
551   QMenu* res = 0;
552   LightApp_Application* anApp = getApp();
553   SUIT_Desktop* desk = anApp->desktop();
554   if ( desk ){
555     QtxActionMenuMgr* menuMgr = desk->menuMgr();
556     res = menuMgr->findMenu( id );
557   }
558   return res;
559 }
560
561 /*!
562   \brief Activate module.
563   \param study current study
564   \return \c true if activaion is done successfully or 0 to prevent
565   activation on error
566 */
567 bool PVGUI_Module::activateModule( SUIT_Study* study )
568 {
569   bool isDone = LightApp_Module::activateModule( study );
570   if ( !isDone ) return false;
571
572   setMenuShown( true );
573
574   showView( true );
575
576   // Make default server connection
577   if ( Implementation )
578     Implementation->Core.makeDefaultConnectionIfNoneExists();
579
580   return isDone;
581 }
582
583
584 /*!
585   \brief Deactivate module.
586   \param study current study
587   \return \c true if deactivaion is done successfully or 0 to prevent
588   deactivation on error
589 */
590 bool PVGUI_Module::deactivateModule( SUIT_Study* study )
591 {
592   // hide menus
593   setMenuShown( false );
594
595   return LightApp_Module::deactivateModule( study );
596 }
597
598 /*!
599   \fn CAM_Module* createModule();
600   \brief Export module instance (factory function).
601   \return new created instance of the module
602 */
603
604 #ifdef WNT
605 #define PVGUI_EXPORT __declspec(dllexport)
606 #else   // WNT
607 #define PVGUI_EXPORT
608 #endif  // WNT
609
610 extern "C" {
611   PVGUI_EXPORT CAM_Module* createModule() {
612     return new PVGUI_Module();
613   }
614 }