rework android-rmt display, add a few buttons
[goodguy/history.git] / cinelerra-5.0 / cinelerra / mwindow.C
index b1216332b4d7e862827bc7adfb8cabe783dee5c3..92bb063bd65b6e35f0088f744d95a93eaf9cb9c4 100644 (file)
@@ -49,7 +49,6 @@
 #include "errorbox.h"
 #include "fileformat.h"
 #include "file.h"
-#include "fileserver.h"
 #include "filesystem.h"
 #include "filexml.h"
 #include "format.inc"
@@ -158,7 +157,6 @@ int atexit(void (*function)(void))
 
 
 ArrayList<PluginServer*>* MWindow::plugindb = 0;
-FileServer* MWindow::file_server = 0;
 Commercials* MWindow::commercials = 0;
 
 
@@ -281,7 +279,6 @@ MWindow::~MWindow()
        join();
 #endif
        reset_caches();
-       delete_plugins();
        dead_plugins->remove_all();
        finit_error();
        keyframe_threads->remove_all_objects();
@@ -313,6 +310,7 @@ MWindow::~MWindow()
        delete assets;          assets = 0;
        delete splash_window;   splash_window = 0;
        delete theme;           theme = 0;
+       delete_plugins();
        delete channeldb_buz;
        delete channeldb_v4l2jpeg;
 // This must be last thread to exit
