-void Model_Data::blockSendAttributeUpdated(const bool theBlock)
-{
- mySendAttributeUpdated = !theBlock;
+bool Model_Data::blockSendAttributeUpdated(const bool theBlock, const bool theSendMessage)
+{
+ bool aWasBlocked = !mySendAttributeUpdated;
+ if (mySendAttributeUpdated == theBlock) {
+ mySendAttributeUpdated = !theBlock;
+ if (mySendAttributeUpdated && !myWasChangedButBlocked.empty()) {
+ // so, now it is ok to send the update signal
+ if (theSendMessage) {
+ // make a copy to avoid iteration on modified list
+ // (may be cleared by attribute changed call)
+ std::list<ModelAPI_Attribute*> aWasChangedButBlocked = myWasChangedButBlocked;
+ myWasChangedButBlocked.clear();
+ std::list<ModelAPI_Attribute*>::iterator aChangedIter = aWasChangedButBlocked.begin();
+ for(; aChangedIter != aWasChangedButBlocked.end(); aChangedIter++) {
+ myObject->attributeChanged((*aChangedIter)->id());
+ }
+ static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
+ } else {
+ myWasChangedButBlocked.clear();
+ }
+ }
+ }
+ return aWasBlocked;