several bug fixes and minor feature changes:
[goodguy/history.git] / cinelerra-5.0 / cinelerra / mwindow.C
index 7ad079b382fba0341bb98dd34ed51c8aad5fca49..1a1d4dbae293db9ba4543dc807f828c3c1b40976 100644 (file)
@@ -235,7 +235,6 @@ MWindow::~MWindow()
        hide_keyframe_guis();
        clean_indexes();
        save_defaults();
-
 // Give up and go to a movie
 //  cant run valgrind if this is used
 //     if( !reload_status ) exit(0);
@@ -330,8 +329,7 @@ void MWindow::quit(int unlock)
        interrupt_indexes();
        clean_indexes();
        save_defaults();
-// This is the last thread to exit
-       playback_3d->quit();
+       gui->set_done(0);
        if(unlock) gui->lock_window("MWindow::quit");
 }
 
@@ -671,27 +669,44 @@ void MWindow::init_theme()
        if(!strcasecmp(preferences->theme, "Blond"))
                strcpy(preferences->theme, DEFAULT_THEME);
 
-       for(int i = 0; i < plugindb->total; i++)
-       {
-               if(plugindb->values[i]->theme &&
-                       !strcasecmp(preferences->theme, plugindb->values[i]->title))
-               {
-                       PluginServer plugin = *plugindb->values[i];
-                       plugin.open_plugin(0, preferences, 0, 0);
-                       theme = plugin.new_theme();
-                       theme->mwindow = this;
-                       strcpy(theme->path, plugin.path);
-                       plugin.close_plugin();
-                       break;
+       PluginServer *theme_plugin = 0;
+       for(int i = 0; i < plugindb->total && !theme_plugin; i++) {
+               if( plugindb->values[i]->theme &&
+                   !strcasecmp(preferences->theme, plugindb->values[i]->title) )
+                       theme_plugin = plugindb->values[i];
+       }
+
+       if( !theme_plugin )
+               fprintf(stderr, _("MWindow::init_theme: prefered theme %s not found.\n"),
+                        preferences->theme);
+
+       if( !theme_plugin && strcasecmp(preferences->theme, DEFAULT_THEME) ) {
+               fprintf(stderr, _("MWindow::init_theme: trying default theme %s\n"),
+                       DEFAULT_THEME);
+               for(int i = 0; i < plugindb->total && !theme_plugin; i++) {
+                       if( plugindb->values[i]->theme &&
+                           !strcasecmp(DEFAULT_THEME, plugindb->values[i]->title) )
+                               theme_plugin = plugindb->values[i];
                }
        }
 
-       if(!theme)
-       {
-               fprintf(stderr, _("MWindow::init_theme: theme %s not found.\n"), preferences->theme);
+       if(!theme_plugin) {
+               fprintf(stderr, _("MWindow::init_theme: theme_plugin not found.\n"));
+               exit(1);
+       }
+
+       PluginServer plugin = *theme_plugin;
+       if( plugin.open_plugin(0, preferences, 0, 0) ) {
+               fprintf(stderr, _("MWindow::init_theme: unable to load theme %s\n"),
+                       theme_plugin->title);
                exit(1);
        }
 
+       theme = plugin.new_theme();
+       theme->mwindow = this;
+       strcpy(theme->path, plugin.path);
+       plugin.close_plugin();
+
 // Load default images & settings
        theme->Theme::initialize();
 // Load user images & settings
@@ -1593,7 +1608,6 @@ void MWindow::create_objects(int want_gui,
        if(debug) PRINT_TRACE
 //     show_splash();
 
-       init_error();
        if(debug) PRINT_TRACE
        init_defaults(defaults, config_path);
        init_preferences();
@@ -1603,6 +1617,7 @@ void MWindow::create_objects(int want_gui,
        if(debug) PRINT_TRACE
        init_theme();
        if(debug) PRINT_TRACE
+       init_error();
 
        char string[BCTEXTLEN];
        strcpy(string, preferences->plugin_dir);
@@ -1790,7 +1805,7 @@ ENABLE_BUFFER
 //PRINT_TRACE
        gwindow->start();
 //PRINT_TRACE
-       Thread::start();
+//     Thread::start();
 //PRINT_TRACE
        playback_3d->start();
 //PRINT_TRACE