X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fawindowgui.C;h=bffaa2d1268d9a1ebdc933ef5822a31fe2cf1b5c;hp=094ef19b99aa20bb831cfb4dae9e54e5c6586596;hb=502b6f3b6fd04f6b01c6d70dcb81aa304dd0db1c;hpb=b55798fc64eee00c6fab3b4763e791befb7275f9 diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 094ef19b..bffaa2d1 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -56,6 +56,8 @@ #include "mwindow.h" #include "newfolder.h" #include "preferences.h" +#include "proxy.h" +#include "proxypopup.h" #include "renderengine.h" #include "samples.h" #include "theme.h" @@ -550,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"); @@ -622,20 +625,23 @@ void AssetPicon::create_objects() icon_vframe = VFramePng::vframe_png(clip_icon_path); } if( !icon_vframe ) { +//printf("render clip: %s\n", name); int edl_h = edl->get_h(), edl_w = edl->get_w(); int height = edl_h > 0 ? edl_h : 1; int width = edl_w > 0 ? edl_w : 1; + int color_model = edl->session->color_model; pixmap_w = pixmap_h * width / height; if( gui->temp_picon && - (gui->temp_picon->get_w() != width || + (gui->temp_picon->get_color_model() != color_model || + gui->temp_picon->get_w() != width || gui->temp_picon->get_h() != height) ) { delete gui->temp_picon; gui->temp_picon = 0; } if( !gui->temp_picon ) { gui->temp_picon = new VFrame(0, -1, - width, height, BC_RGB888, -1); + width, height, color_model, -1); } char string[BCTEXTLEN]; sprintf(string, _("Rendering %s"), name); @@ -679,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"); @@ -829,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; @@ -839,6 +847,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow) vicon_audio = 0; vicon_drawing = 1; displayed_folder = AW_NO_FOLDER; + folder_lock = new Mutex("AWindowGUI::folder_lock"); } AWindowGUI::~AWindowGUI() @@ -856,14 +865,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; @@ -889,6 +890,7 @@ AWindowGUI::~AWindowGUI() delete vtransition_vframe; delete vtransition_icon; delete aeffect_vframe; delete aeffect_icon; delete veffect_vframe; delete veffect_icon; + delete folder_lock; } bool AWindowGUI::protected_pixmap(BC_Pixmap *icon) @@ -998,7 +1000,7 @@ void AWindowGUI::create_objects() plugin_icon(ladspa_vframe, ladspa_icon, "lad_picon", lad_picon_png); plugin_icon(ff_aud_vframe, ff_aud_icon, "ff_audio", ff_audio_png); plugin_icon(ff_vid_vframe, ff_vid_icon, "ff_video", ff_video_png); - + folder_lock->lock("AWindowGUI::create_objects"); // Mandatory folders folders.append(new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER, 1)); folders.append(new AssetPicon(mwindow, this, AW_VEFFECT_FOLDER, 1)); @@ -1010,6 +1012,7 @@ void AWindowGUI::create_objects() folders.append(new AssetPicon(mwindow, this, AW_MEDIA_FOLDER, 1)); create_label_folder(); + folder_lock->unlock(); mwindow->theme->get_awindow_sizes(this); load_defaults(mwindow->defaults); @@ -1056,6 +1059,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(); @@ -1065,6 +1070,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(); @@ -1306,6 +1313,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(); @@ -1416,11 +1429,13 @@ void AWindowGUI::create_label_folder() void AWindowGUI::update_asset_list() { + ArrayList 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; iedl->clips.size(); ++i ) { int exists = 0; @@ -1441,8 +1456,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); } } @@ -1465,15 +1479,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; iedl->nested_edls.size(); ++i ) { int exists = 0; @@ -1494,10 +1503,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; icreate_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); @@ -1537,6 +1556,7 @@ void AWindowGUI::update_picon(Indexable *indexable) void AWindowGUI::sort_assets(int use_mtime) { + folder_lock->lock("AWindowGUI::sort_assets"); switch( mwindow->edl->session->awindow_folder ) { case AW_AEFFECT_FOLDER: sort_picons(&aeffects); @@ -1555,31 +1575,80 @@ void AWindowGUI::sort_assets(int use_mtime) break; default: sort_picons(&assets, use_mtime); + break; } // reset xyposition asset_list->update_format(asset_list->get_format(), 0); + folder_lock->unlock(); update_assets(); } void AWindowGUI::sort_folders() { + folder_lock->lock("AWindowGUI::update_assets"); sort_picons(&folders); folder_list->update_format(folder_list->get_format(), 0); + folder_lock->unlock(); update_assets(); } -void AWindowGUI::collect_assets() +EDL *AWindowGUI::collect_proxy(Indexable *indexable) +{ + Asset *proxy_asset = (Asset *)indexable; + char path[BCTEXTLEN]; + int proxy_scale = mwindow->edl->session->proxy_scale; + ProxyRender::from_proxy_path(path, proxy_asset, proxy_scale); + Asset *unproxy_asset = mwindow->edl->assets->get_asset(path); + if( !unproxy_asset || !unproxy_asset->channels ) return 0; +// make a clip from proxy video tracks and unproxy audio tracks + 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; + proxy_edl->session->audio_tracks = unproxy_asset->channels; + proxy_edl->create_default_tracks(); + double length = proxy_asset->frame_rate > 0 ? + (double)proxy_asset->video_length / proxy_asset->frame_rate : + 1.0 / mwindow->edl->session->frame_rate; + Track *current = proxy_edl->tracks->first; + for( int vtrack=0; current; current=NEXT ) { + if( current->data_type != TRACK_VIDEO ) continue; + current->insert_asset(proxy_asset, 0, length, 0, vtrack++); + } + length = (double)unproxy_asset->audio_length / unproxy_asset->sample_rate; + current = proxy_edl->tracks->first; + for( int atrack=0; current; current=NEXT ) { + if( current->data_type != TRACK_AUDIO ) continue; + current->insert_asset(unproxy_asset, 0, length, 0, atrack++); + } + return proxy_edl; +} + + +void AWindowGUI::collect_assets(int proxy) { - int i = 0; mwindow->session->drag_assets->remove_all(); mwindow->session->drag_clips->remove_all(); - while(1) - { - AssetPicon *result = (AssetPicon*)asset_list->get_selection(0, i++); - if( !result ) break; - - if( result->indexable ) mwindow->session->drag_assets->append(result->indexable); - if( result->edl ) mwindow->session->drag_clips->append(result->edl); + mwindow->session->clear_drag_proxy(); + int i = 0; AssetPicon *result; + while( (result = (AssetPicon*)asset_list->get_selection(0, i++)) != 0 ) { + Indexable *indexable = result->indexable; EDL *drag_edl; + if( proxy && (drag_edl=collect_proxy(indexable)) ) { + mwindow->session->drag_clips->append(drag_edl); + mwindow->session->drag_proxy->append(drag_edl); + continue; + } + if( indexable ) { + mwindow->session->drag_assets->append(indexable); + continue; + } + if( result->edl ) { + mwindow->session->drag_clips->append(result->edl); + continue; + } } } @@ -1605,7 +1674,7 @@ void AWindowGUI::copy_picons(ArrayList *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]; @@ -1692,6 +1761,7 @@ void AWindowGUI::filter_displayed_assets() void AWindowGUI::update_assets() { stop_vicon_drawing(); + folder_lock->lock("AWindowGUI::update_assets"); update_folder_list(); update_asset_list(); labellist.remove_all_objects(); @@ -1700,6 +1770,7 @@ void AWindowGUI::update_assets() if( displayed_folder != mwindow->edl->session->awindow_folder ) search_text->clear(); filter_displayed_assets(); + folder_lock->unlock(); if( mwindow->edl->session->folderlist_format != folder_list->get_format() ) { folder_list->update_format(mwindow->edl->session->folderlist_format, 0); @@ -1758,7 +1829,6 @@ int AWindowGUI::drag_motion() int AWindowGUI::drag_stop() { if( get_hidden() ) return 0; - return 0; } @@ -1952,8 +2022,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; @@ -1969,20 +2042,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; } @@ -2010,6 +2093,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(); @@ -2048,7 +2136,7 @@ void AWindowAssets::draw_background() int AWindowAssets::drag_start_event() { int collect_pluginservers = 0; - int collect_assets = 0; + int collect_assets = 0, proxy = 0; if( BC_ListBox::drag_start_event() ) { switch( mwindow->edl->session->awindow_folder ) { @@ -2071,6 +2159,10 @@ int AWindowAssets::drag_start_event() case AW_LABEL_FOLDER: // do nothing! break; + case AW_PROXY_FOLDER: + proxy = 1; + // fall thru + case AW_MEDIA_FOLDER: default: mwindow->session->current_operation = DRAG_ASSET; collect_assets = 1; @@ -2090,7 +2182,7 @@ int AWindowAssets::drag_start_event() } if( collect_assets ) { - gui->collect_assets(); + gui->collect_assets(proxy); } return 1; @@ -2166,6 +2258,8 @@ int AWindowAssets::drag_stop_event() BC_ListBox::drag_stop_event(); // since NO_OPERATION is also defined in listbox, we have to reach for global scope... mwindow->session->current_operation = ::NO_OPERATION; + mwindow->session->clear_drag_proxy(); + return 1; } @@ -2399,10 +2493,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; isize(); ++i ) { PluginServer *plugin = MWindow::plugindb->get(i); if( !plugin->audio && !plugin->video ) continue; @@ -2421,8 +2519,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")