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