QOF
0.7.5
|
Files | |
file | qofundo.h |
QOF undo handling. | |
Macros | |
#define | QOF_MOD_UNDO "qof-undo" |
Functions | |
void | qof_undo_set_param (QofEntity *ent, const QofParam *param, gchar *value) |
Set a value in this parameter of the entity. More... | |
void | qof_undo_modify (QofInstance *inst, const QofParam *param) |
void | qof_undo_commit (QofInstance *inst, const QofParam *param) |
void | qof_undo_create (QofInstance *inst) |
void | qof_undo_delete (QofInstance *inst) |
void | qof_book_clear_undo (QofBook *book) |
Free the entire undo list for this book. More... | |
void | qof_book_undo (QofBook *book) |
Set parameter values from before the previous event. | |
void | qof_book_redo (QofBook *book) |
Set parameter values from after the previous event. | |
gboolean | qof_book_can_undo (QofBook *book) |
event handler for undo widget More... | |
gboolean | qof_book_can_redo (QofBook *book) |
event handler for redo widget More... | |
void | qof_book_start_operation (QofBook *book, gchar *label) |
Start recording operation. More... | |
void | qof_book_end_operation (QofBook *book) |
End recording the current operation. | |
QofTime * | qof_book_undo_first_modified (QofBook *book) |
HIG compliance aid to report time of first change. | |
gint | qof_book_undo_count (QofBook *book) |
Number of undo operations available. | |
QOF Undo operates within a QofBook. In order to undo the changes to the entity, the initial state of each parameter is cached when an operation begins. If the entity changes are not successful, the lack of a qof_book_end_operation call before a qof_book_start_operation will cause the cached data to be freed. If the entity is changed successfully, qof_book_end_operation will create the undo data using the operation label and each of the entity changes that were successful.
Within each operation, entity changes can be recorded using QofEventHandler or individually.
Before deleting an entity, qof_undo_delete. (QOF_EVENT_DESTROY)
Undo data consists of a list of operations that have changed data in this book and a list of entity changes for each of those operations. Each operation can relate to more than one entity change and cover more than one entity but must only relate to one book.
gboolean qof_book_can_redo | ( | QofBook * | book | ) |
event handler for redo widget
gboolean qof_book_can_undo | ( | QofBook * | book | ) |
event handler for undo widget
void qof_book_clear_undo | ( | QofBook * | book | ) |
void qof_book_start_operation | ( | QofBook * | book, |
gchar * | label | ||
) |
void qof_undo_commit | ( | QofInstance * | inst, |
const QofParam * | param | ||
) |
void qof_undo_create | ( | QofInstance * | inst | ) |
prepare undo data for a new instance.
Record the creation of a new (empty) instance so that undo can delete it (and recreate it on redo).
Can be used within a QofEventHandler in response to QOF_EVENT_CREATE.
Definition at line 486 of file qofundo.c.
void qof_undo_delete | ( | QofInstance * | inst | ) |
prepare undo data for an instance to be deleted.
Prepare for the deletion of an entity by storing ALL data in all editable parameters so that this delete operation can be undone.
Can be used within a QofEventHandler in response to QOF_EVENT_DESTROY, before the instance itself is deleted.
Definition at line 523 of file qofundo.c.
void qof_undo_modify | ( | QofInstance * | inst, |
const QofParam * | param | ||
) |
Set a value in this parameter of the entity.
Setting an arbitrary parameter in an entity can involve repetitive string comparisons and setter function prototypes. This function accepts a QofParam (which determines the type of value) and a string representing the value. e.g. for a boolean, pass "TRUE", for a GUID pass the result of guid_to_string_buff.
Sets the undo data for this modification at the same time, calling qof_undo_modify, sets the parameter and qof_undo_commit.
ent | An initialised QofEntity from an accessible QofBook. |
param | from qof_class_get_parameter |
value | A string representation of the required value - original type as specified in param->param_type. |
Definition at line 207 of file qofundo.c.