gui->del_keyboard_listener(
(int (BC_WindowBase::*)(BC_WindowBase *))
&MWindowGUI::keyboard_listener);
- reset_caches();
+ reset_caches(0);
#if 0
// release the hounds
if( awindow && awindow->gui ) awindow->gui->close(0);
void MWindow::check_language()
{
+ char pref_locale[BCSTRLEN];
+ strcpy(pref_locale, DEFAULT_LOCALE);
+ defaults->get("LOCALE",pref_locale);
+// set LANGUAGE if pref locale != sys
+ if( strcmp(pref_locale, DEFAULT_LOCALE) )
+ setenv("LANGUAGE", pref_locale, 1);
+
char curr_lang[BCTEXTLEN]; curr_lang[0] = 0;
const char *env_lang = getenv("LANGUAGE");
if( !env_lang ) env_lang = getenv("LC_ALL");
// Start examining next batch of index files
if(got_indexes) mainindexes->start_build();
+// reload renderengine edl or the plugin guis will flip out
+ sync_parameters(CHANGE_ALL);
// Open plugin GUIs
show_plugins();
init_3d();
if(debug) PRINT_TRACE
- show_splash();
if(debug) PRINT_TRACE
default_standard = default_std();
init_defaults(defaults, config_path);
check_language();
+ show_splash();
init_preferences();
if(splash_window)
splash_window->update_status(_("Initializing Plugins"));
{
session->show_cwindow = 1;
cwindow->show_window();
+ cwindow->gui->tool_panel->raise_tool();
gui->mainmenu->show_cwindow->set_checked(1);
}
if( load_mode == LOADMODE_REPLACE ||
load_mode == LOADMODE_REPLACE_CONCATENATE ) {
edl->session->timecode_offset = 0;
- delete gui->keyvalue_popup;
- gui->keyvalue_popup = 0;
+ gui->close_keyvalue_popup();
gui->load_panes();
}
if(debug) PRINT_TRACE
}
-void MWindow::stack_push(EDL *new_edl, Indexable *idxbl, Edit *edit)
+void MWindow::stack_push(EDL *new_edl, Indexable *idxbl)
{
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;
// 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;
+ Indexable *idxbl = item.idxbl;
+ if( idxbl && idxbl->is_asset && item.mtime ) {
+ Asset *asset = (Asset *)idxbl;
+ if( asset->format == FILE_REF ) {
+ char *path = asset->path;
+ struct stat st;
+ if( stat(path, &st) || item.mtime == st.st_mtime ) {
+ int cw = xS(250), ch = yS(150), px, py;
+ gui->get_pop_cursor(px, py);
+ px -= cw/2; py -= ch/2;
+ ConfirmRefWindow confirm(this, path, px, py, cw, ch);
+ confirm.create_objects();
+ int result = confirm.run_window();
+ if( !result ) {
+ FileXML file;
+ item.new_edl->save_xml(&file, path);
+ file.terminate_string();
+ if(file.write_to_file(path))
+ eprintf(_("Cant write FileREF: %s"), path);
+ }
+ }
}
}
edl->remove_user();
edl = item.edl;
delete undo;
undo = item.undo;
- Indexable *idxbl = item.idxbl;
- int64_t mtime = item.mtime;
stack.remove();
if( idxbl ) {
+// resize the indexable edits if the new_edl duration changed
+ double duration = item.new_edl->tracks->total_length();
+ double dt = duration - item.duration;
+ if( fabs(dt) > 1e-4 )
+ edl->tracks->update_idxbl_length(idxbl->id, dt);
gui->unlock_window();
gui->resource_thread->close_indexable(idxbl);
remove_from_caches(idxbl);
- remove_indexfile(idxbl);
+ IndexFile::delete_index_files(preferences, idxbl);
mainindexes->add_indexable(idxbl);
mainindexes->start_build();
awindow->gui->async_update_assets();
undo_after(_("open edl"), LOAD_ALL);
show_plugins();
gui->stack_button->update();
- if( mtime && idxbl && idxbl->is_asset ) {
- struct stat st;
- Asset *asset = (Asset *)idxbl;
- if( asset->format == FILE_REF && !stat(asset->path, &st) &&
- item.mtime == st.st_mtime ) {
- char text[BCTEXTLEN];
- snprintf(text, sizeof(text),
- _("Warning: Asset not updated: %s"), asset->path);
- show_warning(&preferences->warn_stack, text);
- }
- }
}
int MWindow::save(EDL *edl, char *filename, int stat)
if( prefs != preferences )
preferences->copy_from(prefs);
if( cwindow->playback_engine )
- cwindow->playback_engine->preferences->copy_from(prefs);
+ cwindow->playback_engine->update_preferences(prefs);
for(int i = 0; i < vwindows.size(); i++) {
VWindow *vwindow = vwindows[i];
if( !vwindow->is_running() ) continue;
if( vwindow->playback_engine )
- vwindow->playback_engine->preferences->copy_from(prefs);
+ vwindow->playback_engine->update_preferences(prefs);
}
for(int i = 0; i < zwindows.size(); i++) {
ZWindow *zwindow = zwindows[i];
if( !zwindow->is_running() ) continue;
if( zwindow->zgui->playback_engine )
- zwindow->zgui->playback_engine->preferences->copy_from(prefs);
+ zwindow->zgui->playback_engine->update_preferences(prefs);
}
}
void MWindow::remove_indexfile(Indexable *indexable)
{
if( !indexable->is_asset ) return;
- Asset *asset = (Asset *)indexable;
// Erase file
- IndexFile::delete_index(preferences, asset, ".toc");
- IndexFile::delete_index(preferences, asset, ".idx");
- IndexFile::delete_index(preferences, asset, ".mkr");
+ IndexFile::delete_index_files(preferences, indexable);
}
void MWindow::rebuild_indices()
return 0;
}
-void MWindow::reset_caches()
+void MWindow::reset_caches(int locked)
{
- int locked = gui->get_window_lock();
if( locked ) gui->unlock_window();
awindow->gui->stop_vicon_drawing(1);
- frame_cache->remove_all();
- wave_cache->remove_all();
- audio_cache->remove_all();
- video_cache->remove_all();
- if( cwindow->playback_engine ) {
- if( cwindow->playback_engine->audio_cache )
- cwindow->playback_engine->audio_cache->remove_all();
- if( cwindow->playback_engine->video_cache )
- cwindow->playback_engine->video_cache->remove_all();
- }
+ if( cwindow->playback_engine )
+ cwindow->playback_engine->create_cache();
for(int i = 0; i < vwindows.size(); i++) {
VWindow *vwindow = vwindows[i];
if( !vwindow->is_running() ) continue;
if( !vwindow->playback_engine ) continue;
- if( vwindow->playback_engine->audio_cache )
- vwindow->playback_engine->audio_cache->remove_all();
- if( vwindow->playback_engine->video_cache )
- vwindow->playback_engine->video_cache->remove_all();
+ vwindow->playback_engine->create_cache();
}
- if( locked ) gui->lock_window("MWindow::reset_caches");
+ gui->lock_window("MWindow::reset_caches");
+ frame_cache->remove_all();
+ wave_cache->remove_all();
+ audio_cache->remove_all();
+ video_cache->remove_all();
+ if( !locked ) gui->unlock_window();
}
void MWindow::remove_from_caches(Indexable *idxbl)
mwindow->gui->unlock_window();
}
+
+ConfirmRefWindow::ConfirmRefWindow(MWindow *mwindow, char *path,
+ int px, int py, int cw, int ch)
+ : BC_Window(_(PROGRAM_NAME ": Confirm update"), px, py, cw, ch, cw, ch)
+{
+ this->mwindow = mwindow;
+ this->path = path;
+}
+
+ConfirmRefWindow::~ConfirmRefWindow()
+{
+}
+
+void ConfirmRefWindow::create_objects()
+{
+ lock_window("ConfirmRefWindow::create_objects()");
+ int x = xS(10), y = yS(10), pad = yS(5);
+ BC_Title *title;
+ add_subwindow(title = new BC_Title(x, y, _("FileREF not updated:")));
+ y += title->get_h() + pad;
+ BC_TextBox *text_box;
+ add_subwindow(text_box = new BC_TextBox(x,y, get_w()-2*x, 1, path));
+ y += text_box->get_h() + 2*pad;
+ add_subwindow(title = new BC_Title(x, y, _("Save file ref changes?")));
+ add_subwindow(new BC_OKButton(this));
+ add_subwindow(new BC_CancelButton(this));
+ show_window();
+ unlock_window();
+}
+