X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fassetpopup.C;h=c9bac6fd1d9bbae4dda377d2e0493703ae6dc4cc;hp=15620af7a34c35f0f5d4950a445fe0dc5fbec782;hb=HEAD;hpb=86bd203ac1fc29d93f63d13e2979468f06bdc3a2 diff --git a/cinelerra-5.1/cinelerra/assetpopup.C b/cinelerra-5.1/cinelerra/assetpopup.C index 15620af7..c9bac6fd 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.C +++ b/cinelerra-5.1/cinelerra/assetpopup.C @@ -37,11 +37,14 @@ #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" @@ -73,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)); @@ -104,7 +104,6 @@ void AssetPopup::paste_assets() gui->collect_assets(proxy); 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(); @@ -197,37 +196,20 @@ int AssetPopupBuildIndex::handle_event() } -AssetPopupSortNames::AssetPopupSortNames(MWindow *mwindow, AssetPopup *popup) - : BC_MenuItem(_("Sort names")) -{ - this->mwindow = mwindow; - this->popup = popup; -} - -AssetPopupSortNames::~AssetPopupSortNames() -{ -} - -int AssetPopupSortNames::handle_event() -{ - mwindow->awindow->gui->sort_assets(0); - return 1; -} - -AssetPopupSortTimes::AssetPopupSortTimes(MWindow *mwindow, AssetPopup *popup) - : BC_MenuItem(_("Sort times")) +AssetPopupSort::AssetPopupSort(MWindow *mwindow, AssetPopup *popup) + : BC_MenuItem(_("Sort")) { this->mwindow = mwindow; this->popup = popup; } -AssetPopupSortTimes::~AssetPopupSortTimes() +AssetPopupSort::~AssetPopupSort() { } -int AssetPopupSortTimes::handle_event() +int AssetPopupSort::handle_event() { - mwindow->awindow->gui->sort_assets(1); + mwindow->awindow->gui->sort_assets(); return 1; } @@ -420,6 +402,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)); @@ -441,6 +424,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(); @@ -559,6 +559,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:"))); @@ -573,6 +574,7 @@ void AssetCopyWindow::create_objects() add_subwindow(new BC_OKButton(this)); show_window(); + unlock_window(); } int AssetCopyWindow::resize_event(int w, int h) @@ -684,6 +686,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:"))); @@ -696,6 +699,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) @@ -756,10 +760,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; @@ -816,7 +823,7 @@ int SnapshotMenuItem::handle_event() file.close_file(); } if( !ret ) { - asset->awindow_folder = AW_MEDIA_FOLDER; + asset->folder_no = AW_MEDIA_FOLDER; mwindow->edl->assets->append(asset); mwindow->awindow->gui->async_update_assets(); } @@ -978,8 +985,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; @@ -1036,7 +1044,7 @@ int GrabshotPopup::grab_event(XEvent *event) file.close_file(); } if( !ret ) { - asset->awindow_folder = AW_MEDIA_FOLDER; + asset->folder_no = AW_MEDIA_FOLDER; mwindow->edl->assets->append(asset); mwindow->awindow->gui->async_update_assets(); }