App: transaction related API changes
Introduce a new concept of transaction ID. Each transaction must be unique inside the document. Multiple transactions from different documents can be grouped together with the same transaction ID. This makes it possible to undo/redo single operation that contains changes from multiple documents due to external linking. Application: * get/set/closeActiveTransaction() is used to setup potential transactions with a given name. The transaction is only created when there is actual changes. If objects from multiple documents are changed under the same active transaction, they will have the same trasnaction ID, and can be undo/redo togtether later. * signalUndo/signalRedo, new signals triggered once after an undo/redo operation. Unlike signalUndo/RedoDocument, these signals will only be triggered once even if there may be multiple documents involved during undo/redo. * signal(Before)CloseTransaction, new signals triggered before/after an actual transaction is created or aborted. AutoTransaction: * Helper class to enable automatic management of transactions. See class document for more details. This class will be used by Gui::Command in later patches to allow better automation of transactions in command. Document: * open/commit/abortTransaction() are now redirected to call Application::get/set/closeActiveTransaction() instead. * _openTransaction() is added to do the real creation of transaction. * _checkTransaction() is modified to create transaction on actual change of any property. * getTransactionID() is used to find out the position of a transaction with a given ID. When triggering undo in external document, it may be necessary to perform multi-step undo/redo in order to match for the transaction ID. Transaction/TransactionObject: * Various changes for the new transaction ID concept. * Support undo/redo add/remove dynamic property
This commit is contained in:
@@ -50,7 +50,14 @@
|
||||
</Methode>
|
||||
<Methode Name="openTransaction">
|
||||
<Documentation>
|
||||
<UserDocu>Open a new Undo/Redo transaction.</UserDocu>
|
||||
<UserDocu>openTransaction(name) - Open a new Undo/Redo transaction.
|
||||
|
||||
This function no long creates a new transaction, but calls
|
||||
FreeCAD.setActiveTransaction(name) instead, which will auto creates a
|
||||
transaction with the given name when any change happed in any opened document.
|
||||
If more than one document is changed, all newly created transactions will have
|
||||
the same internal ID and will be undo/redo together.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="abortTransaction">
|
||||
@@ -232,6 +239,18 @@ Both parameters are optional.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="RecomputesFrozen" Type="Boolean"/>
|
||||
</Attribute>
|
||||
<Attribute Name="HasPendingTransaction" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Check if there is a pending transaction</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="HasPendingTransaction" Type="Boolean"/>
|
||||
</Attribute>
|
||||
<Attribute Name="Transacting" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Indicate whether the document is undoing/redoing</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Transacting" Type="Boolean" />
|
||||
</Attribute>
|
||||
<CustomAttributes />
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
Reference in New Issue
Block a user