X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fawindowgui.C;h=38dad86bf1d3a3ac3de310ac033b4e651fb94c88;hp=009647b3dbc7daeb084fd2fc56173be89e4f4ab5;hb=5d3f23cd5b5e987c4ef926d776a08c3aae1fd9bc;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 009647b3..38dad86b 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -23,10 +23,11 @@ #include "asset.h" #include "assetedit.h" #include "assetpopup.h" +#include "assetremove.h" #include "assets.h" #include "audiodevice.h" -#include "awindowgui.h" #include "awindow.h" +#include "awindowgui.h" #include "bccmodels.h" #include "bcsignals.h" #include "bchash.h" @@ -92,7 +93,7 @@ const char *AWindowGUI::folder_names[] = AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length) - : VIcon(w, h, framerate) + : VIcon(w, h, framerate), Garbage("AssetVIcon") { this->picon = picon; this->length = length; @@ -101,6 +102,7 @@ AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_ AssetVIcon::~AssetVIcon() { + picon->gui->vicon_thread->del_vicon(this); delete temp; } @@ -415,8 +417,7 @@ AssetPicon::AssetPicon(MWindow *mwindow, AssetPicon::~AssetPicon() { - if( vicon ) - gui->vicon_thread->del_vicon(vicon); + if( vicon ) vicon->remove_user(); delete vicon_frame; if( indexable ) indexable->remove_user(); if( edl ) edl->remove_user(); @@ -597,6 +598,24 @@ void AssetPicon::create_objects() } gui->vicon_thread->add_vicon(vicon); } + else if( asset->folder_no == AW_PROXY_FOLDER ) { + char unproxy_path[BCTEXTLEN]; + int proxy_scale = mwindow->edl->session->proxy_scale; + if( !ProxyRender::from_proxy_path(unproxy_path, asset, proxy_scale) ) { + Asset *unproxy = mwindow->edl->assets->get_asset(unproxy_path); + if( unproxy ) { + int i = gui->assets.total; + while( --i >= 0 ) { + AssetPicon *picon = (AssetPicon*)gui->assets[i]; + if( picon->id == unproxy->id ) { + vicon = picon->vicon; + if( vicon ) vicon->add_user(); + break; + } + } + } + } + } } else { @@ -1250,6 +1269,7 @@ void AWindowGUI::start_vicon_drawing() { if( !vicon_drawing || !vicon_thread->interrupted ) return; if( mwindow->edl->session->awindow_folder == AW_MEDIA_FOLDER || + mwindow->edl->session->awindow_folder == AW_PROXY_FOLDER || mwindow->edl->session->awindow_folder >= AWINDOW_USER_FOLDERS ) { switch( mwindow->edl->session->assetlist_format ) { case ASSETS_ICONS: @@ -1448,14 +1468,35 @@ int AWindowGUI::keypress_event() case 'v': return cycle_assetlist_format(); case DELETE: - if( shift_down() ) { + if( shift_down() && ctrl_down() ) { PluginServer* plugin = selected_plugin(); if( !plugin ) break; remove_plugin = new AWindowRemovePlugin(awindow, plugin); unlock_window(); remove_plugin->start(); - lock_window(); + lock_window("AWindowGUI::keypress_event 1"); + return 1; } + collect_assets(); + if( shift_down() ) { + mwindow->awindow->asset_remove->start(); + return 1; + } + unlock_window(); + mwindow->remove_assets_from_project(1, 1, + mwindow->session->drag_assets, + mwindow->session->drag_clips); + lock_window("AWindowGUI::keypress_event 2"); + return 1; + case KEY_F1: + case KEY_F2: + case KEY_F3: + case KEY_F4: + if( shift_down() && ctrl_down() ) { + resend_event(mwindow->gui); + return 1; + } + break; } return 0; } @@ -1836,8 +1877,8 @@ void AWindowGUI::copy_picons(AssetPicon *picon, ArrayList *src) if( text && text[0] ) visible = bstrcasestr(picon->get_text(), text) ? 1 : 0; } - if( picon->vicon ) - picon->vicon->hidden = !visible ? 1 : 0; + if( visible && picon->vicon && picon->vicon->hidden ) + picon->vicon->hidden = 0; if( visible ) { BC_ListBoxItem *item2, *item1; dst[0].append(item1 = picon); @@ -2372,6 +2413,7 @@ int AWindowAssets::selection_changed() } else if( gui->vicon_drawing && get_button_down() && get_buttonpress() == 1 && ( mwindow->edl->session->awindow_folder == AW_MEDIA_FOLDER || + mwindow->edl->session->awindow_folder == AW_PROXY_FOLDER || mwindow->edl->session->awindow_folder >= AWINDOW_USER_FOLDERS ) && (item = (AssetPicon*)get_selection(0, 0)) != 0 ) { VIcon *vicon = 0; @@ -2904,3 +2946,51 @@ int AWindowListSort::handle_event() return 1; } +AssetSelectUsedItem::AssetSelectUsedItem(AssetSelectUsed *select_used, const char *text, int action) + : BC_MenuItem(text) +{ + this->select_used = select_used; + this->action = action; +} + +int AssetSelectUsedItem::handle_event() +{ + MWindow *mwindow = select_used->mwindow; + AWindowGUI *gui = select_used->gui; + AWindowAssets *asset_list = gui->asset_list; + ArrayList *data = gui->displayed_assets; + + switch( action ) { + case SELECT_ALL: + case SELECT_NONE: + asset_list->set_all_selected(data, action==SELECT_ALL ? 1 : 0); + break; + case SELECT_USED: + case SELECT_UNUSED: + asset_list->set_all_selected(data, 0); + for( int i = 0; i < data->total; i++ ) { + AssetPicon *picon = (AssetPicon*)data->values[i]; + Indexable *idxbl = picon->indexable ? picon->indexable : + picon->edl ? picon->edl->get_proxy_asset() : 0; + int used = idxbl && mwindow->edl->in_use(idxbl) ? 1 : 0; + asset_list->set_selected(data, i, action==SELECT_USED ? used : !used); + } + break; + } + + int asset_xposition = asset_list->get_xposition(); + int asset_yposition = asset_list->get_yposition(); + asset_list->update(gui->displayed_assets, gui->asset_titles, + mwindow->edl->session->asset_columns, ASSET_COLUMNS, + asset_xposition, asset_yposition, -1, 0); + asset_list->center_selection(); + return 1; +} + +AssetSelectUsed::AssetSelectUsed(MWindow *mwindow, AWindowGUI *gui) + : BC_MenuItem(_("Select")) +{ + this->mwindow = mwindow; + this->gui = gui; +} +