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