1 /* 2 * Sweep, a sound wave editor. 3 * 4 * Copyright (C) 2000 Conrad Parker 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 */ 20 21 #ifndef __SWEEP_UNDO_H__ 22 #define __SWEEP_UNDO_H__ 23 24 #include "sweep_types.h" 25 26 gint 27 update_edit_progress (gpointer data); 28 29 sw_op_instance * 30 sw_op_instance_new (sw_sample * sample, char * description, 31 sw_operation * operation); 32 33 void 34 schedule_operation (sw_sample * sample, char * description, 35 sw_operation * operation, void * do_data); 36 37 void 38 register_operation (sw_sample * s, sw_op_instance * inst); 39 40 void 41 trim_registered_ops (sw_sample * s, int length); 42 43 void 44 undo_current (sw_sample * s); 45 46 void 47 redo_current (sw_sample * s); 48 49 void 50 revert_op (sw_sample * sample, GList * op_gl); 51 52 void 53 set_active_op (sw_sample * s, sw_op_instance * inst); 54 55 void 56 cancel_active_op (sw_sample * s); 57 58 /* Stock undo functions */ 59 60 #if 0 61 typedef struct _replace_data replace_data; 62 63 struct _replace_data { 64 sw_sample * old_sample; 65 sw_sample * new_sample; 66 }; 67 68 replace_data * 69 replace_data_new (sw_sample * old_sample, sw_sample * new_sample); 70 71 void 72 undo_by_replace (replace_data * r); 73 74 void 75 redo_by_replace (replace_data * r); 76 #endif 77 78 typedef struct _sounddata_replace_data sounddata_replace_data; 79 80 struct _sounddata_replace_data { 81 sw_sample * sample; 82 sw_sounddata * old_sounddata; 83 sw_sounddata * new_sounddata; 84 }; 85 86 sounddata_replace_data * 87 sounddata_replace_data_new (sw_sample * sample, 88 sw_sounddata * old_sounddata, 89 sw_sounddata * new_sounddata); 90 91 void 92 sounddata_replace_data_destroy (sounddata_replace_data * sr); 93 94 void 95 undo_by_sounddata_replace (sw_sample * s, sounddata_replace_data * sr); 96 97 void 98 redo_by_sounddata_replace (sw_sample * s, sounddata_replace_data * sr); 99 100 101 typedef struct _paste_over_data paste_over_data; 102 103 struct _paste_over_data { 104 sw_sample * sample; 105 sw_edit_buffer * old_eb; 106 sw_edit_buffer * new_eb; 107 }; 108 109 paste_over_data * 110 paste_over_data_new (sw_edit_buffer * old_eb, sw_edit_buffer * new_eb); 111 112 void 113 paste_over_data_destroy (paste_over_data * p); 114 115 void 116 undo_by_paste_over (sw_sample * s, paste_over_data * p); 117 118 void 119 redo_by_paste_over (sw_sample * s, paste_over_data * p); 120 121 122 typedef struct _splice_data splice_data; 123 124 struct _splice_data { 125 sw_sample * sample; 126 sw_edit_buffer * eb; 127 GList * sels; /* Previous sels of sounddata */ 128 }; 129 130 splice_data * 131 splice_data_new (sw_edit_buffer * eb, GList * sels); 132 133 void 134 splice_data_destroy (splice_data * s); 135 136 void 137 undo_by_splice_in (sw_sample * s, splice_data * sp); 138 139 void 140 redo_by_splice_out (sw_sample * s, splice_data * sp); 141 142 void 143 undo_by_splice_out (sw_sample * s, splice_data * sp); 144 145 void 146 redo_by_splice_in (sw_sample * s, splice_data * sp); 147 148 void 149 undo_by_splice_over (sw_sample * s, splice_data * sp); 150 151 void 152 redo_by_splice_over (sw_sample * s, splice_data * sp); 153 154 void 155 undo_by_crop_in (sw_sample * s, splice_data * sp); 156 157 void 158 redo_by_crop_out (sw_sample * s, splice_data * sp); 159 160 #endif /* __SWEEP_UNDO_H__ */ 161