add transition caching with pref, rev read frame caching, cache lock tweaks, fix...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mwindow.C
index c85212701d68bb1f5e98bb00977958b274c52515..bb04335f118e6b85f9bac7a95ad323fa65c5ce93 100644 (file)
@@ -303,7 +303,7 @@ MWindow::~MWindow()
        gui->del_keyboard_listener(
                (int (BC_WindowBase::*)(BC_WindowBase *))
                &MWindowGUI::keyboard_listener);
-       reset_caches();
+       reset_caches(0);
 #if 0
 // release the hounds
        if( awindow && awindow->gui ) awindow->gui->close(0);
@@ -506,6 +506,13 @@ void MWindow::init_defaults(BC_Hash* &defaults, char *config_path)
 
 void MWindow::check_language()
 {
+       char pref_locale[BCSTRLEN];
+       strcpy(pref_locale, DEFAULT_LOCALE);
+       defaults->get("LOCALE",pref_locale);
+// set LANGUAGE if pref locale != sys
+       if( strcmp(pref_locale, DEFAULT_LOCALE) )
+               setenv("LANGUAGE", pref_locale, 1);
+
        char curr_lang[BCTEXTLEN]; curr_lang[0] = 0;
        const char *env_lang = getenv("LANGUAGE");
        if( !env_lang ) env_lang = getenv("LC_ALL");
@@ -2673,12 +2680,12 @@ void MWindow::create_objects(int want_gui,
        init_3d();
 
        if(debug) PRINT_TRACE
-       show_splash();
 
        if(debug) PRINT_TRACE
        default_standard = default_std();
        init_defaults(defaults, config_path);
        check_language();
+       show_splash();
        init_preferences();
        if(splash_window)
                splash_window->update_status(_("Initializing Plugins"));
@@ -2961,6 +2968,7 @@ void MWindow::show_cwindow()
 {
        session->show_cwindow = 1;
        cwindow->show_window();
+       cwindow->gui->tool_panel->raise_tool();
        gui->mainmenu->show_cwindow->set_checked(1);
 }
 
@@ -3734,8 +3742,7 @@ void MWindow::update_project(int load_mode)
        if( load_mode == LOADMODE_REPLACE ||
            load_mode == LOADMODE_REPLACE_CONCATENATE ) {
                edl->session->timecode_offset = 0;
-               delete gui->keyvalue_popup;
-               gui->keyvalue_popup = 0;
+               gui->close_keyvalue_popup();
                gui->load_panes();
        }
 
@@ -4082,18 +4089,18 @@ void MWindow::update_preferences(Preferences *prefs)
        if( prefs != preferences )
                preferences->copy_from(prefs);
        if( cwindow->playback_engine )
-               cwindow->playback_engine->preferences->copy_from(prefs);
+               cwindow->playback_engine->update_preferences(prefs);
        for(int i = 0; i < vwindows.size(); i++) {
                VWindow *vwindow = vwindows[i];
                if( !vwindow->is_running() ) continue;
                if( vwindow->playback_engine )
-                       vwindow->playback_engine->preferences->copy_from(prefs);
+                       vwindow->playback_engine->update_preferences(prefs);
        }
        for(int i = 0; i < zwindows.size(); i++) {
                ZWindow *zwindow = zwindows[i];
                if( !zwindow->is_running() ) continue;
                if( zwindow->zgui->playback_engine )
-                       zwindow->zgui->playback_engine->preferences->copy_from(prefs);
+                       zwindow->zgui->playback_engine->update_preferences(prefs);
        }
 }
 
@@ -4468,31 +4475,24 @@ int MWindow::create_aspect_ratio(float &w, float &h, int width, int height)
        return 0;
 }
 
-void MWindow::reset_caches()
+void MWindow::reset_caches(int locked)
 {
-       int locked  = gui->get_window_lock();
        if( locked ) gui->unlock_window();
        awindow->gui->stop_vicon_drawing(1);
-       frame_cache->remove_all();
-       wave_cache->remove_all();
-       audio_cache->remove_all();
-       video_cache->remove_all();
-       if( cwindow->playback_engine ) {
-               if( cwindow->playback_engine->audio_cache )
-                       cwindow->playback_engine->audio_cache->remove_all();
-               if( cwindow->playback_engine->video_cache )
-                       cwindow->playback_engine->video_cache->remove_all();
-       }
+       if( cwindow->playback_engine )
+               cwindow->playback_engine->create_cache();
        for(int i = 0; i < vwindows.size(); i++) {
                VWindow *vwindow = vwindows[i];
                if( !vwindow->is_running() ) continue;
                if( !vwindow->playback_engine ) continue;
-               if( vwindow->playback_engine->audio_cache )
-                       vwindow->playback_engine->audio_cache->remove_all();
-               if( vwindow->playback_engine->video_cache )
-                       vwindow->playback_engine->video_cache->remove_all();
+               vwindow->playback_engine->create_cache();
        }
-       if( locked ) gui->lock_window("MWindow::reset_caches");
+       gui->lock_window("MWindow::reset_caches");
+       frame_cache->remove_all();
+       wave_cache->remove_all();
+       audio_cache->remove_all();
+       video_cache->remove_all();
+       if( !locked ) gui->unlock_window();
 }
 
 void MWindow::remove_from_caches(Indexable *idxbl)