raise vwdw stacking tweak, drag handle for transitions, cleanup histogram plugin...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / assetpopup.C
index 51e3f886a609b0e7c3f97db366045c37a26c1b90..9eda28d72e521d62e515118400463b5377234b1b 100644 (file)
@@ -99,19 +99,15 @@ void AssetPopup::create_objects()
 
 void AssetPopup::paste_assets()
 {
-// Collect items into the drag vectors for temporary storage
-       gui->lock_window("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);
+// Collect items into the drag vectors for temporary storage
+       gui->unlock_window();
+       mwindow->gui->lock_window("AssetPopup::paste_assets");
        mwindow->paste_assets(mwindow->edl->local_session->get_selectionstart(1),
                mwindow->edl->tracks->first, 0);   // do not overwrite
-
-       gui->unlock_window();
        mwindow->gui->unlock_window();
-       mwindow->cwindow->gui->unlock_window();
+       gui->lock_window("AssetPopup::paste_assets");
 }
 
 void AssetPopup::match_size()
@@ -302,8 +298,10 @@ AssetPopupBuildIndex::~AssetPopupBuildIndex()
 
 int AssetPopupBuildIndex::handle_event()
 {
+       popup->unlock_window();
 //printf("AssetPopupBuildIndex::handle_event 1\n");
        mwindow->rebuild_indices();
+       popup->lock_window("AssetPopupBuildIndex::handle_event");
        return 1;
 }
 
@@ -394,9 +392,11 @@ AssetPopupOpenMixer::~AssetPopupOpenMixer()
 
 int AssetPopupOpenMixer::handle_event()
 {
+       popup->unlock_window();
        mwindow->gui->lock_window("AssetPopupOpenMixer::handle_event");
        mwindow->create_mixers();
        mwindow->gui->unlock_window();
+       popup->lock_window("AssetPopupOpenMixer::handle_event");
        return 1;
 }
 
@@ -413,14 +413,16 @@ AssetPopupInsertMixer::~AssetPopupInsertMixer()
 
 int AssetPopupInsertMixer::handle_event()
 {
+       popup->unlock_window();
        mwindow->gui->lock_window("AssetPopupInsertMixer::handle_event");
        mwindow->create_mixers(-1);
        mwindow->gui->unlock_window();
+       popup->lock_window("AssetPopupInsertMixer::handle_event");
        return 1;
 }
 
 AssetPopupPaste::AssetPopupPaste(MWindow *mwindow, AssetPopup *popup)
- : BC_MenuItem(_("Paste"))
+ : BC_MenuItem(C_("Paste"))
 {
        this->mwindow = mwindow;
        this->popup = popup;
@@ -892,12 +894,13 @@ int SnapshotMenuItem::handle_event()
        if( !edl->have_video() ) return 1;
 
        Preferences *preferences = mwindow->preferences;
-       char filename[BCTEXTLEN];
+       char filename[BCTEXTLEN], snapshot_path[BCTEXTLEN];
        static const char *exts[] = { "png", "jpg", "tif", "ppm" };
        time_t tt;     time(&tt);
        struct tm tm;  localtime_r(&tt,&tm);
+       File::getenv_path(snapshot_path, preferences->snapshot_path);
        snprintf(filename,sizeof(filename),"%s/%s_%04d%02d%02d-%02d%02d%02d.%s",
-               preferences->snapshot_path, _("snap"),
+               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);
@@ -950,8 +953,8 @@ int SnapshotMenuItem::handle_event()
                command.realtime = 0;
 
                RenderEngine render_engine(0, preferences, 0, 0);
-               CICache video_cache(preferences);
-               render_engine.set_vcache(&video_cache);
+               CICache *video_cache = new CICache(preferences);
+               render_engine.set_vcache(video_cache);
                render_engine.arm_command(&command);
 
                double position = edl->local_session->get_selectionstart(1);
@@ -961,6 +964,7 @@ int SnapshotMenuItem::handle_event()
                if( !ret )
                        ret = file.write_video_buffer(1);
                file.close_file();
+               video_cache->remove_user();
        }
        if( !ret ) {
                asset->folder_no = AW_MEDIA_FOLDER;
@@ -1117,12 +1121,13 @@ int GrabshotPopup::grab_event(XEvent *event)
 
        MWindow *mwindow = grab_thread->mwindow;
        Preferences *preferences = mwindow->preferences;
-       char filename[BCTEXTLEN];
+       char filename[BCTEXTLEN], snapshot_path[BCTEXTLEN];
        static const char *exts[] = { "png", "jpg", "tif", "ppm" };
        time_t tt;     time(&tt);
        struct tm tm;  localtime_r(&tt,&tm);
+       File::getenv_path(snapshot_path, preferences->snapshot_path);
        snprintf(filename,sizeof(filename),"%s/%s_%04d%02d%02d-%02d%02d%02d.%s",
-               preferences->snapshot_path, _("grab"),
+               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]);
        char *asset_path = FileSystem::basepath(filename);