fix segv for plugin render_gui when plugin moved up/dn, opencv build fixes, opts...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / loadfile.C
index 434edfe6e4c20b436008e4e947410a33d283bfcf..c65a9a28531df854f1a08c2025fe91e696b4ce54 100644 (file)
@@ -47,6 +47,7 @@ Load::Load(MWindow *mwindow, MainMenu *mainmenu)
 {
        this->mwindow = mwindow;
        this->mainmenu = mainmenu;
+       this->thread = 0;
 }
 
 Load::~Load()
@@ -77,6 +78,7 @@ LoadFileThread::LoadFileThread(MWindow *mwindow, Load *load)
 {
        this->mwindow = mwindow;
        this->load = load;
+       this->window = 0;
 }
 
 LoadFileThread::~LoadFileThread()
@@ -181,11 +183,9 @@ void LoadFileWindow::create_objects()
        lock_window("LoadFileWindow::create_objects");
        BC_FileBox::create_objects();
 
-       int x = get_w() / 2 -
-               LoadMode::calculate_w(this, mwindow->theme) / 2;
-       int y = get_cancel_button()->get_y() -
-               LoadMode::calculate_h(this, mwindow->theme);
-       loadmode = new LoadMode(mwindow, this, x, y, &thread->load_mode, 0);
+       int x = get_w() / 2 - LoadMode::calculate_w(this, mwindow->theme) / 2;
+       int y = get_y_margin();
+       loadmode = new LoadMode(mwindow, this, x, y, &thread->load_mode, 0, 1);
        loadmode->create_objects();
        add_subwindow(load_file_apply = new LoadFileApply(this));
 
@@ -197,16 +197,15 @@ void LoadFileWindow::create_objects()
 int LoadFileWindow::resize_event(int w, int h)
 {
        draw_background(0, 0, w, h);
-       int x = w / 2 - 200;
-       int y = get_cancel_button()->get_y() -
-               LoadMode::calculate_h(this, mwindow->theme);
+       BC_FileBox::resize_event(w, h);
+       int x = w / 2 - LoadMode::calculate_w(this, mwindow->theme) / 2;
+       int y = get_y_margin();
        loadmode->reposition_window(x, y);
-
-       x = (get_w() - BC_GenericButton::calculate_w(this, _("Apply")))/2;
-       y = get_h() - BC_GenericButton::calculate_h() - 15;
+       x = (w - BC_GenericButton::calculate_w(this, _("Apply")))/2;
+       y = h - BC_GenericButton::calculate_h() - 15;
        load_file_apply->reposition_window(x, y);
-
-       return BC_FileBox::resize_event(w, h);
+       flush();
+       return 1;
 }
 
 
@@ -249,7 +248,7 @@ LocateFileWindow::~LocateFileWindow()
 
 
 LoadPrevious::LoadPrevious(MWindow *mwindow, Load *loadfile)
- : BC_MenuItem(""), Thread()
+ : BC_MenuItem("")
 {
        this->mwindow = mwindow;
        this->loadfile = loadfile;
@@ -257,6 +256,7 @@ LoadPrevious::LoadPrevious(MWindow *mwindow, Load *loadfile)
 
 int LoadPrevious::handle_event()
 {
+       if( !path[0] ) return 1;
        ArrayList<char*> path_list;
        path_list.set_array_delete();
        char *out_path;
@@ -275,14 +275,7 @@ int LoadPrevious::handle_event()
        return 1;
 }
 
-
-
-void LoadPrevious::run()
-{
-//     loadfile->mwindow->load(path, loadfile->append);
-}
-
-int LoadPrevious::set_path(char *path)
+int LoadPrevious::set_path(const char *path)
 {
        strcpy(this->path, path);
        return 0;