Salome HOME
updated copyright message
[modules/shaper.git] / src / XGUI / XGUI_ModuleConnector.cpp
index 5c67a3d5037b62d454236c5de5ec2b8b403b1c11..203d860afac46c6300f1d0784c5c296c441b605d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // 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
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "XGUI_ModuleConnector.h"
@@ -125,21 +124,12 @@ ObjectPtr XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr& theAIS)
 
 void XGUI_ModuleConnector::setSelected(const QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
-  XGUI_Displayer* aDisp = myWorkshop->displayer();
   XGUI_ObjectsBrowser* aBrowser = myWorkshop->objectBrowser();
   if (theValues.isEmpty()) {
     myWorkshop->selector()->clearSelection();
     aBrowser->treeView()->clearSelection();
   } else {
-    aDisp->setSelected(theValues);
-    // Synchronise the selection with Object browser
-    QObjectPtrList anObjects;
-    foreach(ModuleBase_ViewerPrsPtr aVal, theValues) {
-      anObjects.append(aVal->object());
-    }
-    bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
-    aBrowser->setObjectsSelected(anObjects);
-    myWorkshop->objectBrowser()->blockSignals(aBlocked);
+    myWorkshop->selector()->setSelected(theValues);
   }
 }
 
@@ -214,3 +204,64 @@ std::shared_ptr<Config_FeatureMessage> XGUI_ModuleConnector::featureInfo(const Q
   return std::shared_ptr<Config_FeatureMessage>();
 #endif
 }
+
+void XGUI_ModuleConnector::deactivateCurrentSelector()
+{
+  myWorkshop->deactivateCurrentSelector();
+}
+
+QObjectPtrList XGUI_ModuleConnector::displayedObjects() const
+{
+  return myWorkshop->displayer()->displayedObjects();
+}
+
+bool XGUI_ModuleConnector::enableUpdateViewer(bool isEnabled)
+{
+  return myWorkshop->displayer()->enableUpdateViewer(isEnabled);
+}
+
+
+void XGUI_ModuleConnector::applyCurrentSelectionModes(const AISObjectPtr& theAIS)
+{
+  Handle(AIS_InteractiveObject) anIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
+  myWorkshop->selectionActivate()->activate(anIO, false);
+}
+
+
+void XGUI_ModuleConnector::undo()
+{
+  myWorkshop->onUndo();
+}
+
+void XGUI_ModuleConnector::setCancelEnabled(bool toEnable)
+{
+  XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
+  QAction* aAbortAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll);
+  QAction* aAbortAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort);
+  if (aAbortAction) {
+    aAbortAction->setEnabled(toEnable);
+  }
+  if (aAbortAllAction) {
+    aAbortAllAction->setEnabled(toEnable);
+  }
+}
+
+bool XGUI_ModuleConnector::isCancelEnabled() const
+{
+  XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
+  QAction* aAbortAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll);
+  QAction* aAbortAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort);
+  bool isEnabled = false;
+  if (aAbortAction) {
+    isEnabled = true;
+  }
+  if (aAbortAllAction) {
+    isEnabled &= true;
+  }
+  return isEnabled;
+}
+
+void XGUI_ModuleConnector::showHelpPage(const QString& thePage) const
+{
+  workshop()->showHelpPage(thePage);
+}