Salome HOME
PARAVIS main menus and toolbars.
[modules/paravis.git] / src / PVGUI / PVGUI_Module_widgets.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_MenuActions.cxx
23 // Author : Margarita KARPUNINA
24 //
25
26 #include "PVGUI_Module_impl.h"
27
28 #include <QtxActionToolMgr.h>
29 #include <LightApp_Application.h>
30 #include <SUIT_Desktop.h>
31
32 #include <QDockWidget>
33
34 #include <pqAnimationPanel.h>
35 #include <pqComparativeVisPanel.h>
36 #include <pqMainWindowCore.h>
37 #include <pqPipelineBrowser.h>
38 #include <pqPipelineMenu.h>
39
40 /*!
41   \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
42   ParaView pqMainWIndowCore class is fully responsible for these dock widgets' contents.
43 */
44 void PVGUI_Module::setupDockWidgets()
45 {
46   SUIT_Desktop* desk = application()->desktop();
47
48   // See ParaView src/Applications/Client/MainWindow.cxx
49   QDockWidget* pipelineBrowserDock = new QDockWidget( tr( "Pipeline Browser" ), desk );
50   pipelineBrowserDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
51   desk->addDockWidget( Qt::LeftDockWidgetArea, pipelineBrowserDock );
52   Implementation->Core.setupPipelineBrowser( pipelineBrowserDock );
53   pqPipelineBrowser *browser = Implementation->Core.pipelineBrowser();
54   Implementation->Core.pipelineMenu().setModels(browser->getModel(), browser->getSelectionModel());
55
56   QDockWidget* objectInspectorDock = new QDockWidget( tr( "Object Inspector" ), desk );
57   objectInspectorDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
58   desk->addDockWidget( Qt::LeftDockWidgetArea, objectInspectorDock );
59   pqProxyTabWidget* const proxyTab = Implementation->Core.setupProxyTabWidget( objectInspectorDock );
60   // TODO...
61   /*  QObject::connect(
62     proxyTab->getObjectInspector(),
63     SIGNAL(helpRequested(QString)),
64     this,
65     SLOT(showHelpForProxy(QString)));
66
67   QObject::connect(
68     proxyTab->getObjectInspector(),
69     SIGNAL(preaccept()),
70     this,
71     SLOT(onPreAccept()));
72
73   QObject::connect(
74     proxyTab->getObjectInspector(),
75     SIGNAL(postaccept()),
76     this,
77     SLOT(onPostAccept()));*/
78
79   QDockWidget* statisticsViewDock  = new QDockWidget( tr( "Statistics View" ), desk );
80   statisticsViewDock->setAllowedAreas( Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
81   desk->addDockWidget( Qt::BottomDockWidgetArea, statisticsViewDock );
82   Implementation->Core.setupStatisticsView( statisticsViewDock );
83
84   QDockWidget* animationPanelDock  = new QDockWidget( tr( "Animation Inspector" ), desk );
85   desk->addDockWidget( Qt::LeftDockWidgetArea, animationPanelDock );
86   pqAnimationPanel* animation_panel = Implementation->Core.setupAnimationPanel( animationPanelDock );
87   animation_panel->setCurrentTimeToolbar(toolMgr()->toolBar(createTool( tr("TOOL_CURRENT_TIME_CONTROLS") )));
88
89   QDockWidget* lookmarkBrowserDock = new QDockWidget( tr( "Lookmark Browser" ), desk );
90   QSizePolicy sp( QSizePolicy::Preferred, QSizePolicy::Preferred );
91   sp.setHorizontalStretch( 0 );
92   sp.setVerticalStretch( 0 );
93   lookmarkBrowserDock->setSizePolicy( sp );
94   lookmarkBrowserDock->setFloating( false );
95   desk->addDockWidget( Qt::RightDockWidgetArea, lookmarkBrowserDock );
96   Implementation->Core.setupLookmarkBrowser( lookmarkBrowserDock );
97
98   QDockWidget* lookmarkInspectorDock = new QDockWidget( tr( "Lookmark Inspector" ), desk );
99   lookmarkInspectorDock->setAllowedAreas( Qt::RightDockWidgetArea );
100   desk->addDockWidget( Qt::RightDockWidgetArea, lookmarkInspectorDock );
101   Implementation->Core.setupLookmarkInspector( lookmarkInspectorDock );
102
103   QDockWidget* comparativePanelDock  = new QDockWidget( tr( "Comparative View Inspector" ), desk );
104   desk->addDockWidget( Qt::LeftDockWidgetArea, comparativePanelDock );
105   pqComparativeVisPanel* cv_panel    = new pqComparativeVisPanel( comparativePanelDock );
106   comparativePanelDock->setWidget(cv_panel);
107
108   QDockWidget* animationViewDock     = new QDockWidget( tr( "Animation View" ), desk );
109   desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock );
110   Implementation->Core.setupAnimationView( animationViewDock );
111
112   QDockWidget* selectionInspectorDock = new QDockWidget( tr( "Selection Inspector" ), desk );
113   selectionInspectorDock->setAllowedAreas( Qt::AllDockWidgetAreas );
114   desk->addDockWidget( Qt::LeftDockWidgetArea, selectionInspectorDock );
115   Implementation->Core.setupSelectionInspector( selectionInspectorDock );
116
117   // Setup the statusbar ...
118   Implementation->Core.setupProgressBar( desk->statusBar() );
119
120   // Set up the dock window corners to give the vertical docks more room.
121   desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
122   desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
123
124   // Setup the default dock configuration ...
125   lookmarkBrowserDock->hide();
126   lookmarkInspectorDock->hide();
127   statisticsViewDock->hide();
128   animationPanelDock->hide();
129   comparativePanelDock->hide();
130   animationViewDock->hide();
131   selectionInspectorDock->hide();
132 }
133
134 /*!
135   \brief Create dock widgets context menus.
136 */
137 void PVGUI_Module::setupDockWidgetsContextMenu()
138 {
139   pqPipelineBrowser *browser = Implementation->Core.pipelineBrowser();
140   // TODO...
141   /*connect(this->Implementation->UI.actionChangeInput, SIGNAL(triggered()),
142     browser, SLOT(changeInput()));
143   connect(this->Implementation->UI.actionDelete, SIGNAL(triggered()),
144     browser, SLOT(deleteSelected()));
145   pqPipelineBrowserContextMenu *browserMenu =
146     new pqPipelineBrowserContextMenu(browser);
147   browserMenu->setMenuAction(this->Implementation->UI.actionFileOpen);
148   browserMenu->setMenuAction(this->Implementation->UI.actionChangeInput);
149   browserMenu->setMenuAction(this->Implementation->UI.actionDelete);
150   browserMenu->setMenuAction(this->Implementation->UI.actionToolsCreateCustomFilter);*/
151 }