bsd compatibility mods
[goodguy/history.git] / cinelerra-5.1 / cinelerra / awindowgui.C
index 0ed6b1ce0fd3da31afd2e4b1ada67f50711be173..186dcc5b5b0efdb94c4b291de371d334c716ee55 100644 (file)
@@ -57,6 +57,7 @@
 #include "newfolder.h"
 #include "preferences.h"
 #include "proxy.h"
+#include "proxypopup.h"
 #include "renderengine.h"
 #include "samples.h"
 #include "theme.h"
@@ -551,6 +552,7 @@ void AssetPicon::create_objects()
                                        pixmap_w = pixmap_h * 16/9;
                                        icon_vframe = new VFrame(0,
                                                -1, pixmap_w, pixmap_h, BC_RGB888, -1);
+                                       icon_vframe->clear_frame();
                                        { char string[BCTEXTLEN];
                                        sprintf(string, _("Reading %s"), name);
                                        mwindow->gui->lock_window("AssetPicon::create_objects 3");
@@ -683,6 +685,7 @@ void AssetPicon::create_objects()
                                        pixmap_w = pixmap_h * 16/9;
                                        icon_vframe = new VFrame(0,
                                                -1, pixmap_w, pixmap_h, BC_RGB888, -1);
+                                       icon_vframe->clear_frame();
                                        char string[BCTEXTLEN];
                                        sprintf(string, _("Rendering %s"), name);
                                        mwindow->gui->lock_window("AssetPicon::create_objects 3");
@@ -833,6 +836,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
        effectlist_menu = 0;
        assetlist_menu = 0;
        cliplist_menu = 0;
+       proxylist_menu = 0;
        labellist_menu = 0;
        folderlist_menu = 0;
        temp_picon = 0;
@@ -860,14 +864,6 @@ AWindowGUI::~AWindowGUI()
        delete vicon_audio;
        delete newfolder_thread;
 
-       delete asset_menu;
-       delete clip_menu;
-       delete label_menu;
-       delete effectlist_menu;
-       delete assetlist_menu;
-       delete cliplist_menu;
-       delete labellist_menu;
-       delete folderlist_menu;
        delete search_text;
        delete temp_picon;
        delete remove_plugin;
@@ -1060,6 +1056,8 @@ void AWindowGUI::create_objects()
        clip_menu->create_objects();
        add_subwindow(label_menu = new LabelPopup(mwindow, this));
        label_menu->create_objects();
+       add_subwindow(proxy_menu = new ProxyPopup(mwindow, this));
+       proxy_menu->create_objects();
 
        add_subwindow(effectlist_menu = new EffectListMenu(mwindow, this));
        effectlist_menu->create_objects();
@@ -1069,6 +1067,8 @@ void AWindowGUI::create_objects()
        cliplist_menu->create_objects();
        add_subwindow(labellist_menu = new LabelListMenu(mwindow, this));
        labellist_menu->create_objects();
+       add_subwindow(proxylist_menu = new ProxyListMenu(mwindow, this));
+       proxylist_menu->create_objects();
 
        add_subwindow(folderlist_menu = new FolderListMenu(mwindow, this));
        folderlist_menu->create_objects();
@@ -1310,6 +1310,12 @@ int AWindowGUI::keypress_event()
                        return 1;
                }
                break;
