r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / mwindow.h
blob25c5e774078e18401ac1fb042268bf36877e1b42
1 #ifndef MWINDOW_H
2 #define MWINDOW_H
4 #include "assets.inc"
5 #include "audiodevice.inc"
6 #include "arraylist.h"
7 #include "awindow.inc"
8 #include "brender.inc"
9 #include "cache.inc"
10 #include "channel.inc"
11 #include "cwindow.inc"
12 #include "defaults.inc"
13 #include "edit.inc"
14 #include "edl.inc"
15 #include "filesystem.inc"
16 #include "filexml.inc"
17 #include "levelwindow.inc"
18 #include "loadmode.inc"
19 #include "mainindexes.inc"
20 #include "mainprogress.inc"
21 #include "mainsession.inc"
22 #include "mainundo.inc"
23 #include "maxchannels.h"
24 #include "mutex.inc"
25 #include "mwindowgui.inc"
26 #include "mwindow.inc"
27 #include "new.inc"
28 #include "patchbay.inc"
29 #include "playbackengine.inc"
30 #include "plugin.inc"
31 #include "pluginserver.inc"
32 #include "pluginset.inc"
33 #include "preferences.inc"
34 #include "preferencesthread.inc"
35 #include "recordlabel.inc"
36 #include "render.inc"
37 #include "sharedlocation.inc"
38 #include "sighandler.inc"
39 #include "splashgui.inc"
40 #include "theme.inc"
41 #include "threadloader.inc"
42 #include "timebar.inc"
43 #include "timebomb.h"
44 #include "track.inc"
45 #include "tracking.inc"
46 #include "tracks.inc"
47 #include "transition.inc"
48 #include "transportque.inc"
49 #include "videowindow.inc"
50 #include "vwindow.inc"
53 #include <stdint.h>
55 // All entry points for commands except for window locking should be here.
56 // This allows scriptability.
58 class MWindow
60 public:
61 MWindow();
62 ~MWindow();
64 // ======================================== initialization commands
65 void create_objects(int want_gui, int want_new);
66 void show_splash();
67 void hide_splash();
68 void start();
69 static void init_tuner(ArrayList<Channel*> &channeldb, char *path);
71 int run_script(FileXML *script);
72 int new_project();
73 int delete_project(int flash = 1);
75 int load_defaults();
76 int save_defaults();
77 int set_filename(char *filename);
78 // Total vertical pixels in timeline
79 int get_tracks_height();
80 // Total horizontal pixels in timeline
81 int get_tracks_width();
82 // Show windows
83 void show_vwindow();
84 void show_awindow();
85 void show_lwindow();
86 void show_cwindow();
87 void tile_windows();
88 void set_titles(int value);
89 int asset_to_edl(EDL *new_edl, Asset *new_asset, RecordLabels *labels = 0);
91 // Entry point to insert assets and insert edls. Called by TrackCanvas
92 // and AssetPopup when assets are dragged in from AWindow.
93 // Takes the drag vectors from MainSession and
94 // pastes either assets or clips depending on which is full.
95 // Returns 1 if the vectors were full
96 int paste_assets(double position, Track *dest_track);
98 // Insert the assets at a point in the EDL. Called by menueffects,
99 // render, and CWindow drop but recording calls paste_edls directly for
100 // labels.
101 void load_assets(ArrayList<Asset*> *new_assets,
102 double position,
103 int load_mode,
104 Track *first_track /* = 0 */,
105 RecordLabels *labels /* = 0 */,
106 int edit_labels,
107 int edit_plugins);
108 int paste_edls(ArrayList<EDL*> *new_edls,
109 int load_mode,
110 Track *first_track /* = 0 */,
111 double current_position /* = -1 */,
112 int edit_labels,
113 int edit_plugins);
114 // Reset everything for a load
115 void update_project(int load_mode);
116 void fit_selection();
117 // move the window to include the cursor
118 void find_cursor();
119 // Append a plugindb with pointers to the master plugindb
120 void create_plugindb(int do_audio,
121 int do_video,
122 int is_realtime,
123 int is_transition,
124 int is_theme,
125 ArrayList<PluginServer*> &plugindb);
126 // Find the plugin whose title matches title and return it
127 PluginServer* scan_plugindb(char *title);
128 void dump_plugins();
133 int load_filenames(ArrayList<char*> *filenames,
134 int load_mode = LOAD_REPLACE);
136 int interrupt_indexes(); // Stop index building
139 int redraw_time_dependancies(); // after reconfiguring the time format, sample rate, frame rate
141 // =========================================== movement
143 void next_time_format();
144 int reposition_timebar(int new_pixel, int new_height);
145 int expand_sample();
146 int zoom_in_sample();
147 int zoom_sample(int64_t zoom_sample);
148 void zoom_amp(int64_t zoom_amp);
149 void zoom_track(int64_t zoom_track);
150 int fit_sample();
151 int move_left(int64_t distance = 0);
152 int move_right(int64_t distance = 0);
153 void move_up(int64_t distance = 0);
154 void move_down(int64_t distance = 0);
155 int next_label(); // seek to labels
156 int prev_label();
157 void trackmovement(int track_start);
158 int samplemovement(int64_t view_start); // view_start is pixels
159 void select_all();
160 int goto_start();
161 int goto_end();
162 int expand_y();
163 int zoom_in_y();
164 int expand_t();
165 int zoom_in_t();
166 void crop_video();
167 void update_plugins();
168 // Call after every edit operation
169 void save_backup();
170 void show_plugin(Plugin *plugin);
171 void hide_plugin(Plugin *plugin, int lock);
172 void hide_plugins();
173 // Update plugins with configuration changes
174 void update_plugin_guis();
175 void update_plugin_states();
176 void update_plugin_titles();
177 // Called by Attachmentpoint during playback.
178 // Searches for matching plugin and renders data in it.
179 void render_plugin_gui(void *data, Plugin *plugin);
180 void render_plugin_gui(void *data, int size, Plugin *plugin);
183 // ============================= editing commands ========================
185 void add_audio_track_entry(int above, Track *dst);
186 int add_audio_track(int above, Track *dst);
187 void add_clip_to_edl(EDL *edl);
188 void add_video_track_entry(Track *dst = 0);
189 int add_video_track(int above, Track *dst);
191 void asset_to_size();
192 // Entry point for clear operations.
193 void clear_entry();
194 // Clears active region in EDL.
195 // If clear_handle, edit boundaries are cleared if the range is 0.
196 // Called by paste, record, menueffects, render, and CWindow drop.
197 void clear(int clear_handle);
198 void clear_labels();
199 int clear_labels(double start, double end);
200 void concatenate_tracks();
201 void copy();
202 int copy(double start, double end);
203 static int create_aspect_ratio(float &w, float &h, int width, int height);
204 void cut();
206 void delete_folder(char *folder);
207 void delete_inpoint();
208 void delete_outpoint();
210 void delete_track();
211 void delete_track(Track *track);
212 void delete_tracks();
213 void detach_transition(Transition *transition);
214 int feather_edits(int64_t feather_samples, int audio, int video);
215 int64_t get_feather(int audio, int video);
216 float get_aspect_ratio();
217 void insert(double position,
218 FileXML *file,
219 int edit_labels,
220 int edit_plugins,
221 EDL *parent_edl = 0);
223 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
224 // into pluginset_highlighted.
225 void insert_effects_canvas(double start,
226 double length);
228 // CWindow calls this to insert multiple effects from
229 // the drag_pluginservers array.
230 void insert_effects_cwindow(Track *dest_track);
232 // This is called multiple times by the above functions.
233 // It can't sync parameters.
234 void insert_effect(char *title,
235 SharedLocation *shared_location,
236 Track *track,
237 PluginSet *plugin_set,
238 double start,
239 double length,
240 int plugin_type);
242 void match_output_size(Track *track);
243 // Move edit to new position
244 void move_edits(ArrayList<Edit*> *edits,
245 Track *track,
246 double position);
247 // Move effect to position
248 void move_effect(Plugin *plugin,
249 PluginSet *plugin_set,
250 Track *track,
251 int64_t position);
252 void move_plugins_up(PluginSet *plugin_set);
253 void move_plugins_down(PluginSet *plugin_set);
254 void move_track_down(Track *track);
255 void move_tracks_down();
256 void move_track_up(Track *track);
257 void move_tracks_up();
258 void mute_selection();
259 void new_folder(char *new_folder);
260 void overwrite(EDL *source);
261 // For clipboard commands
262 void paste();
263 // For splice and overwrite
264 int paste(double start,
265 double end,
266 FileXML *file,
267 int edit_labels,
268 int edit_plugins);
269 int paste_output(int64_t startproject,
270 int64_t endproject,
271 int64_t startsource_sample,
272 int64_t endsource_sample,
273 int64_t startsource_frame,
274 int64_t endsource_frame,
275 Asset *asset,
276 RecordLabels *new_labels);
277 void paste_silence();
279 void paste_transition();
280 void paste_transition_cwindow(Track *dest_track);
281 void paste_audio_transition();
282 void paste_video_transition();
283 void rebuild_indices();
284 void redo_entry(int is_mwindow);
285 // Asset removal
286 void remove_assets_from_project(int push_undo = 0);
287 void remove_assets_from_disk();
288 void render_single();
289 void render_list();
290 void resize_track(Track *track, int w, int h);
291 void set_auto_keyframes(int value);
292 // Update the editing mode
293 int set_editing_mode(int new_editing_mode);
294 void set_inpoint(int is_mwindow);
295 void set_outpoint(int is_mwindow);
296 void splice(EDL *source);
297 void toggle_loop_playback();
298 void trim_selection();
299 // Synchronize EDL settings with all playback engines depending on current
300 // operation. Doesn't redraw anything.
301 void sync_parameters(int change_type = CHANGE_PARAMS);
302 void to_clip();
303 int toggle_label(int is_mwindow);
304 void undo_entry(int is_mwindow);
306 int cut_automation();
307 int copy_automation();
308 int paste_automation();
309 void clear_automation();
310 int cut_default_keyframe();
311 int copy_default_keyframe();
312 // Use paste_automation to paste the default keyframe in other position.
313 // Use paste_default_keyframe to replace the default keyframe with whatever is
314 // in the clipboard.
315 int paste_default_keyframe();
316 int clear_default_keyframe();
318 int modify_edithandles();
319 int modify_pluginhandles();
320 void finish_modify_handles();
328 // Send new EDL to caches
329 void update_caches();
330 int optimize_assets(); // delete unused assets from the cache and assets
332 // ================================= cursor selection ======================
334 void select_point(double position);
335 int set_loop_boundaries(); // toggle loop playback and set boundaries for loop playback
337 // ================================ handle selection =======================
341 SplashGUI *splash_window;
342 LevelWindow *level_window;
343 Tracks *tracks;
344 PatchBay *patches;
345 MainUndo *undo;
346 TimeBar *timebar;
347 Defaults *defaults;
348 Assets *assets;
349 // CICaches for drawing timeline only
350 CICache *audio_cache, *video_cache;
351 ThreadLoader *threadloader;
352 VideoWindow *video_window;
353 Preferences *preferences;
354 PreferencesThread *preferences_thread;
355 MainSession *session;
356 Theme *theme;
357 MainIndexes *mainindexes;
358 MainProgress *mainprogress;
359 BRender *brender;
361 // Menu items
362 ArrayList<ColormodelItem*> colormodels;
364 int reset_meters();
368 // ====================================== plugins ==============================
370 // Contain file descriptors for all the dlopens
371 ArrayList<PluginServer*> *plugindb;
372 // Currently visible plugins
373 ArrayList<PluginServer*> *plugin_guis;
376 // TV stations to record from
377 ArrayList<Channel*> channeldb_v4l;
378 ArrayList<Channel*> channeldb_buz;
379 // Adjust sample position to line up with frames.
380 int fix_timing(int64_t &samples_out, int64_t &frames_out, int64_t samples_in);
384 Render *render;
385 Render *renderlist;
386 // Master edl
387 EDL *edl;
388 // Main Window GUI
389 MWindowGUI *gui;
390 // Compositor
391 CWindow *cwindow;
392 // Viewer
393 VWindow *vwindow;
394 // Asset manager
395 AWindow *awindow;
396 // Levels
397 LevelWindow *lwindow;
398 // Lock during creation and destruction of GUI
399 Mutex *plugin_gui_lock;
400 // Lock during creation and destruction of brender so playback doesn't use it.
401 Mutex *brender_lock;
403 void init_render();
404 // These three happen synchronously with each other
405 // Make sure this is called after synchronizing EDL's.
406 void init_brender();
407 // Restart brender after testing its existence
408 void restart_brender();
409 // Stops brender after testing its existence
410 void stop_brender();
411 // This one happens asynchronously of the others. Used by playback to
412 // see what frame is background rendered.
413 int brender_available(int position);
414 void set_brender_start();
416 static void init_defaults(Defaults* &defaults);
417 void init_edl();
418 void init_awindow();
419 // Used by MWindow and RenderFarmClient
420 static void init_plugins(Preferences *preferences,
421 ArrayList<PluginServer*>* &plugindb,
422 SplashGUI *splash_window);
423 static void init_plugin_path(Preferences *preferences,
424 ArrayList<PluginServer*>* &plugindb,
425 FileSystem *fs,
426 SplashGUI *splash_window,
427 int *counter);
428 void init_preferences();
429 void init_signals();
430 void init_theme();
431 void init_compositor();
432 void init_levelwindow();
433 void init_viewer();
434 void init_cache();
435 void init_menus();
436 void init_indexes();
437 void init_gui();
438 void init_playbackcursor();
439 void delete_plugins();
440 void clean_indexes();
441 void save_tuner(ArrayList<Channel*> &channeldb, char *path);
442 // TimeBomb timebomb;
443 SigHandler *sighandler;
446 #endif