ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (!aFOperation)
return;
+ // the clear selection is obsolete because during restart of the creation operation
+ // we would like to use selected object, e.g. a line in a parallel constraint
+
// 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<XGUI_ModuleConnector*>(workshop());
+ /*XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
XGUI_Workshop* aWorkshop = aConnector->workshop();
- aWorkshop->selector()->clearSelection();
+ aWorkshop->selector()->clearSelection();*/
/// Restart sketcher operations automatically
FeaturePtr aFeature = aFOperation->feature();
void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation)
{
+ if (myIsInternalEditOperation) {
+ // abort the created feature, which is currently edited
+ SessionPtr aMgr = ModelAPI_Session::get();
+ if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
+ aMgr->undo();
+ }
+ }
+
myIsInternalEditOperation = false;
breakOperationSequence();
}
void PartSet_Module::onOperationActivatedByPreselection()
{
+ if (myRestartingMode != RM_None)
+ return;
+
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
// Set final definitions if they are necessary
if (!(theEvent->buttons() & Qt::LeftButton))
return;
+ if (myModule->isInternalEditOperation()) // it should be processed by mouse release
+ return;
+
// Clear dragging mode
myIsDragging = false;
void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
+ if (myModule->isInternalEditOperation()) {
+ ModuleBase_Operation* anOperation = getCurrentOperation();
+ //if (operationMgr()->isApplyEnabled())
+ anOperation->commit();
+ return;
+ }
+
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
ModuleBase_IViewer* aViewer = aWorkshop->viewer();
if (!aViewer->canDragByMouse())
void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
+ if (myModule->isInternalEditOperation()) {
+ PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(myModule->activeWidget());
+ if (aPoint2DWdg && aPoint2DWdg->canBeActivatedByMove()) {
+ ModuleBase_Operation* anOperation = getCurrentOperation();
+ //if (operationMgr()->isApplyEnabled())
+ anOperation->commit();
+ return;
+ }
+ }
+
if (isNestedCreateOperation(getCurrentOperation()) && !myIsMouseOverViewProcessed) {
myIsMouseOverViewProcessed = true;
// 1. perform the widget mouse move functionality and display the presentation
myLockApplyMgr->activate();
}
+bool PartSet_WidgetPoint2D::canBeActivatedByMove()
+{
+ bool aCanBeActivated = false;
+ if (feature()->getKind() == SketchPlugin_Line::ID() &&
+ attributeID() == SketchPlugin_Line::START_ID())
+ aCanBeActivated = true;
+
+ return aCanBeActivated;
+}
+
void PartSet_WidgetPoint2D::deactivate()
{
ModuleBase_IViewer* aViewer = myWorkshop->viewer();
//bool initFromPrevious(ObjectPtr theObject);
+ /// Defines if the widget can be activated by mouse move.
+ /// By default it returns false
+ virtual bool canBeActivatedByMove();
+
/// The methiod called when widget is deactivated
virtual void deactivate();