4 * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
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.
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.
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
31 #include "filexml.inc"
33 #include "pluginserver.inc"
34 #include "threadindexer.inc"
36 #include "trackcanvas.inc"
37 #include "transition.inc"
41 class Tracks : public List<Track>
48 Tracks& operator=(Tracks &tracks);
49 int load(FileXML *xml,
52 void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
53 int edit_labels, int edit_plugins, int edit_autos, int mode);
54 void move_group(EDL *group, Track *first_track, double position, int overwrite);
55 void move_effect(Plugin *plugin, Track *track, int64_t position);
56 void move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position);
58 // Construct a list of all the recordable edits which start on position
59 void clear_selected_edits();
60 void select_affected_edits(double position, Track *start_track, int sense);
61 int clear_hard_edges(double start, double end);
62 void get_selected_edits(ArrayList<Edit*> *drag_edits);
64 int new_group(int id);
65 int set_group_selected(int id, int v);
66 int del_group(int id);
68 void get_automation_extents(float *min,
74 void equivalent_output(Tracks *tracks, double *result);
76 int move_track_up(Track *track); // move recordable tracks up
77 int move_track_down(Track *track); // move recordable tracks down
78 int move_tracks_up(); // move recordable tracks up
79 int move_tracks_down(); // move recordable tracks down
80 void paste_audio_transition(PluginServer *server);
81 void paste_video_transition(PluginServer *server, int first_track = 0);
84 Plugin *plugin_exists(int plugin_id);
85 int track_exists(Track *track);
87 void paste_transition(PluginServer *server, Edit *dest_edit);
88 // Return the numbers of tracks with the play patch enabled
89 int playable_audio_tracks();
90 int playable_video_tracks();
91 // Return number of tracks with the record patch enabled
92 int recordable_audio_tracks();
93 int recordable_video_tracks();
94 int total_audio_tracks();
95 int total_video_tracks();
96 // return the longest track in all the tracks in seconds
97 double total_length();
98 double total_audio_length();
99 double total_video_length();
100 double total_length_framealigned(double fps);
101 // Update y pixels after a zoom
102 void update_y_pixels(Theme *theme);
103 // Total number of tracks where the following toggles are selected
104 void select_all(int type, int value);
106 void translate_fauto_xy(int fauto, float dx, float dy, int all);
107 void translate_projector(float dx, float dy, int all=0);
108 void translate_camera(float dx, float dy, int all=0);
109 void crop_resize(float x, float y, float z);
110 void crop_shrink(float x, float y, float z);
112 int total_of(int type);
113 Track* get_track_by_id(int id);
115 Track* add_audio_track(int above, Track *dst_track);
116 Track* add_video_track(int above, Track *dst_track);
117 Track* add_subttl_track(int above, Track *dst_track);
118 // Track* add_audio_track(int to_end = 1);
119 // Track* add_video_track(int to_end = 1);
121 int delete_track(Track* track);
122 // detach shared effects referencing module
123 int detach_shared_effects(int module);
131 // Types for drag toggle behavior
151 int change_channels(int oldchannels, int newchannels);
156 // Change references to shared modules in all tracks from old to new.
157 // If do_swap is true values of new are replaced with old.
158 void change_modules(int old_location, int new_location, int do_swap);
159 // Append all the tracks to the end of the recordable tracks
160 int concatenate_tracks(int edit_plugins, int edit_autos);
161 // Change references to shared plugins in all tracks
162 void change_plugins(SharedLocation &old_location, SharedLocation &new_location, int do_swap);
164 int delete_tracks(); // delete all the recordable tracks
165 int delete_all_tracks(); // delete just the tracks
167 void copy_from(Tracks *tracks);
169 // ================================== EDL editing
170 int copy(int copy_flags, double start, double end,
171 FileXML *file, const char *output_path = "");
173 int copy_assets(int copy_flags, FileXML *xml, double start, double end);
174 int blade(double position);
175 int clear(double start, double end, int clear_plugins, int edit_autos);
176 void clear_automation(double selectionstart,
177 double selectionend);
178 void set_automation_mode(double selectionstart,
181 int clear_default_keyframe();
182 int clear_handle(double start,
184 double &longest_distance,
188 int copy_automation(double selectionstart,
193 // int copy_default_keyframe(FileXML *file);
194 void paste_automation(double selectionstart,
199 // int paste_default_keyframe(FileXML *file);
200 int paste(int64_t start, int64_t end);
201 // all units are samples by default
202 int paste_output(int64_t startproject,
204 int64_t startsource_sample,
205 int64_t endsource_sample,
206 int64_t startsource_frame,
207 int64_t endsource_frame,
209 int paste_silence(double start,
213 int purge_asset(Asset *asset);
214 int asset_used(Asset *asset);
216 int popup_transition(int cursor_x, int cursor_y);
217 int select_auto(int cursor_x, int cursor_y);
218 int move_auto(int cursor_x, int cursor_y, int shift_down);
219 int modify_edithandles(double &oldposition, double &newposition,
220 int currentend, int handle_mode, int edit_labels,
221 int edit_plugins, int edit_autos, int group_id);
222 int modify_pluginhandles(double &oldposition,
229 int select_handles();
231 int select_edit(int64_t cursor_position, int cursor_x, int cursor_y, int64_t &new_start, int64_t &new_end);
232 int feather_edits(int64_t start, int64_t end, int64_t samples, int audio, int video);
233 int64_t get_feather(int64_t selectionstart, int64_t selectionend, int audio, int video);
234 // Move edit boundaries and automation during a framerate change
235 int scale_time(float rate_scale, int ignore_record, int scale_edits, int scale_autos, int64_t start, int64_t end);
237 void clear_transitions(double start, double end);
238 void shuffle_edits(double start, double end);
239 void reverse_edits(double start, double end);
240 void align_edits(double start, double end);
241 void set_edit_length(double start, double end, double length);
242 void set_transition_length(double start, double end, double length);
243 void set_transition_length(Transition *transition, double length);
244 void paste_transitions(double start, double end, int track_type, char* title);
246 // ================================== accounting
248 int handles, titles; // show handles or titles
249 int show_output; // what type of video to draw
250 AutoConf auto_conf; // which autos are visible
251 int overlays_visible;
252 double total_playable_length(); // Longest track.
253 // Used by equivalent_output
254 int total_playable_vtracks();
255 double total_recordable_length(); // Longest track with recording on
256 int totalpixels(); // height of all tracks in pixels
257 int number_of(Track *track); // track number of pointer
258 Track* number(int number); // pointer to track number
259 Track *get(int idx, int data_type);