+       case 'o':
+               if( !ctrl_down() && !shift_down() ) {
+                       assetlist_menu->load_file->handle_event();
+                       return 1;
+               }
+               break;
        case DELETE:
                if( shift_down() ) {
                        PluginServer* plugin = selected_plugin();
@@ -1420,11 +1426,13 @@ void AWindowGUI::create_label_folder()
 
 void AWindowGUI::update_asset_list()
 {
+       ArrayList<AssetPicon *> new_assets;
        for( int i = 0; i < assets.total; i++ ) {
                AssetPicon *picon = (AssetPicon*)assets.values[i];
                picon->in_use = 0;
        }
 
+       mwindow->gui->lock_window("AWindowGUI::update_asset_list");
 // Synchronize EDL clips
        for( int i=0; i<mwindow->edl->clips.size(); ++i ) {
                int exists = 0;
@@ -1445,8 +1453,7 @@ void AWindowGUI::update_asset_list()
                if( !exists ) {
                        AssetPicon *picon = new AssetPicon(mwindow,
                                this, mwindow->edl->clips[i]);
-                       picon->create_objects();
-                       assets.append(picon);
+                       new_assets.append(picon);
                }
        }
 
@@ -1469,15 +1476,10 @@ void AWindowGUI::update_asset_list()
                if( !exists ) {
                        AssetPicon *picon = new AssetPicon(mwindow,
                                this, current);
-                       picon->create_objects();
-                       assets.append(picon);
+                       new_assets.append(picon);
                }
        }
 
-       mwindow->gui->lock_window("AWindowGUI::update_asset_list");
-       mwindow->gui->default_message();
-       mwindow->gui->unlock_window();
-
 // Synchronize nested EDLs
        for( int i=0; i<mwindow->edl->nested_edls.size(); ++i ) {
                int exists = 0;
@@ -1498,10 +1500,20 @@ void AWindowGUI::update_asset_list()
                if( !exists ) {
                        AssetPicon *picon = new AssetPicon(mwindow,
                                this, (Indexable*)nested_edl);
-                       picon->create_objects();
-                       assets.append(picon);
+                       new_assets.append(picon);
                }
        }
+       mwindow->gui->unlock_window();
+
+       for( int i=0; i<new_assets.size(); ++i ) {
+               AssetPicon *picon = new_assets[i];
+               picon->create_objects();
+               assets.append(picon);
+       }
+
+       mwindow->gui->lock_window();
+       mwindow->gui->default_message();
+       mwindow->gui->unlock_window();
 
        for( int i = assets.size() - 1; i >= 0; i-- ) {
                AssetPicon *picon = (AssetPicon*)assets.get(i);
@@ -1584,6 +1596,7 @@ EDL *AWindowGUI::collect_proxy(Indexable *indexable)
        EDL *proxy_edl = new EDL(mwindow->edl);
        proxy_edl->create_objects();
        FileSystem fs;  fs.extract_name(path, proxy_asset->path);
+       proxy_edl->set_path(path);
        strcpy(proxy_edl->local_session->clip_title, path);
        strcpy(proxy_edl->local_session->clip_notes, _("Proxy clip"));
        proxy_edl->session->video_tracks = proxy_asset->layers;
@@ -1653,7 +1666,7 @@ void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
                        if( picon->edl )
                                dst[1].append(item2 = new BC_ListBoxItem(picon->edl->local_session->clip_notes));
                        else
-                       if( picon->label && picon->label->textstr )
+                       if( picon->label )
                                dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
                        else if( picon->mtime ) {
                                char date_time[BCSTRLEN];
@@ -1999,8 +2012,11 @@ int AWindowAssets::button_press_event()
                        gui->cliplist_menu->update();
                        gui->cliplist_menu->activate_menu();
                        break;
-               case AW_MEDIA_FOLDER:
                case AW_PROXY_FOLDER:
+                       gui->proxylist_menu->update();
+                       gui->proxylist_menu->activate_menu();
+                       break;
+               case AW_MEDIA_FOLDER:
                        gui->assetlist_menu->update_titles(folder==AW_MEDIA_FOLDER);
                        gui->assetlist_menu->activate_menu();
                        break;
@@ -2016,20 +2032,30 @@ int AWindowAssets::handle_event()
 {
        AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
        if( !asset_picon ) return 0;
+       Indexable *picon_idxbl = asset_picon->indexable;
+       EDL *picon_edl = asset_picon->edl;
+       int proxy = 0;
+       VWindow *vwindow = 0;
        switch( mwindow->edl->session->awindow_folder ) {
        case AW_AEFFECT_FOLDER:
        case AW_VEFFECT_FOLDER:
        case AW_ATRANSITION_FOLDER:
        case AW_VTRANSITION_FOLDER: return 1;
+       case AW_PROXY_FOLDER:
+               proxy = 1; // fall thru
+       default:
+               if( mwindow->vwindows.size() > DEFAULT_VWINDOW )
+                       vwindow = mwindow->vwindows.get(DEFAULT_VWINDOW);
+               break;
        }
-       VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
-               mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
        if( !vwindow || !vwindow->is_running() ) return 1;
+       if( proxy && picon_idxbl ) {
+               picon_edl = gui->collect_proxy(picon_idxbl);
+               picon_idxbl = 0;
+       }
 
-       if( asset_picon->indexable )
-               vwindow->change_source(asset_picon->indexable);
-       else if( asset_picon->edl )
-               vwindow->change_source(asset_picon->edl);
+       if( picon_idxbl ) vwindow->change_source(picon_idxbl);
+       else if( picon_edl ) vwindow->change_source(picon_edl);
        return 1;
 }
 
@@ -2057,6 +2083,11 @@ int AWindowAssets::selection_changed()
                        gui->clip_menu->update();
                        gui->clip_menu->activate_menu();
                        break;
+               case AW_PROXY_FOLDER:
+                       if( !item->indexable && !item->edl ) break;
+                       gui->proxy_menu->update();
+                       gui->proxy_menu->activate_menu();
+                       break;
                default:
                        if( !item->indexable && !item->edl ) break;
                        gui->asset_menu->update();
@@ -2452,10 +2483,14 @@ AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *
 void AddTools::create_objects()
 {
        uint64_t vis = 0;
-       add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
-       vis |= 1 << PLUGIN_LADSPA_ID;
        add_item(new AddPluginItem(this, "ffmpeg", PLUGIN_FFMPEG_ID));
        vis |= 1 << PLUGIN_FFMPEG_ID;
+       add_item(new AddPluginItem(this, "ladspa", PLUGIN_LADSPA_ID));
+       vis |= 1 << PLUGIN_LADSPA_ID;
+#ifdef HAVE_LV2
+       add_item(new AddPluginItem(this, "lv2", PLUGIN_LV2_ID));
+       vis |= 1 << PLUGIN_LV2_ID;
+#endif
        for( int i=0; i<MWindow::plugindb->size(); ++i ) {
                PluginServer *plugin = MWindow::plugindb->get(i);
                if( !plugin->audio && !plugin->video ) continue;
@@ -2474,8 +2509,9 @@ void AddTools::create_objects()
 
 #if 0
 // plugin_dirs list from toplevel makefile include plugin_defs
-N_("ladspa")
 N_("ffmpeg")
+N_("ladspa")
+N_("lv2")
 N_("audio_tools")
 N_("audio_transitions")
 N_("blending")