@@ -437,7 +435,7 @@ void MWindow::init_plugin_index(MWindow *mwindow, Preferences *preferences, FILE
        int vis_id = idx++;
 
        for( int i=0; i<fs.dir_list.total; ++i ) {
-               char *fs_path = fs.dir_list.values[i]->path;
+               char *fs_path = fs.dir_list[i]->path;
                char *base_path = FileSystem::basepath(fs_path), *bp = base_path;
                const char *dp = plug_dir;
                while( *bp && *dp && *bp == *dp ) { ++bp; ++dp; }
@@ -448,24 +446,22 @@ void MWindow::init_plugin_index(MWindow *mwindow, Preferences *preferences, FILE
                        continue;
                }
                if( plugin_exists(plugin_path) ) continue;
-               PluginServer *server = new PluginServer(mwindow, plugin_path, PLUGIN_TYPE_UNKNOWN);
-               result = server->open_plugin(1, preferences, 0, 0);
+               PluginServer server(mwindow, plugin_path, PLUGIN_TYPE_UNKNOWN);
+               result = server.open_plugin(1, preferences, 0, 0);
                if( !result ) {
-                       server->write_table(fp,vis_id);
-                       server->close_plugin();
-                       server->delete_this();
-                       continue;
+                       server.write_table(fp,vis_id);
+                       server.close_plugin();
                }
-               if( result != PLUGINSERVER_IS_LAD ) continue;
-               int lad_index = 0;
-               for(;;) {
-                       PluginServer *server = new PluginServer(mwindow, plugin_path, PLUGIN_TYPE_LADSPA);
-                       server->set_lad_index(lad_index++);
-                       result = server->open_plugin(1, preferences, 0, 0);
-                       if( result ) break;
-                       server->write_table(fp, PLUGIN_LADSPA_ID);
-                       server->close_plugin();
-                       server->delete_this();
+               else if( result == PLUGINSERVER_IS_LAD ) {
+                       int lad_index = 0;
+                       for(;;) {
+                               PluginServer ladspa(mwindow, plugin_path, PLUGIN_TYPE_LADSPA);
+                               ladspa.set_lad_index(lad_index++);
+                               result = ladspa.open_plugin(1, preferences, 0, 0);
+                               if( result ) break;
+                               ladspa.write_table(fp, PLUGIN_LADSPA_ID);
+                               ladspa.close_plugin();
+                       }
                }
        }
 }
@@ -510,7 +506,7 @@ void MWindow::search_plugindb(int do_audio,
 // Get plugins
        for(int i = 0; i < MWindow::plugindb->total; i++)
        {
-               PluginServer *current = MWindow::plugindb->values[i];
+               PluginServer *current = MWindow::plugindb->get(i);
 
                if(current->audio == do_audio &&
                        current->video == do_video &&
@@ -528,13 +524,13 @@ void MWindow::search_plugindb(int do_audio,
                
                for(int i = 0; i < results.total - 1; i++)
                {
-                       PluginServer *value1 = results.values[i];
-                       PluginServer *value2 = results.values[i + 1];
+                       PluginServer *value1 = results[i];
+                       PluginServer *value2 = results[i + 1];
                        if(strcmp(_(value1->title), _(value2->title)) > 0)
                        {
                                done = 0;
-                               results.values[i] = value2;
-                               results.values[i + 1] = value1;
+                               results[i] = value2;
+                               results[i + 1] = value1;
                        }
                }
        }
@@ -551,13 +547,13 @@ PluginServer* MWindow::scan_plugindb(char *title,
 
        for(int i = 0; i < plugindb->total; i++)
        {
-               PluginServer *server = plugindb->values[i];
+               PluginServer *server = plugindb->get(i);
                if(server->title &&
                        !strcasecmp(server->title, title) &&
                        (data_type < 0 ||
                                (data_type == TRACK_AUDIO && server->audio) ||
                                (data_type == TRACK_VIDEO && server->video))) 
-                       return plugindb->values[i];
+                       return plugindb->get(i);
        }
        return 0;
 }
@@ -565,7 +561,7 @@ PluginServer* MWindow::scan_plugindb(char *title,
 int MWindow::plugin_exists(char *plugin_path)
 {
        for( int i=0; i<plugindb->total; ++i ) {
-               PluginServer *server = plugindb->values[i];
+               PluginServer *server = plugindb->get(i);
                if( !strcmp(plugin_path, server->get_path()) ) return 1;
        }
        return 0;
@@ -608,10 +604,10 @@ void MWindow::clean_indexes()
                result = 0;
                for(int i = 0; i < fs.dir_list.total && !result; i++)
                {
-                       fs.join_names(string, preferences->index_directory, fs.dir_list.values[i]->name);
+                       fs.join_names(string, preferences->index_directory, fs.dir_list[i]->name);
                        if(fs.is_dir(string))
                        {
-                               delete fs.dir_list.values[i];
+                               delete fs.dir_list[i];
                                fs.dir_list.remove_number(i);
                                result = 1;
                        }
@@ -625,7 +621,7 @@ void MWindow::clean_indexes()
 // Get oldest
                for(int i = 0; i < fs.dir_list.total; i++)
                {
-                       fs.join_names(string, preferences->index_directory, fs.dir_list.values[i]->name);
+                       fs.join_names(string, preferences->index_directory, fs.dir_list[i]->name);
 
                        if(i == 0 || fs.get_date(string) <= oldest)
                        {
@@ -639,11 +635,11 @@ void MWindow::clean_indexes()
 // Remove index file
                        fs.join_names(string, 
                                preferences->index_directory, 
-                               fs.dir_list.values[oldest_item]->name);
+                               fs.dir_list[oldest_item]->name);
 //printf("MWindow::clean_indexes 1 %s\n", string);
                        if(remove(string))
                                perror("delete_indexes");
-                       delete fs.dir_list.values[oldest_item];
+                       delete fs.dir_list[oldest_item];
                        fs.dir_list.remove_number(oldest_item);
 
 // Remove table of contents if it exists
@@ -695,15 +691,11 @@ void MWindow::init_theme()
        Timer timer;
        theme = 0;
 
-// Replace blond theme with SUV since it doesn't work
-       if(!strcasecmp(preferences->theme, "Blond"))
-               strcpy(preferences->theme, DEFAULT_THEME);
-
        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( plugindb->get(i)->theme &&
+                   !strcasecmp(preferences->theme, plugindb->get(i)->title) )
+                       theme_plugin = plugindb->get(i);
        }
 
        if( !theme_plugin )
@@ -714,9 +706,9 @@ void MWindow::init_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( plugindb->get(i)->theme &&
+                           !strcasecmp(DEFAULT_THEME, plugindb->get(i)->title) )
+                               theme_plugin = plugindb->get(i);
                }
        }
 
@@ -725,17 +717,17 @@ void MWindow::init_theme()
                exit(1);
        }
 
-       PluginServer plugin = *theme_plugin;
-       if( plugin.open_plugin(0, preferences, 0, 0) ) {
+       PluginServer *plugin = new PluginServer(*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 = plugin->new_theme();
        theme->mwindow = this;
-       strcpy(theme->path, plugin.path);
-       plugin.close_plugin();
+       strcpy(theme->path, plugin->path);
+       delete plugin;
 
 // Load default images & settings
        theme->Theme::initialize();
@@ -780,10 +772,10 @@ void MWindow::init_levelwindow()
 VWindow *MWindow::get_viewer(int start_it, int idx)
 {
        vwindows_lock->lock("MWindow::get_viewer");
-       VWindow *vwindow = idx >= 0 && idx < vwindows.size() ? vwindows.get(idx) : 0;
+       VWindow *vwindow = idx >= 0 && idx < vwindows.size() ? vwindows[idx] : 0;
        if( !vwindow ) idx = vwindows.size();
        while( !vwindow && --idx >= 0 ) {
-               VWindow *vwin = vwindows.get(idx);
+               VWindow *vwin = vwindows[idx];
                if( !vwin->is_running() || !vwin->get_edl() )
                        vwindow = vwin;
        }
@@ -1039,7 +1031,7 @@ void MWindow::stop_playback(int wait)
        cwindow->playback_engine->interrupt_playback(wait);
 
        for(int i = 0; i < vwindows.size(); i++) {
-               VWindow *vwindow = vwindows.get(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);
@@ -1064,6 +1056,7 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 // deleted.
        stop_playback(1);
 
+if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
        undo->update_undo_before();
 
 
@@ -1071,11 +1064,11 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 
 // Define new_edls and new_assets to load
        int result = 0, ftype = -1;
-       for(int i = 0; i < filenames->total; i++)
+       for(int i = 0; i < filenames->size(); i++)
        {
 // Get type of file
                File *new_file = new File;
-               Asset *new_asset = new Asset(filenames->values[i]);
+               Asset *new_asset = new Asset(filenames->get(i));
                EDL *new_edl = new EDL;
                char string[BCTEXTLEN];
 
@@ -1190,7 +1183,7 @@ SET_TRACE
                                                }
                                                else
                                                {
-                                                       old_asset = new_edls.values[j]->assets->get_asset(new_asset->path);
+                                                       old_asset = new_edls[j]->assets->get_asset(new_asset->path);
                                                        if( old_asset )
                                                        {
                                                                *new_asset = *old_asset;
@@ -1266,7 +1259,7 @@ SET_TRACE
                        {
                                FileXML xml_file;
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
-                               xml_file.read_from_file(filenames->values[i]);
+                               xml_file.read_from_file(filenames->get(i));
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 
                                if(load_mode == LOADMODE_NESTED)
@@ -1274,7 +1267,7 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 // Load temporary EDL for nesting.
                                        EDL *nested_edl = new EDL;
                                        nested_edl->create_objects();
-                                       nested_edl->set_path(filenames->values[i]);
+                                       nested_edl->set_path(filenames->get(i));
                                        nested_edl->load_xml(&xml_file, LOAD_ALL);
 //printf("MWindow::load_filenames %p %s\n", nested_edl, nested_edl->project_path);
                                        edl_to_nested(new_edl, nested_edl);
@@ -1285,15 +1278,15 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 // Load EDL for pasting
                                        new_edl->load_xml(&xml_file, LOAD_ALL);
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
-                                       test_plugins(new_edl, filenames->values[i]);
+                                       test_plugins(new_edl, filenames->get(i));
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 
                                        if(load_mode == LOADMODE_REPLACE || 
                                                load_mode == LOADMODE_REPLACE_CONCATENATE)
                                        {
-                                               strcpy(session->filename, filenames->values[i]);
+                                               strcpy(session->filename, filenames->get(i));
                                                strcpy(new_edl->local_session->clip_title, 
-                                                       filenames->values[i]);
+                                                       filenames->get(i));
                                                if(update_filename)
                                                        set_filename(new_edl->local_session->clip_title);
                                        }
@@ -1363,7 +1356,7 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
        int got_indexes = 0;
        for(int i = 0; i < new_edls.size(); i++)
        {
-               EDL *new_edl = new_edls.get(i);
+               EDL *new_edl = new_edls[i];
                for(int j = 0; j < new_edl->nested_edls->size(); j++)
                {
                        mainindexes->add_next_asset(0, 
@@ -1379,13 +1372,13 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
        {
                for(int i = 0; i < new_assets.size(); i++)
                {
-                       Asset *new_asset = new_assets.get(i);
+                       Asset *new_asset = new_assets[i];
 
                        File *new_file = 0;
                        int got_it = 0;
                        for(int j = 0; j < new_files.size(); j++)
                        {
-                               new_file = new_files.get(j);
+                               new_file = new_files[j];
                                if(!strcmp(new_file->asset->path,
                                        new_asset->path))
                                {
@@ -1414,7 +1407,7 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
        {
                for(int j = 0; j < track->plugin_set.size(); j++)
                {
-                       PluginSet *plugins = track->plugin_set.get(j);
+                       PluginSet *plugins = track->plugin_set[j];
                        Plugin *plugin = plugins->get_first_plugin();
 
                        while(plugin)
@@ -1454,14 +1447,14 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
                goto_start();
        }
 
-
-       update_project(load_mode);
-
+// need to update undo before project, since mwindow is unlocked & a new load
+// can begin here.  Should really prevent loading until we're done.
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
+       undo->update_undo_after(_("load"), LOAD_ALL);
 
        for(int i = 0; i < new_edls.size(); i++)
        {
-               new_edls.get(i)->remove_user();
+               new_edls[i]->remove_user();
        }
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 
@@ -1469,14 +1462,14 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 
        for(int i = 0; i < new_assets.size(); i++)
        {
-               new_assets.get(i)->Garbage::remove_user();
+               new_assets[i]->Garbage::remove_user();
        }
 
        new_assets.remove_all();
        new_files.remove_all_objects();
 
-       undo->update_undo_after(_("load"), LOAD_ALL);
 
+if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
        if(load_mode == LOADMODE_REPLACE ||
                load_mode == LOADMODE_REPLACE_CONCATENATE)
        {
@@ -1491,6 +1484,10 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 
 
 if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
+       update_project(load_mode);
+
+if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
+
        return 0;
 }
 
@@ -1506,7 +1503,7 @@ void MWindow::test_plugins(EDL *new_edl, char *path)
        {
                for(int k = 0; k < track->plugin_set.total; k++)
                {
-                       PluginSet *plugin_set = track->plugin_set.values[k];
+                       PluginSet *plugin_set = track->plugin_set[k];
                        for(Plugin *plugin = (Plugin*)plugin_set->first; 
                                plugin; 
                                plugin = (Plugin*)plugin->next)
@@ -1607,16 +1604,6 @@ void MWindow::init_shm()
 }
 
 
-void MWindow::init_fileserver(Preferences *preferences)
-{
-#ifdef USE_FILEFORK
-       if( !file_server && preferences->file_forking ) {
-               file_server = new FileServer(preferences);
-               file_server->start();
-       }
-#endif
-}
-
 void MWindow::create_objects(int want_gui, 
        int want_new,
        char *config_path)
@@ -1653,7 +1640,6 @@ void MWindow::create_objects(int want_gui,
 
 // Initialize before too much else is running
 // Preferences & theme are required for building MPEG table of contents
-       init_fileserver(preferences);
 
 // Default project created here
        init_edl();
@@ -1714,7 +1700,7 @@ void MWindow::create_objects(int want_gui,
 // Show all vwindows
 //     if(session->show_vwindow) {
 //             for(int j = 0; j < vwindows.size(); j++) {
-//                     VWindow *vwindow = vwindows.get(j);
+//                     VWindow *vwindow = vwindows[j];
 //                     if( !vwindow->is_running() ) continue;
 //                     if(debug) printf("MWindow::create_objects %d vwindow=%p\n", 
 //                             __LINE__, 
@@ -1801,7 +1787,7 @@ void MWindow::create_objects(int want_gui,
 void MWindow::show_splash()
 {
 #include "data/heroine_logo11_png.h"
-       VFrame *frame = new VFrame(heroine_logo11_png);
+       VFrame *frame = new VFramePng(heroine_logo11_png);
        BC_DisplayInfo display_info;
        splash_window = new SplashGUI(frame, 
                display_info.get_root_w() / 2 - frame->get_w() / 2,
@@ -1821,7 +1807,7 @@ void MWindow::start()
 {
 ENABLE_BUFFER
 //PRINT_TRACE
-//     vwindows.get(DEFAULT_VWINDOW)->start();
+//     vwindows[DEFAULT_VWINDOW]->start();
        awindow->start();
 //PRINT_TRACE
        cwindow->start();
@@ -1846,9 +1832,10 @@ void MWindow::show_vwindow()
        int total_running = 0;
        session->show_vwindow = 1;
 
+//printf("MWindow::show_vwindow %d %d\n", __LINE__, vwindows.size());
 // Raise all windows which are visible
        for(int j = 0; j < vwindows.size(); j++) {
-               VWindow *vwindow = vwindows.get(j);
+               VWindow *vwindow = vwindows[j];
                if( !vwindow->is_running() ) continue;
                vwindow->gui->lock_window("MWindow::show_vwindow");
                vwindow->gui->show_window(0);
@@ -1858,7 +1845,6 @@ void MWindow::show_vwindow()
                total_running++;
        }
 
-//printf("MWindow::show_vwindow %d %d\n", __LINE__, vwindows.size());
 // If no windows visible
        if(!total_running)
        {
@@ -2134,9 +2120,9 @@ SET_TRACE
        for(int i = 0; i < plugin_guis->total; i++)
        {
 // Pointer comparison
-               if(plugin_guis->values[i]->plugin == plugin)
+               if(plugin_guis->get(i)->plugin == plugin)
                {
-                       plugin_guis->values[i]->raise_window();
+                       plugin_guis->get(i)->raise_window();
                        done = 1;
                        break;
                }
@@ -2182,9 +2168,9 @@ void MWindow::hide_plugin(Plugin *plugin, int lock)
        if(lock) plugin_gui_lock->lock("MWindow::hide_plugin");
        for(int i = 0; i < plugin_guis->total; i++)
        {
-               if(plugin_guis->values[i]->plugin == plugin)
+               if(plugin_guis->get(i)->plugin == plugin)
                {
-                       PluginServer *ptr = plugin_guis->values[i];
+                       PluginServer *ptr = plugin_guis->get(i);
                        plugin_guis->remove(ptr);
                        if(lock) plugin_gui_lock->unlock();
 // Last command executed in client side close
@@ -2293,7 +2279,7 @@ void MWindow::update_plugin_guis(int do_keyframe_guis)
        {
                for(int i = 0; i < track->plugin_set.size(); i++)
                {
-                       Plugin *plugin = (Plugin*)track->plugin_set.get(i)->first;
+                       Plugin *plugin = (Plugin*)track->plugin_set[i]->first;
                        while(plugin)
                        {
                                int got_it = 0;
@@ -2328,7 +2314,7 @@ int MWindow::plugin_gui_open(Plugin *plugin)
        plugin_gui_lock->lock("MWindow::plugin_gui_open");
        for(int i = 0; i < plugin_guis->total; i++)
        {
-               if(plugin_guis->values[i]->plugin->identical_location(plugin))
+               if(plugin_guis->get(i)->plugin->identical_location(plugin))
                {
                        result = 1;
                        break;
@@ -2343,9 +2329,9 @@ void MWindow::render_plugin_gui(void *data, Plugin *plugin)
        plugin_gui_lock->lock("MWindow::render_plugin_gui");
        for(int i = 0; i < plugin_guis->total; i++)
        {
-               if(plugin_guis->values[i]->plugin->identical_location(plugin))
+               if(plugin_guis->get(i)->plugin->identical_location(plugin))
                {
-                       plugin_guis->values[i]->render_gui(data);
+                       plugin_guis->get(i)->render_gui(data);
                        break;
                }
        }
@@ -2357,9 +2343,9 @@ void MWindow::render_plugin_gui(void *data, int size, Plugin *plugin)
        plugin_gui_lock->lock("MWindow::render_plugin_gui");
        for(int i = 0; i < plugin_guis->total; i++)
        {
-               if(plugin_guis->values[i]->plugin->identical_location(plugin))
+               if(plugin_guis->get(i)->plugin->identical_location(plugin))
                {
-                       plugin_guis->values[i]->render_gui(data, size);
+                       plugin_guis->get(i)->render_gui(data, size);
                        break;
                }
        }
@@ -2374,8 +2360,8 @@ void MWindow::update_plugin_states()
        {
                int result = 0;
 // Get a plugin GUI
-               Plugin *src_plugin = plugin_guis->values[i]->plugin;
-               PluginServer *src_plugingui = plugin_guis->values[i];
+               Plugin *src_plugin = plugin_guis->get(i)->plugin;
+               PluginServer *src_plugingui = plugin_guis->get(i);
 
 // Search for plugin in EDL.  Only the master EDL shows plugin GUIs.
                for(Track *track = edl->tracks->first; 
@@ -2386,7 +2372,7 @@ void MWindow::update_plugin_states()
                                j < track->plugin_set.total && !result; 
                                j++)
                        {
-                               PluginSet *plugin_set = track->plugin_set.values[j];
+                               PluginSet *plugin_set = track->plugin_set[j];
                                for(Plugin *plugin = (Plugin*)plugin_set->first; 
                                        plugin && !result; 
                                        plugin = (Plugin*)plugin->next)
@@ -2413,7 +2399,7 @@ void MWindow::update_plugin_titles()
 {
        for(int i = 0; i < plugin_guis->total; i++)
        {
-               plugin_guis->values[i]->update_title();
+               plugin_guis->get(i)->update_title();
        }
 }
 
@@ -2549,21 +2535,21 @@ void MWindow::update_project(int load_mode)
                if(session->show_vwindow) first_vwindow = 1;
 // Change visible windows to no source
                for(int i = 0; i < first_vwindow && i < vwindows.size(); i++) {
-                       VWindow *vwindow = vwindows.get(i);
+                       VWindow *vwindow = vwindows[i];
                        if( !vwindow->is_running() ) continue;
                        vwindow->change_source(-1);
                }
 
 // Close remaining windows
                for(int i = first_vwindow; i < vwindows.size(); i++) {
-                       VWindow *vwindow = vwindows.get(i);
+                       VWindow *vwindow = vwindows[i];
                        if( !vwindow->is_running() ) continue;
                        vwindow->close_window();
                }
                if(debug) PRINT_TRACE
        }
        else if(vwindows.size()) {
-               VWindow *vwindow = vwindows.get(DEFAULT_VWINDOW);
+               VWindow *vwindow = vwindows[DEFAULT_VWINDOW];
                if( vwindow->is_running() ) {
                        vwindow->gui->lock_window("MWindow::update_project");
                        vwindow->update(1);
@@ -2610,7 +2596,7 @@ void MWindow::rebuild_indices()
 {
        for(int i = 0; i < session->drag_assets->total; i++)
        {
-               Indexable *indexable = session->drag_assets->values[i];
+               Indexable *indexable = session->drag_assets->get(i);
 //printf("MWindow::rebuild_indices 1 %s\n", indexable->path);
                remove_indexfile(indexable);
 // Schedule index build
@@ -2727,7 +2713,7 @@ void MWindow::reset_caches()
                cwindow->playback_engine->video_cache->remove_all();
        
        for(int i = 0; i < vwindows.size(); i++) {
-               VWindow *vwindow = vwindows.get(i);
+               VWindow *vwindow = vwindows[i];
                if( !vwindow->is_running() ) continue;
                if(vwindow->playback_engine && vwindow->playback_engine->audio_cache)
                        vwindow->playback_engine->audio_cache->remove_all();
@@ -2747,7 +2733,7 @@ void MWindow::remove_asset_from_caches(Asset *asset)
        if( cwindow->playback_engine && cwindow->playback_engine->video_cache )
                cwindow->playback_engine->video_cache->delete_entry(asset);
        for(int i = 0; i < vwindows.size(); i++) {
-               VWindow *vwindow = vwindows.get(i);
+               VWindow *vwindow = vwindows[i];
                if( !vwindow->is_running() ) continue;
                if(vwindow->playback_engine && vwindow->playback_engine->audio_cache)
                        vwindow->playback_engine->audio_cache->delete_entry(asset);
@@ -2757,20 +2743,20 @@ void MWindow::remove_asset_from_caches(Asset *asset)
 }
 
 
-
-void MWindow::remove_assets_from_project(int push_undo)
+void MWindow::remove_assets_from_project(int push_undo, int redraw,
+               ArrayList<Indexable*> *drag_assets, ArrayList<EDL*> *drag_clips)
 {
        for(int i = 0; i < session->drag_assets->total; i++) {
-               Indexable *indexable = session->drag_assets->values[i];
+               Indexable *indexable = session->drag_assets->get(i);
                if(indexable->is_asset) remove_asset_from_caches((Asset*)indexable);
        }
 
 // Remove from VWindow.
        for(int i = 0; i < session->drag_clips->total; i++) {
                for(int j = 0; j < vwindows.size(); j++) {
-                       VWindow *vwindow = vwindows.get(j);
+                       VWindow *vwindow = vwindows[j];
                        if( !vwindow->is_running() ) continue;
-                       if(session->drag_clips->values[i] == vwindow->get_edl()) {
+                       if(session->drag_clips->get(i) == vwindow->get_edl()) {
                                vwindow->gui->lock_window("MWindow::remove_assets_from_project 1");
                                vwindow->delete_source(1, 1);
                                vwindow->gui->unlock_window();
@@ -2780,7 +2766,7 @@ void MWindow::remove_assets_from_project(int push_undo)
        
        for(int i = 0; i < session->drag_assets->size(); i++) {
                for(int j = 0; j < vwindows.size(); j++) {
-                       VWindow *vwindow = vwindows.get(j);
+                       VWindow *vwindow = vwindows[j];
                        if( !vwindow->is_running() ) continue;
                        if(session->drag_assets->get(i) == vwindow->get_source()) {
                                vwindow->gui->lock_window("MWindow::remove_assets_from_project 2");
@@ -2791,35 +2777,38 @@ void MWindow::remove_assets_from_project(int push_undo)
        }
        
        for(int i = 0; i < session->drag_assets->size(); i++) {
-               Indexable *indexable = session->drag_assets->values[i];
+               Indexable *indexable = session->drag_assets->get(i);
                remove_indexfile(indexable);
        }
 
 //printf("MWindow::rebuild_indices 1 %s\n", indexable->path);
        if(push_undo) undo->update_undo_before();
-       edl->remove_from_project(session->drag_assets);
-       edl->remove_from_project(session->drag_clips);
-       save_backup();
+       if(drag_assets) edl->remove_from_project(drag_assets);
+       if(drag_clips) edl->remove_from_project(session->drag_clips);
+       if(redraw) save_backup();
        if(push_undo) undo->update_undo_after(_("remove assets"), LOAD_ALL);
-       restart_brender();
-
-       gui->lock_window("MWindow::remove_assets_from_project 3");
-       gui->update(1,
-               1,
-               1,
-               1,
-               0, 
-               1,
-               0);
-       gui->unlock_window();
-
-       awindow->gui->lock_window("MWindow::remove_assets_from_project 4");
-       awindow->gui->update_assets();
-       awindow->gui->flush();
-       awindow->gui->unlock_window();
+       if(redraw) 
+       {
+               restart_brender();
+
+               gui->lock_window("MWindow::remove_assets_from_project 3");
+               gui->update(1,
+                       1,
+                       1,
+                       1,
+                       0, 
+                       1,
+                       0);
+               gui->unlock_window();
+
+               awindow->gui->lock_window("MWindow::remove_assets_from_project 4");
+               awindow->gui->update_assets();
+               awindow->gui->flush();
+               awindow->gui->unlock_window();
 
-// Removes from playback here
-       sync_parameters(CHANGE_ALL);
+       // Removes from playback here
+               sync_parameters(CHANGE_ALL);
+       }
 }
 
 void MWindow::remove_assets_from_disk()
@@ -2827,10 +2816,13 @@ void MWindow::remove_assets_from_disk()
 // Remove from disk
        for(int i = 0; i < session->drag_assets->total; i++)
        {
-               remove(session->drag_assets->values[i]->path);
+               remove(session->drag_assets->get(i)->path);
        }
 
-       remove_assets_from_project(1);
+       remove_assets_from_project(1, 
+               1, 
+               session->drag_assets,
+               session->drag_clips);
 }
 
 void MWindow::dump_plugins(FILE *fp)
@@ -2840,15 +2832,15 @@ void MWindow::dump_plugins(FILE *fp)
        {
                fprintf(fp, "type=%d audio=%d video=%d rt=%d multi=%d"
                        " synth=%d transition=%d theme=%d %s\n",
-                       plugindb->values[i]->plugin_type,
-                       plugindb->values[i]->audio,
-                       plugindb->values[i]->video,
-                       plugindb->values[i]->realtime,
-                       plugindb->values[i]->multichannel,
-                       plugindb->values[i]->get_synthesis(),
-                       plugindb->values[i]->transition,
-                       plugindb->values[i]->theme,
-                       plugindb->values[i]->title);
+                       plugindb->get(i)->plugin_type,
+                       plugindb->get(i)->audio,
+                       plugindb->get(i)->video,
+                       plugindb->get(i)->realtime,
+                       plugindb->get(i)->multichannel,
+                       plugindb->get(i)->get_synthesis(),
+                       plugindb->get(i)->transition,
+                       plugindb->get(i)->theme,
+                       plugindb->get(i)->title);
        }
 }
 
@@ -2916,7 +2908,7 @@ int MWindow::save_defaults()
        for(int i = 0; i < plugin_guis->total; i++)
        {
 // Pointer comparison
-               plugin_guis->values[i]->save_defaults();
+               plugin_guis->get(i)->save_defaults();
        }
        awindow->save_defaults(defaults);
 
@@ -3086,7 +3078,7 @@ int MWindow::reset_meters()
        cwindow->gui->unlock_window();
 
        for(int j = 0; j < vwindows.size(); j++) {
-               VWindow *vwindow = vwindows.get(j);
+               VWindow *vwindow = vwindows[j];
                if( !vwindow->is_running() ) continue;
                vwindow->gui->lock_window("MWindow::reset_meters 2");
                vwindow->gui->meters->reset_meters();
@@ -3121,7 +3113,7 @@ void MWindow::resync_guis()
        cwindow->gui->unlock_window();
 
        for(int i = 0; i < vwindows.size(); i++) {
-               VWindow *vwindow = vwindows.get(i);
+               VWindow *vwindow = vwindows[i];
                if( !vwindow->is_running() ) continue;
                vwindow->gui->lock_window("MWindow::resync_guis");
                vwindow->gui->resize_event(vwindow->gui->get_w(), 
@@ -3279,6 +3271,6 @@ void MWindow::dump_plugindb(FILE *fp)
 {
        if( !plugindb ) return;
        for(int i = 0; i < plugindb->total; i++)
-               plugindb->values[i]->dump(fp);
+               plugindb->get(i)->dump(fp);
 }