return myObjs->internalFeature(theIndex);
}
+void Model_Document::synchronizeTransactions()
+{
+ Model_Document* aRoot =
+ std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument()).get();
+ if (aRoot == this)
+ return; // don't need to synchronise root with root
+
+ std::shared_ptr<Model_Session> aSession =
+ std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
+ while(myRedos.size() > aRoot->myRedos.size()) { // remove redos in this
+ aSession->setCheckTransactions(false);
+ redo();
+ aSession->setCheckTransactions(true);
+ }
+ /* this case can not be reproduced in any known case for the current moment, so, just comment
+ while(myRedos.size() < aRoot->myRedos.size()) { // add more redos in this
+ undoInternal(false, true);
+ }*/
+}
+
// Feature that is used for selection in the Part document by the external request
class Model_SelectionInPartFeature : public ModelAPI_Feature {
public:
MODEL_EXPORT virtual int numInternalFeatures();
//! Returns the feature by zero-based index: features in the history or not
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex);
+ //! Performs synchronization of transactions with the module document:
+ //! If some document is not active (by undo of activation) but in memory,
+ //! on activation the transactions must be synchronised because all redos performed
+ //! wihtout this participation
+ MODEL_EXPORT virtual void synchronizeTransactions();
+
/// Creates a construction cresults
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
std::shared_ptr<ModelAPI_Document> aDoc = document()->subDocument(data()->name());
myIsInLoad = false;
if (aDoc) {
+ aDoc->synchronizeTransactions();
aDocRef->setValue(aDoc);
}
}
virtual int numInternalFeatures() = 0;
//! Returns the feature by zero-based index: features in the history or not
virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex) = 0;
+ //! Performs synchronization of transactions with the module document:
+ //! If some document is not active (by undo of activation) but in memory,
+ //! on activation the transactions must be synchronised because all redos performed
+ //! wihtout this participation
+ virtual void synchronizeTransactions() = 0;
//! To virtually destroy the fields of successors
std::string aObjType;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
ObjectPtr aObject = (*aIt);
- // We do not show objects which not has to be shown in object browser
+ // We do not show objects which does not need to be shown in object browser
if (!aObject->isInHistory())
continue;