subDoc(*aSubIter)->abortOperation();
}
-bool Model_Document::isOperation()
+bool Model_Document::isOperation() const
{
// operation is opened for all documents: no need to check subs
return myDoc->HasOpenCommand() == Standard_True ;
std::list<std::string> Model_Document::undoList() const
{
std::list<std::string> aResult;
+ // the number of skipped current operations (on undo they will be aborted)
+ int aSkipCurrent = isOperation() ? 1 : 0;
std::list<Transaction>::const_reverse_iterator aTrIter = myTransactions.crbegin();
int aNumUndo = myTransactions.size();
if (!myNestedNum.empty())
aNumUndo = *myNestedNum.rbegin();
for( ; aNumUndo > 0; aTrIter++, aNumUndo--) {
- aResult.push_back(aTrIter->myId);
+ if (aSkipCurrent == 0) aResult.push_back(aTrIter->myId);
+ else aSkipCurrent--;
}
return aResult;
}
//! Aborts the operation
MODEL_EXPORT virtual void abortOperation();
//! Returns true if operation has been started, but not yet finished or aborted
- MODEL_EXPORT virtual bool isOperation();
+ MODEL_EXPORT virtual bool isOperation() const;
//! Returns true if document was modified (since creation/opening)
MODEL_EXPORT virtual bool isModified();
};
/// Message that document (Part, PartSet) was created
-class MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage : public Events_Message
+class ModelAPI_DocumentCreatedMessage : public Events_Message
{
DocumentPtr myDocument;
public:
/// Creates an empty message
- ModelAPI_DocumentCreatedMessage(const Events_ID theID, const void* theSender = 0);
+ MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage(const Events_ID theID, const void* theSender = 0);
/// The virtual destructor
- virtual ~ModelAPI_DocumentCreatedMessage();
+ MODELAPI_EXPORT virtual ~ModelAPI_DocumentCreatedMessage();
- static Events_ID eventId()
+ MODELAPI_EXPORT static Events_ID eventId()
{
static const char * MY_DOCUMENT_CREATED_EVENT_ID("DocumentCreated");
return Events_Loop::eventByName(MY_DOCUMENT_CREATED_EVENT_ID);
}
- DocumentPtr document() const;
- void setDocument(DocumentPtr theDocument);
+ MODELAPI_EXPORT DocumentPtr document() const;
+ MODELAPI_EXPORT void setDocument(DocumentPtr theDocument);
};
#endif