PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
: ModuleBase_IModule(theWshop),
- myIsDragging(false), myRestartingMode(true), myDragDone(false)
+ myIsDragging(false), myRestartingMode(LastFeatureUse), myDragDone(false)
{
//myWorkshop = dynamic_cast<XGUI_Workshop*>(theWshop);
ModuleBase_IViewer* aViewer = aViewer = theWshop->viewer();
connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
this, SLOT(onMouseMoved(ModuleBase_IViewWindow*, QMouseEvent*)));
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+
+ XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
+ connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased()));
}
PartSet_Module::~PartSet_Module()
FeaturePtr aFeature = theOperation->feature();
std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- if (aSPFeature && myRestartingMode) {
+ if (aSPFeature && (myRestartingMode != None)) {
myLastOperationId = theOperation->id();
- myLastFeature = theOperation->feature();
+ myLastFeature = myRestartingMode == LastFeatureUse ? theOperation->feature() : FeaturePtr();
launchOperation(myLastOperationId);
} else {
breakOperationSequence();
{
myLastOperationId = "";
myLastFeature = FeaturePtr();
- myRestartingMode = false;
+ myRestartingMode = None;
}
void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
{
- myRestartingMode = true;
+ myRestartingMode = LastFeatureUse;
if (theOperation->id().toStdString() == SketchPlugin_Sketch::ID()) {
// Display all sketcher sub-Objects
myCurrentSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theOperation->feature());
}
}
+void PartSet_Module::onEnterReleased()
+{
+ myRestartingMode = LastFeatureEmpty;
+}
QStringList PartSet_Module::sketchOperationIdList() const
{
{
Q_OBJECT
- public:
+/// Enumeration to specify the restart operation properties.
+enum RestartingMode {
+ None, /// the operation should not be restarted
+ LastFeatureUse, /// the operation is restarted and use the previous feature for own initialization
+ LastFeatureEmpty /// the operation is restarted and does not use the previous feature
+};
+
+public:
PartSet_Module(ModuleBase_IWorkshop* theWshop);
virtual ~PartSet_Module();
/// \param theEvent the mouse event
virtual void onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
+ /// SLOT, that is called by enter key released
+ /// Set a specific type of restarting the current operation
+ void onEnterReleased();
+
/// Launches the operation from current highlighting
void launchEditing();
bool myDragDone;
// Automatical restarting mode flag
- bool myRestartingMode;
+ RestartingMode myRestartingMode;
double myCurX, myCurY;
CompositeFeaturePtr myCurrentSketch;