Salome HOME
Copyright update 2022
[modules/gui.git] / src / PVViewer / PVViewer_Behaviors.cxx
index 75fc467cc2adfedf8f4b30a805225316464b446b..66f22e2c682a29d0b21ee754d53e9f66f14b9cf0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,7 @@
 
 #include "PVViewer_Behaviors.h"
 
-#include <SUIT_Desktop.h>
-#include <SalomeApp_Module.h>
+#include <QMainWindow>
 
 #include <pqInterfaceTracker.h>
 #include <pqApplicationCore.h>
@@ -37,7 +36,6 @@
 #include <pqDataTimeStepBehavior.h>
 #include <pqDefaultViewBehavior.h>
 #include <pqObjectPickingBehavior.h>
-#include <pqPersistentMainWindowStateBehavior.h>
 #include <pqPipelineContextMenuBehavior.h>
 #include <pqPluginActionGroupBehavior.h>
 #include <pqPluginDockWidgetsBehavior.h>
 #include <pqCollaborationBehavior.h>
 #include <pqVerifyRequiredPluginBehavior.h>
 #include <pqPluginSettingsBehavior.h>
-#include <pqFixPathsInStateFilesBehavior.h>
 #include <pqApplyBehavior.h>
 
 #include <pqPropertiesPanel.h>
 
 int PVViewer_Behaviors::BehaviorLoadingLevel = 0;
 
-PVViewer_Behaviors::PVViewer_Behaviors(SUIT_Desktop * parent)
-  : QObject(static_cast<QObject *>(parent))
+PVViewer_Behaviors::PVViewer_Behaviors(QMainWindow * parent)
+  : QObject(parent)
 {
 }
 
@@ -63,7 +60,7 @@ PVViewer_Behaviors::PVViewer_Behaviors(SUIT_Desktop * parent)
  * This method should be updated at each new version of ParaView with what is found in
  *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
  */
-void PVViewer_Behaviors::instanciateMinimalBehaviors(SUIT_Desktop * desk)
+void PVViewer_Behaviors::instanciateMinimalBehaviors(QMainWindow * /*desk*/)
 {
   if (BehaviorLoadingLevel < 1)
     {
@@ -75,15 +72,11 @@ void PVViewer_Behaviors::instanciateMinimalBehaviors(SUIT_Desktop * desk)
       // Register standard types of view-frame actions.
       pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm));
 
-      // Load plugins distributed with application.
-      pqApplicationCore::instance()->loadDistributedPlugins();
-
+      new pqPipelineContextMenuBehavior(this);
       new pqDefaultViewBehavior(this);  // shows a 3D view as soon as a server connection is made
       new pqAlwaysConnectedBehavior(this);  // client always connected to a server
-      new pqAutoLoadPluginXMLBehavior(this);  // auto load plugins
       new pqVerifyRequiredPluginBehavior(this);
       new pqPluginSettingsBehavior(this);
-      new pqFixPathsInStateFilesBehavior(this);
       new pqCrashRecoveryBehavior(this);
       new pqCommandLineOptionsBehavior(this);
 
@@ -95,7 +88,7 @@ void PVViewer_Behaviors::instanciateMinimalBehaviors(SUIT_Desktop * desk)
  * This method should be updated at each new version of ParaView with what is found in
  *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
  */
-void PVViewer_Behaviors::instanciateAllBehaviors(SUIT_Desktop * desk)
+void PVViewer_Behaviors::instanciateAllBehaviors(QMainWindow * desk)
 {
   //    "new pqParaViewBehaviors(anApp->desktop(), this);"
   // -> (which loads all standard ParaView behaviors at once) has to be replaced in order to
@@ -110,20 +103,27 @@ void PVViewer_Behaviors::instanciateAllBehaviors(SUIT_Desktop * desk)
       //new pqQtMessageHandlerBehavior(this);   // THIS ONE TO EXCLUDE !! see comment above
       new pqDataTimeStepBehavior(this);
       new pqSpreadSheetVisibilityBehavior(this);
-      new pqPipelineContextMenuBehavior(this);
+      //new pqPipelineContextMenuBehavior(this);
       new pqUndoRedoBehavior(this);
+      new pqAutoLoadPluginXMLBehavior(this);  // auto load plugins GUI stuff
       new pqPluginDockWidgetsBehavior(desk);
       new pqPluginActionGroupBehavior(desk);
-      new pqPersistentMainWindowStateBehavior(desk);
+      // rnv: Disable ParaView main window persistance mechanism,
+      //      because SALOME has own functionality for store/restore windows state.
+      //  new pqPersistentMainWindowStateBehavior(desk);
       new pqObjectPickingBehavior(desk);
       new pqCollaborationBehavior(this);
       new pqViewStreamingBehavior(this);
 
+      // Move instantiation of the pqApplyBehavior to the PVViewer_GUIElements::buildPVWidgets(),
+      // because without pqPropertiesPanel it doesn't make sense.      
+      /*
       pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
       foreach (pqPropertiesPanel* ppanel, desk->findChildren<pqPropertiesPanel*>())
       {
         applyBehavior->registerPanel(ppanel);
       }
+      */
       BehaviorLoadingLevel = 2;
     }
 }