As mentioned before, every page has its own undo history; additionally, there
is a special page
tlo_universe for storing undo history items of
actions performed on
objs. Every undo history item corresponds to one
top-level transaction, the nested transactions are included in it.
Creating an undo history item for one page does in no way affect the undo histories
of other pages; the undo histories are independent.
One undo item has two levels – the outer one for the GUI and the inner one for the kernel. The GUI level contains the name of the item and a list of elementary kernel operations, such as object link, anchor rehang or a property change. When undo is called, a whole GUI undo action is undone.
To manipulate the undo histories, these functions can be used:
trans_undo(struct obj_tlo* tlo, char *error_string); trans_redo(struct obj_tlo* tlo, char *error_string); trans_clear_undo(struct obj_tlo* tlo); // clear the whole undo history trans_clear_one_redo(struct obj_tlo* tlo); trans_clear_all_redo(struct obj_tlo* tlo); trans_merge_undo(struct obj_tlo *tlo, struct undo_gui *first, string name); trans_rename_undo(struct obj_tlo *tlo, struct undo_gui *ug, string name);
They must not be called when a transaction is active (for obvious reasons). The following functions enable the GUI to navigate through the undo histories:
trans_get_first_gui(struct obj_tlo* t); trans_get_next_gui(struct obj_tlo* t, struct undo_gui *ug); trans_get_last_gui(struct obj_tlo* t); trans_get_prev_gui(struct obj_tlo* t, struct undo_gui *ug);