BEAST/BSE - Better Audio System and Sound Engine
0.8.2
|
00001 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __BSE_UNDO_STACK_H__ 00003 #define __BSE_UNDO_STACK_H__ 00004 00005 #include <bse/bseitem.hh> 00006 00007 G_BEGIN_DECLS 00008 00009 00010 #define BSE_UNDO_STACK_VOID(ustack) ((ustack)->max_steps == 0) 00011 00012 00013 /* --- BseUndoStack structs --- */ 00014 typedef struct { 00015 SfiTime stamp; 00016 gchar *name; 00017 SfiRing *undo_steps; 00018 } BseUndoGroup; 00019 typedef void (*BseUndoNotify) (BseProject *project, 00020 BseUndoStack *ustack, 00021 gboolean step_added); 00022 struct _BseUndoStack 00023 { 00024 BseProject *project; 00025 BseUndoNotify notify; 00026 guint n_open_groups; 00027 BseUndoGroup *group; 00028 GSList *debug_names; 00029 guint max_steps; 00030 guint ignore_steps; 00031 guint n_undo_groups; 00032 SfiRing *undo_groups; 00033 gint dirt_counter; /* signed! */ 00034 guint n_merge_requests; 00035 gchar *merge_name; 00036 guint merge_next : 1; 00037 }; 00038 typedef void (*BseUndoFunc) (BseUndoStep *ustep, 00039 BseUndoStack *ustack); 00040 typedef void (*BseUndoFree) (BseUndoStep *ustep); 00041 struct _BseUndoStep 00042 { 00043 BseUndoFunc undo_func; 00044 BseUndoFree free_func; 00045 gchar *debug_name; 00046 union { 00047 gpointer v_pointer; 00048 glong v_long; 00049 gulong v_ulong; 00050 } data[1]; /* flexible array */ 00051 }; 00052 00053 00054 /* --- prototypes --- */ 00055 BseUndoStack* bse_undo_stack_dummy (void); 00056 BseUndoStack* bse_undo_stack_new (BseProject *project, 00057 BseUndoNotify notify); 00058 void bse_undo_stack_limit (BseUndoStack *self, 00059 guint max_steps); 00060 void bse_undo_group_open (BseUndoStack *self, 00061 const gchar *name); 00062 void bse_undo_stack_ignore_steps (BseUndoStack *self); 00063 void bse_undo_stack_push (BseUndoStack *self, 00064 BseUndoStep *ustep); 00065 void bse_undo_stack_push_add_on (BseUndoStack *self, 00066 BseUndoStep *ustep); 00067 void bse_undo_stack_unignore_steps (BseUndoStack *self); 00068 void bse_undo_group_close (BseUndoStack *self); 00069 void bse_undo_stack_add_merger (BseUndoStack *self, 00070 const gchar *name); 00071 void bse_undo_stack_remove_merger (BseUndoStack *self); 00072 void bse_undo_stack_clear (BseUndoStack *self); 00073 gboolean bse_undo_stack_dirty (BseUndoStack *self); 00074 void bse_undo_stack_clean_dirty (BseUndoStack *self); 00075 void bse_undo_stack_force_dirty (BseUndoStack *self); 00076 void bse_undo_stack_destroy (BseUndoStack *self); 00077 guint bse_undo_stack_depth (BseUndoStack *self); 00078 void bse_undo_stack_undo (BseUndoStack *self); 00079 const gchar* bse_undo_stack_peek (BseUndoStack *self); 00080 BseUndoStep* bse_undo_step_new (BseUndoFunc undo_func, 00081 BseUndoFree undo_free, 00082 guint n_data_fields); 00083 void bse_undo_step_exec (BseUndoStep *ustep, 00084 BseUndoStack *ustack); 00085 void bse_undo_step_free (BseUndoStep *ustep); 00086 gchar* bse_undo_pointer_pack (gpointer item, 00087 BseUndoStack *ustack); 00088 gpointer bse_undo_pointer_unpack (const gchar *packed_pointer, 00089 BseUndoStack *ustack); 00090 00091 const BseUndoStep* bse_undo_group_peek_last_atom (BseUndoStack *self, 00092 SfiTime *stamp_p); 00093 00094 G_END_DECLS 00095 00096 #endif /* __BSE_UNDO_STACK_H__ */