}
-EDL* ClipEDLs::get_copy(EDL *src)
+EDL* ClipEDLs::get_nested(EDL *src)
{
if( !src ) return 0;
for( int i=0; i<size(); ++i ) {
void add_clip(EDL *clip);
void remove_clip(EDL *clip);
// Return copy of the src EDL which belongs to the current object.
- EDL* get_copy(EDL *src);
+ EDL* get_nested(EDL *src);
void copy_nested(ClipEDLs &nested);
EDL* load(char *path);
void clear();
gui->lock_window("ClipPopupNest::handle_event 1");
if( mwindow->session->drag_clips->total > 0 ) {
EDL *edl = mwindow->edl;
+ time_t dt; time(&dt);
+ struct tm dtm; localtime_r(&dt, &dtm);
+ char path[BCSTRLEN];
+ sprintf(path, _("Nested_%02d%02d%02d-%02d%02d%02d"),
+ dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
+ dtm.tm_hour, dtm.tm_min, dtm.tm_sec);
EDL *clip = mwindow->session->drag_clips->values[0];
- EDL *new_clip = new EDL(edl);
- new_clip->create_objects();
- new_clip->copy_all(clip);
+ EDL *nested = edl->new_nested(clip, path);
+ EDL *new_clip = edl->create_nested_clip(nested);
new_clip->awindow_folder = AW_CLIP_FOLDER;
+ sprintf(new_clip->local_session->clip_icon,
+ "clip_%02d%02d%02d-%02d%02d%02d.png",
+ dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
+ dtm.tm_hour, dtm.tm_min, dtm.tm_sec);
snprintf(new_clip->local_session->clip_title,
sizeof(new_clip->local_session->clip_title),
_("Nested: %s"), clip->local_session->clip_title);
strcpy(new_clip->local_session->clip_notes,
clip->local_session->clip_notes);
- time_t dt; time(&dt);
- struct tm dtm; localtime_r(&dt, &dtm);
- sprintf(new_clip->local_session->clip_icon,
- "clip_%02d%02d%02d-%02d%02d%02d.png",
- dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
- dtm.tm_hour, dtm.tm_min, dtm.tm_sec);
- char path[BCSTRLEN];
- sprintf(path, _("Nested_%02d%02d%02d-%02d%02d%02d"),
- dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
- dtm.tm_hour, dtm.tm_min, dtm.tm_sec);
- EDL *clip_edl = edl->new_nested(new_clip, path);
- new_clip->remove_user();
int idx = edl->clips.number_of(clip);
if( idx >= 0 ) {
- edl->clips[idx] = clip_edl;
+ edl->clips[idx] = new_clip;
clip->remove_user();
}
else
- edl->clips.append(clip_edl);
- mwindow->mainindexes->add_next_asset(0, clip_edl);
+ edl->clips.append(new_clip);
+ mwindow->mainindexes->add_next_asset(0, nested);
mwindow->mainindexes->start_build();
popup->gui->async_update_assets();
}
void Edit::copy_from(Edit *edit)
{
- this->nested_edl = edl->nested_edls.get_copy(edit->nested_edl);
+ this->nested_edl = edl->nested_edls.get_nested(edit->nested_edl);
this->asset = edl->assets->update(edit->asset);
this->startsource = edit->startsource;
this->startproject = edit->startproject;
{
EDL *dest_nested_edl = 0;
if(source_edit->nested_edl)
- dest_nested_edl = edl->nested_edls.get_copy(source_edit->nested_edl);
+ dest_nested_edl = edl->nested_edls.get_nested(source_edit->nested_edl);
// Update Assets
Asset *dest_asset = 0;
return 0;
}
-EDL *EDL::get_nested(EDL *nested_edl, const char *path)
+void EDL::copy_indexables(EDL *edl)
{
- for( int i=0; i<nested_edls.size(); ++i ) {
- EDL *dst = nested_edls[i];
- if( !strcmp(path, dst->path) ) return dst;
+ for( Track *track=edl->tracks->first; track; track=track->next ) {
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ if( edit->asset )
+ assets->update(edit->asset);
+ if( edit->nested_edl )
+ nested_edls.get_nested(edit->nested_edl);
+ }
}
- return new_nested(nested_edl, path);
}
-EDL *EDL::new_nested(EDL *nested_edl, const char *path)
+EDL *EDL::new_nested(EDL *edl, const char *path)
+{
+ EDL *nested = new EDL; // no parent for nested edl
+ nested->create_objects();
+ nested->copy_session(edl);
+ nested->set_path(path);
+ nested->update_index(edl);
+ nested->copy_indexables(edl);
+ nested->tracks->copy_from(edl->tracks);
+ nested_edls.append(nested);
+ return nested;
+}
+
+EDL *EDL::create_nested_clip(EDL *nested)
{
- EDL *new_edl = new EDL; // no parent for nested clip
+ EDL *new_edl = new EDL(this); // parent for clip edl
new_edl->create_objects();
- new_edl->copy_session(this);
- new_edl->create_nested(nested_edl, path);
+ new_edl->create_nested(nested);
return new_edl;
}
-void EDL::create_nested(EDL *nested_edl, const char *path)
+void EDL::create_nested(EDL *nested)
{
- set_path(path);
- strcpy(local_session->clip_title, path);
-// save a ref to nested edl for garbage delete
- EDL *nest = clips.get_copy(nested_edl);
// Keep frame rate, sample rate, and output size unchanged.
// Nest all video & audio outputs
session->video_tracks = 1;
- session->audio_tracks = nest->session->audio_channels;
+ session->audio_tracks = nested->session->audio_channels;
create_default_tracks();
- insert_asset(0, nest, 0, 0, 0);
+ insert_asset(0, nested, 0, 0, 0);
}
void EDL::retrack()
EDL *new_nested_edl = 0;
if( asset ) new_asset = assets->update(asset);
- if( nested_edl ) new_nested_edl = nested_edls.get_copy(nested_edl);
+ if( nested_edl ) new_nested_edl = nested_edls.get_nested(nested_edl);
// Paste video
int vtrack = 0;
int copy(double start, double end, int all,
const char *closer, FileXML *file,
const char *output_path, int rewind_it);
- EDL *get_nested(EDL *nested_edl, const char *path);
- EDL *new_nested(EDL *nested_edl, const char *path);
- void create_nested(EDL *nested_edl, const char *path);
+ void copy_indexables(EDL *edl);
+ EDL *new_nested(EDL *edl, const char *path);
+ EDL *create_nested_clip(EDL *nested);
+ void create_nested(EDL *nested);
void paste_silence(double start, double end,
int edit_labels /* = 1 */,
int edit_plugins,
if( index_state == src->index_state ) return;
if( index_state ) index_state->remove_user();
index_state = src->index_state;
- index_state->add_user();
+ if( index_state ) index_state->add_user();
}
nested_edl->create_objects();
nested_edl->load_xml(&xml_file, LOAD_ALL);
//printf("MWindow::load_filenames %p %s\n", nested_edl, nested_edl->project_path);
- new_edl->create_nested(nested_edl, filenames->get(i));
+ new_edl->create_nested(nested_edl);
+ new_edl->set_path(filenames->get(i));
nested_edl->Garbage::remove_user();
}
else {
new_edl->copy_session(edl);
if( !indexable->is_asset ) {
EDL *nested_edl = (EDL*)indexable;
- new_edl->create_nested(nested_edl, indexable->path);
+ new_edl->create_nested(nested_edl);
+ new_edl->set_path(indexable->path);
}
else {
Asset *asset = (Asset*)indexable;
edl->add_clip(new_edl->clips[j]);
}
for( int j=0; j<new_edl->nested_edls.size(); ++j ) {
- edl->nested_edls.get_copy(new_edl->nested_edls[j]);
+ edl->nested_edls.get_nested(new_edl->nested_edls[j]);
}
if( new_edl->total_vwindow_edls() ) {
*/
#include "assetedit.h"
+#include "assetremove.h"
#include "proxypopup.h"
#include "awindow.h"
#include "awindowgui.h"
void ProxyPopup::create_objects()
{
+ BC_MenuItem *menu_item;
+ BC_SubMenu *submenu;
add_item(info = new ProxyPopupInfo(mwindow, this));
add_item(format = new AWindowListFormat(mwindow, gui));
add_item(new ProxyPopupSort(mwindow, this));
add_item(view_window = new ProxyPopupViewWindow(mwindow, this));
add_item(new ProxyPopupCopy(mwindow, this));
add_item(new ProxyPopupPaste(mwindow, this));
+ add_item(menu_item = new BC_MenuItem(_("Remove...")));
+ menu_item->add_submenu(submenu = new BC_SubMenu());
+ submenu->add_submenuitem(new ProxyPopupProjectRemove(mwindow, this));
+ submenu->add_submenuitem(new ProxyPopupDiskRemove(mwindow, this));
}
void ProxyPopup::paste_assets()
}
+ProxyPopupProjectRemove::ProxyPopupProjectRemove(MWindow *mwindow, ProxyPopup *popup)
+ : BC_MenuItem(_("Remove from project"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+
+ProxyPopupProjectRemove::~ProxyPopupProjectRemove()
+{
+}
+
+int ProxyPopupProjectRemove::handle_event()
+{
+ popup->gui->collect_assets();
+ mwindow->remove_assets_from_project(1, 1,
+ mwindow->session->drag_assets,
+ mwindow->session->drag_clips);
+ return 1;
+}
+
+
+ProxyPopupDiskRemove::ProxyPopupDiskRemove(MWindow *mwindow, ProxyPopup *popup)
+ : BC_MenuItem(_("Remove from disk"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+
+
+ProxyPopupDiskRemove::~ProxyPopupDiskRemove()
+{
+}
+
+int ProxyPopupDiskRemove::handle_event()
+{
+ popup->gui->collect_assets();
+ mwindow->awindow->asset_remove->start();
+ return 1;
+}
+
+
+
ProxyListMenu::ProxyListMenu(MWindow *mwindow, AWindowGUI *gui)
: BC_PopupMenu(0, 0, 0, "", 0)
{
ProxyPopup *popup;
};
+class ProxyPopupProjectRemove : public BC_MenuItem
+{
+public:
+ ProxyPopupProjectRemove(MWindow *mwindow, ProxyPopup *popup);
+ ~ProxyPopupProjectRemove();
+
+ int handle_event();
+
+ MWindow *mwindow;
+ ProxyPopup *popup;
+};
+
+class ProxyPopupDiskRemove : public BC_MenuItem
+{
+public:
+ ProxyPopupDiskRemove(MWindow *mwindow, ProxyPopup *popup);
+ ~ProxyPopupDiskRemove();
+
+ int handle_event();
+
+ MWindow *mwindow;
+ ProxyPopup *popup;
+};
+
class ProxyListMenu : public BC_PopupMenu
{
public:
class ProxyPopupView;
class ProxyPopupViewWindow;
class ProxyPopupCopy;
+class ProxyPopupProjectRemove;
+class ProxyPopupDiskRemove;
class ProxyListMenu;
#endif