]> SALOME platform Git repositories - modules/paravis.git/blob - src/PVGUI/view/PVGUI_Behaviors.cxx
Salome HOME
9b3061e43117d91ce67e941a12346ab0badc4cb3
[modules/paravis.git] / src / PVGUI / view / PVGUI_Behaviors.cxx
1 // Copyright (C) 2010-2014  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author: Adrien Bruneton (CEA)
20
21 #include "PVGUI_Behaviors.h"
22
23 #include <SUIT_Desktop.h>
24 #include <SalomeApp_Module.h>
25
26 #include <pqInterfaceTracker.h>
27 #include <pqApplicationCore.h>
28 #include <pqPluginManager.h>
29 #include <pqStandardViewModules.h>
30 #include <pqStandardPropertyWidgetInterface.h>
31
32 #include <pqAlwaysConnectedBehavior.h>
33 #include <pqAutoLoadPluginXMLBehavior.h>
34 #include <pqCommandLineOptionsBehavior.h>
35 #include <pqCrashRecoveryBehavior.h>
36 #include <pqDataTimeStepBehavior.h>
37 #include <pqDefaultViewBehavior.h>
38 #include <pqDeleteBehavior.h>
39 #include <pqObjectPickingBehavior.h>
40 #include <pqPersistentMainWindowStateBehavior.h>
41 #include <pqPipelineContextMenuBehavior.h>
42 #include <pqPluginActionGroupBehavior.h>
43 #include <pqPluginDockWidgetsBehavior.h>
44 #include <pqPVNewSourceBehavior.h>
45 #include <pqSpreadSheetVisibilityBehavior.h>
46 #include <pqUndoRedoBehavior.h>
47 #include <pqViewFrameActionsBehavior.h>
48 #include <pqViewStreamingBehavior.h>
49 #include <pqCollaborationBehavior.h>
50
51 bool PVGUI_Behaviors::hasMinimalInstanciated = false;
52
53 PVGUI_Behaviors::PVGUI_Behaviors(SalomeApp_Module * parent)
54   : QObject(static_cast<QObject *>(parent))
55 {
56 }
57
58 /**! Instanciate minimal ParaView behaviors needed when using an instance of PVViewer.
59  * This method should be updated at each new version of ParaView with what is found in
60  *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
61  */
62 void PVGUI_Behaviors::instanciateMinimalBehaviors(SUIT_Desktop * desk)
63 {
64   hasMinimalInstanciated = true;
65
66   // Register ParaView interfaces.
67   pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();
68
69   // * adds support for standard paraview views.
70   pgm->addInterface(new pqStandardViewModules(pgm));
71   pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
72
73   // Load plugins distributed with application.
74   pqApplicationCore::instance()->loadDistributedPlugins();
75
76   new pqViewFrameActionsBehavior(this);     // button above the view port controlling selection and camera undos
77   new pqDefaultViewBehavior(this);  // shows a 3D view as soon as a server connection is made
78   new pqAlwaysConnectedBehavior(this);  // client always connected to a server
79   new pqPVNewSourceBehavior(this);  // new source is made active, ...
80   new pqAutoLoadPluginXMLBehavior(this);  // auto load plugins
81 }
82
83 /**! Instanciate usual ParaView behaviors.
84  * This method should be updated at each new version of ParaView with what is found in
85  *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
86  */
87 void PVGUI_Behaviors::instanciateAllBehaviors(SUIT_Desktop * desk)
88 {
89   //    "new pqParaViewBehaviors(anApp->desktop(), this);"
90   // -> (which loads all standard ParaView behaviors at once) has to be replaced in order to
91   // exclude using of pqQtMessageHandlerBehaviour
92
93   // Define application behaviors.
94   if (!hasMinimalInstanciated)
95     instanciateMinimalBehaviors(desk);
96   //new pqQtMessageHandlerBehavior(this);   // THIS ONE TO EXCLUDE !! see comment above
97   new pqDataTimeStepBehavior(this);
98   new pqSpreadSheetVisibilityBehavior(this);
99   new pqPipelineContextMenuBehavior(this);
100   new pqObjectPickingBehavior(this); // NEW in 4.1
101   new pqDeleteBehavior(this);
102   new pqUndoRedoBehavior(this);
103   new pqCrashRecoveryBehavior(this);
104   new pqPluginDockWidgetsBehavior(desk);
105   //new pqVerifyRequiredPluginBehavior(this);
106   new pqPluginActionGroupBehavior(desk);
107   //new pqFixPathsInStateFilesBehavior(this);
108   new pqCommandLineOptionsBehavior(this);
109   new pqPersistentMainWindowStateBehavior(desk);
110   new pqObjectPickingBehavior(desk);
111   new pqCollaborationBehavior(this);
112   //new pqMultiServerBehavior(this);
113   new pqViewStreamingBehavior(this);
114
115 }