[Pythoncad-developer] undo and versioning
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
From: Matteo B. <mat...@bo...> - 2010-03-03 09:02:08
|
Hi Gertwin, Actually for storing the undo history I use this system: Each time I create a new entity I add a record at the pycadundo table, (Just one for bulk operation as we have discuss for improve performance), and I write the pycad_undo_id value in the entity table too. Each time I make an undo redo I write in this table a new record.. so I can easily go up and down in the undo history. at the some time I set pycad_undo_visible in the entity table to 0 or 1 Use case for entity operation : New entity: Create a new record in undo table Create a new record in entity table + pycad_undo_visible=1 + add undo index Update an existing entity: Create a new record in undo table Mark the Updatete row in the entity Table with pycad_undo_visible=0 Create a new record in the entity table + pycad_undo_visible=1 + add undo index this two row in the entity table have the some pycad_entity_id Delete Entity: Create a new record in undo table Mark the Deleted row in the entity Table with pycad_undo_visible=0 Use case for Undo: Create a new record in undo table putting in the pycad_incremental_id the right id (I have a global class variable to store this information) make it -1 Set in the pycad_ent_table the pycad_undo_visible=0 for all the entity that have the pycad_incremental_id that match before make -1 Use case for Redo: Similar to Undo but put pycad_undo_visible=1 to the entity that need it Stop redo at the end of undo :-) Use case for Clear undo History: Delete all the record from entity table with pycad_undo_visible=0 set all undo id to -1 (it means no undo id) delete all record from undo table. This is what I'm trying to do with the undo operation... Now I have to finish to develop this system and introduce the version feature on it. In case of version we can provide this basic operation: NewEntity: pycad_entity_state="Working" Modifies an entity: pycad_entity_state="Working" Release: pycad_entity_state in the pycadEnt table ="Released" all the previous record with some pycad_entity_id with pycad_entity_state="Working" will be deleted may be we need to add a new column with the revision index all the undo operation related to the deleted record will be deleted too (so no undo operation can be performed after an release may be undo clear history can be used ...). Have you any suggestions or comment ? It's what you have in mind too ? I wold like to get a list of command and operation that the kernel have to perform to do such a feature... Thank in advance.. Regards, Matteo |