2. onNoMoreWidgets is moved to sketch reentrant manager.
}
}
-void PartSet_Module::onNoMoreWidgets(const std::string& thePreviousAttributeID)
-{
- mySketchReentrantMgr->noMoreWidgets(thePreviousAttributeID);
-}
-
-void PartSet_Module::onVertexSelected()
-{
- mySketchReentrantMgr->vertexSelected();
-}
-
ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
Config_WidgetAPI* theWidgetApi, std::string theParentId)
{
PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, aWorkshop,
theWidgetApi, theParentId);
aPointWgt->setSketch(mySketchMgr->activeSketch());
- connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
+ connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
aWgt = aPointWgt;
} else if (theType == "sketch-2dpoint_flyout_selector") {
PartSet_WidgetPoint2DFlyout* aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop,
theWidgetApi, theParentId);
aPointWgt->setSketch(mySketchMgr->activeSketch());
- connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
+ connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
aWgt = aPointWgt;
} else if (theType == "point2ddistance") {
PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent,
virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;
public slots:
- /// SLOT, that is called by no more widget signal emitted by property panel
- /// Set a specific flag to restart the sketcher operation
- void onNoMoreWidgets(const std::string& thePreviousAttributeID);
-
/// Redefines the parent method in order to customize the next case:
/// If the sketch nested operation is active and the presentation is not visualized in the viewer,
/// the operation should be always aborted.
virtual void registerProperties();
private slots:
- /// Processing of vertex selected
- void onVertexSelected();
-
void onTreeViewDoubleClick(const QModelIndex&);
private:
if (aPropertyPanel) {
connect(aPropertyPanel, SIGNAL(beforeWidgetActivated(ModuleBase_ModelWidget*)),
this, SLOT(onBeforeWidgetActivated(ModuleBase_ModelWidget*)));
+
+ PartSet_SketcherReetntrantMgr* aReentranceMgr = myModule->sketchReentranceMgr();
+ connect(aPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)),
+ aReentranceMgr, SLOT(onNoMoreWidgets(const std::string&)));
+ connect(aPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)),
+ aReentranceMgr, SLOT(onWidgetActivated()));
}
XGUI_ViewerProxy* aViewerProxy = aWorkshop->viewer();
myIsInternalEditOperation = true;
// activate selection filters of the first widget in the viewer
- onInternalActivateFirstWidgetSelection();
+ onWidgetActivated();
// activate the last active widget in the Property Panel
if (!myPreviousAttributeID.empty()) {
SessionPtr aMgr = ModelAPI_Session::get();
if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
aMgr->undo();
+ workshop()->operationMgr()->updateApplyOfOperations();
+ workshop()->updateCommandStatus();
}
}
myIsInternalEditOperation = false;
PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
if (aPoint2DWdg && aPoint2DWdg->canBeActivatedByMove()) {
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
- //if (operationMgr()->isApplyEnabled())
anOperation->commit();
aProcessed = true;
}
if (myIsInternalEditOperation) {
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
- //if (operationMgr()->isApplyEnabled())
- anOperation->commit();
- aProcessed = true;
- // fill the widget by the mouse event point
- PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
- if (aPoint2DWdg) {
- aPoint2DWdg->onMouseRelease(theWnd, theEvent);
+ ModuleBase_ModelWidget* anActiveWidget = anOperation->propertyPanel()->activeWidget();
+ if (!anActiveWidget || !anActiveWidget->isViewerSelector()) {
+ anOperation->commit();
+ aProcessed = true;
+
+ // fill the widget by the mouse event point
+ PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
+ if (aPoint2DWdg) {
+ aPoint2DWdg->onMouseRelease(theWnd, theEvent);
+ }
}
}
}
}
-void PartSet_SketcherReetntrantMgr::noMoreWidgets(const std::string& thePreviousAttributeID)
+void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID)
{
if (!isActiveMgr())
return;
}
}
-void PartSet_SketcherReetntrantMgr::vertexSelected()
+void PartSet_SketcherReetntrantMgr::onVertexSelected()
{
if (!isActiveMgr())
return;
return !isActiveMgr() || myRestartingMode == RM_None;
}
-void PartSet_SketcherReetntrantMgr::onInternalActivateFirstWidgetSelection()
+void PartSet_SketcherReetntrantMgr::onWidgetActivated()
{
if (!isActiveMgr())
return;
/// Activates the operation widgets relatively the internal reentrant flags
void propertyPanelDefined(ModuleBase_Operation* theOperation);
- /// It is called by no more widget signal emitted by property panel
- /// Set a specific flag to restart the sketcher operation
- void noMoreWidgets(const std::string& thePreviousAttributeID);
/// Processing of vertex selected, if the feature is line, save flags to stop reentrant operation
void vertexSelected();
/// Returns false if the reentrant mode of the operation is not empty.
bool canBeCommittedByPreselection();
-public slots:
- void onInternalActivateFirstWidgetSelection();
+private slots:
+ /// SLOT, that is called by a widget activating in the property panel
+ /// If the 'internal' edit operation is started, it activates the first control selection
+ void onWidgetActivated();
+
+ /// SLOT, that is called by no more widget signal emitted by property panel
+ /// Set a specific flag to restart the sketcher operation
+ void onNoMoreWidgets(const std::string& thePreviousAttributeID);
+
+ /// Processing of vertex selected
+ void onVertexSelected();
private:
/// Returns true if the current operation is a sketch or a nested sketch operation
theWidget->activate();
}
myActiveWidget = theWidget;
- if (myActiveWidget) {
- emit widgetActivated(theWidget);
- } else if (!isEditingMode()) {
+ emit widgetActivated(theWidget);
+ if (!myActiveWidget && !isEditingMode()) {
emit noMoreWidgets(aPreviosAttributeID);
- //setFocusOnOkButton();
}
}
QAction* aCancelAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort);
connect(aCancelAct, SIGNAL(triggered()), myOperationMgr, SLOT(onAbortOperation()));
- connect(myPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)),
- myModule, SLOT(onNoMoreWidgets(const std::string&)));
connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)),
myOperationMgr, SLOT(onKeyReleased(QKeyEvent*)));
//connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
// this, SLOT(onValidationStateChanged(bool)));
- connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)),
- myModule, SLOT(onInternalActivateFirstWidgetSelection()));
}
//******************************************************