X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Module.cpp;h=9b380a839de031128e1b0311af90b67a7373f389;hb=4d3ed04028394a778cbba218593158d0f84c6607;hp=abf7f605ff13e08c8fbe16039be43cbad8414bb1;hpb=42985955d89fa845790a7e38609f5b6838285147;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index abf7f605f..9b380a839 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -18,6 +18,7 @@ #include "PartSet_MenuMgr.h" #include "PartSet_CustomPrs.h" #include "PartSet_IconFactory.h" +#include "PartSet_WidgetChoice.h" #include "PartSet_Filters.h" #include "PartSet_FilterInfinite.h" @@ -225,12 +226,16 @@ void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) /// Restart sketcher operations automatically if (!mySketchReentrantMgr->operationCommitted(theOperation)) { - // the selection is cleared after commit the create operation - // in order to do not use the same selected objects in the restarted operation - // for common behaviour, the selection is cleared even if the operation is not restarted - XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - aWorkshop->selector()->clearSelection(); + + ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); + if (aFOperation && !aFOperation->isEditOperation()) { + // the selection is cleared after commit the create operation + // in order to do not use the same selected objects in the restarted operation + // for common behaviour, the selection is cleared even if the operation is not restarted + XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); + XGUI_Workshop* aWorkshop = aConnector->workshop(); + aWorkshop->selector()->clearSelection(); + } } } @@ -369,11 +374,11 @@ void PartSet_Module::updateViewerMenu(const QMap& theStdActio myMenuMgr->updateViewerMenu(theStdActions); } -QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature, const bool isCheckGUI) +QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature) { - QString anError = ModuleBase_IModule::getFeatureError(theFeature, isCheckGUI); + QString anError = ModuleBase_IModule::getFeatureError(theFeature); if (anError.isEmpty()) - anError = sketchMgr()->getFeatureError(theFeature, isCheckGUI); + anError = sketchMgr()->getFeatureError(theFeature); return anError; } @@ -539,6 +544,9 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th aWgt = new PartSet_WidgetFileSelector(theParent, aWorkshop, theWidgetApi, theParentId); } else if (theType == "sketch_launcher") { aWgt = new PartSet_WidgetSketchCreator(theParent, this, theWidgetApi, theParentId); + } else if (theType == "module_choice") { + aWgt = new PartSet_WidgetChoice(theParent, theWidgetApi, theParentId); + connect(aWgt, SIGNAL(itemSelected(int)), SLOT(onBooleanOperationChange(int))); } return aWgt; } @@ -780,7 +788,8 @@ void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser) { XGUI_ObjectsBrowser* aOB = dynamic_cast(theObjectBrowser); if (aOB) { - QLineEdit* aLabel = aOB->activeDocLabel(); + QLabel* aLabel = aOB->activeDocLabel(); + aLabel->installEventFilter(myMenuMgr); connect(aLabel, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(onActiveDocPopup(const QPoint&))); //QPalette aPalet = aLabel->palette(); @@ -799,7 +808,7 @@ void PartSet_Module::onActiveDocPopup(const QPoint& thePnt) XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); XGUI_Workshop* aWorkshop = aConnector->workshop(); - QLineEdit* aHeader = aWorkshop->objectBrowser()->activeDocLabel(); + QLabel* aHeader = aWorkshop->objectBrowser()->activeDocLabel(); aActivatePartAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument())); @@ -899,7 +908,7 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); XGUI_Workshop* aWorkshop = aConnector->workshop(); XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView(); - QLineEdit* aLabel = aWorkshop->objectBrowser()->activeDocLabel(); + QLabel* aLabel = aWorkshop->objectBrowser()->activeDocLabel(); QPalette aPalet = aLabel->palette(); SessionPtr aMgr = ModelAPI_Session::get(); @@ -1014,3 +1023,24 @@ bool PartSet_Module::processEnter(const std::string& thePreviousAttributeID) { return mySketchReentrantMgr->processEnter(thePreviousAttributeID); } + + +//****************************************************** +void PartSet_Module::onBooleanOperationChange(int theOperation) +{ + ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); + if (!aOperation) + return; + ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + switch (theOperation) { + case 0: + aPanel->setWindowTitle(tr("Cut")); + break; + case 1: + aPanel->setWindowTitle(tr("Fuse")); + break; + case 2: + aPanel->setWindowTitle(tr("Common")); + break; + } +}