Salome HOME
Issue #3086: Avoid crash when FeatureInfo is null.
[modules/shaper.git] / src / XGUI / XGUI_ModuleConnector.cpp
index 2f41e3659dc0975cffe816a114b9e76c65df80cd..36866a91eda927474d490538e3d4e00d5d9bebdc 100644 (file)
@@ -211,3 +211,59 @@ 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;
+}