<commit_before>// Copyright (C) 2014-2016  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
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
//
// See http://www.salome-platform.org/ or email : <EMAIL>
//
// Author: <NAME> (CEA)

#include "PVViewer_Behaviors.h"

#include <QMainWindow>

#include <pqInterfaceTracker.h>
#include <pqApplicationCore.h>
#include <pqPluginManager.h>
#include <pqStandardPropertyWidgetInterface.h>
#include <pqStandardViewFrameActionsImplementation.h>
#include <pqPropertiesPanel.h>

#include <pqAlwaysConnectedBehavior.h>
#include <pqAutoLoadPluginXMLBehavior.h>
#include <pqCommandLineOptionsBehavior.h>
#include <pqCrashRecoveryBehavior.h>
#include <pqDataTimeStepBehavior.h>
#include <pqDefaultViewBehavior.h>
#include <pqObjectPickingBehavior.h>
#include <pqPersistentMainWindowStateBehavior.h>
#include <pqPipelineContextMenuBehavior.h>
#include <pqPluginActionGroupBehavior.h>
#include <pqPluginDockWidgetsBehavior.h>
#include <pqSpreadSheetVisibilityBehavior.h>
#include <pqUndoRedoBehavior.h>
#include <pqViewStreamingBehavior.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(QMainWindow * parent)
  : QObject(parent)
{
}

/**! Instanciate minimal ParaView behaviors needed when using an instance of PVViewer.
 * This method should be updated at each new version of ParaView with what is found in
 *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
 */
void PVViewer_Behaviors::instanciateMinimalBehaviors(QMainWindow * desk)
{
  if (BehaviorLoadingLevel < 1)
    {
      // Register ParaView interfaces.
      pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();

      // Register standard types of property widgets.
      pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
      // Register standard types of view-frame actions.
      pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm));

      // Load plugins distributed with application.
      pqApplicationCore::instance()->loadDistributedPlugins();

      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 pqVerifyRequiredPluginBehavior(this);
      new pqPluginSettingsBehavior(this);
      new pqFixPathsInStateFilesBehavior(this);
      new pqCrashRecoveryBehavior(this);
      new pqCommandLineOptionsBehavior(this);

      BehaviorLoadingLevel = 1;
    }
}

/**! Instanciate usual ParaView behaviors.
 * This method should be updated at each new version of ParaView with what is found in
 *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
 */
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
  // exclude using of pqQtMessageHandlerBehaviour

  // Define application behaviors.
  if (BehaviorLoadingLevel < 1)
    instanciateMinimalBehaviors(desk);

  if (BehaviorLoadingLevel < 2)
    {
      //new pqQtMessageHandlerBehavior(this);   // THIS ONE TO EXCLUDE !! see comment above
      new pqDataTimeStepBehavior(this);
      new pqSpreadSheetVisibilityBehavior(this);
      new pqPipelineContextMenuBehavior(this);
      new pqUndoRedoBehavior(this);
      new pqAutoLoadPluginXMLBehavior(this);  // auto load plugins GUI stuff
      new pqPluginDockWidgetsBehavior(desk);
      new pqPluginActionGroupBehavior(desk);
      new pqPersistentMainWindowStateBehavior(desk);
      new pqObjectPickingBehavior(desk);
      new pqCollaborationBehavior(this);
      new pqViewStreamingBehavior(this);

      pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
      foreach (pqPropertiesPanel* ppanel, desk->findChildren<pqPropertiesPanel*>())
      {
        applyBehavior->registerPanel(ppanel);
      }
      BehaviorLoadingLevel = 2;
    }
}<commit_msg>Fix for the '0023265: [CEA 1809] In PARAVIS, th field vtkBlockColors is displayed with a continute scalar bar instead of a discrete one' issue.<commit_after>// Copyright (C) 2014-2016  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
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
//
// See http://www.salome-platform.org/ or email : <EMAIL>
//
// Author: <NAME> (CEA)

