aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
activateModule();
if (myMainWindow) {
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
const Model_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const Model_ObjectUpdatedMessage*>(theMessage);
onFeatureCreatedMsg(aUpdMsg);
+ return;
}
// Redisplay feature
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
const Model_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const Model_ObjectUpdatedMessage*>(theMessage);
onFeatureRedisplayMsg(aUpdMsg);
+ return;
}
//Update property panel on corresponding message. If there is no current operation (no
const Model_ObjectUpdatedMessage* anUpdateMsg =
dynamic_cast<const Model_ObjectUpdatedMessage*>(theMessage);
onFeatureUpdatedMsg(anUpdateMsg);
+ return;
+ }
+
+ if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
+ const Model_ObjectDeletedMessage* aDelMsg =
+ dynamic_cast<const Model_ObjectDeletedMessage*>(theMessage);
+ onObjectDeletedMsg(aDelMsg);
+ return;
}
//An operation passed by message. Start it, process and commit.
std::set<ObjectPtr>::const_iterator aIt;
bool isDisplayed = false;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(*aIt);
+ ObjectPtr aObj = (*aIt);
+ ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
if (aRes) {
isDisplayed = myDisplayer->redisplay(aRes, false);
}
QTimer::singleShot(50, this, SLOT(activateLastPart()));
}
}
+
+//******************************************************
+void XGUI_Workshop::onObjectDeletedMsg(const Model_ObjectDeletedMessage* theMsg)
+{
+ //std::set<ObjectPtr> aFeatures = theMsg->objects();
+}
//******************************************************
void XGUI_Workshop::onOperationStarted()
tr("Seleted features will be deleted. Continue?"),
QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
// ToDo: definbe deleting method
- /* if (aRes == QMessageBox::Yes) {
+ if (aRes == QMessageBox::Yes) {
PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
aMgr->rootDocument()->startOperation();
foreach (ObjectPtr aObj, theList) {
if (aDoc == aMgr->currentDocument()) {
aDoc->close();
}
- aMgr->rootDocument()->removeFeature(aPart->owner());
+ //aMgr->rootDocument()->removeFeature(aPart->owner());
} else {
- aObj->document()->removeFeature(aObj);
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (aFeature)
+ aObj->document()->removeFeature(aFeature);
}
}
myDisplayer->updateViewer();
aMgr->rootDocument()->finishOperation();
- }*/
+ }
}
//**************************************************************