{
if (myIsDisabled != theFlag) {
myIsDisabled = theFlag;
+ data()->setIsDeleted(theFlag); // store it in data model (t oget back on undo/redo, etc)
// this must be before "updated" message send to have history updated for OB update
document()->updateHistory(groupName()); // to update the history cash data in the document
// generate related events
return false;
}
-bool ModelAPI_Result::isDisabled() const
+bool ModelAPI_Result::isDisabled()
{
+ if (myIsDisabled != data()->isDeleted())
+ setDisabled(std::dynamic_pointer_cast<ModelAPI_Result>(
+ data()->owner()), data()->isDeleted()); // restore from the data model the correct value
return myIsDisabled;
}
+bool ModelAPI_Result::isConcealed()
+{
+ return myIsConcealed;
+}
+
void ModelAPI_Result::setIsConcealed(const bool theValue)
{
if (myIsConcealed != theValue) {
myIsConcealed = theValue;
- if (document().get()) // can be on creation of result
+ if (document().get()) { // can be on creation of result
document()->updateHistory(groupName()); // to update the history cash data in the document
+ if (myIsConcealed) {
+ ModelAPI_EventCreator::get()->sendDeleted(document(), groupName());
+ static Events_ID kDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), kDispEvent);
+ } else {
+ static Events_ID kEventCreated = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
+ ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), kEventCreated);
+ }
+ }
}
}
static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
aECreator->sendUpdated(data()->attribute(theID)->owner(), EVENT_DISP);
}
+
+void ModelAPI_Result::init()
+{
+ myIsDisabled = true; // by default it is not initialized and false to be after created
+ myIsConcealed = false;
+}