1 // Copyright (C) 2010-2014 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author: Adrien Bruneton (CEA)
21 #include "PVGUI_Behaviors.h"
23 #include <SUIT_Desktop.h>
24 #include <SalomeApp_Module.h>
26 #include <pqInterfaceTracker.h>
27 #include <pqApplicationCore.h>
28 #include <pqPluginManager.h>
29 #include <pqStandardViewModules.h>
30 #include <pqStandardPropertyWidgetInterface.h>
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>
51 bool PVGUI_Behaviors::hasMinimalInstanciated = false;
53 PVGUI_Behaviors::PVGUI_Behaviors(SalomeApp_Module * parent)
54 : QObject(static_cast<QObject *>(parent))
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
62 void PVGUI_Behaviors::instanciateMinimalBehaviors(SUIT_Desktop * desk)
64 hasMinimalInstanciated = true;
66 // Register ParaView interfaces.
67 pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();
69 // * adds support for standard paraview views.
70 pgm->addInterface(new pqStandardViewModules(pgm));
71 pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
73 // Load plugins distributed with application.
74 pqApplicationCore::instance()->loadDistributedPlugins();
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
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
87 void PVGUI_Behaviors::instanciateAllBehaviors(SUIT_Desktop * desk)
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
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);