#include "bccmodels.h"
#include "bcsignals.h"
#include "bchash.h"
+#include "binfolder.h"
#include "cache.h"
#include "cstrdup.h"
#include "clip.h"
#include "mainsession.h"
#include "mwindowgui.h"
#include "mwindow.h"
-#include "newfolder.h"
#include "preferences.h"
+#include "proxy.h"
+#include "proxypopup.h"
#include "renderengine.h"
#include "samples.h"
#include "theme.h"
temp->draw_line(x,0, x,vh);
return temp;
}
+ int ww = picon->gui->vicon_thread->view_w;
+ int hh = picon->gui->vicon_thread->view_h;
+ if( !asset->video_data ) {
+ if( !temp ) {
+ temp = new VFrame(0, -1, ww, hh, BC_RGB888, -1);
+ temp->clear_frame();
+ }
+ return temp;
+ }
if( seq_no >= images.size() ) {
MWindow *mwindow = picon->mwindow;
File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
}
if( !temp )
temp = new VFrame(0, -1, asset->width, asset->height, BC_RGB888, -1);
- int ww = picon->gui->vicon_thread->view_w;
- int hh = picon->gui->vicon_thread->view_h;
while( seq_no >= images.size() ) {
+ mwindow->video_cache->check_in(asset);
+ Thread::yield();
+ file = mwindow->video_cache->check_out(asset, mwindow->edl, 0);
+ if( !file ) { usleep(1000); continue; }
file->set_layer(0);
int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
file->set_video_position(pos,0);
int AssetVIcon::get_vx()
{
BC_ListBox *lbox = picon->gui->asset_list;
- return lbox->get_item_x(picon);
+ return lbox->get_icon_x(picon);
}
int AssetVIcon::get_vy()
{
BC_ListBox *lbox = picon->gui->asset_list;
- return lbox->get_item_y(picon) + lbox->get_title_h();
+ return lbox->get_icon_y(picon);
}
void AssetVIcon::load_audio()
persistent = persist;
}
+AssetPicon::AssetPicon(MWindow *mwindow,
+ AWindowGUI *gui, int folder, const char *title)
+ : BC_ListBoxItem(title, gui->folder_icon)
+{
+ reset();
+ foldernum = folder;
+ this->mwindow = mwindow;
+ this->gui = gui;
+ persistent = 0;
+}
+
AssetPicon::AssetPicon(MWindow *mwindow,
AWindowGUI *gui, PluginServer *plugin)
: BC_ListBoxItem()
{
if( vicon )
gui->vicon_thread->del_vicon(vicon);
+ delete vicon_frame;
if( indexable ) indexable->remove_user();
if( edl ) edl->remove_user();
if( icon && !gui->protected_pixmap(icon) ) {
indexable = 0;
edl = 0;
foldernum = AW_NO_FOLDER;
+ sort_key = -1;
icon = 0;
icon_vframe = 0;
vicon = 0;
+ vicon_frame = 0;
in_use = 1;
- mtime = 0;
+ comments_time = 0;
id = 0;
persistent = 0;
}
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");
}
struct stat st;
- mtime = !stat(asset->path, &st) ? st.st_mtime : 0;
+ comments_time = !stat(asset->path, &st) ? st.st_mtime : 0;
}
else
if( indexable && !indexable->is_asset ) {
icon_vframe = VFramePng::vframe_png(clip_icon_path);
}
if( !icon_vframe ) {
-printf("render clip: %s\n", name);
+//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;
open_render_engine(edl, 0);
render_video(0, gui->temp_picon);
close_render_engine();
- gui->lock_window("AssetPicon::create_objects 0");
icon_vframe = new VFrame(0,
-1, pixmap_w, pixmap_h, BC_RGB888, -1);
icon_vframe->transfer_from(gui->temp_picon);
pixmap_w = icon_vframe->get_w();
pixmap_h = icon_vframe->get_h();
}
+ gui->lock_window("AssetPicon::create_objects 0");
icon = new BC_Pixmap(gui, pixmap_w, pixmap_h);
icon->draw_vframe(icon_vframe,
0, 0, pixmap_w, pixmap_h, 0, 0);
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");
veffect_vframe = 0; veffect_icon = 0;
plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
- newfolder_thread = 0;
asset_menu = 0;
effectlist_menu = 0;
assetlist_menu = 0;
cliplist_menu = 0;
+ proxylist_menu = 0;
labellist_menu = 0;
folderlist_menu = 0;
temp_picon = 0;
vicon_audio = 0;
vicon_drawing = 1;
displayed_folder = AW_NO_FOLDER;
+ new_folder_thread = 0;
+ modify_folder_thread = 0;
+ folder_lock = new Mutex("AWindowGUI::folder_lock");
}
AWindowGUI::~AWindowGUI()
labellist.remove_all_objects();
displayed_assets[1].remove_all_objects();
+ delete new_folder_thread;
+ delete modify_folder_thread;
delete vicon_thread;
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;
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)
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));
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);
+ new_folder_thread = new NewFolderThread(this);
+ modify_folder_thread = new ModifyFolderThread(this);
int x1 = mwindow->theme->alist_x, y1 = mwindow->theme->alist_y;
int w1 = mwindow->theme->alist_w, h1 = mwindow->theme->alist_h;
add_subwindow(asset_list = new AWindowAssets(mwindow, this, x1, y1, w1, h1));
vicon_thread = new VIconThread(asset_list);
+ asset_list->update_vicon_area();
vicon_thread->start();
vicon_audio = new AssetVIconAudio(this);
//int x = mwindow->theme->abuttons_x;
//int y = mwindow->theme->abuttons_y;
-
- newfolder_thread = new NewFolderThread(mwindow, this);
-
add_subwindow(asset_menu = new AssetPopup(mwindow, this));
asset_menu->create_objects();
add_subwindow(clip_menu = new ClipPopup(mwindow, this));
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();
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();
// view->reposition_window(x, y);
BC_WindowBase::resize_event(w, h);
+ asset_list->update_vicon_area();
return 1;
}
void AWindowGUI::start_vicon_drawing()
{
- if( !vicon_drawing ) return;
- if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return;
- if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
- vicon_thread->start_drawing();
+ if( !vicon_drawing || !vicon_thread->interrupted ) return;
+ if( mwindow->edl->session->awindow_folder == AW_MEDIA_FOLDER ||
+ mwindow->edl->session->awindow_folder >= AWINDOW_USER_FOLDERS ) {
+ switch( mwindow->edl->session->assetlist_format ) {
+ case ASSETS_ICONS:
+ case ASSETS_ICONS_PACKED:
+ case ASSETS_ICON_LIST:
+ asset_list->update_vicon_area();
+ vicon_thread->start_drawing();
+ break;
+ default:
+ break;
+ }
+ }
}
void AWindowGUI::stop_vicon_drawing()
{
+ if( vicon_thread->interrupted ) return;
vicon_thread->stop_drawing();
}
+VFrame *AssetPicon::get_vicon_frame()
+{
+ if( !vicon ) return 0;
+ if( gui->vicon_thread->interrupted ) return 0;
+ VFrame *frame = vicon->frame();
+ if( !frame ) return 0;
+ if( !vicon_frame )
+ vicon_frame = new VFrame(vicon->vw, vicon->vh, frame->get_color_model());
+ vicon_frame->transfer_from(frame);
+ return vicon_frame;
+}
+
+int AWindowGUI::cycle_assetlist_format()
+{
+ EDLSession *session = mwindow->edl->session;
+ int format = ASSETS_TEXT;
+ if( allow_iconlisting ) {
+ switch( session->assetlist_format ) {
+ case ASSETS_TEXT:
+ format = ASSETS_ICONS;
+ break;
+ case ASSETS_ICONS:
+ format = ASSETS_ICONS_PACKED;
+ break;
+ case ASSETS_ICONS_PACKED:
+ format = ASSETS_ICON_LIST;
+ break;
+ case ASSETS_ICON_LIST:
+ format = ASSETS_TEXT;
+ break;
+ }
+ }
+ stop_vicon_drawing();
+ session->assetlist_format = format;
+ asset_list->update_format(session->assetlist_format, 0);
+ async_update_assets();
+ start_vicon_drawing();
+ return 1;
+}
+
AWindowRemovePluginGUI::
AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
int x, int y, PluginServer *plugin)
void AWindowRemovePluginGUI::create_objects()
{
+ lock_window("AWindowRemovePluginGUI::create_objects");
BC_Button *ok_button = new BC_OKButton(this);
add_subwindow(ok_button);
BC_Button *cancel_button = new BC_CancelButton(this);
0, 0, 1, 0, 0, LISTBOX_SINGLE, ICON_LEFT, 0);
add_subwindow(list);
show_window();
+ unlock_window();
}
int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayList<BC_ListBoxItem*> &folder)
return 1;
}
break;
+ case 'o':
+ if( !ctrl_down() && !shift_down() ) {
+ assetlist_menu->load_file->handle_event();
+ return 1;
+ }
+ break;
+ case 'v':
+ return cycle_assetlist_format();
case DELETE:
if( shift_down() ) {
PluginServer* plugin = selected_plugin();
UpdateAssetsXAtom = create_xatom("CWINDOWGUI_UPDATE_ASSETS");
return 0;
}
-int AWindowGUI::recieve_custom_xatoms(xatom_event *event)
+int AWindowGUI::receive_custom_xatoms(xatom_event *event)
{
if( event->message_type == UpdateAssetsXAtom ) {
update_assets();
// Search assets for folders
for( int i = 0; i < mwindow->edl->folders.total; i++ ) {
- const char *folder = mwindow->edl->folders.values[i];
+ BinFolder *bin_folder = mwindow->edl->folders[i];
int exists = 0;
for( int j = 0; j < folders.total; j++ ) {
- AssetPicon *picon = (AssetPicon*)folders.values[j];
- if( !strcasecmp(picon->get_text(), folder) ) {
+ AssetPicon *picon = (AssetPicon*)folders[j];
+ if( !strcasecmp(picon->get_text(), bin_folder->title) ) {
exists = 1;
picon->in_use = 1;
break;
}
if( !exists ) {
- int aw_folder = folder_number(folder);
- if( aw_folder >= 0 ) {
- AssetPicon *picon = new AssetPicon(mwindow, this, aw_folder, 1);
- picon->create_objects();
- folders.append(picon);
- }
+ const char *title = bin_folder->title;
+ int folder = bin_folder->awindow_folder;
+ AssetPicon *picon = new AssetPicon(mwindow, this, folder, title);
+ picon->create_objects();
+ folders.append(picon);
}
}
// Delete unused non-persistent folders
+ int do_autoplace = 0;
for( int i=folders.total; --i>=0; ) {
AssetPicon *picon = (AssetPicon*)folders.values[i];
if( !picon->in_use && !picon->persistent ) {
delete picon;
folders.remove_number(i);
+ do_autoplace = 1;
}
}
+ if( do_autoplace )
+ folder_list->set_autoplacement(&folders, 0, 1);
}
void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
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;
if( !exists ) {
AssetPicon *picon = new AssetPicon(mwindow,
this, mwindow->edl->clips[i]);
- picon->create_objects();
- assets.append(picon);
+ new_assets.append(picon);
}
}
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;
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);
assets.remove_number(i);
continue;
}
- if( !picon->indexable || !picon->indexable->is_asset ) continue;
- struct stat st;
- picon->mtime = !stat(picon->indexable->path, &st) ? st.st_mtime : 0;
+ if( picon->indexable && picon->indexable->is_asset ) {
+ struct stat st;
+ picon->comments_time = !stat(picon->indexable->path, &st) ?
+ st.st_mtime : 0;
+ }
}
}
}
}
-void AWindowGUI::sort_assets(int use_mtime)
+void AWindowGUI::sort_assets()
{
+ folder_lock->lock("AWindowGUI::sort_assets");
switch( mwindow->edl->session->awindow_folder ) {
case AW_AEFFECT_FOLDER:
sort_picons(&aeffects);
sort_picons(&labellist);
break;
default:
- sort_picons(&assets, use_mtime);
+ sort_picons(&assets);
+ 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->layers ) return 0;
+// make a clip from proxy video tracks and unproxy audio tracks
+ EDL *proxy_edl = new EDL(mwindow->edl);
+ proxy_edl->create_objects();
+ proxy_edl->set_path(proxy_asset->path);
+ FileSystem fs; fs.extract_name(path, proxy_asset->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 ?
+ ( proxy_asset->video_length >= 0 ?
+ ( proxy_asset->video_length / proxy_asset->frame_rate ) :
+ ( proxy_edl->session->si_useduration ?
+ proxy_edl->session->si_duration :
+ 1.0 / proxy_asset->frame_rate ) ) :
+ 1.0 / proxy_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++);
+ }
+ proxy_edl->awindow_folder = AW_PROXY_FOLDER;
+ 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);
+ int i = 0; AssetPicon *result;
+ while( (result = (AssetPicon*)asset_list->get_selection(0, i++)) != 0 ) {
+ Indexable *indexable = result->indexable;
+ if( proxy && indexable && indexable->is_asset &&
+ indexable->awindow_folder == AW_PROXY_FOLDER ) {
+ EDL *drag_edl = collect_proxy(indexable);
+ if( drag_edl ) mwindow->session->drag_clips->append(drag_edl);
+ continue;
+ }
+ if( indexable ) {
+ mwindow->session->drag_assets->append(indexable);
+ continue;
+ }
+ if( result->edl ) {
+ mwindow->session->drag_clips->append(result->edl);
+ continue;
+ }
}
}
// Remove current pointers
dst[0].remove_all();
dst[1].remove_all_objects();
+ BinFolder *bin_folder = folder < AWINDOW_USER_FOLDERS ? 0 :
+ mwindow->edl->get_folder(folder);
// Create new pointers
for( int i = 0; i < src->total; i++ ) {
+ int visible = folder < 0 ? 1 : 0;
AssetPicon *picon = (AssetPicon*)src->values[i];
- if( folder < 0 ||
- (picon->indexable && picon->indexable->awindow_folder == folder) ||
- (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
+ picon->sort_key = -1;
+ if( !visible && bin_folder ) {
+ Indexable *idxbl = bin_folder->is_clips ? (Indexable *)picon->edl :
+ picon->indexable ? picon->indexable :
+ picon->edl ? picon->edl->get_proxy_asset() : 0;
+ if( idxbl ) {
+ picon->sort_key = mwindow->edl->folders.matches_indexable(folder, idxbl);
+ if( picon->sort_key < 0 ) continue;
+ visible = 1;
+ }
+ }
+ if( !visible && picon->indexable && picon->indexable->awindow_folder == folder )
+ visible = 1;
+ if( !visible && picon->edl && picon->edl->local_session->folder == folder )
+ visible = 1;
+ if( visible ) {
const char *text = search_text->get_text();
- int hidden = text && text[0] && !bstrcasestr(picon->get_text(), text);
- if( picon->vicon ) picon->vicon->hidden = hidden;
- if( hidden ) continue;
+ if( text && text[0] )
+ visible = bstrcasestr(picon->get_text(), text) ? 1 : 0;
+ }
+ if( picon->vicon )
+ picon->vicon->hidden = !visible ? 1 : 0;
+ if( visible ) {
BC_ListBoxItem *item2, *item1;
dst[0].append(item1 = picon);
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 ) {
+ else if( picon->comments_time ) {
char date_time[BCSTRLEN];
- struct tm stm; localtime_r(&picon->mtime, &stm);
+ struct tm stm; localtime_r(&picon->comments_time, &stm);
sprintf(date_time,"%04d.%02d.%02d %02d:%02d:%02d",
stm.tm_year+1900, stm.tm_mon+1, stm.tm_mday,
stm.tm_hour, stm.tm_min, stm.tm_sec);
}
}
-void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src, int use_mtime)
+void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src)
{
int done = 0, changed = 0;
while( !done ) {
for( int i=0; i<src->total-1; ++i ) {
AssetPicon *item1 = (AssetPicon *)src->values[i];
AssetPicon *item2 = (AssetPicon *)src->values[i + 1];
- if( use_mtime ? item1->mtime > item2->mtime :
- strcmp(item1->get_text(), item2->get_text()) > 0 ) {
- src->values[i + 1] = item1;
- src->values[i] = item2;
- done = 0; changed = 1;
+ double v = item2->sort_key - item1->sort_key;
+ if( v > 0 ) continue;
+ if( v == 0 ) {
+ const char *cp1 = item1->get_text();
+ const char *bp1 = strrchr(cp1, '/');
+ if( bp1 ) cp1 = bp1 + 1;
+ const char *cp2 = item2->get_text();
+ const char *bp2 = strrchr(cp2, '/');
+ if( bp2 ) cp2 = bp2 + 1;
+ if( strcmp(cp2, cp1) >= 0 ) continue;
}
+ src->values[i + 1] = item1;
+ src->values[i] = item2;
+ done = 0; changed = 1;
}
}
if( changed ) {
}
}
-
void AWindowGUI::filter_displayed_assets()
{
//allow_iconlisting = 1;
void AWindowGUI::update_assets()
{
stop_vicon_drawing();
+ folder_lock->lock("AWindowGUI::update_assets");
update_folder_list();
update_asset_list();
labellist.remove_all_objects();
if( displayed_folder != mwindow->edl->session->awindow_folder )
search_text->clear();
+ vicon_thread->hide_vicons();
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);
create_persistent_folder(&vtransitions, 0, 1, 0, 1);
}
-int AWindowGUI::folder_number(const char *name)
-{
- for( int i = 0; i < AWINDOW_FOLDERS; i++ ) {
- if( !strcasecmp(name, folder_names[i]) ) return i;
- }
- return AW_NO_FOLDER;
-}
-
int AWindowGUI::drag_motion()
{
if( get_hidden() ) return 0;
int AWindowGUI::drag_stop()
{
if( get_hidden() ) return 0;
-
return 0;
}
AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
: BC_ListBox(x, y, w, h,
- mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
+ mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
LISTBOX_ICONS : LISTBOX_TEXT,
&gui->folders, // Each column has an ArrayList of BC_ListBoxItems.
0, // Titles for columns. Set to 0 for no titles
return result;
}
-
-
-
-
+int AWindowFolders::drag_stop()
+{
+ int result = 0;
+ if( get_hidden() ) return 0;
+ if( mwindow->session->current_operation == DRAG_ASSET &&
+ gui->folder_list->cursor_above() ) { // check user folder
+ int item_no = gui->folder_list->get_cursor_item();
+ AssetPicon *picon = (AssetPicon *)(item_no < 0 ? 0 : gui->folders[item_no]);
+ if( picon && picon->foldernum >= AWINDOW_USER_FOLDERS ) {
+ BinFolder *folder = mwindow->edl->get_folder(picon->foldernum);
+ ArrayList<Indexable *> *drags = folder->is_clips ?
+ ((ArrayList<Indexable *> *)mwindow->session->drag_clips) :
+ ((ArrayList<Indexable *> *)mwindow->session->drag_assets);
+ if( folder && drags && !folder->add_patterns(drags, shift_down()) )
+ flicker(1,30);
+ mwindow->session->current_operation = ::NO_OPERATION;
+ result = 1;
+ }
+ }
+ return result;
+}
AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
- : BC_ListBox(x, y, w, h,
- (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
- LISTBOX_ICONS : LISTBOX_TEXT,
+ : BC_ListBox(x, y, w, h, !gui->allow_iconlisting ? LISTBOX_TEXT :
+ mwindow->edl->session->assetlist_format == ASSETS_ICONS ? LISTBOX_ICONS :
+ mwindow->edl->session->assetlist_format == ASSETS_ICONS_PACKED ? LISTBOX_ICONS_PACKED :
+ mwindow->edl->session->assetlist_format == ASSETS_ICON_LIST ? LISTBOX_ICON_LIST :
+ LISTBOX_TEXT,
&gui->assets, // Each column has an ArrayList of BC_ListBoxItems.
gui->asset_titles,// Titles for columns. Set to 0 for no titles
mwindow->edl->session->asset_columns, // width of each column
gui->cliplist_menu->update();
gui->cliplist_menu->activate_menu();
break;
- case AW_MEDIA_FOLDER:
case AW_PROXY_FOLDER:
- gui->assetlist_menu->update_titles(folder==AW_MEDIA_FOLDER);
- gui->assetlist_menu->activate_menu();
+ gui->proxylist_menu->update();
+ gui->proxylist_menu->activate_menu();
break;
+ default:
+ case AW_MEDIA_FOLDER: {
+ int shots = folder==AW_MEDIA_FOLDER || folder>=AWINDOW_USER_FOLDERS;
+ gui->assetlist_menu->update_titles(shots);
+ gui->assetlist_menu->activate_menu();
+ break; }
}
result = 1;
}
{
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;
}
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();
break;
}
- BC_ListBox::deactivate_selection();
- return 1;
+ deactivate_selection();
}
- else if( gui->vicon_drawing &&
- get_button_down() && get_buttonpress() == 1 &&
- (item = (AssetPicon*)get_selection(0, 0)) ) {
+ else if( gui->vicon_drawing && get_button_down() && get_buttonpress() == 1 &&
+ ( mwindow->edl->session->awindow_folder == AW_MEDIA_FOLDER ||
+ mwindow->edl->session->awindow_folder >= AWINDOW_USER_FOLDERS ) &&
+ (item = (AssetPicon*)get_selection(0, 0)) != 0 ) {
VIcon *vicon = 0;
- if( !gui->vicon_thread->viewing ) {
+ if( !gui->vicon_thread->vicon ) {
vicon = item->vicon;
}
gui->vicon_thread->set_view_popup(vicon);
-
}
- return 0;
+ return 1;
}
void AWindowAssets::draw_background()
clear_box(0,0,get_w(),get_h(),get_bg_surface());
set_color(BC_WindowBase::get_resources()->audiovideo_color);
set_font(LARGEFONT);
- int aw_folder = mwindow->edl->session->awindow_folder;
- if( aw_folder < 0 ) return;
- const char *aw_name = _(AWindowGUI::folder_names[aw_folder]);
- draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30,
- aw_name, -1, get_bg_surface());
+ int folder = mwindow->edl->session->awindow_folder;
+ const char *title = mwindow->edl->get_folder_name(folder);
+ draw_text(get_w() - get_text_width(LARGEFONT, title) - 4, 30,
+ title, -1, get_bg_surface());
}
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 ) {
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;
}
if( collect_assets ) {
- gui->collect_assets();
+ gui->collect_assets(proxy);
}
return 1;
mwindow->cwindow->gui->unlock_window();
lock_window("AWindowAssets::drag_motion_event");
+ if( mwindow->session->current_operation == DRAG_ASSET &&
+ gui->folder_list->cursor_above() ) { // highlight user folder
+ int item_no = gui->folder_list->get_cursor_item();
+ if( item_no >= 0 ) {
+ AssetPicon *folder = (AssetPicon *)gui->folders[item_no];
+ if( folder->foldernum < AWINDOW_USER_FOLDERS ) item_no = -1;
+ }
+ int folder_xposition = gui->folder_list->get_xposition();
+ int folder_yposition = gui->folder_list->get_yposition();
+ gui->folder_list->update(&gui->folders, 0, 0, 1,
+ folder_xposition, folder_yposition, item_no, 0, 1);
+ }
return 0;
}
}
lock_window("AWindowAssets::drag_stop_event");
+ if( !result ) {
+ result = gui->folder_list->drag_stop();
+ }
+
if( result )
get_drag_popup()->set_animation(0);
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;
+
return 1;
}
int AWindowAssets::focus_in_event()
{
+ int ret = BC_ListBox::focus_in_event();
gui->start_vicon_drawing();
- return 0;
+ return ret;
}
int AWindowAssets::focus_out_event()
return BC_ListBox::focus_out_event();
}
+int AWindowAssets::cursor_enter_event()
+{
+ int ret = BC_ListBox::cursor_enter_event();
+ gui->start_vicon_drawing();
+ return ret;
+}
+
+int AWindowAssets::cursor_leave_event()
+{
+ gui->stop_vicon_drawing();
+ return BC_ListBox::cursor_leave_event();
+}
+
+void AWindowAssets::update_vicon_area()
+{
+ int x0 = 0, x1 = get_w();
+ int y0 = get_title_h();
+ int y1 = get_h();
+ if( is_highlighted() ) {
+ x0 += LISTBOX_BORDER; x1 -= LISTBOX_BORDER;
+ y0 += LISTBOX_BORDER; y1 -= LISTBOX_BORDER;
+ }
+ gui->vicon_thread->set_drawing_area(x0,y0, x1,y1);
+}
+
+int AWindowAssets::mouse_over_event(int no)
+{
+ if( gui->vicon_thread->viewing &&
+ no >= 0 && no < gui->displayed_assets[0].size() ) {
+ AssetPicon *picon = (AssetPicon *)gui->displayed_assets[0][no];
+ VIcon *vicon = picon->vicon;
+ picon->gui->vicon_thread->set_view_popup(vicon);
+ }
+ return 0;
+}
+
+
AWindowSearchTextBox::AWindowSearchTextBox(AWindowSearchText *search_text, int x, int y, int w)
: BC_TextBox(x, y, w, 1, "")
{
text_box->update("");
}
-AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
- : BC_Button(x, y, mwindow->theme->newbin_data)
-{
- this->mwindow = mwindow;
- this->gui = gui;
- set_tooltip(_("New bin"));
-}
-
-int AWindowNewFolder::handle_event()
-{
- gui->newfolder_thread->start_new_folder();
- return 1;
-}
-
-AWindowDeleteFolder::AWindowDeleteFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
- : BC_Button(x, y, mwindow->theme->deletebin_data)
-{
- this->mwindow = mwindow;
- this->gui = gui;
- set_tooltip(_("Delete bin"));
-}
-
-int AWindowDeleteFolder::handle_event()
-{
- if( gui->folder_list->get_selection(0, 0) ) {
- BC_ListBoxItem *folder = gui->folder_list->get_selection(0, 0);
- mwindow->delete_folder(folder->get_text());
- }
- return 1;
-}
-
-AWindowRenameFolder::AWindowRenameFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
- : BC_Button(x, y, mwindow->theme->renamebin_data)
-{
- this->mwindow = mwindow;
- this->gui = gui;
- set_tooltip(_("Rename bin"));
-}
-
-int AWindowRenameFolder::handle_event()
-{
- return 1;
-}
-
AWindowDeleteDisk::AWindowDeleteDisk(MWindow *mwindow, AWindowGUI *gui, int x, int y)
: BC_Button(x, y, mwindow->theme->deletedisk_data)
{
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;
#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")
: BC_Toggle(x, y, images, agui->vicon_drawing)
{
this->agui = agui;
- set_tooltip(_("draw vicons"));
+ set_tooltip(_("Preview"));
}
void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)
AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
- : BC_MenuItem("")
+ : BC_MenuItem("","v",'v')
{
this->mwindow = mwindow;
this->gui = gui;
int AWindowListFormat::handle_event()
{
- gui->stop_vicon_drawing();
+ return gui->cycle_assetlist_format();
+}
+void AWindowListFormat::update()
+{
EDLSession *session = mwindow->edl->session;
+ const char *text = 0;
switch( session->assetlist_format ) {
case ASSETS_TEXT:
- session->assetlist_format = ASSETS_ICONS;
+ text = _("Display icons");
break;
case ASSETS_ICONS:
- session->assetlist_format = ASSETS_TEXT;
+ text = _("Display icons packed");
+ break;
+ case ASSETS_ICONS_PACKED:
+ text = _("Display icon list");
+ break;
+ case ASSETS_ICON_LIST:
+ text = _("Display text");
break;
}
-
- gui->asset_list->update_format(session->assetlist_format, 1);
- if( !mwindow->awindow->gui->allow_iconlisting ) {
- mwindow->edl->session->assetlist_format = ASSETS_TEXT;
- }
-
- gui->start_vicon_drawing();
- return 1;
-}
-
-void AWindowListFormat::update()
-{
- set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
- (char*)_("Display icons") : (char*)_("Display text"));
+ set_text(text);
}
AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui)
int AWindowListSort::handle_event()
{
- gui->sort_assets(0);
+ gui->sort_assets();
return 1;
}