fix audio big btn replay, new proj path, proxy fix, updated Features5
[goodguy/history.git] / cinelerra-5.1 / cinelerra / proxy.C
index 7f729f37ebe561305178998382a48ddac87a5f92..5432f478546fb1927cd64e7c20667e843545bb06 100644 (file)
@@ -33,6 +33,7 @@
 #include "formattools.h"
 #include "language.h"
 #include "mainerror.h"
+#include "mainindexes.h"
 #include "mainprogress.h"
 #include "mainundo.h"
 #include "mutex.h"
@@ -83,7 +84,9 @@ ProxyDialog::ProxyDialog(MWindow *mwindow)
        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()
@@ -99,7 +102,7 @@ BC_Window* ProxyDialog::new_gui()
        asset->load_defaults(mwindow->defaults, "PROXY_", 1, 1, 0, 0, 0);
        mwindow->gui->lock_window("ProxyDialog::new_gui");
        int cx, cy;
-       mwindow->gui->get_abs_cursor_xy(cx, cy);
+       mwindow->gui->get_abs_cursor(cx, cy);
        gui = new ProxyWindow(mwindow, this, cx - WIDTH/2, cy - HEIGHT/2);
        gui->create_objects();
        mwindow->gui->unlock_window();
@@ -207,6 +210,8 @@ void ProxyDialog::to_proxy()
                        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++ )
@@ -254,7 +259,7 @@ void ProxyDialog::to_proxy()
        mwindow->restart_brender();
 
        mwindow->gui->lock_window("ProxyDialog::to_proxy");
-       mwindow->update_project(LOAD_ALL);
+       mwindow->update_project(LOADMODE_REPLACE);
        mwindow->gui->unlock_window();
 }
 
@@ -291,7 +296,7 @@ void ProxyRender::from_proxy_path(char *new_path, Asset *asset, int scale)
        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, '.');
@@ -454,9 +459,6 @@ void ProxyWindow::create_objects()
        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();
@@ -758,6 +760,11 @@ void ProxyClient::process_package(LoadPackage *ptr)
                }
                proxy_render->update_progress();
        }
+       if( !proxy_render->failed && !proxy_render->is_canceled() ) {
+               Asset *asset = mwindow->edl->assets->update(proxy);
+               mwindow->mainindexes->add_next_asset(0, asset);
+               mwindow->mainindexes->start_build();
+       }
 }