#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"
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();
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;
}
{
int cur_x, cur_y;
popup->gui->get_abs_cursor(cur_x, cur_y);
- if( mwindow->session->drag_assets->size() ) {
- AssetEdit *asset_edit = mwindow->awindow->get_asset_editor();
- asset_edit->edit_asset(
- mwindow->session->drag_assets->values[0], cur_x, cur_y);
+ int n = mwindow->session->drag_assets->size();
+ if( n > 0 ) {
+ for( int i=0; i<n; ++i ) {
+ AssetEdit *asset_edit = mwindow->awindow->get_asset_editor();
+ asset_edit->edit_asset(
+ mwindow->session->drag_assets->values[i], cur_x-30*i, cur_y-30*i);
+ }
}
else if( mwindow->session->drag_clips->size() ) {
popup->gui->awindow->clip_edit->edit_clip(
int AssetPopupView::handle_event()
{
VWindow *vwindow = mwindow->get_viewer(1, DEFAULT_VWINDOW);
- vwindow->gui->lock_window("AssetPopupView::handle_event");
if( mwindow->session->drag_assets->total )
vwindow->change_source(
vwindow->change_source(
mwindow->session->drag_clips->values[0]);
- vwindow->gui->unlock_window();
return 1;
}
int AssetPopupViewWindow::handle_event()
{
-// Find window with nothing
- VWindow *vwindow = mwindow->get_viewer(1);
-
-// TODO: create new vwindow or change current vwindow
- vwindow->gui->lock_window("AssetPopupView::handle_event");
-
- if( mwindow->session->drag_assets->total )
- vwindow->change_source(
- mwindow->session->drag_assets->values[0]);
- else
- if( mwindow->session->drag_clips->total )
- vwindow->change_source(
- mwindow->session->drag_clips->values[0]);
-
- vwindow->gui->unlock_window();
+ for( int i=0; i<mwindow->session->drag_assets->size(); ++i ) {
+ VWindow *vwindow = mwindow->get_viewer(1);
+ vwindow->gui->lock_window("AssetPopupView::handle_event 1");
+ vwindow->change_source(mwindow->session->drag_assets->get(i));
+ vwindow->gui->unlock_window();
+ }
+ for( int i=0; i<mwindow->session->drag_clips->size(); ++i ) {
+ VWindow *vwindow = mwindow->get_viewer(1);
+ vwindow->gui->lock_window("AssetPopupView::handle_event 2");
+ vwindow->change_source(mwindow->session->drag_clips->get(i));
+ vwindow->gui->unlock_window();
+ }
return 1;
}
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));
snapshot_submenu->add_submenuitem(new SnapshotMenuItem(snapshot_submenu, _("png"), SNAPSHOT_PNG));
snapshot_submenu->add_submenuitem(new SnapshotMenuItem(snapshot_submenu, _("jpeg"), SNAPSHOT_JPEG));
snapshot_submenu->add_submenuitem(new SnapshotMenuItem(snapshot_submenu, _("tiff"), SNAPSHOT_TIFF));
+ snapshot_submenu->add_submenuitem(new SnapshotMenuItem(snapshot_submenu, _("ppm"), SNAPSHOT_PPM));
GrabshotSubMenu *grabshot_submenu;
add_item(asset_grabshot = new AssetGrabshot(mwindow, this));
asset_grabshot->add_submenu(grabshot_submenu = new GrabshotSubMenu(asset_grabshot));
grabshot_submenu->add_submenuitem(new GrabshotMenuItem(grabshot_submenu, _("png"), GRABSHOT_PNG));
grabshot_submenu->add_submenuitem(new GrabshotMenuItem(grabshot_submenu, _("jpeg"), GRABSHOT_JPEG));
grabshot_submenu->add_submenuitem(new GrabshotMenuItem(grabshot_submenu, _("tiff"), GRABSHOT_TIFF));
+ grabshot_submenu->add_submenuitem(new GrabshotMenuItem(grabshot_submenu, _("ppm"), GRABSHOT_PPM));
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();
Preferences *preferences = mwindow->preferences;
char filename[BCTEXTLEN];
- static const char *exts[] = { "png", "jpg", "tif" };
+ static const char *exts[] = { "png", "jpg", "tif", "ppm" };
time_t tt; time(&tt);
struct tm tm; localtime_r(&tt,&tm);
snprintf(filename,sizeof(filename),"%s/%s_%04d%02d%02d-%02d%02d%02d.%s",
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;
asset->tiff_cmodel = 0;
asset->tiff_compression = 0;
break;
+ case SNAPSHOT_PPM:
+ asset->format = FILE_PPM;
+ break;
}
asset->width = fw;
asset->height = fh;
double position = edl->local_session->get_selectionstart(1);
int64_t source_position = (int64_t)(position * edl->get_frame_rate());
- ret = render_engine.vrender->process_buffer(frame, source_position, 0);
+ ret = !render_engine.vrender ? 1 :
+ render_engine.vrender->process_buffer(frame, source_position, 0);
if( !ret )
ret = file.write_video_buffer(1);
file.close_file();
int cw = lx1-lx0, ch = ly1-ly0;
hide_window();
sync_display();
+ grab_thread->done = 1;
MWindow *mwindow = grab_thread->mwindow;
Preferences *preferences = mwindow->preferences;
char filename[BCTEXTLEN];
- static const char *exts[] = { "png", "jpg", "tif" };
+ static const char *exts[] = { "png", "jpg", "tif", "ppm" };
time_t tt; time(&tt);
struct tm tm; localtime_r(&tt,&tm);
snprintf(filename,sizeof(filename),"%s/%s_%04d%02d%02d-%02d%02d%02d.%s",
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 SNAPSHOT_PNG:
+ case GRABSHOT_PNG:
asset->format = FILE_PNG;
asset->png_use_alpha = 1;
break;
- case SNAPSHOT_JPEG:
+ case GRABSHOT_JPEG:
asset->format = FILE_JPEG;
asset->jpeg_quality = 90;
break;
- case SNAPSHOT_TIFF:
+ case GRABSHOT_TIFF:
asset->format = FILE_TIFF;
asset->tiff_cmodel = 0;
asset->tiff_compression = 0;
break;
+ case GRABSHOT_PPM:
+ asset->format = FILE_PPM;
+ break;
}
+
// no odd dimensions
int rw = get_root_w(0), rh = get_root_h(0);
if( cx < 0 ) { cw += cx; cx = 0; }
if( cy < 0 ) { ch += cy; cy = 0; }
if( cx+cw > rw ) cw = rw-cx;
if( cy+ch > rh ) ch = rh-cy;
+ if( !cw || !ch ) return 1;
+
VFrame vframe(cw,ch, BC_RGB888);
if( cx+cw < rw ) ++cw;
if( cy+ch < rh ) ++ch;
asset->remove_user();
}
- grab_thread->done = 1;
return 1;
}