mwindow->gui->lock_window("AssetPopup::paste_assets");
mwindow->cwindow->gui->lock_window("AssetPopup::paste_assets");
- gui->collect_assets();
+ int proxy = mwindow->edl->session->awindow_folder == AW_PROXY_FOLDER ? 1 : 0;
+ gui->collect_assets(proxy);
mwindow->paste_assets(mwindow->edl->local_session->get_selectionstart(1),
- mwindow->edl->tracks->first,
- 0); // do not overwrite
+ mwindow->edl->tracks->first, 0); // do not overwrite
+ mwindow->session->clear_drag_proxy();
gui->unlock_window();
mwindow->gui->unlock_window();
int AssetPopup::update()
{
format->update();
- gui->collect_assets();
+ int proxy = mwindow->edl->session->awindow_folder == AW_PROXY_FOLDER ? 1 : 0;
+ gui->collect_assets(proxy);
return 0;
}
#include "mwindow.h"
#include "newfolder.h"
#include "preferences.h"
+#include "proxy.h"
#include "renderengine.h"
#include "samples.h"
#include "theme.h"
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);
+ 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;
+ }
}
}
int AWindowGUI::drag_stop()
{
if( get_hidden() ) return 0;
-
return 0;
}
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;
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;
}
int drag_motion();
int drag_stop();
// Collect items into the drag vectors of MainSession
- void collect_assets();
+ void collect_assets(int proxy=0);
+ EDL *collect_proxy(Indexable *indexable);
void create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
int do_audio,
int do_video,
void Indexable::update_index(Indexable *src)
{
if( index_state == src->index_state ) return;
- index_state->remove_user();
+ if( index_state ) index_state->remove_user();
index_state = src->index_state;
index_state->add_user();
}
drag_assets = new ArrayList<Indexable*>;
drag_auto_gang = new ArrayList<Auto*>;
drag_clips = new ArrayList<EDL*>;
+ drag_proxy = new ArrayList<EDL*>;
drag_edits = new ArrayList<Edit*>;
drag_edit = 0;
clip_number = 1;
MainSession::~MainSession()
{
+ clear_drag_proxy();
delete drag_pluginservers;
delete drag_assets;
delete drag_auto_gang;
delete drag_clips;
+ delete drag_proxy;
delete drag_edits;
}
CLAMP(cwindow_controls, 0, 1);
}
+void MainSession::clear_drag_proxy()
+{
+ for( int i=drag_proxy->size(); --i>=0; )
+ drag_proxy->get(i)->remove_user();
+ drag_proxy->remove_all();
+}
+
void MainSession::save_x11_host(int play_config, const char *x11_host)
{
strcpy(!play_config ? a_x11_host : b_x11_host, x11_host);
int load_defaults(BC_Hash *defaults);
int save_defaults(BC_Hash *defaults);
+ void clear_drag_proxy();
void save_x11_host(int play_config, const char *x11_host);
int set_default_x11_host(int win_config=-1);
void default_window_positions(int window_config=0);
void boundaries();
-
-
-
-
// For drag and drop events
// The entire track where the dropped asset is going to go
Track *track_highlighted;
Edits *trim_edits;
ArrayList<Indexable*> *drag_assets;
ArrayList<EDL*> *drag_clips;
+ ArrayList<EDL*> *drag_proxy;
Auto *drag_auto;
ArrayList<Auto*> *drag_auto_gang;
}
}
}
+ for( int j=0,m=edl->clips.size(); j<m; ++j ) {
+ EDL *clip = edl->clips[j];
+ for( Track *track=clip->tracks->first; track; track=track->next ) {
+ if( track->data_type != TRACK_VIDEO ) continue;
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ if( !edit->asset ) continue;
+ if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) {
+ edit->asset = proxy_asset;
+ }
+ }
+ }
+ }
}
}
asset = new Asset;
bzero(size_text, sizeof(char*) * MAX_SIZES);
bzero(size_factors, sizeof(int) * MAX_SIZES);
- total_sizes = 0;
+ size_text[0] = cstrdup(_("Original size"));
+ size_factors[0] = 1;
+ total_sizes = 1;
}
ProxyDialog::~ProxyDialog()
proxy->width = proxy->actual_width;
proxy->height = proxy->actual_height;
proxy->remove_user();
+ mwindow->edl->assets->remove_pointer(proxy);
+ proxy->remove_user();
}
proxy_assets.remove_all();
for( int i = 0; i < orig_idxbls.size(); i++ )
char prxy[BCTEXTLEN];
int n = sprintf(prxy, ".proxy%d", scale);
strcpy(new_path, asset->path);
- char *ptr = strstr(asset->path, prxy);
+ char *ptr = strstr(new_path, prxy);
if( !ptr || (ptr[n] != '-' && ptr[n] != '.') ) return;
// remove proxy, path.proxy#-sfx.ext => path.sfx
char *ext = strrchr(ptr, '.');
add_subwindow(text = new BC_Title(x, y, _("Scale factor:")));
x += text->get_w() + margin;
- dialog->size_text[0] = cstrdup(_("Original size"));
- dialog->size_factors[0] = 1;
- dialog->total_sizes = 1;
int popupmenu_w = BC_PopupMenu::calculate_w(get_text_width(MEDIUMFONT, dialog->size_text[0]));
add_subwindow(scale_factor = new ProxyMenu(mwindow, this, x, y, popupmenu_w, ""));
scale_factor->update_sizes();
ProxyRender(MWindow *mwindow, Asset *format_asset);
~ProxyRender();
void to_proxy_path(char *new_path, Indexable *indexable, int scale);
- void from_proxy_path(char *new_path, Asset *asset, int scale);
+ static void from_proxy_path(char *new_path, Asset *asset, int scale);
ArrayList<Indexable *> orig_idxbls; // originals which match the proxy assets
ArrayList<Indexable *> orig_proxies; // proxy assets