| Buzztard Bt-Edit Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | ||||
#include "bt-edit.h" struct BtChangeLog; BtChangeLog * bt_change_log_new (void); gboolean bt_change_log_is_active (BtChangeLog *self); void bt_change_log_add (BtChangeLog *self,BtChangeLogger *owner,gchar *undo_data,gchar *redo_data); void bt_change_log_redo (BtChangeLog *self); void bt_change_log_undo (BtChangeLog *self); void bt_change_log_start_group (BtChangeLog *self); void bt_change_log_end_group (BtChangeLog *self); gboolean bt_change_log_recover (BtChangeLog *self,const gchar *log_name); void bt_change_log_register (BtChangeLog *self,BtChangeLogger *logger);
Tracks edits actions since last save. Provides undo/redo. Supports grouping
of edits into single undo/redo items (see bt_change_log_start_group()).
Edit actions are logged to disk for crash recovery. Groups are logged atomically, when they are closed (to have a recoverable log).
Logs are reset when saving a song. The log is removed when a song is closed.
BtEditApplication checks for left-over logs at startup and uses BtCrashRecoverDialog to offer a list of recoverable songs to the user.
BtChangeLog * bt_change_log_new (void);
Create a new instance on first call and return a reference later on.
Returns : |
the new signleton instance |
gboolean bt_change_log_is_active (BtChangeLog *self);
Checks if the changelog journalling is active. Should be checked before adding entries to avoid logging when e.g. loading a song.
|
the changelog |
Returns : |
TRUE if the log is active |
void bt_change_log_add (BtChangeLog *self,BtChangeLogger *owner,gchar *undo_data,gchar *redo_data);
Add a new change to the change log. Changes are passed as serialized strings.
The change-log takes ownership of undo_data and redo_data.
|
the change log |
|
the owner of the change |
|
how to undo the change |
|
how to redo the change |
void bt_change_log_redo (BtChangeLog *self);
Redo the last action.
|
the change log |
void bt_change_log_undo (BtChangeLog *self);
Undo the last action.
|
the change log |
void bt_change_log_start_group (BtChangeLog *self);
Open a new group. All further bt_change_log_add() calls will add to the
active group. The group needs to be closed using bt_change_log_end_group().
Groups can be nested.
A top-level group is undone or redone with a single bt_change_log_undo() or
bt_change_log_redo() call.
One would start and finish such a group in the first signal handler that triggered the change.
|
the change log |
void bt_change_log_end_group (BtChangeLog *self);
Closed the last group opened with bt_change_log_start_group(). Usually one
a group would be closed in the same local scope where it was opened.
|
the change log |
gboolean bt_change_log_recover (BtChangeLog *self,const gchar *log_name);
Recover the given song.
Return: TRUE for successful recovery.
|
the changelog |
|
the log file to replay |
void bt_change_log_register (BtChangeLog *self,BtChangeLogger *logger);
Register a change-logger for use in change log replay.
|
the change log |
|
a change logger |