- asset->save_defaults(mwindow->defaults, "PROXY_", 1, 1, 0, 0, 0);
-
- if( !result )
- to_proxy();
-}
-
-void ProxyDialog::to_proxy()
-{
- ArrayList<Indexable*> orig_idxbls;
- ArrayList<Indexable*> proxy_assets;
-
- EDL *edl = mwindow->edl;
- mwindow->edl->Garbage::add_user();
- mwindow->save_backup();
- mwindow->undo->update_undo_before(_("proxy"), this);
- ProxyRender proxy_render(mwindow, asset);
-
-// revert project to original size from current size
-// remove all session proxy assets at the at the current proxy_scale
- int proxy_scale = edl->session->proxy_scale;
- if( proxy_scale > 1 ) {
- Asset *orig_asset = edl->assets->first;
- for( ; orig_asset; orig_asset=orig_asset->next ) {
- char new_path[BCTEXTLEN];
- proxy_render.to_proxy_path(new_path, orig_asset, proxy_scale);
-// test if proxy asset was already added to proxy_assets
- int got_it = 0;
- for( int i = 0; !got_it && i<proxy_assets.size(); ++i )
- got_it = !strcmp(proxy_assets[i]->path, new_path);
- if( got_it ) continue;
- Asset *proxy_asset = edl->assets->get_asset(new_path);
- if( !proxy_asset ) continue;
-// add pointer to existing EDL asset if it exists
-// EDL won't delete it unless it's the same pointer.
- proxy_assets.append(proxy_asset);
- proxy_asset->add_user();
- orig_idxbls.append(orig_asset);
- orig_asset->add_user();
- }
-
-// convert from the proxy assets to the original assets
- int proxy_auto_scale = edl->session->proxy_auto_scale;
- mwindow->set_proxy(0, 1, proxy_auto_scale, &proxy_assets, &orig_idxbls);
-
-// remove the references
- for( int i=0; i<proxy_assets.size(); ++i ) {
- Asset *proxy = (Asset *) proxy_assets[i];
- proxy->width = proxy->actual_width;
- proxy->height = proxy->actual_height;
- proxy->remove_user();
- }
- proxy_assets.remove_all();
- for( int i = 0; i < orig_idxbls.size(); i++ )
- orig_idxbls[i]->remove_user();
- orig_idxbls.remove_all();
- }
-
- ArrayList<char *> confirm_paths; // test for new files
- confirm_paths.set_array_delete();
-
-// convert to new size if not original size
- if( new_scale != 1 ) {
- FileSystem fs;
- Asset *orig = mwindow->edl->assets->first;
- for( ; orig; orig=orig->next ) {
- Asset *proxy = proxy_render.add_original(orig, new_scale);
- if( !proxy ) continue;
- int exists = fs.get_size(proxy->path) > 0 ? 1 : 0;
- int got_it = exists && // if proxy exists, and is newer than orig
- fs.get_date(proxy->path) > fs.get_date(orig->path) ? 1 : 0;
- if( !got_it ) {
- if( exists ) // prompt user to overwrite
- confirm_paths.append(cstrdup(proxy->path));
- proxy_render.add_needed(orig, proxy);
- }
- }