make kfrm operator= illegal, use copy_from instead
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / tracks.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
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
22 #ifndef TRACKS_H
23 #define TRACKS_H
24
25 #include <stdio.h>
26 #include <stdint.h>
27
28 #include "autoconf.h"
29 #include "edl.inc"
30 #include "file.inc"
31 #include "filexml.inc"
32 #include "linklist.h"
33 #include "pluginserver.inc"
34 #include "threadindexer.inc"
35 #include "track.h"
36 #include "trackcanvas.inc"
37 #include "transition.inc"
38
39
40
41 class Tracks : public List<Track>
42 {
43 public:
44         Tracks();
45         Tracks(EDL *edl);
46         virtual ~Tracks();
47
48         Tracks& operator=(Tracks &tracks);
49         int load(FileXML *xml,
50                 int &track_offset,
51                 uint32_t load_flags);
52         void move_edits(ArrayList<Edit*> *edits,
53                 Track *track,
54                 double position,
55                 int edit_labels,
56                 int edit_plugins,
57                 int edit_autos,
58                 int behaviour);
59         void move_effect(Plugin *plugin,
60                 Track *track,
61                 int64_t position);
62         void move_effect(Plugin *plugin,
63                 PluginSet *plugin_set,
64                 int64_t position);
65
66 // Construct a list of all the recordable edits which start on position
67         void get_affected_edits(ArrayList<Edit*> *drag_edits,
68                 double position,
69                 Track *start_track);
70
71         void get_automation_extents(float *min,
72                 float *max,
73                 double start,
74                 double end,
75                 int autogrouptype);
76
77         void equivalent_output(Tracks *tracks, double *result);
78
79         int move_track_up(Track *track);        // move recordable tracks up
80         int move_track_down(Track *track);      // move recordable tracks down
81         int move_tracks_up();                   // move recordable tracks up
82         int move_tracks_down();                 // move recordable tracks down
83         void paste_audio_transition(PluginServer *server);
84         void paste_video_transition(PluginServer *server, int first_track = 0);
85
86 // Only tests effects
87         int plugin_exists(Plugin *plugin);
88         int track_exists(Track *track);
89
90         void paste_transition(PluginServer *server, Edit *dest_edit);
91 // Return the numbers of tracks with the play patch enabled
92         int playable_audio_tracks();
93         int playable_video_tracks();
94 // Return number of tracks with the record patch enabled
95         int recordable_audio_tracks();
96         int recordable_video_tracks();
97         int total_audio_tracks();
98         int total_video_tracks();
99 // return the longest track in all the tracks in seconds
100         double total_length();
101         double total_audio_length();
102         double total_video_length();
103         double total_length_framealigned(double fps);
104 // Update y pixels after a zoom
105         void update_y_pixels(Theme *theme);
106 // Total number of tracks where the following toggles are selected
107         void select_all(int type,
108                 int value);
109         void translate_projector(float offset_x, float offset_y);
110                 int total_of(int type);
111 // add a track
112         Track* add_audio_track(int above, Track *dst_track);
113         Track* add_video_track(int above, Track *dst_track);
114         Track* add_subttl_track(int above, Track *dst_track);
115 //      Track* add_audio_track(int to_end = 1);
116 //      Track* add_video_track(int to_end = 1);
117 // delete any track
118         int delete_track(Track* track);
119 // detach shared effects referencing module
120         int detach_shared_effects(int module);
121
122         EDL *edl;
123
124
125
126
127
128 // Types for drag toggle behavior
129         enum
130         {
131                 NONE,
132                 PLAY,
133                 RECORD,
134                 GANG,
135                 DRAW,
136                 MUTE,
137                 EXPAND
138         };
139
140
141
142
143
144
145
146
147
148         int change_channels(int oldchannels, int newchannels);
149         int dump(FILE *fp);
150
151
152
153 // Change references to shared modules in all tracks from old to new.
154 // If do_swap is true values of new are replaced with old.
155         void change_modules(int old_location, int new_location, int do_swap);
156 // Append all the tracks to the end of the recordable tracks
157         int concatenate_tracks(int edit_plugins, int edit_autos);
158 // Change references to shared plugins in all tracks
159         void change_plugins(SharedLocation &old_location, SharedLocation &new_location, int do_swap);
160
161         int delete_tracks();     // delete all the recordable tracks
162         int delete_all_tracks();      // delete just the tracks
163
164         void copy_from(Tracks *tracks);
165
166 // ================================== EDL editing
167         int copy(double start,
168                 double end,
169                 int all,
170                 FileXML *file,
171                 const char *output_path = "");
172
173
174
175         int copy_assets(FileXML *xml,
176                 double start,
177                 double end,
178                 int all);
179         int blade(double position);
180         int clear(double start, double end, int clear_plugins, int edit_autos);
181         void clear_automation(double selectionstart,
182                 double selectionend);
183         void set_automation_mode(double selectionstart,
184                 double selectionend,
185                 int mode);
186         int clear_default_keyframe();
187         int clear_handle(double start,
188                 double end,
189                 double &longest_distance,
190                 int clear_labels,
191                 int clear_plugins,
192                 int edit_autos);
193         int copy_automation(double selectionstart,
194                 double selectionend,
195                 FileXML *file,
196                 int default_only,
197                 int autos_only);
198 //      int copy_default_keyframe(FileXML *file);
199         void paste_automation(double selectionstart,
200                 FileXML *xml,
201                 int default_only,
202                 int active_only,
203                 int typeless);
204 //      int paste_default_keyframe(FileXML *file);
205         int paste(int64_t start, int64_t end);
206 // all units are samples by default
207         int paste_output(int64_t startproject,
208                                 int64_t endproject,
209                                 int64_t startsource_sample,
210                                 int64_t endsource_sample,
211                                 int64_t startsource_frame,
212                                 int64_t endsource_frame,
213                                 Asset *asset);
214         int paste_silence(double start,
215                 double end,
216                 int edit_plugins,
217                 int edit_autos);
218         int purge_asset(Asset *asset);
219         int asset_used(Asset *asset);
220 // Transition popup
221         int popup_transition(int cursor_x, int cursor_y);
222         int select_auto(int cursor_x, int cursor_y);
223         int move_auto(int cursor_x, int cursor_y, int shift_down);
224         int modify_edithandles(double &oldposition,
225                 double &newposition,
226                 int currentend,
227                 int handle_mode,
228                 int edit_labels,
229                 int edit_plugins,
230                 int edit_autos);
231         int modify_pluginhandles(double &oldposition,
232                 double &newposition,
233                 int currentend,
234                 int handle_mode,
235                 int edit_labels,
236                 int edit_autos,
237                 Edits *trim_edits);
238         int select_handles();
239         int select_region();
240         int select_edit(int64_t cursor_position, int cursor_x, int cursor_y, int64_t &new_start, int64_t &new_end);
241         int feather_edits(int64_t start, int64_t end, int64_t samples, int audio, int video);
242         int64_t get_feather(int64_t selectionstart, int64_t selectionend, int audio, int video);
243 // Move edit boundaries and automation during a framerate change
244         int scale_time(float rate_scale, int ignore_record, int scale_edits, int scale_autos, int64_t start, int64_t end);
245
246         void clear_transitions(double start, double end);
247         void shuffle_edits(double start, double end);
248         void reverse_edits(double start, double end);
249         void align_edits(double start, double end);
250         void set_edit_length(double start, double end, double length);
251         void set_transition_length(double start, double end, double length);
252         void set_transition_length(Transition *transition, double length);
253         void paste_transitions(double start, double end, int track_type, char* title);
254
255 // ================================== accounting
256
257         int handles, titles;     // show handles or titles
258         int show_output;         // what type of video to draw
259         AutoConf auto_conf;      // which autos are visible
260         int overlays_visible;
261         double total_playable_length();     // Longest track.
262 // Used by equivalent_output
263         int total_playable_vtracks();
264         double total_recordable_length();   // Longest track with recording on
265         int totalpixels();       // height of all tracks in pixels
266         int number_of(Track *track);        // track number of pointer
267         Track* number(int number);      // pointer to track number
268         Track *get(int idx, int data_type);
269
270
271 private:
272 };
273
274 #endif