X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindow.C;h=156c9532abfb3742ae1e82987db95bdfdefd9408;hb=2ba7e9962ea989863e152373e96a09b00a0b4eb8;hp=dcca2ca75d6470512a18bc2ff26fd1ccf1555b46;hpb=089f2be86316b88f72a6c359ab10e2b95539005b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index dcca2ca7..156c9532 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -20,7 +20,9 @@ #include "asset.h" #include "assets.h" +#include "atrack.h" #include "audioalsa.h" +#include "autos.h" #include "awindowgui.h" #include "awindow.h" #include "batchrender.h" @@ -52,11 +54,13 @@ #include "file.h" #include "filesystem.h" #include "filexml.h" +#include "floatautos.h" #include "framecache.h" #include "gwindow.h" #include "gwindowgui.h" #include "keyframegui.h" #include "indexfile.h" +#include "intautos.h" #include "interlacemodes.h" #include "language.h" #include "levelwindowgui.h" @@ -76,6 +80,7 @@ #include "mwindow.h" #include "nestededls.h" #include "new.h" +#include "panautos.h" #include "patchbay.h" #include "playback3d.h" #include "playbackengine.h" @@ -106,6 +111,8 @@ #include "transition.h" #include "transportque.h" #include "vframe.h" +#include "vtrack.h" +#include "versioninfo.h" #include "videodevice.inc" #include "videowindow.h" #include "vplayback.h" @@ -235,6 +242,7 @@ MWindow::~MWindow() delete create_bd; create_bd = 0; delete create_dvd; create_dvd = 0; delete batch_render; batch_render = 0; + delete render; render = 0; commit_commercial(); if( commercials && !commercials->remove_user() ) commercials = 0; @@ -292,15 +300,13 @@ MWindow::~MWindow() finit_error(); keyframe_threads->remove_all_objects(); colormodels.remove_all_objects(); - delete gui; gui = 0; - delete render; render = 0; delete awindow; awindow = 0; delete lwindow; lwindow = 0; delete twindow; twindow = 0; delete wwindow; wwindow = 0; delete gwindow; gwindow = 0; - // must be last or nouveau chokes delete cwindow; cwindow = 0; + delete gui; gui = 0; //delete file_server; file_server = 0; // reusable delete mainindexes; mainindexes = 0; delete mainprogress; mainprogress = 0; @@ -340,8 +346,8 @@ MWindow::~MWindow() void MWindow::quit(int unlock) { - stop_playback(1); if(unlock) gui->unlock_window(); + stop_playback(1); brender_lock->lock("MWindow::quit"); delete brender; brender = 0; @@ -640,14 +646,14 @@ int MWindow::init_ladspa_index(MWindow *mwindow, Preferences *preferences, strcpy(plugin_path, path); delete [] path; printf("init ladspa index: %s\n", plugin_dir); FILE *fp = fopen(index_path,"w"); - if( !fp ) { + if( !fp ) { fprintf(stderr,_("MWindow::init_ladspa_index: " "can't create plugin index: %s\n"), index_path); return 1; } fprintf(fp, "%d\n", PLUGIN_FILE_VERSION); fprintf(fp, "%s\n", plugin_dir); - init_plugin_index(mwindow, preferences, fp, plugin_path); + init_plugin_index(mwindow, preferences, fp, plugin_path); fclose(fp); return 0; } @@ -795,6 +801,7 @@ void MWindow::init_preferences() BC_Signals::set_trap_hook(trap_hook, this); BC_Signals::set_catch_segv(preferences->trap_sigsegv); BC_Signals::set_catch_intr(preferences->trap_sigintr); + BC_WindowBase::get_resources()->popupmenu_btnup = preferences->popupmenu_btnup; } void MWindow::clean_indexes() @@ -902,6 +909,11 @@ void MWindow::show_warning(int *do_warning, const char *text) wwindow->show_warning(do_warning, text); } +int MWindow::wait_warning() +{ + return wwindow->wait_result(); +} + void MWindow::init_theme() { Timer timer; @@ -1272,7 +1284,7 @@ int MWindow::put_commercial() void MWindow::stop_playback(int wait) { int locked = gui->get_window_lock(); - if( locked ) gui->unlock_window(); + if( locked ) gui->unlock_window(); cwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, @@ -1286,7 +1298,7 @@ void MWindow::stop_playback(int wait) vwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, 0, 0); vwindow->playback_engine->interrupt_playback(wait); } - if( locked ) gui->lock_window("MWindow::stop_playback"); + if( locked ) gui->lock_window("MWindow::stop_playback"); } int MWindow::load_filenames(ArrayList *filenames, @@ -1495,7 +1507,29 @@ SET_TRACE if(debug) printf("MWindow::load_filenames %d\n", __LINE__); xml_file.read_from_file(filenames->get(i)); if(debug) printf("MWindow::load_filenames %d\n", __LINE__); - + const char *cin_version = 0; + while( !xml_file.read_tag() ) { + if( xml_file.tag.title_is("EDL") ) { + cin_version = xml_file.tag.get_property("VERSION"); + break; + } + } + xml_file.rewind(); + if( !cin_version ) { + eprintf(_("XML file %s\n not from cinelerra."),filenames->get(i)); + char string[BCTEXTLEN]; + sprintf(string,_("Unknown %s"), filenames->get(i)); + gui->show_message(string); + result = 1; + break; + } + if( strcmp(cin_version, CINELERRA_VERSION) ) { + char string[BCTEXTLEN]; + snprintf(string, sizeof(string), + _("Warning: XML from cinelerra version %s\n" + "Session data may be incompatible."), cin_version); + show_warning(&preferences->warn_version, string); + } if(load_mode == LOADMODE_NESTED) { // Load temporary EDL for nesting. @@ -2130,6 +2164,14 @@ void MWindow::show_gwindow() gui->mainmenu->show_gwindow->set_checked(1); } +void MWindow::hide_gwindow() +{ + session->show_gwindow = 0; + + gwindow->gui->lock_window("MWindow::show_gwindow"); + gwindow->gui->hide_window(); + gwindow->gui->unlock_window(); +} void MWindow::show_lwindow() { @@ -2192,6 +2234,22 @@ void MWindow::set_auto_keyframes(int value, int lock_mwindow, int lock_cwindow) if(lock_cwindow) cwindow->gui->unlock_window(); } +void MWindow::set_auto_visibility(Autos *autos, int value) +{ + if( autos->type == Autos::AUTOMATION_TYPE_PLUGIN ) + edl->session->auto_conf->plugins = value; + else if( autos->autoidx >= 0 ) + edl->session->auto_conf->autos[autos->autoidx] = value; + else + return; + + gui->update(0, 1, 0, 0, 0, 0, 0); + gui->mainmenu->update_toggles(1); + gui->unlock_window(); + gwindow->gui->update_toggles(1); + gui->lock_window("MWindow::set_auto_visibility"); +} + void MWindow::set_keyframe_type(int mode) { gui->lock_window("MWindow::set_keyframe_type"); @@ -2433,7 +2491,7 @@ void MWindow::hide_plugin(Plugin *plugin, int lock) ptr->hide_gui(); delete_plugin(ptr); //sleep(1); -// return; + return; } } if(lock) plugin_gui_lock->unlock(); @@ -2880,7 +2938,6 @@ void MWindow::save_backup() File::get_config_path(), BACKUP_FILE); edl->save_xml(&file, backup_path, 0, 0); file.terminate_string(); - char path[BCTEXTLEN]; FileSystem fs; fs.complete_path(backup_path); @@ -3117,15 +3174,25 @@ void MWindow::dump_undo(FILE *fp) void MWindow::dump_exe(FILE *fp) { - char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN]; - sprintf(proc_path, "/proc/%d/exe", (int)getpid()); - int ret = readlink(proc_path, exe_path, sizeof(exe_path)); - if( ret < 0 ) { fprintf(fp,"readlink: %m\n"); return; } - exe_path[ret] = 0; + char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN]; + sprintf(proc_path, "/proc/%d/exe", (int)getpid()); + + int ret = -1, n = 100; + for( int len; (len=readlink(proc_path, exe_path, sizeof(exe_path)))>0; --n ) { + exe_path[len] = 0; strcpy(proc_path, exe_path); + ret = 0; + } + if( n < 0 || ret < 0 ) { fprintf(fp,"readlink: %m\n"); return; } + struct stat st; - if( stat(exe_path,&st) ) { fprintf(fp,"stat: %m\n"); return; } - fprintf(fp, "path: %s = %9jd bytes\n",exe_path,st.st_size); - int fd = open(exe_path,O_RDONLY+O_NONBLOCK); + if( stat(proc_path,&st) ) { fprintf(fp,"stat: %m\n"); return; } + fprintf(fp, "path: %s = %9jd bytes\n",proc_path,st.st_size); + struct tm *tm = localtime(&st.st_mtime); + char mtime[256]; + strftime(mtime, sizeof(mtime), "%F %T", tm); + fprintf(fp,"mtime: %s\n", mtime); + + int fd = open(proc_path,O_RDONLY+O_NONBLOCK); if( fd < 0 ) { fprintf(fp,"open: %m\n"); return; } uint8_t *bfr = 0; int64_t bfrsz = 0; @@ -3422,6 +3489,8 @@ int MWindow::select_asset(Asset *asset, int vstream, int astream, int delete_tra EDLSession *session = edl->session; double old_framerate = session->frame_rate; double old_samplerate = session->sample_rate; + int old_auto_keyframes = session->auto_keyframes; + session->auto_keyframes = 0; int result = file->open_file(preferences, asset, 1, 0); if( !result && delete_tracks > 0 ) undo->update_undo_before(); @@ -3535,6 +3604,7 @@ int MWindow::select_asset(Asset *asset, int vstream, int astream, int delete_tra edl->resample(old_samplerate, session->sample_rate, TRACK_AUDIO); } delete file; + session->auto_keyframes = old_auto_keyframes; if( !result && delete_tracks > 0 ) { save_backup(); undo->update_undo_after(_("select asset"), LOAD_ALL); @@ -3563,3 +3633,34 @@ void MWindow::dump_plugindb(FILE *fp) plugindb->get(i)->dump(fp); } +FloatAuto* MWindow::get_float_auto(PatchGUI *patch,int idx) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + FloatAutos *ptr = (FloatAutos*)patch->track->automation->autos[idx]; + return (FloatAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + +IntAuto* MWindow::get_int_auto(PatchGUI *patch,int idx) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + IntAutos *ptr = (IntAutos*)patch->track->automation->autos[idx]; + return (IntAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + +PanAuto* MWindow::get_pan_auto(PatchGUI *patch) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + PanAutos *ptr = (PanAutos*)patch->track->automation->autos[AUTOMATION_PAN]; + return (PanAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + +