X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindow.C;h=6e1ecaa912d094629747dbd28d3c122f03237679;hb=ddb2a20b7dbae022ea8394b60a97cbaea839ded9;hp=ec1376878f4a2ee62926ebfcb417df4c33dc2fa9;hpb=24db15d85f2e4c986ff91f992e815747c55948f3;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index ec137687..6e1ecaa9 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -201,6 +201,7 @@ MWindow::MWindow() mainprogress = 0; brender = 0; brender_active = 0; + strcpy(cin_lang,"en"); channeldb_buz = new ChannelDB; channeldb_v4l2jpeg = new ChannelDB; //file_server = 0; @@ -230,6 +231,7 @@ MWindow::MWindow() MWindow::~MWindow() { run_lock->lock("MWindow::~MWindow"); + stop_playback(1); in_destructor = 1; //printf("MWindow::~MWindow %d\n", __LINE__); gui->stop_drawing(); @@ -470,7 +472,7 @@ void MWindow::check_language() if( !env_lang ) env_lang = getenv("LC_ALL"); if( !env_lang ) env_lang = getenv("LANG"); if( !env_lang ) { - snprintf(curr_lang, sizeof(curr_lang), "%s-%s.%s", + snprintf(curr_lang, sizeof(curr_lang), "%s_%s-%s", BC_Resources::language, BC_Resources::region, BC_Resources::encoding); env_lang = curr_lang; } @@ -487,6 +489,12 @@ void MWindow::check_language() ::remove(ladspa_path); defaults->save(); } + if( strlen(env_lang) > 1 && + ( env_lang[2] == 0 || env_lang[2] == '_' || env_lang[2] == '.' ) ) { + cin_lang[0] = env_lang[0]; cin_lang[1] = env_lang[1]; cin_lang[2] = 0; + } + else + strcpy(cin_lang, "en"); } void MWindow::get_plugin_path(char *path, const char *plug_dir, const char *fs_path) @@ -725,6 +733,66 @@ void MWindow::add_plugins(ArrayList &plugins) plugins.remove_all(); } +void MWindow::init_plugin_tips(ArrayList &plugins) +{ + const char *cfg_path = File::get_cindat_path(); + char msg_path[BCTEXTLEN]; int txt = 0; + FILE *fp = 0; + if( BC_Resources::language[0] ) { + snprintf(msg_path, sizeof(msg_path), "%s/info/plugins.%s", + cfg_path, BC_Resources::language); + fp = fopen(msg_path, "r"); + } + if( !fp ) { + txt = 1; + snprintf(msg_path, sizeof(msg_path), "%s/info/plugins.txt", + cfg_path); + fp = fopen(msg_path, "r"); + } + if( !fp ) return; + char text[BCTEXTLEN]; + char *tp = text, *ep = tp + sizeof(text)-1; + char title[BCTEXTLEN]; + title[0] = 0; + int no = 0; + for(;;) { + ++no; int done = 1; + char line[BCTEXTLEN], *cp = line; + if( fgets(line,sizeof(line)-1,fp) ) { + if( *cp == '#' ) continue; + done = *cp == ' ' || *cp == '\t' ? 0 : -1; + } + if( done ) { + if( tp > text && *--tp == '\n' ) *tp = 0; + if( title[0] ) { + tp = !txt ? title : _(title); + int idx = plugins.size(); + while( --idx>=0 && strcmp(plugins[idx]->title, tp) ); + if( idx >= 0 ) { + delete [] plugins[idx]->tip; + plugins[idx]->tip = cstrdup(text); + } + title[0] = 0; + } + if( done > 0 ) break; + tp = text; *tp = 0; + char *dp = strchr(cp, ':'); + if( !dp ) { + printf("plugin tips: error on line %d\n", no); + continue; + } + char *bp = title; + while( cp < dp ) *bp++ = *cp++; + *bp = 0; + ++cp; + } + + while( *cp == ' ' || *cp == '\t' ) ++cp; + for( ; tpremove_all_objects(); @@ -919,6 +987,7 @@ void MWindow::init_gwindow() void MWindow::init_tipwindow() { + TipWindow::load_tips(cin_lang); if( !twindow ) twindow = new TipWindow(this); twindow->start(); @@ -953,12 +1022,13 @@ void MWindow::init_theme() fprintf(stderr, _("MWindow::init_theme: prefered theme %s not found.\n"), preferences->theme); - if( !theme_plugin && strcasecmp(preferences->theme, DEFAULT_THEME) ) { + const char *default_theme = _(DEFAULT_THEME); + if( !theme_plugin && strcasecmp(preferences->theme, default_theme) ) { fprintf(stderr, _("MWindow::init_theme: trying default theme %s\n"), - DEFAULT_THEME); + default_theme); for(int i = 0; i < plugindb->total && !theme_plugin; i++) { if( plugindb->get(i)->theme && - !strcasecmp(DEFAULT_THEME, plugindb->get(i)->title) ) + !strcasecmp(default_theme, plugindb->get(i)->title) ) theme_plugin = plugindb->get(i); } } @@ -1171,20 +1241,28 @@ void MWindow::init_brender() void MWindow::restart_brender() { //printf("MWindow::restart_brender 1\n"); - if(!brender_active || !preferences->use_brender) return; - if(brender) brender->restart(edl); + if( !brender_active || !preferences->use_brender ) return; + if( !brender ) return; + int locked = gui->get_window_lock(); + if( locked ) gui->unlock_window(); + brender->restart(edl); + if( locked ) gui->lock_window("MWindow::restart_brender"); } void MWindow::stop_brender() { - if(brender) brender->stop(); + if( !brender ) return; + int locked = gui->get_window_lock(); + if( locked ) gui->unlock_window(); + brender->stop(); + if( locked ) gui->lock_window("MWindow::stop_brender"); } int MWindow::brender_available(int position) { int result = 0; brender_lock->lock("MWindow::brender_available 1"); - if(brender) + if(brender && brender_active) { if(brender->map_valid) { @@ -1217,8 +1295,10 @@ void MWindow::set_brender_active(int v, int update) } restart_brender(); } - else + else { + edl->session->brender_start = edl->session->brender_end = 0; stop_brender(); + } if( update ) { gui->update_timebar(0); gui->draw_overlays(1); @@ -1326,17 +1406,12 @@ void MWindow::stop_playback(int wait) int locked = gui->get_window_lock(); if( locked ) gui->unlock_window(); - cwindow->playback_engine->que->send_command(STOP, - CHANGE_NONE, - 0, - 0); - cwindow->playback_engine->interrupt_playback(wait); + cwindow->playback_engine->stop_playback(); for(int i = 0; i < vwindows.size(); i++) { VWindow *vwindow = vwindows[i]; if( !vwindow->is_running() ) continue; - vwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, 0, 0); - vwindow->playback_engine->interrupt_playback(wait); + vwindow->playback_engine->stop_playback(); } if( locked ) gui->lock_window("MWindow::stop_playback"); } @@ -1455,6 +1530,7 @@ SET_TRACE case FILE_NOT_FOUND: sprintf(string, _("Failed to open %s"), new_asset->path); gui->show_message(string, theme->message_error); + gui->update_default_message(); break; // Unknown format @@ -1596,6 +1672,15 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); if(update_filename) set_filename(new_edl->local_session->clip_title); } + else + if( load_mode == LOADMODE_RESOURCESONLY ) { + strcpy(new_edl->local_session->clip_title, + filenames->get(i)); + struct stat st; + time_t t = !stat(filenames->get(i),&st) ? + st.st_mtime : time(&t); + ctime_r(&t, new_edl->local_session->clip_notes); + } } new_edls.append(new_edl); @@ -1616,12 +1701,10 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); if(debug) printf("MWindow::load_filenames %d\n", __LINE__); - if(!result) gui->statusbar->default_message(); - - - - - + if(!result) { + gui->reset_default_message(); + gui->default_message(); + } if(debug) printf("MWindow::load_filenames %d\n", __LINE__); @@ -1644,10 +1727,7 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); edl->session->autos_follow_edits); } - paste_edls(&new_edls, - load_mode, - 0, - -1, + paste_edls(&new_edls, load_mode, 0, -1, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits, @@ -1675,32 +1755,26 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); } if(debug) printf("MWindow::load_filenames %d\n", __LINE__); - if(new_assets.size()) + for(int i = 0; i < new_assets.size(); i++) { - for(int i = 0; i < new_assets.size(); i++) - { - Asset *new_asset = new_assets[i]; + Asset *new_asset = new_assets[i]; - File *new_file = 0; - int got_it = 0; - for(int j = 0; j < new_files.size(); j++) + File *new_file = 0; + int got_it = 0; + for(int j = 0; j < new_files.size(); j++) + { + new_file = new_files[j]; + if(!strcmp(new_file->asset->path, + new_asset->path)) { - new_file = new_files[j]; - if(!strcmp(new_file->asset->path, - new_asset->path)) - { - got_it = 1; - break; - } + got_it = 1; + break; } - - mainindexes->add_next_asset(got_it ? new_file : 0, new_asset); - got_indexes = 1; - edl->assets->update(new_asset); - } - + mainindexes->add_next_asset(got_it ? new_file : 0, new_asset); + got_indexes = 1; + edl->assets->update(new_asset); } if(debug) printf("MWindow::load_filenames %d\n", __LINE__); @@ -1728,10 +1802,6 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); show_plugin(plugin); } } - else - { - plugin->show = 0; - } plugin = (Plugin*)plugin->next; } @@ -1937,6 +2007,7 @@ void MWindow::create_objects(int want_gui, if(debug) PRINT_TRACE init_ladspa_plugins(this, preferences); if(debug) PRINT_TRACE + init_plugin_tips(*plugindb); if(splash_window) splash_window->operation->update(_("Initializing GUI")); if(debug) PRINT_TRACE @@ -1965,6 +2036,9 @@ void MWindow::create_objects(int want_gui, Timer timer; + init_awindow(); + if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); + init_compositor(); if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); @@ -1976,24 +2050,21 @@ void MWindow::create_objects(int want_gui, init_gui(); if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); - init_awindow(); - if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); - init_levelwindow(); if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); - if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); - init_indexes(); if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); init_channeldb(); - if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); + init_gwindow(); if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); + init_render(); if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference()); + init_brender(); init_exportedl(); init_commercials(); @@ -2877,7 +2948,7 @@ void MWindow::update_project(int load_mode) const int debug = 0; if(debug) PRINT_TRACE - restart_brender(); + init_brender(); edl->tracks->update_y_pixels(theme); if(debug) PRINT_TRACE @@ -2969,9 +3040,13 @@ void MWindow::rebuild_indices() index_state->index_status = INDEX_NOTTESTED; if( indexable->is_asset ) { Asset *asset = (Asset *)indexable; - if( asset->format != FILE_PCM ) + if( asset->format != FILE_PCM ) { + asset->format = FILE_UNKNOWN; asset->reset_audio(); + } asset->reset_video(); +// File file; // re-probe the asset +// file.open_file(preferences, asset, 1, 0); } mainindexes->add_next_asset(0, indexable); } @@ -3116,8 +3191,8 @@ void MWindow::remove_asset_from_caches(Asset *asset) void MWindow::remove_assets_from_project(int push_undo, int redraw, ArrayList *drag_assets, ArrayList *drag_clips) { - for(int i = 0; i < session->drag_assets->total; i++) { - Indexable *indexable = session->drag_assets->get(i); + for(int i = 0; i < drag_assets->total; i++) { + Indexable *indexable = drag_assets->get(i); if(indexable->is_asset) remove_asset_from_caches((Asset*)indexable); } @@ -3134,11 +3209,11 @@ void MWindow::remove_assets_from_project(int push_undo, int redraw, } } - for(int i = 0; i < session->drag_assets->size(); i++) { + for(int i = 0; i < drag_assets->size(); i++) { for(int j = 0; j < vwindows.size(); j++) { VWindow *vwindow = vwindows[j]; if( !vwindow->is_running() ) continue; - if(session->drag_assets->get(i) == vwindow->get_source()) { + if(drag_assets->get(i) == vwindow->get_source()) { vwindow->gui->lock_window("MWindow::remove_assets_from_project 2"); vwindow->delete_source(1, 1); vwindow->gui->unlock_window(); @@ -3146,29 +3221,22 @@ void MWindow::remove_assets_from_project(int push_undo, int redraw, } } - for(int i = 0; i < session->drag_assets->size(); i++) { - Indexable *indexable = session->drag_assets->get(i); + for(int i = 0; i < drag_assets->size(); i++) { + Indexable *indexable = drag_assets->get(i); remove_indexfile(indexable); } //printf("MWindow::rebuild_indices 1 %s\n", indexable->path); if(push_undo) undo->update_undo_before(); if(drag_assets) edl->remove_from_project(drag_assets); - if(drag_clips) edl->remove_from_project(session->drag_clips); + if(drag_clips) edl->remove_from_project(drag_clips); if(redraw) save_backup(); if(push_undo) undo->update_undo_after(_("remove assets"), LOAD_ALL); - if(redraw) - { + if(redraw) { restart_brender(); gui->lock_window("MWindow::remove_assets_from_project 3"); - gui->update(1, - 1, - 1, - 1, - 0, - 1, - 0); + gui->update(1, 1, 1, 1, 0, 1, 0); gui->unlock_window(); // Removes from playback here