lv2 rework, sams ffmpeg icons, elision patch
[goodguy/history.git] / cinelerra-5.1 / cinelerra / assetpopup.C
index 07cc8eb4dd1ded8c0f336bd1616bce654247bd32..059e5850d86de696bbe8462c77bb503c41c7e1fd 100644 (file)
 #include "edl.h"
 #include "edlsession.h"
 #include "file.h"
+#include "filesystem.h"
 #include "filexml.h"
 #include "language.h"
+#include "loadfile.h"
 #include "localsession.h"
 #include "mainerror.h"
 #include "mainindexes.h"
+#include "mainmenu.h"
 #include "mainsession.h"
 #include "mwindow.h"
 #include "mwindowgui.h"
@@ -100,10 +103,11 @@ void AssetPopup::paste_assets()
        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();
@@ -140,7 +144,8 @@ void AssetPopup::match_all()
 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;
 }
 
@@ -418,6 +423,7 @@ AssetListMenu::~AssetListMenu()
 
 void AssetListMenu::create_objects()
 {
+       add_item(load_file = new AssetPopupLoadFile(mwindow, gui));
        add_item(format = new AWindowListFormat(mwindow, gui));
        add_item(new AWindowListSort(mwindow, gui));
        add_item(new AssetListCopy(mwindow, gui));
@@ -439,6 +445,23 @@ void AssetListMenu::create_objects()
        update_titles(shots_displayed = 1);
 }
 
+AssetPopupLoadFile::AssetPopupLoadFile(MWindow *mwindow, AWindowGUI *gui)
+ : BC_MenuItem(_("Load files..."), "o", 'o')
+{
+       this->mwindow = mwindow;
+       this->gui = gui;
+}
+
+AssetPopupLoadFile::~AssetPopupLoadFile()
+{
+}
+
+int AssetPopupLoadFile::handle_event()
+{
+       mwindow->gui->mainmenu->load_file->thread->start();
+       return 1;
+}
+
 void AssetListMenu::update_titles(int shots)
 {
        format->update();
@@ -754,10 +777,13 @@ int SnapshotMenuItem::handle_event()
                preferences->snapshot_path, _("snap"),
                1900+tm.tm_year,1+tm.tm_mon,tm.tm_mday,
                tm.tm_hour,tm.tm_min,tm.tm_sec, exts[mode]);
+       char *asset_path = FileSystem::basepath(filename);
+       Asset *asset = new Asset(asset_path);
+       delete [] asset_path;
+
        int fw = edl->get_w(), fh = edl->get_h();
        int fcolor_model = edl->session->color_model;
 
-       Asset *asset = new Asset(filename);
        switch( mode ) {
        case SNAPSHOT_PNG:
                asset->format = FILE_PNG;
@@ -976,8 +1002,9 @@ int GrabshotPopup::grab_event(XEvent *event)
                preferences->snapshot_path, _("grab"),
                1900+tm.tm_year,1+tm.tm_mon,tm.tm_mday,
                tm.tm_hour,tm.tm_min,tm.tm_sec, exts[mode]);
-
-       Asset *asset = new Asset(filename);
+       char *asset_path = FileSystem::basepath(filename);
+       Asset *asset = new Asset(asset_path);
+       delete [] asset_path;
        switch( mode ) {
        case GRABSHOT_PNG:
                asset->format = FILE_PNG;