}
}
-
-
BC_Window* VWindow::new_gui()
{
//printf("VWindow::create_objects 1\n");
return gui;
}
+void VWindow::handle_close_event(int result)
+{
+ delete playback_engine;
+ playback_engine = 0;
+}
+
EDL* VWindow::get_edl()
{
void VWindow::change_source(int edl_number)
{
if(!is_running()) return;
+ if( playback_engine->is_playing_back )
+ stop_playback(1);
+ gui->lock_window("VWindow::change_source 1");
//printf("VWindow::change_source %d %p\n", __LINE__, mwindow->edl->get_vwindow_edl(edl_number));
if( edl_number >= 0 && edl_number < mwindow->edl->total_vwindow_edls() &&
mwindow->edl->get_vwindow_edl(edl_number) )
// indexable = 0;
// mwindow->edl->vwindow_edl_shared = 0;
}
+ gui->unlock_window();
}
void VWindow::change_source(Indexable *indexable)
{
+ if( !indexable->is_asset ) {
+ change_source((EDL*)indexable);
+ return;
+ }
if(!running()) return;
-// if(asset && this->asset &&
-// asset->id == this->asset->id &&
-// asset == this->asset) return;
+ if( playback_engine->is_playing_back )
+ stop_playback(1);
-//printf("VWindow::change_source %d\n", __LINE__);
+ gui->lock_window("VWindow::change_source 2");
char title[BCTEXTLEN];
FileSystem fs;
fs.extract_name(title, indexable->path);
-//printf("VWindow::change_source 1\n");
-
delete_source(1, 0);
-//printf("VWindow::change_source 1\n");
-
-// Generate EDL off of main EDL for cutting
- Asset *asset = 0;
- EDL *nested_edl = 0;
- if(indexable->is_asset)
- {
- this->indexable = asset = new Asset;
- asset->copy_from((Asset*)indexable, 0);
- }
- else
- {
- this->indexable = nested_edl = new EDL;
- nested_edl->create_objects();
- nested_edl->copy_all((EDL*)indexable);
- }
// Create EDL
this->edl = new EDL(mwindow->edl);
this->edl->create_objects();
mwindow->edl->append_vwindow_edl(this->edl, 1);
-// mwindow->edl->vwindow_edl = new EDL(mwindow->edl);
-// mwindow->edl->vwindow_edl_shared = 0;
-// mwindow->edl->vwindow_edl->create_objects();
-
-//printf("VWindow::change_source 1 %d %p %p\n", __LINE__, asset, nested_edl);
- if(asset)
- mwindow->asset_to_edl(this->edl, asset);
- else
- mwindow->edl_to_nested(this->edl, nested_edl);
+// Generate EDL off of main EDL for cutting
+ Asset *asset = new Asset;
+ asset->copy_from((Asset*)indexable, 0);
+ this->indexable = asset;
+ mwindow->asset_to_edl(this->edl, asset);
// Update GUI
gui->change_source(this->edl, title);
update_position(CHANGE_ALL, 1, 1, 1);
-
-
-//printf("VWindow::change_source 2\n");
+ gui->unlock_window();
}
void VWindow::change_source(EDL *edl)
{
if(!running()) return;
+ if( playback_engine->is_playing_back )
+ stop_playback(1);
+
//printf("VWindow::change_source %d %p\n", __LINE__, edl);
// EDLs are identical
// if(edl && mwindow->edl->vwindow_edl &&
// edl->id == mwindow->edl->vwindow_edl->id) return;
if(edl && get_edl() && edl->id == get_edl()->id) return;
+ gui->lock_window("VWindow::change_source 3");
+
delete_source(1, 0);
if(edl)
}
else
gui->change_source(edl, _("Viewer"));
+ gui->unlock_window();
}
-void VWindow::change_source(char *folder, int item)
-{
-//printf("VWindow::change_source %d\n", __LINE__);
- int result = 0;
- if(!running()) return;
-// Search EDLs
- if(!strcasecmp(folder, CLIP_FOLDER))
- {
- if(item < mwindow->edl->clips.total)
- {
- change_source(mwindow->edl->clips.values[item]);
- result = 1;
- }
- }
- else
-// Search media
- if(!strcasecmp(folder, MEDIA_FOLDER))
- {
- if(item < mwindow->edl->assets->total())
- {
- change_source(mwindow->edl->assets->get_item_number(item));
- result = 1;
- }
- }
- else
-// Search extra clip folders
- {
- }
-
- if(!result)
- {
- delete_source(1, 1);
- }
-}
-
-
-
void VWindow::goto_start()
{
{
//printf("VWindow::update_position %d\n", __LINE__);
//edl->dump();
- playback_engine->que->send_command(CURRENT_FRAME,
- change_type,
- edl,
- 1);
+ playback_engine->refresh_frame(change_type, edl);
double position = edl->local_session->get_selectionstart(1);
- Asset *asset = edl->assets->first;
- if( asset && asset->tcstart ) {
- double rate = asset->video_data ? asset->frame_rate :
- asset->audio_data ? asset->sample_rate : 0;
- if( rate > 0 )
- position += asset->tcstart / rate;
- }
-
if(lock_window) gui->lock_window("VWindow::update_position");
gui->clock->update(position);
+ gui->timebar->update(1);
if(lock_window) gui->unlock_window();
}
}
-
-
-
+void VWindow::stop_playback(int wait)
+{
+ playback_engine->stop_playback(wait);
+}
int VWindow::update_position(double position)
{
}
}
-void VWindow::clear_inpoint()
-{
- EDL *edl = get_edl();
- if(edl)
- {
- edl->local_session->unset_inpoint();
- gui->timebar->update(1);
- }
-}
-
-void VWindow::clear_outpoint()
+void VWindow::unset_inoutpoint()
{
EDL *edl = get_edl();
if(edl)
{
- edl->local_session->unset_outpoint();
+ edl->unset_inoutpoint();
gui->timebar->update(1);
}
}
-void VWindow::copy()
+void VWindow::copy(int all)
{
EDL *edl = get_edl();
if(edl)
{
- double start = edl->local_session->get_selectionstart();
- double end = edl->local_session->get_selectionend();
+ double start = all ? 0 :
+ edl->local_session->get_selectionstart();
+ double end = all ? edl->tracks->total_length() :
+ edl->local_session->get_selectionend();
+ EDL *copy_edl = new EDL; // no parent or assets wont be copied
+ copy_edl->create_objects();
+ copy_edl->copy_all(edl);
FileXML file;
- edl->copy(start,
- end,
- 0,
- 0,
- 0,
- &file,
- "",
- 1);
+ copy_edl->copy(start, end, 0, &file, "", 1);
+ copy_edl->remove_user();
const char *file_string = file.string();
long file_length = strlen(file_string);
mwindow->gui->lock_window();
- mwindow->gui->get_clipboard()->to_clipboard(file_string, file_length,
- SECONDARY_SELECTION);
- mwindow->gui->get_clipboard()->to_clipboard(file_string, file_length,
- BC_PRIMARY_SELECTION);
+ mwindow->gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
+ mwindow->gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION);
mwindow->gui->unlock_window();
}
}