ac5d71a32f818f02f4a2a3ce96ae96648fb741ba
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mwindow.h
1 /*
2  * CINELERRA
3  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 #ifndef MWINDOW_H
22 #define MWINDOW_H
23
24 #include <stdio.h>
25 #include <stdint.h>
26
27 #include "apatchgui.h"
28 #include "arraylist.h"
29 #include "asset.inc"
30 #include "assets.inc"
31 #include "audiodevice.inc"
32 #include "autos.inc"
33 #include "awindow.inc"
34 #include "batchrender.inc"
35 #include "bcwindowbase.inc"
36 #include "bdcreate.inc"
37 #include "brender.inc"
38 #include "cache.inc"
39 #include "channel.inc"
40 #include "channeldb.inc"
41 #include "commercials.inc"
42 #include "convert.inc"
43 #include "cwindow.inc"
44 #include "bchash.inc"
45 #include "devicedvbinput.inc"
46 #include "devicempeginput.inc"
47 #include "dvdcreate.inc"
48 #include "edit.inc"
49 #include "edl.inc"
50 #include "edlsession.inc"
51 #include "exportedl.inc"
52 #include "filesystem.inc"
53 #include "filexml.inc"
54 #include "framecache.inc"
55 #include "gwindow.inc"
56 #include "indexable.inc"
57 #include "keyframegui.inc"
58 #include "levelwindow.inc"
59 #include "loadmode.inc"
60 #include "mainerror.inc"
61 #include "mainindexes.inc"
62 #include "mainprogress.inc"
63 #include "mainsession.inc"
64 #include "mainundo.inc"
65 #include "maxchannels.h"
66 #include "mixersalign.inc"
67 #include "mutex.inc"
68 #include "mwindow.inc"
69 #include "mwindowgui.inc"
70 #include "new.inc"
71 #include "patchbay.inc"
72 #include "playback3d.inc"
73 #include "playbackengine.inc"
74 #include "plugin.inc"
75 #include "pluginclient.inc"
76 #include "pluginfclient.inc"
77 #include "pluginserver.inc"
78 #include "pluginset.inc"
79 #include "preferences.inc"
80 #include "preferencesthread.inc"
81 #include "proxy.inc"
82 #include "record.inc"
83 #include "recordlabel.inc"
84 #include "render.inc"
85 #include "sharedlocation.inc"
86 #include "sighandler.inc"
87 #include "splashgui.inc"
88 #include "shuttle.inc"
89 #include "theme.inc"
90 #include "thread.h"
91 #include "threadloader.inc"
92 #include "timebar.inc"
93 #include "tipwindow.inc"
94 #include "track.inc"
95 #include "tracking.inc"
96 #include "tracks.inc"
97 #include "transition.inc"
98 #include "transportque.inc"
99 #include "videowindow.inc"
100 #include "vpatchgui.h"
101 #include "vwindow.inc"
102 #include "zwindow.inc"
103 #include "wwindow.inc"
104 #include "wavecache.inc"
105 #include "wintv.inc"
106 #include "x10tv.inc"
107
108 #define FONT_SEARCHPATH "fonts"
109
110 class StackItem
111 {
112 public:
113         EDL *edl, *new_edl;
114         Indexable *idxbl;
115         MainUndo *undo;
116         int64_t mtime;
117 };
118
119 class Stack : public ArrayList<StackItem>
120 {
121 public:
122 };
123
124
125 #define BEEP_SAMPLE_RATE 48000
126
127 class Beeper : public Thread
128 {
129 public:
130         typedef int16_t audio_data_t;
131         Beeper(MWindow *mwindow);
132         ~Beeper();
133
134         void run();
135         void start();
136         void stop(int wait);
137         void tone(double freq, double secs, double gain);
138
139         MWindow *mwindow;
140         double freq, secs, gain;
141         AudioDevice *audio;
142         int playing_audio, interrupted;
143         int audio_pos;
144 };
145
146
147 class MWindow : public Thread
148 {
149 public:
150         MWindow();
151         ~MWindow();
152
153 // ======================================== initialization commands
154         void create_objects(int want_gui,
155                 int want_new,
156                 char *config_path);
157         int uses_opengl();
158         void show_splash();
159         void hide_splash();
160         void start();
161         void run();
162
163         int run_script(FileXML *script);
164         int new_project();
165         int delete_project(int flash = 1);
166         void quit();
167         int restart() { return restart_status; }
168
169         int load_defaults();
170         int save_defaults();
171         int set_filename(const char *filename);
172 // Total vertical pixels in timeline
173         int get_tracks_height();
174 // Total horizontal pixels in timeline
175         int get_tracks_width();
176 // session stack
177         void stack_push(EDL *edl, Indexable *idxbl);
178         void stack_pop();
179         void clip_to_media();
180         void media_to_clip();
181         int create_ref(Asset *asset, EDL *ref);
182 // Show windows
183         void show_vwindow();
184         void show_awindow();
185         void show_lwindow();
186         void show_cwindow();
187         void show_gwindow();
188         void hide_gwindow();
189         void restore_windows();
190         void load_layout(const char *layout);
191         void save_layout(const char *layout);
192         void delete_layout(const char *layout);
193         int tile_windows(int window_config);
194         char *get_cwindow_display();
195         void set_screens(int value);
196         int asset_to_edl(EDL *new_edl,
197                 Asset *new_asset,
198                 RecordLabels *labels = 0);
199
200 // Entry point to insert assets and insert edls.  Called by TrackCanvas
201 // and AssetPopup when assets are dragged in from AWindow.
202 // Takes the drag vectors from MainSession and
203 // pastes either assets or clips depending on which is full.
204 // Returns 1 if the vectors were full
205         int paste_assets(double position, Track *dest_track, int overwrite);
206
207 // Insert the assets at a point in the EDL.  Called by menueffects,
208 // render, and CWindow drop but recording calls paste_edls directly for
209 // labels.
210         void load_assets(ArrayList<Indexable*> *new_assets,
211                 double position,
212                 int load_mode,
213                 Track *first_track /* = 0 */,
214                 RecordLabels *labels /* = 0 */,
215                 int edit_labels,
216                 int edit_plugins,
217                 int edit_autos,
218                 int overwrite);
219         int paste_edls(ArrayList<EDL*> *new_edls,
220                 int load_mode,
221                 Track *first_track /* = 0 */,
222                 double current_position /* = -1 */,
223                 int edit_labels,
224                 int edit_plugins,
225                 int edit_autos,
226                 int overwrite);
227 // Reset everything for a load
228         void update_project(int load_mode);
229         void update_preferences(Preferences *prefs);
230         void update_vwindow();
231 // Fit selected time to horizontal display range
232         void fit_selection();
233 // Fit selected autos to the vertical display range
234         void fit_autos(int all);
235         void change_currentautorange(int autogrouptype, int increment, int changemax);
236         void expand_autos(int changeall, int domin, int domax);
237         void shrink_autos(int changeall, int domin, int domax);
238 // move the window to include the cursor
239         void find_cursor();
240 // Search plugindb and put results in argument
241         static void search_plugindb(int do_audio,
242                 int do_video,
243                 int is_realtime,
244                 int is_transition,
245                 int is_theme,
246                 ArrayList<PluginServer*> &results);
247 // Find the plugin whose title matches title and return it
248         static PluginServer* scan_plugindb(char *title,
249                 int data_type);
250         static void fix_plugin_title(char *title);
251         static int plugin_exists(const char *plugin_path, ArrayList<PluginServer*> &plugins);
252         static int plugin_exists(char *plugin_path);
253         void dump_plugindb(FILE *fp);
254         void stop_playback(int wait);
255         void stop_transport();
256         void undo_before(const char *description = "", void *creator = 0);
257         void undo_after(const char *description, uint32_t load_flags, int changes_made = 1);
258
259         void handle_mixers(EDL *edl, int command, int wait_tracking,
260                 int use_inout, int toggle_audio, int loop_play, float speed);
261         ZWindow *create_mixer(Indexable *indexable, double position);
262         void create_mixers(double position = 0);
263         void refresh_mixers(int dir=1);
264         void stop_mixers();
265         void close_mixers(int result=1);
266         void open_mixers();
267         ZWindow *get_mixer(Mixer *&mixer);
268         void del_mixer(ZWindow *zwindow);
269         int mixer_track_active(Track *track);
270         void update_mixer_tracks();
271         void start_mixer();
272         int select_zwindow(ZWindow *zwindow);
273         void tile_mixers();
274         int load_filenames(ArrayList<char*> *filenames,
275                 int load_mode = LOADMODE_REPLACE,
276                 int edl_mode = LOADMODE_EDL_CLIP,
277 // Cause the project filename on the top of the window to be updated.
278 // Not wanted for loading backups.
279                 int update_filename = 1);
280
281 // Print out plugins which are referenced in the EDL but not loaded.
282         void test_plugins(EDL *new_edl, const char *path);
283
284         int interrupt_indexes();  // Stop index building
285
286         int redraw_time_dependancies();     // after reconfiguring the time format, sample rate, frame rate
287
288 // =========================================== movement
289
290         void next_time_format();
291         void prev_time_format();
292         void time_format_common();
293         int reposition_timebar(int new_pixel, int new_height);
294         int expand_sample();
295         int zoom_in_sample();
296         int zoom_sample(int64_t zoom_sample);
297         void zoom_autos(float min, float max);
298         void zoom_amp(int64_t zoom_amp);
299         void zoom_track(int64_t zoom_track);
300         int fit_sample();
301         int move_left(int64_t distance = 0);
302         int move_right(int64_t distance = 0);
303         void move_up(int64_t distance = 0);
304         void move_down(int64_t distance = 0);
305         int find_selection(double position, int scroll_display = 0);
306         void toggle_camera_xyz();
307         void toggle_projector_xyz();
308         double get_position();
309         void set_position(double position);
310
311 // seek to labels
312 // shift_down must be passed by the caller because different windows call
313 // into this
314         int next_label(int shift_down);
315         int prev_label(int shift_down);
316 // seek to edit handles
317         int next_edit_handle(int shift_down);
318         int prev_edit_handle(int shift_down);
319 // seek to keyframes
320         int nearest_plugin_keyframe(int shift_down, int dir);
321         int nearest_auto_keyframe(int shift_down, int dir);
322 // offset is pixels to add to track_start
323         void trackmovement(int offset, int pane_number);
324 // view_start is pixels
325         int samplemovement(int64_t view_start, int pane_number);
326         void select_all();
327         int goto_start();
328         int goto_end();
329         int goto_position(double position);
330         int expand_y();
331         int zoom_in_y();
332         int expand_t();
333         int zoom_in_t();
334         void split_x();
335         void split_y();
336         void crop_video(int mode);
337         void update_plugins();
338         void get_backup_path(char *path, int len);
339 // Call after every edit operation
340         void save_backup();
341         void load_backup();
342         void show_plugin(Plugin *plugin);
343         void hide_plugin(Plugin *plugin, int lock);
344         void hide_plugins();
345         void delete_plugin(PluginServer *plugin);
346 // Update plugins with configuration changes.
347 // Called by TrackCanvas::cursor_motion_event.
348         void update_plugin_guis(int do_keyframe_guis = 1);
349         void update_plugin_states();
350         void update_plugin_titles();
351 // Called by Attachmentpoint during playback.
352 // Searches for matching plugin and renders data in it.
353         void render_plugin_gui(void *data, Plugin *plugin);
354         void render_plugin_gui(void *data, int size, Plugin *plugin);
355         void reset_plugin_gui_frames(Plugin *plugin);
356         void render_plugin_gui_frames(PluginClientFrames *frames, Plugin *plugin);
357         double get_tracking_position();
358         int get_tracking_direction();
359
360 // Called from PluginVClient::process_buffer
361 // Returns 1 if a GUI for the plugin is open so OpenGL routines can determine if
362 // they can run.
363         int plugin_gui_open(Plugin *plugin);
364         void stop_plugin_guis();
365
366         void show_keyframe_gui(Plugin *plugin);
367         void hide_keyframe_guis();
368         void hide_keyframe_gui(Plugin *plugin);
369         void update_keyframe_guis();
370         int get_hash_color(Edit *edit);
371         int get_hash_color(int v);
372         int get_group_color(int v);
373         int get_title_color(Edit *edit);
374
375 // ============================= editing commands ========================
376
377 // Map each recordable audio track to the desired pattern
378         void map_audio(int pattern);
379         void remap_audio(int pattern);
380         enum
381         {
382                 AUDIO_5_1_TO_2,
383                 AUDIO_1_TO_1
384         };
385         void add_audio_track_entry(int above, Track *dst);
386         int add_audio_track(int above, Track *dst);
387         void add_clip_to_edl(EDL *edl);
388         void add_video_track_entry(Track *dst = 0);
389         int add_video_track(int above, Track *dst);
390         void add_subttl_track_entry(Track *dst = 0);
391         int add_subttl_track(int above, Track *dst);
392
393         void asset_to_all();
394         void asset_to_size();
395         void asset_to_rate();
396 // Entry point for clear operations.
397         void clear_entry();
398 // Clears active region in EDL.
399 // If clear_handle, edit boundaries are cleared if the range is 0.
400 // Called by paste, record, menueffects, render, and CWindow drop.
401         void clear(int clear_handle);
402         void clear_labels();
403         int clear_labels(double start, double end);
404         void clear_hard_edges();
405         int clear_hard_edges(double start, double end);
406         void clear_select();
407         void concatenate_tracks();
408         int copy_flags(int copy_flags=COPY_CLIPBOARD);
409         void copy();
410         int copy(double start, double end);
411         void cut();
412         void blade(double position);
413         void cut(double start, double end, double new_position=-1);
414 // cut edit from current position to handle/label
415         void cut_left_edit();
416         void cut_right_edit();
417         void cut_left_label();
418         void cut_right_label();
419
420 // Calculate aspect ratio from pixel counts
421         static int create_aspect_ratio(float &w, float &h, int width, int height);
422 // Calculate defaults path
423         static void create_defaults_path(char *string, const char *config_file);
424
425         void delete_track(Track *track);
426         void delete_tracks();
427         int feather_edits(int64_t feather_samples, int audio, int video);
428         int64_t get_feather(int audio, int video);
429         float get_aspect_ratio();
430         void insert(double position, FileXML *file,
431                 int edit_labels, int edit_plugins, int edit_autos,
432                 EDL *parent_edl, Track *first_track, int overwrite);
433
434 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
435 // into pluginset_highlighted.
436         void insert_effects_canvas(double start, double length);
437
438 // CWindow calls this to insert multiple effects from
439 // the drag_pluginservers array.
440         void insert_effects_cwindow(Track *dest_track);
441
442 // Attach new effect to all recordable tracks
443 // single_standalone - attach 1 standalone on the first track and share it with
444 // other tracks
445         void insert_effect(char *title,
446                 SharedLocation *shared_location,
447                 int data_type, int plugin_type, int single_standalone);
448
449 // This is called multiple times by the above functions.
450 // It can't sync parameters.
451         void insert_effect(char *title,
452                 SharedLocation *shared_location,
453                 Track *track, PluginSet *plugin_set,
454                 double start, double length, int plugin_type);
455
456         void match_output_size(Track *track);
457         void delete_edit(Edit *edit, const char *msg, int collapse=0);
458         void delete_edits(ArrayList<Edit*> *edits, const char *msg, int collapse=0);
459         void delete_edits(int collapse=0);
460         void cut_selected_edits(int collapse, int packed);
461 // Move edit to new position
462         void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
463                 int mode); // mode: 0 - mute and overwrite,  1 - cut and paste
464         void selected_edits_to_clipboard(int packed);
465         void paste_clipboard(Track *first_track, double position, int overwrite,
466                 int edit_edits, int edit_labels, int edit_autos, int edit_plugins);
467         void move_group(EDL *group, Track *first_track, double position, int overwrite);
468 // Move effect to position
469         void move_effect(Plugin *plugin, Track *track, int64_t position);
470         void move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position);
471         void move_plugins_up(PluginSet *plugin_set);
472         void move_plugins_down(PluginSet *plugin_set);
473         void move_track_down(Track *track);
474         void move_tracks_down();
475         void move_track_up(Track *track);
476         void move_tracks_up();
477         void mute_selection();
478         void new_folder(const char *new_folder, int is_clips);
479         void delete_folder(char *folder);
480 // For clipboard commands
481         void paste();
482         void paste(double start, Track *first_track, int clear_selection, int overwrite);
483 // For splice and overwrite
484         void overwrite(EDL *source, int all);
485         void splice(EDL *source, int all);
486         int paste(double start, double end, FileXML *file,
487                 int edit_labels, int edit_plugins, int edit_autos,
488                 Track *first_track, int overwrite);
489         int paste_output(int64_t startproject, int64_t endproject,
490                 int64_t startsource_sample, int64_t endsource_sample,
491                 int64_t startsource_frame, int64_t endsource_frame,
492                 Asset *asset, RecordLabels *new_labels);
493         void paste_silence();
494
495 // Detach single transition
496         void detach_transition(Transition *transition);
497 // Detach all transitions in selection
498         void detach_transitions();
499 // Attach dragged transition
500         void paste_transition();
501 // Attach transition to all edits in selection
502         void paste_transitions(int track_type, char *title);
503 // Attach transition dragged onto CWindow
504         void paste_transition_cwindow(Track *dest_track);
505 // Attach default transition to single edit
506         void paste_audio_transition();
507         void paste_video_transition();
508         void shuffle_edits();
509         void reverse_edits();
510         void align_edits();
511         void set_edit_length(double length);
512 // Set length of single transition
513         void set_transition_length(Transition *transition, double length);
514 // Set length in seconds of all transitions in active range
515         void set_transition_length(double length);
516
517         void remove_indexfile(Indexable *indexable);
518         void rebuild_indices();
519 // Asset removal from caches
520         void reset_caches();
521         void remove_from_caches(Indexable *idxbl);
522         void remove_assets_from_project(int push_undo, int redraw, int delete_indexes,
523                 ArrayList<Indexable*> *drag_assets /* mwindow->session->drag_assets */,
524                 ArrayList<EDL*> *drag_clips /* mwindow->session->drag_clips */);
525         void remove_assets_from_disk();
526         void resize_track(Track *track, int w, int h);
527
528         void set_automation_mode(int mode);
529         void set_keyframe_type(int mode);
530         void set_auto_keyframes(int value);
531         void set_span_keyframes(int value);
532         void set_auto_visibility(Autos *autos, int value);
533         void set_labels_follow_edits(int value);
534
535 // Update the editing mode
536         int set_editing_mode(int new_editing_mode);
537         void toggle_editing_mode();
538         void set_inpoint();
539         void set_outpoint();
540         void unset_inoutpoint();
541         void toggle_loop_playback();
542         void trim_selection();
543 // Synchronize EDL settings with all playback engines depending on current
544 // operation.  Doesn't redraw anything.
545         void sync_parameters(int change_type = CHANGE_PARAMS);
546         void save_clip(EDL *new_edl, const char *txt);
547         void to_clip(EDL *edl, const char *txt, int all);
548         int toggle_label();
549         void undo_entry(BC_WindowBase *calling_window_gui);
550         void redo_entry(BC_WindowBase *calling_window_gui);
551         void save_undo_data();
552         void load_undo_data();
553         void remove_undo_data();
554         int copy_target(const char *path, const char *target);
555         int link_target(const char *real_path, const char *link_path, int relative);
556         void save_project(const char *dir, int save_mode, int overwrite, int reload);
557
558         int cut_automation();
559         int copy_automation();
560         int paste_automation();
561         void clear_automation();
562         int cut_default_keyframe();
563         int copy_default_keyframe();
564 // Use paste_automation to paste the default keyframe in other position.
565 // Use paste_default_keyframe to replace the default keyframe with whatever is
566 // in the clipboard.
567         int paste_default_keyframe();
568         int clear_default_keyframe();
569
570         FloatAuto* get_float_auto(PatchGUI *patch,int idx);
571         IntAuto* get_int_auto(PatchGUI *patch,int idx);
572         PanAuto* get_pan_auto(PatchGUI *patch);
573         PatchGUI *get_patchgui(Track *track);
574
575         int modify_edithandles();
576         int modify_pluginhandles();
577         void finish_modify_handles();
578         void rescale_proxy(EDL *clip, int orig_scale, int new_scale);
579         void add_proxy(ArrayList<Indexable*> *orig_assets,
580                         ArrayList<Indexable*> *proxy_assets);
581         int render_proxy(ArrayList<Indexable *> &new_idxbls);
582         void beep(double freq, double secs, double gain);
583         int enable_proxy();
584         int disable_proxy();
585         int to_proxy(Asset *asset, int new_scale, int new_use_scaler);
586         Beeper *beeper;
587
588         void dump_plugins(FILE *fp=stdout);
589         void dump_edl(FILE *fp=stdout);
590         void dump_undo(FILE *fp=stdout);
591         void dump_exe(FILE *fp=stdout);
592         static void trap_hook(FILE *fp, void *vp);
593
594         void reset_android_remote();
595
596 // Send new EDL to caches
597         void age_caches();
598         int optimize_assets();            // delete unused assets from the cache and assets
599 // render edl assets to specified format, then replace in edl
600         void start_convert(Asset *format_asset, const char *suffix,
601                         float beep, int to_proxy, int remove_originals);
602         void finish_convert(int remove_originals);
603         ConvertRender *convert_render;
604
605         void select_point(double position);
606         int set_loop_boundaries();         // toggle loop playback and set boundaries for loop playback
607
608
609         Playback3D *playback_3d;
610         SplashGUI *splash_window;
611
612 // Main undo stack
613         MainUndo *undo;
614         int undo_command;
615 // session stack
616         Stack stack;
617
618         BC_Hash *defaults;
619         Assets *assets;
620 // CICaches for drawing timeline only
621         CICache *audio_cache, *video_cache;
622 // Frame cache for drawing timeline only.
623 // Cache drawing doesn't wait for file decoding.
624         FrameCache *frame_cache;
625         WaveCache *wave_cache;
626         Preferences *preferences;
627         PreferencesThread *preferences_thread;
628         MainSession *session;
629         Theme *theme;
630         MainIndexes *mainindexes;
631         MainProgress *mainprogress;
632         BRender *brender;
633         char cin_lang[4];
634         int brender_active;
635         const char *default_standard;
636         static Commercials *commercials;
637         int commercial_active;
638         int has_commercials();
639 // copy of edl created in speed_before, used in speed_after to normalize_speed
640         EDL *speed_edl;
641
642 // Menu items
643         ArrayList<ColormodelItem*> colormodels;
644         ArrayList<InterlacemodeItem*>          interlace_project_modes;
645         ArrayList<InterlacemodeItem*>          interlace_asset_modes;
646
647         int reset_meters();
648         void resync_guis();
649
650         int select_asset(Asset *asset, int vstream, int astream, int delete_tracks);
651         int select_asset(int vtrack, int delete_tracks);
652
653 // Channel DB for playback only.  Record channel DB's are in record.C
654         ChannelDB *channeldb_buz;
655         ChannelDB *channeldb_v4l2jpeg;
656
657 // ====================================== plugins ==============================
658
659 // Contains file descriptors for all the dlopens
660         static ArrayList<PluginServer*> *plugindb;
661 // Currently visible plugins
662         int64_t plugin_visibility;
663         PluginGUIs *plugin_guis;
664 // GUI Plugins to delete
665         ArrayList<PluginServer*> *dead_plugins;
666 // Keyframe editors
667         ArrayList<KeyFrameThread*> *keyframe_threads;
668
669 // Adjust sample position to line up with frames.
670         int fix_timing(int64_t &samples_out,
671                 int64_t &frames_out,
672                 int64_t samples_in);
673
674
675         CreateBD_Thread *create_bd;
676         CreateDVD_Thread *create_dvd;
677         BatchRenderThread *batch_render;
678         Render *render;
679
680         ExportEDL *exportedl;
681
682
683 // Master edl
684         EDL *edl;
685 // Main Window GUI
686         MWindowGUI *gui;
687 // Compositor
688         CWindow *cwindow;
689 // Viewer
690         Mutex *vwindows_lock;
691         ArrayList<VWindow*> vwindows;
692 // Mixer
693         Mutex *zwindows_lock;
694         ArrayList<ZWindow*> zwindows;
695         MixersAlign *mixers_align;
696
697 // Asset manager
698         AWindow *awindow;
699 // Automation window
700         GWindow *gwindow;
701 // Tip of the day
702         TipWindow *twindow;
703 // Warning window
704         WWindow *wwindow;
705         void show_warning(int *do_warning, const char *text);
706         int wait_warning();
707 // Levels
708         LevelWindow *lwindow;
709         Mutex *run_lock;
710 // Lock during creation and destruction of GUI
711         Mutex *plugin_gui_lock;
712         Mutex *dead_plugin_lock;
713         Mutex *keyframe_gui_lock;
714 // Lock during creation and destruction of brender so playback doesn't use it.
715         Mutex *brender_lock;
716 // Initialize shared memory
717         void init_shm(const char *pfn, int64_t min);
718 // Initialize channel DB's for playback
719         void init_channeldb();
720         void init_render();
721         void init_exportedl();
722 // These three happen synchronously with each other
723 // Make sure this is called after synchronizing EDL's.
724         void init_brender();
725 // Restart brender after testing its existence
726         void restart_brender();
727 // Stops brender after testing its existence
728         void stop_brender();
729 // This one happens asynchronously of the others.  Used by playback to
730 // see what frame is background rendered.
731         int brender_available(int position);
732         void set_brender_active(int v, int update=1);
733         int put_commercial();
734         void activate_commercial() { commercial_active = 1; }
735         void commit_commercial();
736         void undo_commercial();
737         void cut_commercials();
738         void update_gui(int changed_edl);
739         int paste_subtitle_text(char *text, double start, double end);
740
741         void init_error();
742         void finit_error();
743         static void init_defaults(BC_Hash* &defaults, char *config_path);
744         void check_language();
745         const char *default_std();
746         void fill_preset_defaults(const char *preset, EDLSession *session);
747         const char *get_preset_name(int index);
748         void init_edl();
749         void init_awindow();
750         void init_gwindow();
751         void init_tipwindow();
752 // Used by MWindow and RenderFarmClient
753         static void get_plugin_path(char *path, const char *plug_dir, const char *fs_path);
754         static int init_plugins(MWindow *mwindow, Preferences *preferences);
755         static int init_ladspa_plugins(MWindow *mwindow, Preferences *preferences);
756         static void init_plugin_tips(ArrayList<PluginServer*> &plugins, const char *lang);
757         static int check_plugin_index(ArrayList<PluginServer*> &plugins,
758                 const char *plug_dir, const char *plug_path);
759         static void init_plugin_index(MWindow *mwindow, Preferences *preferences,
760                 FILE *fp, const char *plugin_dir);
761         static int init_ladspa_index(MWindow *mwindow, Preferences *preferences,
762                 FILE *fp, const char *plugin_dir);
763         static void scan_plugin_index(MWindow *mwindow, Preferences *preferences,
764                 FILE *fp, const char *plug_dir, const char *plug_path, int &idx);
765         static void init_ffmpeg();
766         static void init_ffmpeg_index(MWindow *mwindow, Preferences *preferences, FILE *fp);
767         static int load_plugin_index(MWindow *mwindow, FILE *fp, const char *plugin_dir);
768         static PluginServer *new_ffmpeg_server(MWindow *mwindow, const char *name);
769         static int init_lv2_index(MWindow *mwindow, Preferences *preferences, FILE *fp);
770         static PluginServer *new_lv2_server(MWindow *mwindow, const char *name);
771         static void remove_plugin_index();
772
773         void init_preferences();
774         void init_signals();
775         void init_shuttle();
776         void init_wintv();
777         void init_x10tv();
778         void init_theme();
779         void init_compositor();
780         void init_levelwindow();
781 // Called when creating a new viewer to view footage
782         VWindow* get_viewer(int start_it, int idx=-1);
783         void init_cache();
784         void init_menus();
785         void init_indexes();
786         void init_gui();
787         void init_3d();
788         void init_playbackcursor();
789         void init_commercials();
790         static void add_plugins(ArrayList<PluginServer*> &plugins);
791         static void delete_plugins();
792         void speed_before();
793         int speed_after(int done);
794         int normalize_speed(EDL *old_edl, EDL *new_edl);
795 //
796         void clean_indexes();
797 //      TimeBomb timebomb;
798         SigHandler *sighandler;
799         int restart_status;
800         int screens;
801         int in_destructor;
802         Shuttle *shuttle;
803         WinTV *wintv;
804         X10TV *x10tv;
805 };
806
807 #endif