From: nds Date: Fri, 11 Mar 2016 08:38:08 +0000 (+0300) Subject: Issue 1302 Restricting preselection to the first argument only X-Git-Tag: V_2.3.0~390 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4457a01fc445d79067555b37d88370116a373eb1;p=modules%2Fshaper.git Issue 1302 Restricting preselection to the first argument only --- diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 294d0f037..c460480fd 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -331,15 +331,15 @@ bool ModuleBase_OperationFeature::commit() return false; } -void ModuleBase_OperationFeature::activateByPreselection(ModuleBase_IWorkshop* theWorkshop) +ModuleBase_ModelWidget* ModuleBase_OperationFeature::activateByPreselection( + const std::string& theGreedAttributeId) { + ModuleBase_ModelWidget* aWidget = 0; if (myPreSelection.empty()) - return; - + return aWidget; + // equal vertices should not be used here ModuleBase_ISelection::filterSelectionOnEqualPoints(myPreSelection); - std::string aGreedAttributeId = ModuleBase_Tools::findGreedAttribute(theWorkshop, myFeature); - ModuleBase_IPropertyPanel* aPropertyPanel = propertyPanel(); ModuleBase_ModelWidget* aFilledWgt = 0; if (aPropertyPanel) { @@ -347,23 +347,18 @@ void ModuleBase_OperationFeature::activateByPreselection(ModuleBase_IWorkshop* t QList::const_iterator aWIt; ModuleBase_ModelWidget* aWgt = 0; if (!aWidgets.empty()) { - if (!aGreedAttributeId.empty()) { + if (!theGreedAttributeId.empty()) { // set preselection to greed widget for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) { aWgt = (*aWIt); - if (aWgt->attributeID() == aGreedAttributeId) { + if (aWgt->attributeID() == theGreedAttributeId) { aPropertyPanel->setPreselectionWidget(aWgt); aWgt->setSelection(myPreSelection, true); aPropertyPanel->setPreselectionWidget(NULL); + aFilledWgt = aWgt; break; } } - // activate first not greed widget - std::string aFirstAttributeId = aWidgets.front()->attributeID(); - if (aFirstAttributeId == aGreedAttributeId) // activate next widget after greeded - aFilledWgt = aWidgets.front(); - else - aFilledWgt = NULL; // activate first widget of the panel } else { bool isSet = false; @@ -387,18 +382,11 @@ void ModuleBase_OperationFeature::activateByPreselection(ModuleBase_IWorkshop* t // it is better to perform it not in setSelection of each widget, but do it here, // after the preselection is processed ModuleBase_ModelWidget::updateObject(myFeature); - - // 3. a signal should be emitted before the next widget activation - // because, the activation of the next widget will give a focus to the widget. As a result - // the value of the widget is initialized. And commit may happens until the value is entered. - if (aFilledWgt) - emit activatedByPreselection(); } } - // 4. activate the next obligatory widget - aPropertyPanel->activateNextWidget(aFilledWgt); - clearPreselection(); + + return aFilledWgt; } void ModuleBase_OperationFeature::setParentFeature(CompositeFeaturePtr theParent) diff --git a/src/ModuleBase/ModuleBase_OperationFeature.h b/src/ModuleBase/ModuleBase_OperationFeature.h index c2411b884..2d1844d13 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.h +++ b/src/ModuleBase/ModuleBase_OperationFeature.h @@ -105,8 +105,10 @@ Q_OBJECT /// \return Currently installed property panel //ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; } - /// Activates widgets by preselection if it is accepted. Emits signal if the activation is correct - virtual void activateByPreselection(ModuleBase_IWorkshop* theWorkshop); + /// Activates widgets by preselection if it is accepted. + /// \param theGreeAttributeId a greed attribute id if there is in the current feature + /// \return last filled widget + virtual ModuleBase_ModelWidget* activateByPreselection(const std::string& theGreedAttributeId); /// If the operation works with feature which is sub-feature of another one /// then this variable has to be initialised by parent feature @@ -124,10 +126,6 @@ Q_OBJECT /// \return theFeature a feature FeaturePtr previousCurrentFeature(); -signals: - /// The operation is filled with existing preselection - void activatedByPreselection(); - public slots: /// Starts operation /// Public slot. Verifies whether operation can be started and starts operation. diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.cpp b/src/ModuleBase/ModuleBase_WidgetEditor.cpp index b5dee0c4d..3adc21b0d 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetEditor.cpp @@ -43,8 +43,10 @@ ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() { } -void ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText) +bool ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText) { + bool isValueAccepted = false; + QDialog aDlg(QApplication::desktop(), Qt::FramelessWindowHint); QHBoxLayout* aLay = new QHBoxLayout(&aDlg); aLay->setContentsMargins(2, 2, 2, 2); @@ -70,15 +72,17 @@ void ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText) aPoint = QPoint(myXPosition, myYPosition); aDlg.move(aPoint); - aDlg.exec(); - - outText = anEditor->text(); - bool isDouble; - double aValue = outText.toDouble(&isDouble); - if (isDouble) { - outValue = aValue; - outText = ""; // return empty string, if it's can be converted to a double + isValueAccepted = aDlg.exec() == QDialog::Accepted; + if (isValueAccepted) { + outText = anEditor->text(); + bool isDouble; + double aValue = outText.toDouble(&isDouble); + if (isDouble) { + outValue = aValue; + outText = ""; // return empty string, if it's can be converted to a double + } } + return isValueAccepted; } bool ModuleBase_WidgetEditor::focusTo() @@ -87,8 +91,9 @@ bool ModuleBase_WidgetEditor::focusTo() return true; } -void ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) +bool ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) { + bool isValueAccepted = false; // we need to emit the focus in event manually in order to save the widget as an active // in the property panel before the mouse leave event happens in the viewer. The module // ask an active widget and change the feature visualization if the widget is not the current one. @@ -103,23 +108,27 @@ void ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) if (mySpinBox->hasVariable()) aText = mySpinBox->text(); - editedValue(aValue, aText); - if (aText.isEmpty()) { - ModuleBase_Tools::setSpinValue(mySpinBox, aValue); - } else { - ModuleBase_Tools::setSpinText(mySpinBox, aText); - } - if (theSendSignals) { - emit valuesChanged(); - // the focus leaves the control automatically by the Enter/Esc event - // it is processed in operation manager - //emit focusOutWidget(this); - - if (!myIsEditing) - emit enterClicked(this); + isValueAccepted = editedValue(aValue, aText); + if (isValueAccepted) { + if (aText.isEmpty()) { + ModuleBase_Tools::setSpinValue(mySpinBox, aValue); + } else { + ModuleBase_Tools::setSpinText(mySpinBox, aText); + } + if (theSendSignals) { + emit valuesChanged(); + // the focus leaves the control automatically by the Enter/Esc event + // it is processed in operation manager + //emit focusOutWidget(this); + } + else + storeValue(); } - else - storeValue(); + + if (theSendSignals && !myIsEditing) + emit enterClicked(this); + + return isValueAccepted; } void ModuleBase_WidgetEditor::setCursorPosition(const int theX, const int theY) diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.h b/src/ModuleBase/ModuleBase_WidgetEditor.h index db9dd1cc4..049188026 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.h +++ b/src/ModuleBase/ModuleBase_WidgetEditor.h @@ -44,12 +44,17 @@ Q_OBJECT /// Shous popup window under cursor for data editing /// \param theSendSignals a flag whether the signals should be sent or the value /// is to be applyed directly - void showPopupEditor(const bool theSendSignals = true); + /// \return true if the editor value is accepted + bool showPopupEditor(const bool theSendSignals = true); void setCursorPosition(const int theX, const int theY); private: - void editedValue(double& outValue, QString& outText); + /// Show editor + /// \param theOutValue a result value + /// \param theOutText a result text + /// \return true if the editor value is accepted + bool editedValue(double& theOutValue, QString& theOutText); private: ///< the current widget feature diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 0849ba3e3..3f2ef5ed8 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -125,10 +125,6 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) XGUI_ModuleConnector* aConnector = dynamic_cast(theWshop); XGUI_Workshop* aWorkshop = aConnector->workshop(); - XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr(); - connect(anOpMgr, SIGNAL(operationActivatedByPreselection()), - this, SLOT(onOperationActivatedByPreselection())); - ModuleBase_IViewer* aViewer = theWshop->viewer(); connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)), this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*))); @@ -275,6 +271,86 @@ void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation) } void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation) +{ + ModuleBase_IWorkshop* anIWorkshop = workshop(); + if (!theOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel + anIWorkshop->updateCommandStatus(); + } + else { + ModuleBase_OperationFeature* aFOperation = dynamic_cast + (theOperation); + if (aFOperation) { + XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(anIWorkshop); + XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); + ModuleBase_ModelWidget* aFilledWidget = 0; + bool aPostonedWidgetActivation = false; + FeaturePtr aFeature = aFOperation->feature(); + + std::string aGreedAttributeId = ModuleBase_Tools::findGreedAttribute(anIWorkshop, aFeature); + // if there is a greed attribute, automatic commit by preselection for this feature is prohibited + aWorkshop->setPropertyPanel(aFOperation); + + // filling the operation values by the current selection + // if the operation can be committed after the controls filling, the method perform should + // be stopped. Otherwise unnecessary presentations can be shown(e.g. operation prs in sketch) + bool isOperationCommitted = false; + if (!aFOperation->isEditOperation()) { + aFilledWidget = aFOperation->activateByPreselection(aGreedAttributeId); + if (currentOperation() != aFOperation) + isOperationCommitted = true; + else { + if (aGreedAttributeId.empty()) { + // a signal should be emitted before the next widget activation + // because, the activation of the next widget will give a focus to the widget. As a result + // the value of the widget is initialized. And commit may happens until the value is entered. + if (aFilledWidget) { + if (mySketchReentrantMgr->canBeCommittedByPreselection()) + isOperationCommitted = mySketchMgr->operationActivatedByPreselection(); + // activate the next obligatory widget + if (!isOperationCommitted) + aPropertyPanel->activateNextWidget(aFilledWidget); + } + } + else { // there is a greed widget + const QList& aWidgets = aPropertyPanel->modelWidgets(); + std::string aFirstAttributeId = aWidgets.front()->attributeID(); + // activate next widget after greeded if it is the first widget in the panel + // else the first panel widget is already activated by operation start + if (aFirstAttributeId == aGreedAttributeId) + aPostonedWidgetActivation = true; + } + } + } if (!isOperationCommitted) { + anIWorkshop->updateCommandStatus(); + aWorkshop->connectToPropertyPanel(true); + operationStartedInternal(aFOperation); + + // the objects of the current operation should be deactivated + QObjectPtrList anObjects; + anObjects.append(aFeature); + std::list aResults = aFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { + anObjects.append(*aIt); + } + QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end(); + for (; anIt != aLast; anIt++) + aWorkshop->deactivateActiveObject(*anIt, false); + if (anObjects.size() > 0) { + XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + aDisplayer->updateViewer(); + } + } + if (aPostonedWidgetActivation) { + // if the widget is an empty in the chain of activated widgets, the current operation + // is restarted. It should be performed after functionality of the operation starting + aPropertyPanel->activateNextWidget(aFilledWidget); + } + } + } +} + +void PartSet_Module::operationStartedInternal(ModuleBase_Operation* theOperation) { /// Restart sketcher operations automatically mySketchReentrantMgr->operationStarted(theOperation); @@ -557,13 +633,6 @@ void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* the anOpMgr->onKeyReleased(theWnd->viewPort(), theEvent); } -void PartSet_Module::onOperationActivatedByPreselection() -{ - if (!mySketchReentrantMgr->canBeCommittedByPreselection()) - return; - mySketchMgr->operationActivatedByPreselection(); -} - ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent, Config_WidgetAPI* theWidgetApi) diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index d3731bd8b..2581d7bb2 100755 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -312,10 +312,6 @@ protected slots: /// \param theEvent the key event void onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent); - /// SLOT, that is called by the current operation filling with the preselection. - /// It commits the operation of it is can be committed - void onOperationActivatedByPreselection(); - /// A slot called on view window creation void onViewCreated(ModuleBase_IViewWindow*); @@ -338,6 +334,12 @@ protected: /// \param isToConnect a boolean value whether connect or disconnect virtual void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect); + /// Realizes some functionality by an operation start + /// Displays all sketcher sub-Objects, hides sketcher result, appends selection filters + /// Activate the operation presentation + /// \param theOperation a started operation + virtual void operationStartedInternal(ModuleBase_Operation* theOperation); + private slots: void onTreeViewDoubleClick(const QModelIndex&); diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index dcb1a81b5..869ee082b 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -1008,85 +1009,30 @@ void PartSet_SketcherMgr::activatePlaneFilter(const bool& toActivate) myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter); } -void PartSet_SketcherMgr::operationActivatedByPreselection() +bool PartSet_SketcherMgr::operationActivatedByPreselection() { + bool isOperationStopped = false; ModuleBase_Operation* anOperation = getCurrentOperation(); if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) { // Set final definitions if they are necessary //propertyPanelDefined(aOperation); /// Commit sketcher operations automatically + /// distance operation are able to show popup editor to modify the distance value + /// after entering the value, the operation should be committed/aborted(by Esc key) + bool aCanCommitOperation = true; ModuleBase_OperationFeature* aFOperation = dynamic_cast (anOperation); - if (aFOperation) { - if (PartSet_SketcherMgr::isDistanceOperation(aFOperation)) { - FeaturePtr aFeature = aFOperation->feature(); - // editor is shown only if all attribute references are filled by preseletion - bool anAllRefAttrInitialized = true; - - std::list aRefAttrs = aFeature->data()->attributes( - ModelAPI_AttributeRefAttr::typeId()); - std::list::const_iterator anIt = aRefAttrs.begin(), aLast = aRefAttrs.end(); - for (; anIt != aLast && anAllRefAttrInitialized; anIt++) { - anAllRefAttrInitialized = (*anIt)->isInitialized(); - } - if (anAllRefAttrInitialized) { - // Activate dimension value editing on double click - ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); - QList aWidgets = aPanel->modelWidgets(); - // Find corresponded widget to activate value editing - foreach (ModuleBase_ModelWidget* aWgt, aWidgets) { - if (aWgt->attributeID() == "ConstraintValue") { - // the featue should be displayed in order to find the AIS text position, - // the place where the editor will be shown - aFeature->setDisplayed(true); - /// the execute is necessary to perform in the feature compute for flyout position - aFeature->execute(); - - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - - PartSet_WidgetEditor* anEditor = dynamic_cast(aWgt); - if (anEditor) { - int aX = 0, anY = 0; - - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); - AISObjectPtr anAIS = aDisplayer->getAISObject(aFeature); - Handle(AIS_InteractiveObject) anAISIO; - if (anAIS.get() != NULL) { - anAISIO = anAIS->impl(); - } - if (anAIS.get() != NULL) { - Handle(AIS_InteractiveObject) anAISIO = anAIS->impl(); - - if (!anAISIO.IsNull()) { - Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAISIO); - if (!aDim.IsNull()) { - gp_Pnt aPosition = aDim->GetTextPosition(); - - ModuleBase_IViewer* aViewer = aWorkshop->viewer(); - Handle(V3d_View) aView = aViewer->activeView(); - int aCX, aCY; - aView->Convert(aPosition.X(), aPosition.Y(), aPosition.Z(), aCX, aCY); - - QWidget* aViewPort = aViewer->activeViewPort(); - QPoint aGlPoint = aViewPort->mapToGlobal(QPoint(aCX, aCY)); - aX = aGlPoint.x(); - anY = aGlPoint.y(); - } - } - anEditor->setCursorPosition(aX, anY); - anEditor->showPopupEditor(false); - } - } - } - } - } - } + if (aFOperation && PartSet_SketcherMgr::isDistanceOperation(aFOperation)) + aCanCommitOperation = setDistanceValueByPreselection(anOperation, myModule->workshop()); + + if (aCanCommitOperation) + isOperationStopped = anOperation->commit(); + else { + anOperation->abort(); + isOperationStopped = true; } - anOperation->commit(); } + return isOperationStopped; } bool PartSet_SketcherMgr::canUndo() const @@ -1370,6 +1316,79 @@ void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr& th myPlaneFilter->setPlane(thePln); } +bool PartSet_SketcherMgr::setDistanceValueByPreselection(ModuleBase_Operation* theOperation, + ModuleBase_IWorkshop* theWorkshop) +{ + bool isValueAccepted = false; + + ModuleBase_OperationFeature* aFOperation = dynamic_cast + (theOperation); + FeaturePtr aFeature = aFOperation->feature(); + // editor is shown only if all attribute references are filled by preseletion + bool anAllRefAttrInitialized = true; + + std::list aRefAttrs = aFeature->data()->attributes( + ModelAPI_AttributeRefAttr::typeId()); + std::list::const_iterator anIt = aRefAttrs.begin(), aLast = aRefAttrs.end(); + for (; anIt != aLast && anAllRefAttrInitialized; anIt++) { + anAllRefAttrInitialized = (*anIt)->isInitialized(); + } + if (anAllRefAttrInitialized) { + // Activate dimension value editing on double click + ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel(); + QList aWidgets = aPanel->modelWidgets(); + // Find corresponded widget to activate value editing + foreach (ModuleBase_ModelWidget* aWgt, aWidgets) { + if (aWgt->attributeID() == "ConstraintValue") { + // the featue should be displayed in order to find the AIS text position, + // the place where the editor will be shown + aFeature->setDisplayed(true); + /// the execute is necessary to perform in the feature compute for flyout position + aFeature->execute(); + + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + + PartSet_WidgetEditor* anEditor = dynamic_cast(aWgt); + if (anEditor) { + int aX = 0, anY = 0; + + XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(theWorkshop); + XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + AISObjectPtr anAIS = aDisplayer->getAISObject(aFeature); + Handle(AIS_InteractiveObject) anAISIO; + if (anAIS.get() != NULL) { + anAISIO = anAIS->impl(); + } + if (anAIS.get() != NULL) { + Handle(AIS_InteractiveObject) anAISIO = anAIS->impl(); + + if (!anAISIO.IsNull()) { + Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAISIO); + if (!aDim.IsNull()) { + gp_Pnt aPosition = aDim->GetTextPosition(); + + ModuleBase_IViewer* aViewer = aWorkshop->viewer(); + Handle(V3d_View) aView = aViewer->activeView(); + int aCX, aCY; + aView->Convert(aPosition.X(), aPosition.Y(), aPosition.Z(), aCX, aCY); + + QWidget* aViewPort = aViewer->activeViewPort(); + QPoint aGlPoint = aViewPort->mapToGlobal(QPoint(aCX, aCY)); + aX = aGlPoint.x(); + anY = aGlPoint.y(); + } + } + anEditor->setCursorPosition(aX, anY); + isValueAccepted = anEditor->showPopupEditor(false); + } + } + } + } + } + return isValueAccepted; +} + void PartSet_SketcherMgr::getCurrentSelection(const FeaturePtr& theFeature, const FeaturePtr& theSketch, ModuleBase_IWorkshop* theWorkshop, diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index ef5fb511a..a7118e899 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -149,7 +149,8 @@ public: /// Commit the operation if it is possible. If the operation is dimention constraint, /// it gives widget editor to input dimention value - void operationActivatedByPreselection(); + /// \return true if the operation is stopped after activation + bool operationActivatedByPreselection(); /// Returns True if there are available Undos and the sketch manager allows undo /// \return the boolean result @@ -284,6 +285,12 @@ private: void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent, Point& thePoint); + /// Show distance value editor if it is a distance operation and all attribute references + /// are filled by preseletion + /// \return true if the value is accepted + static bool setDistanceValueByPreselection(ModuleBase_Operation* theOperation, + ModuleBase_IWorkshop* theWorkshop); + typedef QMap, std::set > > FeatureToSelectionMap; diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 3e6c41223..e2b43b619 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -194,11 +194,6 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation) connect(theOperation, SIGNAL(stopped()), SLOT(onOperationStopped())); connect(theOperation, SIGNAL(resumed()), SLOT(onOperationResumed())); - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); - if (aFOperation) - connect(aFOperation, SIGNAL(activatedByPreselection()), - SIGNAL(operationActivatedByPreselection())); bool isStarted = theOperation->start(); if (isStarted) diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index 7a62ddbe3..3b08ba8b9 100755 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -134,9 +134,6 @@ signals: /// Emitted when current operation is aborted void operationAborted(ModuleBase_Operation* theOperation); - /// Signal is emitted after the current operation is filled with existing preselection. - void operationActivatedByPreselection(); - /// Signal is emitted after the key released click. void keyEnterReleased(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index e04181c6c..e5c0578d2 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -439,42 +439,7 @@ bool XGUI_Workshop::isFeatureOfNested(const FeaturePtr& theFeature) void XGUI_Workshop::onOperationStarted(ModuleBase_Operation* theOperation) { setGrantedFeatures(theOperation); - - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (theOperation); - if (!aFOperation) - return; - - if (aFOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel - setPropertyPanel(aFOperation); - // filling the operation values by the current selection - // if the operation can be committed after the controls filling, the method perform should - // be stopped. Otherwise unnecessary presentations can be shown(e.g. operation prs in sketch) - if (!aFOperation->isEditOperation()) { - aFOperation->activateByPreselection(moduleConnector()); - if (operationMgr()->currentOperation() != aFOperation) - return; - } - } - updateCommandStatus(); - - connectToPropertyPanel(true); - myModule->operationStarted(aFOperation); - - // the objects of the current operation should be deactivated - QObjectPtrList anObjects; - FeaturePtr aFeature = aFOperation->feature(); - anObjects.append(aFeature); - std::list aResults = aFeature->results(); - std::list::const_iterator aIt; - for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { - anObjects.append(*aIt); - } - QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end(); - for (; anIt != aLast; anIt++) - deactivateActiveObject(*anIt, false); - if (anObjects.size() > 0) - myDisplayer->updateViewer(); + myModule->operationStarted(theOperation); } //****************************************************** diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 00245d70e..37685b169 100755 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -258,6 +258,15 @@ Q_OBJECT /// \param theUpdateViewer update viewer flag void synchronizeGroupInViewer(const DocumentPtr& theDoc, const std::string& theGroup, bool theUpdateViewer); + /// Update the property panel content by the XML description of the operation and set the panel + /// into the operation + /// \param theOperation an operation + void setPropertyPanel(ModuleBase_Operation* theOperation); + + /// Connects or disconnects to the value changed signal of the property panel widgets + /// \param isToConnect a boolean value whether connect or disconnect + void connectToPropertyPanel(const bool isToConnect); + /// A constant string used for "Move to end" command definition /// It is used for specific processing of Undo/Redo for this command. static QString MOVE_TO_END_COMMAND; @@ -349,15 +358,6 @@ signals: /// \param theOperation an operation void setGrantedFeatures(ModuleBase_Operation* theOperation); - /// Update the property panel content by the XML description of the operation and set the panel - /// into the operation - /// \param theOperation an operation - void setPropertyPanel(ModuleBase_Operation* theOperation); - - /// Connects or disconnects to the value changed signal of the property panel widgets - /// \param isToConnect a boolean value whether connect or disconnect - void connectToPropertyPanel(const bool isToConnect); - //! Find all referenced features. Return direct and indirect lists of referenced object //! \param theList an objects to be checked //! \param aDirectRefFeatures a list of direct reference features