Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

mwindow.h

Go to the documentation of this file.
00001 #ifndef MWINDOW_H
00002 #define MWINDOW_H
00003 
00004 #include "arraylist.h"
00005 #include "asset.inc"
00006 #include "assets.inc"
00007 #include "audiodevice.inc"
00008 #include "awindow.inc"
00009 #include "batchrender.inc"
00010 #include "bcwindowbase.inc"
00011 #include "brender.inc"
00012 #include "cache.inc"
00013 #include "channel.inc"
00014 #include "channeldb.inc"
00015 #include "cwindow.inc"
00016 #include "defaults.inc"
00017 #include "edit.inc"
00018 #include "edl.inc"
00019 #include "filesystem.inc"
00020 #include "filexml.inc"
00021 #include "gwindow.inc"
00022 #include "levelwindow.inc"
00023 #include "loadmode.inc"
00024 #include "mainindexes.inc"
00025 #include "mainprogress.inc"
00026 #include "mainsession.inc"
00027 #include "mainundo.inc"
00028 #include "maxchannels.h"
00029 #include "mutex.inc"
00030 #include "mwindow.inc"
00031 #include "mwindowgui.inc"
00032 #include "new.inc"
00033 #include "patchbay.inc"
00034 #include "playbackengine.inc"
00035 #include "plugin.inc"
00036 #include "pluginserver.inc"
00037 #include "pluginset.inc"
00038 #include "preferences.inc"
00039 #include "preferencesthread.inc"
00040 #include "recordlabel.inc"
00041 #include "render.inc"
00042 #include "sharedlocation.inc"
00043 #include "sighandler.inc"
00044 #include "splashgui.inc"
00045 #include "theme.inc"
00046 #include "threadloader.inc"
00047 #include "timebar.inc"
00048 #include "timebomb.h"
00049 #include "tipwindow.inc"
00050 #include "track.inc"
00051 #include "tracking.inc"
00052 #include "tracks.inc"
00053 #include "transition.inc"
00054 #include "transportque.inc"
00055 #include "videowindow.inc"
00056 #include "vwindow.inc"
00057 #include "bcwindowbase.inc"
00058 
00059 #include <stdint.h>
00060 
00061 // All entry points for commands except for window locking should be here.
00062 // This allows scriptability.
00063 
00064 class MWindow
00065 {
00066 public:
00067         MWindow();
00068         ~MWindow();
00069 
00070 // ======================================== initialization commands
00071         void create_objects(int want_gui, 
00072                 int want_new,
00073                 char *config_path);
00074         void show_splash();
00075         void hide_splash();
00076         void start();
00077 
00078         int run_script(FileXML *script);
00079         int new_project();
00080         int delete_project(int flash = 1);
00081 
00082         int load_defaults();
00083         int save_defaults();
00084         int set_filename(char *filename);
00085 // Total vertical pixels in timeline
00086         int get_tracks_height();
00087 // Total horizontal pixels in timeline
00088         int get_tracks_width();
00089 // Show windows
00090         void show_vwindow();
00091         void show_awindow();
00092         void show_lwindow();
00093         void show_cwindow();
00094         void show_gwindow();
00095         void tile_windows();
00096         void set_titles(int value);
00097         int asset_to_edl(EDL *new_edl, Asset *new_asset, RecordLabels *labels = 0);
00098 
00099 // Entry point to insert assets and insert edls.  Called by TrackCanvas 
00100 // and AssetPopup when assets are dragged in from AWindow.
00101 // Takes the drag vectors from MainSession and
00102 // pastes either assets or clips depending on which is full.
00103 // Returns 1 if the vectors were full
00104         int paste_assets(double position, Track *dest_track);
00105         
00106 // Insert the assets at a point in the EDL.  Called by menueffects,
00107 // render, and CWindow drop but recording calls paste_edls directly for
00108 // labels.
00109         void load_assets(ArrayList<Asset*> *new_assets, 
00110                 double position, 
00111                 int load_mode,
00112                 Track *first_track /* = 0 */,
00113                 RecordLabels *labels /* = 0 */,
00114                 int edit_labels,
00115                 int edit_plugins);
00116         int paste_edls(ArrayList<EDL*> *new_edls, 
00117                 int load_mode, 
00118                 Track *first_track /* = 0 */,
00119                 double current_position /* = -1 */,
00120                 int edit_labels,
00121                 int edit_plugins);
00122 // Reset everything for a load
00123         void update_project(int load_mode);
00124 // Fit selected time to horizontal display range
00125         void fit_selection();
00126 // Fit selected autos to the vertical display range
00127         void fit_autos();
00128         void expand_autos();
00129         void shrink_autos();
00130 // move the window to include the cursor
00131         void find_cursor();
00132 // Append a plugindb with pointers to the master plugindb
00133         void create_plugindb(int do_audio, 
00134                 int do_video, 
00135                 int is_realtime, 
00136                 int is_transition,
00137                 int is_theme,
00138                 ArrayList<PluginServer*> &plugindb);
00139 // Find the plugin whose title matches title and return it
00140         PluginServer* scan_plugindb(char *title,
00141                 int data_type);
00142         void dump_plugins();
00143 
00144 
00145 
00146         
00147         int load_filenames(ArrayList<char*> *filenames, 
00148                 int load_mode = LOAD_REPLACE,
00149 // Cause the project filename on the top of the window to be updated.
00150 // Not wanted for loading backups.
00151                 int update_filename = 1,
00152                 char *reel_name = "cin0000",
00153                 int reel_number = 0,
00154                 int overwrite_reel = 0);
00155         
00156 
00157 // Print out plugins which are referenced in the EDL but not loaded.
00158         void test_plugins(EDL *new_edl, char *path);
00159 
00160         int interrupt_indexes();  // Stop index building
00161 
00162 
00163         int redraw_time_dependancies();     // after reconfiguring the time format, sample rate, frame rate
00164 
00165 // =========================================== movement
00166 
00167         void next_time_format();
00168         void prev_time_format();
00169         void time_format_common();
00170         int reposition_timebar(int new_pixel, int new_height);
00171         int expand_sample(double fixed_sample = -1);    // fixed_sample is the sample that should hold fixed position on the screen after zooming, -1 = selection
00172         int zoom_in_sample(double fixed_sample = -1);
00173         int zoom_sample(int64_t zoom_sample, int64_t view_start = -1); // what's the supposed view start
00174         void zoom_amp(int64_t zoom_amp);
00175         void zoom_track(int64_t zoom_track);
00176         int fit_sample();
00177         int move_left(int64_t distance = 0);
00178         int move_right(int64_t distance = 0);
00179         void move_up(int64_t distance = 0);
00180         void move_down(int64_t distance = 0);
00181         int next_label();   // seek to labels
00182         int prev_label();
00183         void trackmovement(int track_start);
00184         int samplemovement(int64_t view_start);     // view_start is pixels
00185         void select_all();
00186         int goto_start();
00187         int goto_end();
00188         int expand_y();
00189         int zoom_in_y();
00190         int expand_t();
00191         int zoom_in_t();
00192         void crop_video();
00193         void update_plugins();
00194 // Call after every edit operation
00195         void save_backup();
00196         void show_plugin(Plugin *plugin);
00197         void hide_plugin(Plugin *plugin, int lock);
00198         void hide_plugins();
00199 // Update plugins with configuration changes.
00200 // Called by TrackCanvas::cursor_motion_event.
00201         void update_plugin_guis();
00202         void update_plugin_states();
00203         void update_plugin_titles();
00204 // Called by Attachmentpoint during playback.
00205 // Searches for matching plugin and renders data in it.
00206         void render_plugin_gui(void *data, Plugin *plugin);
00207         void render_plugin_gui(void *data, int size, Plugin *plugin);
00208 
00209 
00210 // ============================= editing commands ========================
00211 
00212         void add_audio_track_entry(int above, Track *dst);
00213         int add_audio_track(int above, Track *dst);
00214         void add_clip_to_edl(EDL *edl);
00215         void add_video_track_entry(Track *dst = 0);
00216         int add_video_track(int above, Track *dst);
00217 
00218         void asset_to_size();
00219 // Entry point for clear operations.
00220         void clear_entry();
00221 // Clears active region in EDL.
00222 // If clear_handle, edit boundaries are cleared if the range is 0.
00223 // Called by paste, record, menueffects, render, and CWindow drop.
00224         void clear(int clear_handle);
00225         void clear_labels();
00226         int clear_labels(double start, double end);
00227         void concatenate_tracks();
00228         void copy();
00229         int copy(double start, double end);
00230         static int create_aspect_ratio(float &w, float &h, int width, int height);
00231         void cut();
00232 
00233         void delete_folder(char *folder);
00234         void delete_inpoint();
00235         void delete_outpoint();    
00236 
00237         void delete_track();
00238         void delete_track(Track *track);
00239         void delete_tracks();
00240         void detach_transition(Transition *transition);
00241         int feather_edits(int64_t feather_samples, int audio, int video);
00242         int64_t get_feather(int audio, int video);
00243         float get_aspect_ratio();
00244         void insert(double position, 
00245                 FileXML *file,
00246                 int edit_labels,
00247                 int edit_plugins,
00248                 EDL *parent_edl = 0);
00249 
00250 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
00251 // into pluginset_highlighted.
00252         void insert_effects_canvas(double start,
00253                 double length);
00254 
00255 // CWindow calls this to insert multiple effects from 
00256 // the drag_pluginservers array.
00257         void insert_effects_cwindow(Track *dest_track);
00258 
00259 // This is called multiple times by the above functions.
00260 // It can't sync parameters.
00261         void insert_effect(char *title, 
00262                 SharedLocation *shared_location, 
00263                 Track *track,
00264                 PluginSet *plugin_set,
00265                 double start,
00266                 double length,
00267                 int plugin_type);
00268 
00269         void match_output_size(Track *track);
00270 // Move edit to new position
00271         void move_edits(ArrayList<Edit*> *edits,
00272                 Track *track,
00273                 double position,
00274                 int behaviour);       // behaviour: 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
00275 // Move effect to position
00276         void move_effect(Plugin *plugin,
00277                 PluginSet *plugin_set,
00278                 Track *track,
00279                 int64_t position);
00280         void move_plugins_up(PluginSet *plugin_set);
00281         void move_plugins_down(PluginSet *plugin_set);
00282         void move_track_down(Track *track);
00283         void move_tracks_down();
00284         void move_track_up(Track *track);
00285         void move_tracks_up();
00286         void mute_selection();
00287         void new_folder(char *new_folder);
00288         void overwrite(EDL *source);
00289 // For clipboard commands
00290         void paste();
00291 // For splice and overwrite
00292         int paste(double start, 
00293                 double end, 
00294                 FileXML *file,
00295                 int edit_labels,
00296                 int edit_plugins);
00297         int paste_output(int64_t startproject, 
00298                                 int64_t endproject, 
00299                                 int64_t startsource_sample, 
00300                                 int64_t endsource_sample, 
00301                                 int64_t startsource_frame,
00302                                 int64_t endsource_frame,
00303                                 Asset *asset, 
00304                                 RecordLabels *new_labels);
00305         void paste_silence();
00306 
00307         void paste_transition();
00308         void paste_transition_cwindow(Track *dest_track);
00309         void paste_audio_transition();
00310         void paste_video_transition();
00311         void rebuild_indices();
00312 // Asset removal
00313         void remove_assets_from_project(int push_undo = 0);
00314         void remove_assets_from_disk();
00315         void resize_track(Track *track, int w, int h);
00316         void set_auto_keyframes(int value);
00317 // Update the editing mode
00318         int set_editing_mode(int new_editing_mode);
00319         void set_inpoint(int is_mwindow);
00320         void set_outpoint(int is_mwindow);
00321         void splice(EDL *source);
00322         void toggle_loop_playback();
00323         void trim_selection();
00324 // Synchronize EDL settings with all playback engines depending on current 
00325 // operation.  Doesn't redraw anything.
00326         void sync_parameters(int change_type = CHANGE_PARAMS);
00327         void to_clip();
00328         int toggle_label(int is_mwindow);
00329         void undo_entry(BC_WindowBase *calling_window_gui);
00330         void redo_entry(BC_WindowBase *calling_window_gui);
00331 
00332         int cut_automation();
00333         int copy_automation();
00334         int paste_automation();
00335         void clear_automation();
00336         int cut_default_keyframe();
00337         int copy_default_keyframe();
00338 // Use paste_automation to paste the default keyframe in other position.
00339 // Use paste_default_keyframe to replace the default keyframe with whatever is
00340 // in the clipboard.
00341         int paste_default_keyframe();
00342         int clear_default_keyframe();
00343 
00344         int modify_edithandles();
00345         int modify_pluginhandles();
00346         void finish_modify_handles();
00347 
00348         
00349         
00350         
00351         
00352         
00353 
00354 // Send new EDL to caches
00355         void update_caches();
00356         int optimize_assets();            // delete unused assets from the cache and assets
00357 
00358 // ================================= cursor selection ======================
00359 
00360         void select_point(double position);
00361         int set_loop_boundaries();         // toggle loop playback and set boundaries for loop playback
00362 
00363 // ================================ handle selection =======================
00364 
00365 
00366 
00367         SplashGUI *splash_window;
00368         MainUndo *undo;
00369         Defaults *defaults;
00370         Assets *assets;
00371 // CICaches for drawing timeline only
00372         CICache *audio_cache, *video_cache;
00373         Preferences *preferences;
00374         PreferencesThread *preferences_thread;
00375         MainSession *session;
00376         Theme *theme;
00377         MainIndexes *mainindexes;
00378         MainProgress *mainprogress;
00379         BRender *brender;
00380 
00381 // Menu items
00382         ArrayList<ColormodelItem*> colormodels;
00383         ArrayList<InterlaceautofixoptionItem*> interlace_asset_autofixoptions;
00384         ArrayList<InterlacemodeItem*>          interlace_project_modes;
00385         ArrayList<InterlacemodeItem*>          interlace_asset_modes;
00386         ArrayList<InterlacefixmethodItem*>     interlace_asset_fixmethods;
00387 
00388         int reset_meters();
00389 
00390 // Channel DB for playback only.  Record channel DB's are in record.C
00391         ChannelDB *channeldb_buz;
00392         ChannelDB *channeldb_v4l2jpeg;
00393 
00394 // ====================================== plugins ==============================
00395 
00396 // Contain file descriptors for all the dlopens
00397         ArrayList<PluginServer*> *plugindb;
00398 // Currently visible plugins
00399         ArrayList<PluginServer*> *plugin_guis;
00400 
00401 
00402 // Adjust sample position to line up with frames.
00403         int fix_timing(int64_t &samples_out, 
00404                 int64_t &frames_out, 
00405                 int64_t samples_in);
00406 
00407 
00408         BatchRenderThread *batch_render;
00409         Render *render;
00410 // Master edl
00411         EDL *edl;
00412 // Main Window GUI
00413         MWindowGUI *gui;
00414 // Compositor
00415         CWindow *cwindow;
00416 // Viewer
00417         VWindow *vwindow;
00418 // Asset manager
00419         AWindow *awindow;
00420 // Automation window
00421         GWindow *gwindow;
00422 // Tip of the day
00423         TipWindow *twindow;
00424 // Levels
00425         LevelWindow *lwindow;
00426 // Lock during creation and destruction of GUI
00427         Mutex *plugin_gui_lock;
00428 // Lock during creation and destruction of brender so playback doesn't use it.
00429         Mutex *brender_lock;
00430 
00431 // Initialize channel DB's for playback
00432         void init_channeldb();
00433         void init_render();
00434 // These three happen synchronously with each other
00435 // Make sure this is called after synchronizing EDL's.
00436         void init_brender();
00437 // Restart brender after testing its existence
00438         void restart_brender();
00439 // Stops brender after testing its existence
00440         void stop_brender();
00441 // This one happens asynchronously of the others.  Used by playback to
00442 // see what frame is background rendered.
00443         int brender_available(int position);
00444         void set_brender_start();
00445 
00446         static void init_defaults(Defaults* &defaults, 
00447                 char *config_path);
00448         void init_edl();
00449         void init_awindow();
00450         void init_gwindow();
00451         void init_tipwindow();
00452 // Used by MWindow and RenderFarmClient
00453         static void init_plugins(Preferences *preferences, 
00454                 ArrayList<PluginServer*>* &plugindb,
00455                 SplashGUI *splash_window);
00456         static void init_plugin_path(Preferences *preferences, 
00457                 ArrayList<PluginServer*>* &plugindb,
00458                 FileSystem *fs,
00459                 SplashGUI *splash_window,
00460                 int *counter);
00461         void init_preferences();
00462         void init_signals();
00463         void init_theme();
00464         void init_compositor();
00465         void init_levelwindow();
00466         void init_viewer();
00467         void init_cache();
00468         void init_menus();
00469         void init_indexes();
00470         void init_gui();
00471         void init_playbackcursor();
00472         void delete_plugins();
00473 // 
00474         void clean_indexes();
00475 //      TimeBomb timebomb;
00476         SigHandler *sighandler;
00477 };
00478 
00479 #endif

Generated on Sun Jan 8 13:38:57 2006 for Cinelerra-svn by  doxygen 1.4.4