1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : PVGUI_Module_MenuActions.cxx
23 // Author : Margarita KARPUNINA
26 #include "PVGUI_Module_impl.h"
28 #include <QtxActionToolMgr.h>
29 #include <LightApp_Application.h>
30 #include <SUIT_Desktop.h>
33 #include <QDockWidget>
38 #include <pqAnimationViewWidget.h> //VSV
40 #include <pqApplicationCore.h>
41 #include <pqComparativeVisPanel.h>
42 #include <pqObjectInspectorWidget.h>
43 #include <pqPipelineBrowserWidget.h>
44 #include <pqProxyTabWidget.h>
45 #include <pqSettings.h>
46 #include <pqDataInformationWidget.h>
47 #include <pqPVAnimationWidget.h>
48 #include <pqSelectionInspectorPanel.h>
49 #include <pqProgressWidget.h>
51 #include <pqAlwaysConnectedBehavior.h>
52 #include <pqApplicationCore.h>
53 #include <pqAutoLoadPluginXMLBehavior.h>
54 #include <pqCommandLineOptionsBehavior.h>
55 #include <pqCrashRecoveryBehavior.h>
56 #include <pqDataTimeStepBehavior.h>
57 #include <pqDefaultViewBehavior.h>
58 #include <pqDeleteBehavior.h>
59 #include <pqPersistentMainWindowStateBehavior.h>
60 #include <pqPluginActionGroupBehavior.h>
61 #include <pqPluginDockWidgetsBehavior.h>
62 #include <pqPluginManager.h>
63 #include <pqPVNewSourceBehavior.h>
64 #include <pqSpreadSheetVisibilityBehavior.h>
65 #include <pqStandardViewModules.h>
66 #include <pqUndoRedoBehavior.h>
67 #include <pqViewFrameActionsBehavior.h>
68 #include <pqParaViewMenuBuilders.h>
71 \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
72 ParaView pqMainWIndowCore class is fully responsible for these dock widgets' contents.
74 void PVGUI_Module::setupDockWidgets()
76 SUIT_Desktop* desk = application()->desktop();
79 QDockWidget* pipelineBrowserDock = new QDockWidget( tr( "TTL_PIPELINE_BROWSER" ), desk );
80 pipelineBrowserDock->setObjectName("pipelineBrowserDock");
81 pipelineBrowserDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
82 desk->addDockWidget( Qt::LeftDockWidgetArea, pipelineBrowserDock );
83 pqPipelineBrowserWidget* browser = new pqPipelineBrowserWidget(pipelineBrowserDock);
84 pqParaViewMenuBuilders::buildPipelineBrowserContextMenu(*browser);
85 pipelineBrowserDock->setWidget(browser);
86 myDockWidgets.append(pipelineBrowserDock);
89 QDockWidget* objectInspectorDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk );
90 objectInspectorDock->setObjectName("objectInspectorDock");
91 objectInspectorDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
92 desk->addDockWidget( Qt::LeftDockWidgetArea, objectInspectorDock );
93 pqProxyTabWidget* proxyTab = new pqProxyTabWidget(objectInspectorDock);
94 proxyTab->setShowOnAccept(true);
95 objectInspectorDock->setWidget(proxyTab);
96 connect( proxyTab->getObjectInspector(), SIGNAL( helpRequested(QString) ),
97 this, SLOT( showHelpForProxy(QString) ) );
98 //connect( proxyTab->getObjectInspector(), SIGNAL( preaccept() ), this, SLOT( onPreAccept() ) );
99 //connect( proxyTab->getObjectInspector(), SIGNAL( postaccept() ), this, SLOT( onPostAccept() ) );
100 myDockWidgets.append(objectInspectorDock);
103 QDockWidget* statisticsViewDock = new QDockWidget( tr( "TTL_STATISTICS_VIEW" ), desk );
104 statisticsViewDock->setObjectName("statisticsViewDock");
105 statisticsViewDock->setAllowedAreas(Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|
106 Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
107 desk->addDockWidget( Qt::BottomDockWidgetArea, statisticsViewDock );
108 pqDataInformationWidget* aStatWidget = new pqDataInformationWidget(statisticsViewDock);
109 statisticsViewDock->setWidget(aStatWidget);
110 myDockWidgets.append(statisticsViewDock);
113 QDockWidget* animationViewDock = new QDockWidget( tr( "TTL_ANIMATION_VIEW" ), desk );
114 animationViewDock->setObjectName("animationViewDock");
115 desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock );
116 pqPVAnimationWidget* animation_panel = new pqPVAnimationWidget(animationViewDock);
117 animationViewDock->setWidget(animation_panel);
118 myDockWidgets.append(animationViewDock);
121 QDockWidget* selectionInspectorDock = new QDockWidget( tr( "TTL_SELECTION_INSPECTOR" ), desk );
122 selectionInspectorDock->setObjectName("selectionInspectorDock");
123 selectionInspectorDock->setAllowedAreas( Qt::AllDockWidgetAreas );
124 desk->addDockWidget( Qt::LeftDockWidgetArea, selectionInspectorDock );
125 pqSelectionInspectorPanel* aSelInspector = new pqSelectionInspectorPanel(selectionInspectorDock);
126 selectionInspectorDock->setWidget(aSelInspector);
127 myDockWidgets.append(selectionInspectorDock);
130 QDockWidget* comparativePanelDock = new QDockWidget( tr( "TTL_COMPARATIVE_VIEW_INSPECTOR" ), desk );
131 comparativePanelDock->setObjectName("comparativePanelDock");
132 desk->addDockWidget( Qt::LeftDockWidgetArea, comparativePanelDock );
133 pqComparativeVisPanel* cv_panel = new pqComparativeVisPanel( comparativePanelDock );
134 comparativePanelDock->setWidget(cv_panel);
135 myDockWidgets.append(comparativePanelDock);
137 // Setup the statusbar ...
138 pqProgressWidget* aProgress = new pqProgressWidget(desk->statusBar());
139 desk->statusBar()->addPermanentWidget(aProgress);
141 // Set up the dock window corners to give the vertical docks more room.
142 desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
143 desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
145 // Setup the default dock configuration ...
146 statisticsViewDock->hide();
147 comparativePanelDock->hide();
148 animationViewDock->hide();
149 selectionInspectorDock->hide();
152 // Setup quick-launch shortcuts.
153 QShortcut *ctrlSpace = new QShortcut(Qt::CTRL + Qt::Key_Space, desk);
154 QObject::connect(ctrlSpace, SIGNAL(activated()), pqApplicationCore::instance(), SLOT(quickLaunch()));
155 QShortcut *altSpace = new QShortcut(Qt::ALT + Qt::Key_Space, desk);
156 QObject::connect(altSpace, SIGNAL(activated()), pqApplicationCore::instance(), SLOT(quickLaunch()));
161 \brief Save states of dockable ParaView widgets.
163 void PVGUI_Module::saveDockWidgetsState()
165 SUIT_Desktop* desk = application()->desktop();
167 // Save the state of the window ...
168 pqApplicationCore::instance()->settings()->saveState(*desk, "MainWindow");
170 for (int i = 0; i < myDockWidgets.size(); ++i)
171 myDockWidgets.at(i)->setParent(0);
175 \brief Restore states of dockable ParaView widgets.
177 void PVGUI_Module::restoreDockWidgetsState()
179 SUIT_Desktop* desk = application()->desktop();
181 for (int i = 0; i < myDockWidgets.size(); ++i)
182 myDockWidgets.at(i)->setParent(desk);
184 // Restore the state of the window ...
185 pqApplicationCore::instance()->settings()->restoreState("MainWindow", *desk);