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