X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fawindowgui.C;h=f33b9cbc1eb3f96eecdb44677167f7904aaa55da;hp=094ef19b99aa20bb831cfb4dae9e54e5c6586596;hb=eecf057a9d6b8c8cffc7d0001bff89bc9cac7b05;hpb=b55798fc64eee00c6fab3b4763e791befb7275f9 diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 094ef19b..f33b9cbc 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; @@ -856,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; @@ -1056,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(); @@ -1065,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(); @@ -1306,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(); @@ -1568,18 +1578,63 @@ void AWindowGUI::sort_folders() 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; + } } } @@ -1758,7 +1813,6 @@ int AWindowGUI::drag_motion() int AWindowGUI::drag_stop() { if( get_hidden() ) return 0; - return 0; } @@ -1952,8 +2006,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; @@ -2010,6 +2067,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 +2110,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 +2133,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 +2156,7 @@ int AWindowAssets::drag_start_event() } if( collect_assets ) { - gui->collect_assets(); + gui->collect_assets(proxy); } return 1; @@ -2166,6 +2232,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; }