X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ModuleConnector.cpp;h=59baeb5159658c27b1c2aeb3fa00d8096cbf8ea9;hb=745c72679f6346375d5e886b25cc3865f3c4daae;hp=34b7d462c7c6c6a1a84d929c7873d2b386ae8cac;hpb=dc7d4d86b58b81684abc9b5a2be8ec30f210c2da;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index 34b7d462c..59baeb515 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ // // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "XGUI_ModuleConnector.h" @@ -29,6 +28,7 @@ #include "XGUI_PropertyPanel.h" #include "XGUI_ActionsMgr.h" #include "XGUI_ErrorMgr.h" +#include "XGUI_ObjectsBrowser.h" #include #include @@ -108,6 +108,13 @@ AISObjectPtr XGUI_ModuleConnector::findPresentation(const ObjectPtr& theObject) return aDisp->getAISObject(theObject); } +bool XGUI_ModuleConnector::isVisible(const ObjectPtr& theObject) const +{ + XGUI_Displayer* aDisp = myWorkshop->displayer(); + return aDisp->isVisible(theObject); +} + + ObjectPtr XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr& theAIS) const { XGUI_Displayer* aDisp = myWorkshop->displayer(); @@ -117,11 +124,13 @@ ObjectPtr XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr& theAIS) void XGUI_ModuleConnector::setSelected(const QList& theValues) { - XGUI_Displayer* aDisp = myWorkshop->displayer(); + XGUI_ObjectsBrowser* aBrowser = myWorkshop->objectBrowser(); if (theValues.isEmpty()) { myWorkshop->selector()->clearSelection(); - } else - aDisp->setSelected(theValues); + aBrowser->treeView()->clearSelection(); + } else { + myWorkshop->selector()->setSelected(theValues); + } } void XGUI_ModuleConnector::setStatusBarMessage(const QString& theMessage) @@ -195,3 +204,64 @@ std::shared_ptr XGUI_ModuleConnector::featureInfo(const Q return std::shared_ptr(); #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(); + 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); +}