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,
59 void move_effect(Plugin *plugin,
62 void move_effect(Plugin *plugin,
63 PluginSet *plugin_set,
66 // Construct a list of all the recordable edits which start on position
67 void get_affected_edits(ArrayList<Edit*> *drag_edits,
71 void get_automation_extents(float *min,
77 void equivalent_output(Tracks *tracks, double *result);
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);
87 int plugin_exists(Plugin *plugin);
88 int track_exists(Track *track);
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,
109 void translate_projector(float offset_x, float offset_y);
110 int total_of(int type);
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);
118 int delete_track(Track* track);
119 // detach shared effects referencing module
120 int detach_shared_effects(int module);
128 // Types for drag toggle behavior
148 int change_channels(int oldchannels, int newchannels);
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);
161 int delete_tracks(); // delete all the recordable tracks
162 int delete_all_tracks(); // delete just the tracks
164 void copy_from(Tracks *tracks);
166 // ================================== EDL editing
167 int copy(double start,
171 const char *output_path = "");
175 int copy_assets(FileXML *xml,
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,
186 int clear_default_keyframe();
187 int clear_handle(double start,
189 double &longest_distance,
193 int copy_automation(double selectionstart,
198 // int copy_default_keyframe(FileXML *file);
199 void paste_automation(double selectionstart,
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,
209 int64_t startsource_sample,
210 int64_t endsource_sample,
211 int64_t startsource_frame,
212 int64_t endsource_frame,
214 int paste_silence(double start,
218 int purge_asset(Asset *asset);
219 int asset_used(Asset *asset);
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,
231 int modify_pluginhandles(double &oldposition,
238 int select_handles();
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);
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);
255 // ================================== accounting
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);