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