TDF_LabelMap& scope();
/// Sets the ID of the attribute in Data (called from Data): here it is used for myRef ID setting
- MODELAPI_EXPORT virtual void setID(const std::string theID);
+ MODEL_EXPORT virtual void setID(const std::string theID);
friend class Model_Data;
friend class Model_AttributeSelectionList;
#include <ModelAPI_Validator.h>
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_Session.h>
+#include <ModelAPI_Tools.h>
#include <Events_Loop.h>
#include <Events_LongOp.h>
#include <Events_Error.h>
if (theFeature->data()->execState() != ModelAPI_StateDone)
aMustbeUpdated = true;
+ ModelAPI_ExecState aState = ModelAPI_StateDone;
+
+ // check the parameters: values can be changed
+ std::list<AttributePtr> aDoubles =
+ theFeature->data()->attributes(ModelAPI_AttributeDouble::typeId());
+ std::list<AttributePtr>::iterator aDoubleIter = aDoubles.begin();
+ for(; aDoubleIter != aDoubles.end(); aDoubleIter++) {
+ AttributeDoublePtr aDouble =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(*aDoubleIter);
+ if (aDouble.get() && !aDouble->text().empty()) {
+ double aNewVal;
+ if (ModelAPI_Tools::findVariable(aDouble->text(), aNewVal)) {
+ if (aNewVal != aDouble->value()) {
+ aDouble->setValue(aNewVal);
+ aMustbeUpdated = true;
+ }
+ } else {
+ aState = ModelAPI_StateInvalidArgument;
+ }
+ }
+ }
+
// composite feature must be executed after sub-features execution
CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
aMustbeUpdated = true;
}
}
- ModelAPI_ExecState aState = ModelAPI_StateDone;
// check all references: if referenced objects are updated, this object also must be updated
// also check state of referenced objects: if they are not ready, inherit corresponding state
std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
}
if (isUseTransaction) {
aMgr->finishOperation();
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ aWorkshop->updateCommandStatus();
}
+
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
myModule->sketchMgr()->restoreSelection();
}
aOperation->abort();
return;
}
+ // Init flyout point for radius rotation
+ FeaturePtr aFeature = myCurrentSelection.begin().key();
if (isSketcher) {
myIsDragging = true;
get2dPoint(theWnd, theEvent, myCurrentPoint);
myDragDone = false;
launchEditing();
- // Init flyout point for radius rotation
- FeaturePtr aFeature = myCurrentSelection.begin().key();
- std::shared_ptr<SketchPlugin_Feature> aSPFeature =
- std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+ if (aFeature.get() != NULL) {
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSPFeature.get() && aSPFeature->getKind() == SketchPlugin_ConstraintRadius::ID()) {
- DataPtr aData = aSPFeature->data();
- AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
- std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
- aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY);
+ DataPtr aData = aSPFeature->data();
+ AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
+ std::shared_ptr<GeomDataAPI_Point2D> aFPAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
+ aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY);
+ }
}
-
} else if (isSketchOpe && isEditing) {
// If selected another object commit current result
aOperation->commit();
return 0;
}
+QAction* XGUI_ContextMenuMgr::actionByName(const QString& theName) const
+{
+ foreach(QAction* eachAction, myActions) {
+ if (eachAction->text() == theName) {
+ return eachAction;
+ }
+ }
+ return NULL;
+}
+
QStringList XGUI_ContextMenuMgr::actionIds() const
{
return myActions.keys();
/// \param theId an id of an action
QAction* action(const QString& theId) const;
+ QAction* actionByName(const QString& theName) const;
+
/// Returns list of registered actions Ids
QStringList actionIds() const;
//QIntList aModes;
//myDisplayer->activateObjects(aModes);
myModule->operationStopped(theOperation);
+
+ if (myOperationMgr->operationsCount() == 0) {
+ // Activate selection mode for all objects
+ QIntList aModes;
+ myDisplayer->activateObjects(aModes);
+ }
}
{
ModuleBase_IModule* aModule = module();
// 1. allow the module to delete objects, do nothing if it has succeed
- if (aModule->deleteObjects())
+ if (aModule->deleteObjects()) {
+ updateCommandStatus();
return;
+ }
if (!isActiveOperationAborted())
return;
if (isEditing) {
anId.chop(ModuleBase_Operation::EditSuffix().size());
}
- ActionInfo anInfo = myActionsMgr->actionInfoById(anId);
+ ActionInfo anInfo;
+ QAction* aContextMenuAct = myContextMenuMgr->actionByName(anId);
+ if (aContextMenuAct) {
+ anInfo.initFrom(aContextMenuAct);
+ } else {
+ anInfo = myActionsMgr->actionInfoById(anId);
+ }
if (isEditing) {
anInfo.text = anInfo.text.prepend("Modify ");
}