gui->del_keyboard_listener(
(int (BC_WindowBase::*)(BC_WindowBase *))
&MWindowGUI::keyboard_listener);
+ reset_caches();
#if 0
// release the hounds
if( awindow && awindow->gui ) awindow->gui->close(0);
gui->close(0);
join();
#endif
- reset_caches();
dead_plugins->remove_all_objects();
// must delete theme before destroying plugindb
// theme destructor will be deleted by delete_plugins
return zwindow;
}
-void MWindow::del_mixer(ZWindow *zwindow)
+ZWindow *MWindow::get_mixer(int idx)
{
- zwindows_lock->lock("MWindow::del_mixer 0");
- edl->mixers.del_mixer(zwindow->idx);
+ ZWindow *zwindow = 0;
+ zwindows_lock->lock("MWindow::get_mixer");
+ for( int i=0; !zwindow && i<zwindows.size(); ++i ) {
+ ZWindow *zwdw = zwindows[i];
+ if( !zwdw->running() ) continue;
+ if( zwdw->idx != idx ) continue;
+ zwindow = zwindows[i];
+ }
+ zwindows_lock->unlock();
+ return zwindow;
+}
+
+void MWindow::close_mixer(ZWindow *zwindow)
+{
+ zwindows_lock->lock("MWindow::close_mixer 0");
if( session->selected_zwindow >= 0 ) {
int i = zwindows.number_of(zwindow);
if( i >= 0 && i < session->selected_zwindow )
session->selected_zwindow = -1;
}
zwindows_lock->unlock();
- gui->lock_window("MWindow::del_mixer 1");
+ gui->lock_window("MWindow::close_mixer 1");
gui->update_mixers(0, -1);
gui->unlock_window();
}
gui->mbuttons->edit_panel->keyframe->update(value);
gui->flush();
cwindow->gui->lock_window("MWindow::set_auto_keyframes");
- cwindow->gui->edit_panel->keyframe->update(value);
cwindow->gui->flush();
cwindow->gui->unlock_window();
}
gui->mbuttons->edit_panel->span_keyframe->update(value);
gui->flush();
cwindow->gui->lock_window("MWindow::set_span_keyframes");
- cwindow->gui->edit_panel->span_keyframe->update(value);
cwindow->gui->flush();
cwindow->gui->unlock_window();
}
for( int i=0; i<edl->mixers.size(); ++i ) {
Mixer *mixer = edl->mixers[i];
+ if( !mixer->show ) continue;
ZWindow *zwindow = get_mixer(mixer);
zwindow->set_title(mixer->title);
zwindow->start();
if(debug) PRINT_TRACE
}
-void MWindow::stack_push(EDL *new_edl, Indexable *idxbl)
+void MWindow::stack_push(EDL *new_edl, Indexable *idxbl, Edit *edit)
{
int got_indexes = 0;
for( int i=0; i<new_edl->nested_edls.size(); ++i ) {
undo_before();
StackItem &item = stack.append();
item.edl = edl;
+ item.edit = edit;
item.new_edl = new_edl;
+ item.duration = new_edl->tracks->total_length();
item.undo = undo;
item.idxbl = idxbl;
item.mtime = 0;
// session edl replaced, overwrite and save clip data
if( item.new_edl != edl )
item.new_edl->overwrite_clip(edl);
+ Edit *edit = item.edit;
+// resize the referring edit if the edl duration changed
+ if( edit ) {
+ double duration = item.new_edl->tracks->total_length();
+ double dt = duration - item.duration;
+ if( fabs(dt) > 1e-4 ) {
+ int64_t du = edit->track->to_units(dt,0);
+ if( (edit->length+=du) < 0 )
+ edit->length = 0;
+ }
+ }
edl->remove_user();
edl = item.edl;
delete undo;
stack.remove();
if( idxbl ) {
gui->unlock_window();
+ gui->resource_thread->close_indexable(idxbl);
remove_from_caches(idxbl);
remove_indexfile(idxbl);
mainindexes->add_indexable(idxbl);
return;
}
undo_before();
+ awindow->gui->stop_vicon_drawing();
int clips_total = session->drag_clips->total;
for( int i=0; i<clips_total; ++i ) {
EDL *clip = session->drag_clips->values[i];
void MWindow::reset_caches()
{
+ awindow->gui->stop_vicon_drawing();
frame_cache->remove_all();
wave_cache->remove_all();
audio_cache->remove_all();
void MWindow::remove_from_caches(Indexable *idxbl)
{
+ awindow->gui->stop_vicon_drawing();
frame_cache->remove_item(idxbl);
wave_cache->remove_item(idxbl);
if( gui->render_engine &&
delete gui->render_engine;
gui->render_engine = 0;
}
- if( gui->resource_thread->render_engine_id == idxbl->id ) {
- gui->resource_thread->render_engine_id = -1;
- delete gui->resource_thread->render_engine;
- gui->resource_thread->render_engine = 0;
- }
+ gui->resource_thread->close_indexable(idxbl);
if( !idxbl->is_asset ) return;
Asset *asset = (Asset *)idxbl;
audio_cache->delete_entry(asset);
if( zwindow->zgui->playback_engine->video_cache )
zwindow->zgui->playback_engine->video_cache->delete_entry(asset);
}
+ awindow->gui->start_vicon_drawing();
}
void MWindow::remove_assets_from_project(int push_undo, int redraw, int delete_indexes,
ArrayList<Indexable*> *drag_assets, ArrayList<EDL*> *drag_clips)
{
- awindow->gui->close_view_popup();
+ awindow->gui->stop_vicon_drawing();
// Remove from VWindow.
if( drag_clips ) {
fprintf(fp, "\n");
}
+void MWindow::dump_caches(FILE *fp)
+{
+ fprintf(fp, "audio cache: ");
+ audio_cache->dump(fp);
+ fprintf(fp, "video cache: ");
+ video_cache->dump(fp);
+}
+
void MWindow::trap_hook(FILE *fp, void *vp)
{
MWindow *mwindow = (MWindow *)vp;
mwindow->dump_undo(fp);
fprintf(fp, "\nEXE: %s\n", AboutPrefs::build_timestamp);
mwindow->dump_exe(fp);
+ fprintf(fp, "\nCACHES:\n");
+ mwindow->dump_caches(fp);
}
return patchgui;
}
-int MWindow::get_cpus()
+int MWindow::get_cpus(int out_w, int out_h)
{
- int out_w = edl->session->output_w;
- int out_h = edl->session->output_h;
+ if( !out_w ) out_w = edl->session->output_w;
+ if( !out_h ) out_h = edl->session->output_h;
int cpus = out_w*out_h/0x80000 + 1;
if( cpus > preferences->processors )
cpus = preferences->processors;
return cpus;
}
+int MWindow::get_cpus()
+{
+ return get_cpus(edl->session->output_w, edl->session->output_h);
+}