#include "PVViewer_Behaviors.h"

#include <QMainWindow>

#include <pqInterfaceTracker.h>
#include <pqApplicationCore.h>
#include <pqPluginManager.h>
#include <pqStandardPropertyWidgetInterface.h>
#include <pqStandardViewFrameActionsImplementation.h>
#include <pqPropertiesPanel.h>

#include <pqAlwaysConnectedBehavior.h>
#include <pqAutoLoadPluginXMLBehavior.h>
#include <pqCommandLineOptionsBehavior.h>
#include <pqCrashRecoveryBehavior.h>
#include <pqDataTimeStepBehavior.h>
#include <pqDefaultViewBehavior.h>
#include <pqObjectPickingBehavior.h>
#include <pqPersistentMainWindowStateBehavior.h>
#include <pqPipelineContextMenuBehavior.h>
#include <pqPluginActionGroupBehavior.h>
#include <pqPluginDockWidgetsBehavior.h>
#include <pqSpreadSheetVisibilityBehavior.h>
#include <pqUndoRedoBehavior.h>
#include <pqViewStreamingBehavior.h>
#include <pqCollaborationBehavior.h>
#include <pqStandardArrayColorMapsBehavior.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(QMainWindow * parent)
  : QObject(parent)
{
}

/**! Instanciate minimal ParaView behaviors needed when using an instance of PVViewer.
 * This method should be updated at each new version of ParaView with what is found in
 *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
 */
void PVViewer_Behaviors::instanciateMinimalBehaviors(QMainWindow * desk)
{
  if (BehaviorLoadingLevel < 1)
    {
      // Register ParaView interfaces.
      pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();

      // Register standard types of property widgets.
      pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
      // Register standard types of view-frame actions.
      pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm));

      // Load plugins distributed with application.
      pqApplicationCore::instance()->loadDistributedPlugins();

      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 pqVerifyRequiredPluginBehavior(this);
      new pqPluginSettingsBehavior(this);
      new pqFixPathsInStateFilesBehavior(this);
      new pqCrashRecoveryBehavior(this);
      new pqCommandLineOptionsBehavior(this);

      BehaviorLoadingLevel = 1;
    }
}

/**! Instanciate usual ParaView behaviors.
 * This method should be updated at each new version of ParaView with what is found in
 *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
 */
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
  // exclude using of pqQtMessageHandlerBehaviour

  // Define application behaviors.
  if (BehaviorLoadingLevel < 1)
    instanciateMinimalBehaviors(desk);

  if (BehaviorLoadingLevel < 2)
    {
      //new pqQtMessageHandlerBehavior(this);   // THIS ONE TO EXCLUDE !! see comment above
      new pqDataTimeStepBehavior(this);
      new pqSpreadSheetVisibilityBehavior(this);
      new pqPipelineContextMenuBehavior(this);
      new pqUndoRedoBehavior(this);
      new pqAutoLoadPluginXMLBehavior(this);  // auto load plugins GUI stuff
      new pqPluginDockWidgetsBehavior(desk);
      new pqPluginActionGroupBehavior(desk);
      new pqPersistentMainWindowStateBehavior(desk);
      new pqObjectPickingBehavior(desk);
      new pqCollaborationBehavior(this);
      new pqViewStreamingBehavior(this);
      new pqStandardArrayColorMapsBehavior(this);

      pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
      foreach (pqPropertiesPanel* ppanel, desk->findChildren<pqPropertiesPanel*>())
      {
        applyBehavior->registerPanel(ppanel);
      }
      BehaviorLoadingLevel = 2;
    }
}
{'fraction_non_alphanumeric': 0.08753262397109014, 'fraction_numerical': 0.007327845814093555, 'mean_word_length': 4.603487064116985, 'pattern_counts': {'":': 0, '<': 70, '<?xml version=': 0, '>': 80, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6522125', 'n_tokens_mistral': 3012, 'n_tokens_neox': 2835, 'n_words': 815}