{
ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
return !aOperation || !aOperation->hasObject(theObject);
-}
\ No newline at end of file
+}
+
+void ModuleBase_IModule::onOperationResumed(ModuleBase_Operation* theOperation)
+{
+ emit operationResumed(theOperation);
+}
\r
/// Realizes some functionality by an operation start\r
/// \param theOperation a started operation\r
- virtual void operationStarted(ModuleBase_Operation* theOperation) {}\r
+ virtual void onOperationStarted(ModuleBase_Operation* theOperation) {}\r
\r
/// Realizes some functionality by an operation resume\r
+ /// By default it emits operationResumed signal\r
/// \param theOperation a resumed operation\r
- virtual void operationResumed(ModuleBase_Operation* theOperation) {}\r
+ virtual void onOperationResumed(ModuleBase_Operation* theOperation);\r
\r
/// Realizes some functionality by an operation stop\r
- virtual void operationStopped(ModuleBase_Operation* theOperation) {}\r
+ virtual void onOperationStopped(ModuleBase_Operation* theOperation) {}\r
\r
/// Realizes some functionality by an operation commit\r
- virtual void operationCommitted(ModuleBase_Operation* theOperation) {}\r
+ virtual void onOperationCommitted(ModuleBase_Operation* theOperation) {}\r
\r
/// Realizes some functionality by an operation abort\r
- virtual void operationAborted(ModuleBase_Operation* theOperation) {}\r
+ virtual void onOperationAborted(ModuleBase_Operation* theOperation) {}\r
\r
/// Realizes some functionality by an operation start\r
/// \param theOperation a started operation\r
signals:\r
void operationLaunched();\r
\r
+ void operationResumed(ModuleBase_Operation* theOp);\r
+\r
public slots:\r
/// Called on call of command corresponded to a feature\r
virtual void onFeatureTriggered();\r
myCurrentFeature = FeaturePtr();
}
abortOperation();
- emit aborted();
stopOperation();
// is is necessary to deactivate current widgets before the model operation is aborted
new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)));
Events_Loop::loop()->send(aMsg);
+
+ emit aborted();
}
bool ModuleBase_Operation::commit()
myPreSelection = aPreSelected;
}
-//void ModuleBase_Operation::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
-//{
-// //activateByPreselection();
-// //if (theWidget && myPropertyPanel) {
-// // myPropertyPanel->activateNextWidget();
-// //// //emit activateNextWidget(myActiveWidget);
-// //}
-//}
-
-//bool ModuleBase_Operation::setWidgetValue(ObjectPtr theFeature, double theX, double theY)
-//{
-// ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget();
-// if (!aActiveWgt)
-// return false;
-// ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature();
-// aValue->setObject(theFeature);
-// aValue->setPoint(std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
-// bool isApplyed = aActiveWgt->setValue(aValue);
-//
-// delete aValue;
-// myIsModified = (myIsModified || isApplyed);
-// return isApplyed;
-//}
bool ModuleBase_Operation::getViewerPoint(ModuleBase_ViewerPrs thePrs,
ModuleBase_IViewer* theViewer,
Config_Prop::Integer, SKETCH_WIDTH);
}
-void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
+void PartSet_Module::onOperationCommitted(ModuleBase_Operation* theOperation)
{
if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
mySketchMgr->commitNestedSketch(theOperation);
myRestartingMode = RM_None;
}
-void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation)
+void PartSet_Module::onOperationAborted(ModuleBase_Operation* theOperation)
{
breakOperationSequence();
}
ModuleBase_IModule::sendOperation(theOperation);
}
-void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation)
+void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
{
if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
}
}
-void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
+void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
{
if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
mySketchMgr->stopSketch(theOperation);
aPart->activate();
}
}
-}
\ No newline at end of file
+}
/// Realizes some functionality by an operation start
/// Displays all sketcher sub-Objects, hides sketcher result, appends selection filters
/// \param theOperation a started operation
- virtual void operationStarted(ModuleBase_Operation* theOperation);
+ virtual void onOperationStarted(ModuleBase_Operation* theOperation);
/// Realizes some functionality by an operation commit
/// Restarts sketcher operation automatically of it is necessary
/// \param theOperation a committed operation
- virtual void operationCommitted(ModuleBase_Operation* theOperation);
+ virtual void onOperationCommitted(ModuleBase_Operation* theOperation);
/// Realizes some functionality by an operation abort
/// Hides all sketcher sub-Objects, displays sketcher result and removes selection filters
/// \param theOperation an aborted operation
- virtual void operationAborted(ModuleBase_Operation* theOperation);
+ virtual void onOperationAborted(ModuleBase_Operation* theOperation);
/// Realizes some functionality by an operation stop
/// Hides all sketcher sub-Objects, displays sketcher result and removes selection filters
/// \param theOperation a stopped operation
- virtual void operationStopped(ModuleBase_Operation* theOperation);
+ virtual void onOperationStopped(ModuleBase_Operation* theOperation);
/// Returns current operation
virtual ModuleBase_Operation* currentOperation() const;
#include <XGUI_Workshop.h>
#include <XGUI_Displayer.h>
#include <XGUI_SelectionMgr.h>
+#include <XGUI_OperationMgr.h>
#include <GeomAPI_Face.h>
ModuleBase_Operation* anOperation = myModule->createOperation("Sketch");
anOperation->setFeature(aSketch);
myModule->sendOperation(anOperation);
+ //connect(anOperation, SIGNAL(aborted()), aWorkshop->operationMgr(), SLOT(abortAllOperations()));
} else {
// Break current operation
QMessageBox::warning(this, tr("Extrusion Cut"),
if (aCompFeature->numberOfSubs() == 0)
return ModuleBase_ModelWidget::focusTo();
+ CompositeFeaturePtr aSketchFeature =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
+ if (aSketchFeature->numberOfSubs() == 0) {
+ connect(myModule, SIGNAL(operationResumed(ModuleBase_Operation*)), SLOT(onResumed(ModuleBase_Operation*)));
+ }
SessionPtr aMgr = ModelAPI_Session::get();
bool aIsOp = aMgr->isOperation();
// Open transaction if it was closed before
restoreValue();
return false;
-}
\ No newline at end of file
+}
+
+void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp)
+{
+ // Abort operation
+ SessionPtr aMgr = ModelAPI_Session::get();
+ bool aIsOp = aMgr->isOperation();
+ // Close transaction
+ if (aIsOp)
+ aMgr->abortOperation();
+ theOp->abort();
+}
private slots:
void onStarted();
+ void onResumed(ModuleBase_Operation* theOp);
+
private:
PartSet_Module* myModule;
}
updateCommandStatus();
- myModule->operationStarted(theOperation);
+ myModule->onOperationStarted(theOperation);
// the objects of the current operation should be deactivated
QObjectPtrList anObjects;
}
updateCommandStatus();
- myModule->operationResumed(theOperation);
+ myModule->onOperationResumed(theOperation);
}
hidePropertyPanel();
myPropertyPanel->cleanContent();
- myModule->operationStopped(theOperation);
+ myModule->onOperationStopped(theOperation);
// the deactivated objects of the current operation should be activated back.
// They were deactivated on operation start or an object redisplay
void XGUI_Workshop::onOperationCommitted(ModuleBase_Operation* theOperation)
{
- myModule->operationCommitted(theOperation);
+ myModule->onOperationCommitted(theOperation);
}
void XGUI_Workshop::onOperationAborted(ModuleBase_Operation* theOperation)
{
- myModule->operationAborted(theOperation);
+ myModule->onOperationAborted(theOperation);
}
void XGUI_Workshop::setNestedFeatures(ModuleBase_Operation* theOperation)