add clip folders, icon margins, fix safe regions, update neophyte, fix folder edl...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / assetpopup.C
index 026806a1c9eb3e6bddf15acdbc020e5da5246b93..59e13131507e0b2cbcb685078069de58cd25744c 100644 (file)
@@ -37,6 +37,7 @@
 #include "edl.h"
 #include "edlsession.h"
 #include "file.h"
+#include "filesystem.h"
 #include "filexml.h"
 #include "language.h"
 #include "loadfile.h"
@@ -75,10 +76,7 @@ void AssetPopup::create_objects()
        BC_SubMenu *submenu;
        add_item(info = new AssetPopupInfo(mwindow, this));
        add_item(format = new AWindowListFormat(mwindow, gui));
-       add_item(menu_item = new BC_MenuItem(_("Sort...")));
-       menu_item->add_submenu(submenu = new BC_SubMenu());
-       submenu->add_submenuitem(new AssetPopupSortNames(mwindow, this));
-       submenu->add_submenuitem(new AssetPopupSortTimes(mwindow, this));
+       add_item(new AssetPopupSort(mwindow, this));
        add_item(index = new AssetPopupBuildIndex(mwindow, this));
        add_item(view = new AssetPopupView(mwindow, this));
        add_item(view_window = new AssetPopupViewWindow(mwindow, this));
@@ -102,11 +100,9 @@ void AssetPopup::paste_assets()
        mwindow->gui->lock_window("AssetPopup::paste_assets");
        mwindow->cwindow->gui->lock_window("AssetPopup::paste_assets");
 
-       int proxy = mwindow->edl->session->awindow_folder == AW_PROXY_FOLDER ? 1 : 0;
-       gui->collect_assets(proxy);
+       gui->collect_assets();
        mwindow->paste_assets(mwindow->edl->local_session->get_selectionstart(1),
                mwindow->edl->tracks->first, 0);   // do not overwrite
-       mwindow->session->clear_drag_proxy();
 
        gui->unlock_window();
        mwindow->gui->unlock_window();
@@ -143,8 +139,7 @@ void AssetPopup::match_all()
 int AssetPopup::update()
 {
        format->update();
-       int proxy = mwindow->edl->session->awindow_folder == AW_PROXY_FOLDER ? 1 : 0;
-       gui->collect_assets(proxy);
+       gui->collect_assets();
        return 0;
 }
 
@@ -199,37 +194,20 @@ int AssetPopupBuildIndex::handle_event()
 }
 
 
-AssetPopupSortNames::AssetPopupSortNames(MWindow *mwindow, AssetPopup *popup)
- : BC_MenuItem(_("Sort names"))
+AssetPopupSort::AssetPopupSort(MWindow *mwindow, AssetPopup *popup)
+ : BC_MenuItem(_("Sort"))
 {
        this->mwindow = mwindow;
        this->popup = popup;
 }
 
-AssetPopupSortNames::~AssetPopupSortNames()
+AssetPopupSort::~AssetPopupSort()
 {
 }
 
-int AssetPopupSortNames::handle_event()
+int AssetPopupSort::handle_event()
 {
-       mwindow->awindow->gui->sort_assets(0);
-       return 1;
-}
-
-AssetPopupSortTimes::AssetPopupSortTimes(MWindow *mwindow, AssetPopup *popup)
- : BC_MenuItem(_("Sort times"))
-{
-       this->mwindow = mwindow;
-       this->popup = popup;
-}
-
-AssetPopupSortTimes::~AssetPopupSortTimes()
-{
-}
-
-int AssetPopupSortTimes::handle_event()
-{
-       mwindow->awindow->gui->sort_assets(1);
+       mwindow->awindow->gui->sort_assets();
        return 1;
 }
 
@@ -579,6 +557,7 @@ AssetCopyWindow::~AssetCopyWindow()
 
 void AssetCopyWindow::create_objects()
 {
+       lock_window("AssetCopyWindow::create_objects");
        BC_Title *title;
        int x = 10, y = 10, pad = 5;
        add_subwindow(title = new BC_Title(x, y, _("List of asset paths:")));
@@ -593,6 +572,7 @@ void AssetCopyWindow::create_objects()
 
        add_subwindow(new BC_OKButton(this));
        show_window();
+       unlock_window();
 }
 
 int AssetCopyWindow::resize_event(int w, int h)
@@ -704,6 +684,7 @@ AssetPasteWindow::~AssetPasteWindow()
 
 void AssetPasteWindow::create_objects()
 {
+       lock_window("AssetPasteWindow::create_objects()");
        BC_Title *title;
        int x = 10, y = 10, pad = 5;
        add_subwindow(title = new BC_Title(x, y, _("Enter list of asset paths:")));
@@ -716,6 +697,7 @@ void AssetPasteWindow::create_objects()
        add_subwindow(new BC_OKButton(this));
        add_subwindow(new BC_CancelButton(this));
        show_window();
+       unlock_window();
 }
 
 int AssetPasteWindow::resize_event(int w, int h)
@@ -776,10 +758,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;
@@ -998,8 +983,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;