#include "awindowgui.h"
#include "awindow.h"
#include "batchrender.h"
+#include "bccmodels.h"
#include "bcdisplayinfo.h"
#include "bcprogressbox.h"
#include "bcsignals.h"
#include "channelinfo.h"
#include "clip.h"
#include "clipedls.h"
-#include "bccmodels.h"
#include "commercials.h"
#include "confirmsave.h"
+#include "convert.h"
#include "cplayback.h"
#include "ctimebar.h"
#include "cwindowgui.h"
#include "mainsession.h"
#include "mainundo.h"
#include "mbuttons.h"
+#include "mixersalign.h"
#include "mutex.h"
#include "mwindowgui.h"
#include "mwindow.h"
#include "savefile.inc"
#include "samplescroll.h"
#include "sha1.h"
+#include "shuttle.h"
#include "sighandler.h"
#include "splashgui.h"
#include "statusbar.h"
#include "vframe.h"
#include "vtrack.h"
#include "versioninfo.h"
+#include "vicon.h"
#include "videodevice.inc"
#include "videowindow.h"
#include "vplayback.h"
}
-
extern long cin_timezone;
ArrayList<PluginServer*>* MWindow::plugindb = 0;
playback_3d = 0;
splash_window = 0;
undo = 0;
+ undo_command = COMMAND_NONE;
defaults = 0;
assets = 0;
//commercials = 0;
create_bd = 0;
create_dvd = 0;
batch_render = 0;
+ convert_render = 0;
render = 0;
edl = 0;
gui = 0;
screens = 1;
in_destructor = 0;
speed_edl = 0;
- proxy_beep = 0;
+ beeper = 0;
+ shuttle = 0;
+ mixers_align = 0;
}
run_lock->lock("MWindow::~MWindow");
in_destructor = 1;
//printf("MWindow::~MWindow %d\n", __LINE__);
+ if( wwindow && wwindow->is_running() )
+ wwindow->close_window();
+ if( twindow && twindow->is_running() )
+ twindow->close_window();
gui->remote_control->deactivate();
gui->record->stop();
#ifdef HAVE_DVB
gui->channel_info->stop();
#endif
- delete proxy_beep;
+ delete beeper;
delete create_bd; create_bd = 0;
delete create_dvd; create_dvd = 0;
+ delete shuttle; shuttle = 0;
delete batch_render; batch_render = 0;
+ delete convert_render; convert_render = 0;
delete render; render = 0;
+ delete mixers_align; mixers_align = 0;
commit_commercial();
if( commercials && !commercials->remove_user() ) commercials = 0;
close_mixers();
if( cwindow && cwindow->gui ) cwindow->gui->close(0);
if( lwindow && lwindow->gui ) lwindow->gui->close(0);
if( gwindow && gwindow->gui ) gwindow->gui->close(0);
- if( twindow && twindow->is_running() ) twindow->close_window();
- if( wwindow && wwindow->is_running() ) wwindow->close_window();
vwindows.remove_all_objects();
zwindows.remove_all_objects();
gui->close(0);
if( awindow ) awindow->join();
if( cwindow ) cwindow->join();
if( lwindow ) lwindow->join();
- if( twindow ) twindow->join();
- if( wwindow ) wwindow->join();
if( gwindow ) gwindow->join();
join();
#else
close_gui(cwindow);
close_gui(lwindow);
close_gui(gwindow);
- close_gui(twindow);
- close_gui(wwindow);
vwindows.remove_all_objects();
zwindows.remove_all_objects();
gui->close(0);
colormodels.remove_all_objects();
interlace_project_modes.remove_all_objects();
interlace_asset_modes.remove_all_objects();
- interlace_asset_fixmethods.remove_all_objects();
sighandler->terminate();
delete sighandler;
delete run_lock;
{
preferences = new Preferences;
preferences->load_defaults(defaults);
- const char *lv2_path = getenv("LV2_PATH");
- if( lv2_path && strcmp(lv2_path, preferences->lv2_path) ) {
- strncpy(preferences->lv2_path, lv2_path, sizeof(preferences->lv2_path));
- remove_plugin_index();
- }
- else if( !lv2_path && preferences->lv2_path[0] ) {
- File::setenv_path("LV2_PATH",preferences->lv2_path, 0);
- }
+ File::setenv_path("LV2_PATH",preferences->lv2_path, 1);
session = new MainSession(this);
session->load_defaults(defaults);
// set x11_host, screens, window_config
zwindows_lock->lock("MWindow::get_mixer");
if( !mixer ) mixer = edl->mixers.new_mixer();
ZWindow *zwindow = 0;
- for( int i=0; !zwindow && i<zwindows.size(); ++i )
- if( zwindows[i]->idx < 0 ) zwindow = zwindows[i];
+ for( int i=0; !zwindow && i<zwindows.size(); ++i ) {
+ ZWindow *zwdw = zwindows[i];
+ if( zwdw->running() ) continue;
+ if( zwdw->idx >= 0 ) continue;
+ zwindow = zwindows[i];
+ }
if( !zwindow )
zwindows.append(zwindow = new ZWindow(this));
zwindow->idx = mixer->idx;
zwindows_lock->unlock();
}
-void MWindow::queue_mixers(EDL *edl, int command, int wait_tracking,
- int use_inout, int update_refresh, int toggle_audio, int loop_play)
+void MWindow::handle_mixers(EDL *edl, int command, int wait_tracking,
+ int use_inout, int toggle_audio, int loop_play, float speed)
{
- zwindows_lock->lock("MWindow::queue_mixers");
+ zwindows_lock->lock("MWindow::handle_mixers");
for( int vidx=0; vidx<zwindows.size(); ++vidx ) {
ZWindow *zwindow = zwindows[vidx];
if( zwindow->idx < 0 ) continue;
track->record = track->play = 0;
}
zwindow->change_source(mixer_edl);
- zwindow->issue_command(command,
- wait_tracking, use_inout, update_refresh, toggle_audio, loop_play);
+ zwindow->handle_mixer(command, 0,
+ use_inout, toggle_audio, loop_play, speed);
}
zwindows_lock->unlock();
}
void MWindow::refresh_mixers(int dir)
{
int command = dir >= 0 ? CURRENT_FRAME : LAST_FRAME;
- queue_mixers(edl,command,0,0,1,0,0);
+ handle_mixers(edl, command, 0, 0, 0, 0, 0);
}
void MWindow::stop_mixers()
for( int vidx=0; vidx<zwindows.size(); ++vidx ) {
ZWindow *zwindow = zwindows[vidx];
if( zwindow->idx < 0 ) continue;
- zwindow->issue_command(STOP, 0, 0, 0, 0, 0);
+ zwindow->handle_mixer(STOP, 0, 0, 0, 0, 0);
}
}
-void MWindow::close_mixers(int destroy)
+void MWindow::close_mixers(int result)
{
ArrayList<ZWindow*> closed;
zwindows_lock->lock("MWindow::close_mixers");
for( int i=zwindows.size(); --i>=0; ) {
ZWindow *zwindow = zwindows[i];
if( zwindow->idx < 0 ) continue;
- zwindow->destroy = destroy;
+ zwindow->idx = -1;
ZWindowGUI *zgui = zwindow->zgui;
zgui->lock_window("MWindow::select_zwindow 0");
- zgui->set_done(0);
+ zgui->set_done(result);
zgui->unlock_window();
closed.append(zwindow);
}
}
}
-ZWindow *MWindow::create_mixer(Indexable *indexable)
+ZWindow *MWindow::create_mixer(Indexable *indexable, double position)
{
ArrayList<Indexable*> new_assets;
new_assets.append(indexable);
Track *track = edl->tracks->last;
- load_assets(&new_assets, 0, LOADMODE_NEW_TRACKS, 0, 0, 0, 0, 0, 0);
+ load_assets(&new_assets, position, LOADMODE_NEW_TRACKS, 0, 0, 0, 0, 0, 1);
track = !track ? edl->tracks->first : track->next;
Mixer *mixer = 0;
ZWindow *zwindow = get_mixer(mixer);
return zwindow;
}
-void MWindow::create_mixers()
+void MWindow::create_mixers(double position)
{
if( !session->drag_assets->size() &&
!session->drag_clips->size() ) return;
- undo->update_undo_before();
+ undo_before();
select_zwindow(0);
ArrayList<ZWindow *>new_mixers;
for( int i=0; i<session->drag_assets->size(); ++i ) {
Indexable *indexable = session->drag_assets->get(i);
if( !indexable->have_video() ) continue;
- ZWindow *zwindow = create_mixer(indexable);
+ ZWindow *zwindow = create_mixer(indexable, position);
new_mixers.append(zwindow);
}
for( int i=0; i<session->drag_clips->size(); ++i ) {
Indexable *indexable = (Indexable*)session->drag_clips->get(i);
if( !indexable->have_video() ) continue;
- ZWindow *zwindow = create_mixer(indexable);
+ ZWindow *zwindow = create_mixer(indexable, position);
new_mixers.append(zwindow);
}
refresh_mixers();
save_backup();
- undo->update_undo_after(_("create mixers"), LOAD_ALL);
+ undo_after(_("create mixers"), LOAD_ALL);
restart_brender();
- gui->update(1, 2, 1, 1, 1, 1, 0);
+ gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
sync_parameters(CHANGE_ALL);
}
int bw = lt + BC_DisplayInfo::get_right_border(); // borders
int bh = top + BC_DisplayInfo::get_bottom_border();
int zx = 0, zy = 0; // window origins
- int mw = 10+10, mh = 10+10; // canvas margins
+ int mw = xS(10+10), mh = yS(10+10); // canvas margins
int rsz = 0, n = 0, dz = 0;
int ow = edl->session->output_w, oh = edl->session->output_h;
for( int i=0; i<zwindows.size(); ++i ) {
int mx = x2 - zw, my = y2 - zh;
if( xx > mx ) xx = mx;
if( yy > my ) yy = my;
- xx += lt + dz; yy += top + dz;
+ xx += lt + xS(dz); yy += top + yS(dz);
zwindow->reposition(xx,yy, ww,hh);
if( zwindow->running() ) {
ZWindowGUI *gui = (ZWindowGUI *)zwindow->get_gui();
#define ILACEASSETMODELISTADD(x) ilacemode_to_text(string, x); \
interlace_asset_modes.append(new InterlacemodeItem(string, x));
-#define ILACEFIXMETHODLISTADD(x) ilacefixmethod_to_text(string, x); \
- interlace_asset_fixmethods.append(new InterlacefixmethodItem(string, x));
-
// Interlacing Modes
ILACEASSETMODELISTADD(ILACE_MODE_UNDETECTED); // Not included in the list for the project options.
ILACEASSETMODELISTADD(ILACE_MODE_NOTINTERLACED);
ILACEPROJECTMODELISTADD(ILACE_MODE_NOTINTERLACED);
- // Interlacing Fixing Methods
- ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_NONE);
- ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_UPONE);
- ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_DOWNONE);
+ mixers_align = new MixersAlign(this);
}
void MWindow::init_indexes()
exportedl = new ExportEDL(this);
}
+void MWindow::init_shuttle()
+{
+#ifdef HAVE_SHUTTLE
+ int ret = Shuttle::probe();
+ if( ret >= 0 ) {
+ shuttle = new Shuttle(this);
+ if( shuttle->read_config_file() > 0 ) {
+ printf("shuttle: bad config file\n");
+ delete shuttle; shuttle = 0;
+ return;
+ }
+ shuttle->start(ret);
+ }
+#endif
+}
+
void MWindow::init_brender()
{
if(preferences->use_brender && !brender)
gui->stop_transport(gui->get_window_lock() ? "MWindow::stop_transport" : 0);
}
+void MWindow::undo_before(const char *description, void *creator)
+{
+ undo->update_undo_before(description, creator);
+}
+
+void MWindow::undo_after(const char *description, uint32_t load_flags, int changes_made)
+{
+ undo->update_undo_after(description, load_flags, changes_made);
+}
+
void MWindow::beep(double freq, double secs, double gain)
{
- if( !proxy_beep ) proxy_beep = new ProxyBeep(this);
- proxy_beep->tone(freq, secs, gain);
+ if( !beeper ) beeper = new Beeper(this);
+ beeper->tone(freq, secs, gain);
}
+Beeper::Beeper(MWindow *mwindow)
+ : Thread(1, 0, 0)
+{
+ this->mwindow = mwindow;
+ audio = new AudioDevice(mwindow);
+ playing_audio = 0;
+ interrupted = -1;
+}
+
+Beeper::~Beeper()
+{
+ stop(0);
+ delete audio;
+}
+
+void Beeper::run()
+{
+ int channels = 2;
+ int64_t bfrsz = BEEP_SAMPLE_RATE;
+ EDL *edl = mwindow->edl;
+ EDLSession *session = edl->session;
+ AudioOutConfig *aconfig = session->playback_config->aconfig;
+ audio->open_output(aconfig, BEEP_SAMPLE_RATE, bfrsz, channels, 0);
+ audio->start_playback();
+
+ double out0[bfrsz], out1[bfrsz], *out[2] = { out0, out1 };
+ const double two_pi = 2*M_PI;
+ int64_t audio_len = BEEP_SAMPLE_RATE * secs;
+ const double dt = two_pi * freq/BEEP_SAMPLE_RATE;
+ double th = 0;
+
+ audio_pos = 0;
+ playing_audio = 1;
+ while( !interrupted ) {
+ int len = audio_len - audio_pos;
+ if( len <= 0 ) break;
+ if( len > bfrsz ) len = bfrsz;
+ int k = audio_pos;
+ for( int i=0; i<len; ++i,++k,th+=dt ) {
+ double t = th - two_pi;
+ if( t >= 0 ) th = t;
+ out0[i] = out1[i] = sin(th) * gain;
+ }
+ audio->write_buffer(out, channels, len);
+ audio_pos = k;
+ }
+
+ if( !interrupted )
+ audio->set_last_buffer();
+ audio->stop_audio(interrupted ? 0 : 1);
+ playing_audio = 0;
+
+ audio->close_all();
+}
+
+void Beeper::start()
+{
+ if( running() ) return;
+ audio_pos = -1;
+ interrupted = 0;
+ Thread::start();
+}
+
+void Beeper::stop(int wait)
+{
+ if( running() && !interrupted ) {
+ interrupted = 1;
+ audio->stop_audio(wait);
+ }
+ Thread::join();
+}
+
+void Beeper::tone(double freq, double secs, double gain)
+{
+ stop(0);
+ this->freq = freq;
+ this->secs = secs;
+ this->gain = gain;
+ start();
+}
+
+
int MWindow::load_filenames(ArrayList<char*> *filenames,
int load_mode,
int update_filename)
gui->lock_window("MWindow::load_filenames 0");
if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
- undo->update_undo_before();
+ undo_before();
if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
sprintf(string, _("Loading %s"), new_asset->path);
gui->show_message(string);
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
ftype = new_file->open_file(preferences, new_asset, 1, 0);
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
result = 1;
switch( ftype ) {
if( new_asset->video_data &&
((new_asset->width % 2) || (new_asset->height % 2)) ) {
char string[BCTEXTLEN];
- sprintf(string, _("%s's resolution is %dx%d.\nImages with odd dimensions may not decode properly."),
+ sprintf(string, _("%s's resolution is %dx%d.\n"
+ "Images with odd dimensions may not decode properly."),
new_asset->path, new_asset->width, new_asset->height);
MainError::show_error(string);
}
case FILE_IS_XML: {
FileXML xml_file;
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
xml_file.read_from_file(filenames->get(i));
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
const char *cin_version = 0;
while( !xml_file.read_tag() ) {
if( xml_file.tag.title_is("EDL") ) {
break;
}
if( strcmp(cin_version, CINELERRA_VERSION) &&
+ strcmp(cin_version, "Unify") &&
strcmp(cin_version, "5.1") ) {
char string[BCTEXTLEN];
snprintf(string, sizeof(string),
EDL *nested_edl = new EDL;
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);
+ int groups = nested_edl->regroup(session->group_number);
+ session->group_number += groups;
new_edl->create_nested(nested_edl);
new_edl->set_path(filenames->get(i));
nested_edl->Garbage::remove_user();
else {
// Load EDL for pasting
new_edl->load_xml(&xml_file, LOAD_ALL);
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
+ int groups = new_edl->regroup(session->group_number);
+ session->group_number += groups;
test_plugins(new_edl, filenames->get(i));
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
if( load_mode == LOADMODE_REPLACE ||
load_mode == LOADMODE_REPLACE_CONCATENATE ) {
// Paste them.
// Don't back up here.
- if(new_edls.size())
- {
+ if( new_edls.size() ) {
// For pasting, clear the active region
- if(load_mode == LOADMODE_PASTE ||
- load_mode == LOADMODE_NESTED)
- {
+ if( load_mode == LOADMODE_PASTE ||
+ load_mode == LOADMODE_NESTED ) {
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
if(!EQUIV(start, end))
- edl->clear(start,
- end,
+ edl->clear(start, end,
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits,
edl->session->autos_follow_edits);
- }
- paste_edls(&new_edls, load_mode, 0, -1,
- edl->session->labels_follow_edits,
- edl->session->plugins_follow_edits,
- edl->session->autos_follow_edits,
- 0); // overwrite
+ paste_edls(&new_edls, load_mode, 0, -1,
+ edl->session->labels_follow_edits,
+ edl->session->plugins_follow_edits,
+ edl->session->autos_follow_edits,
+ 0); // overwrite
+ }
+ else if( load_mode == LOADMODE_NEW_TRACKS )
+ paste_edls(&new_edls, load_mode, 0, -1, 0, 0, 0, 0);
+ else
+ paste_edls(&new_edls, load_mode, 0, -1, 1, 1, 1, 0);
}
-
-
-
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
-
// Add new assets to EDL and schedule assets for index building.
int got_indexes = 0;
for( int i=0; i<new_edls.size(); ++i ) {
}
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
for( int i=0; i<new_assets.size(); ++i ) {
Asset *new_asset = new_assets[i];
edl->assets->update(new_asset);
got_indexes = 1;
}
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
// Start examining next batch of index files
if(got_indexes) mainindexes->start_build();
-if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
// Open plugin GUIs
Track *track = edl->tracks->first;
- while(track)
- {
- for(int j = 0; j < track->plugin_set.size(); j++)
- {
+ while( track ) {
+ for( int j = 0; j < track->plugin_set.size(); j++ ) {
PluginSet *plugins = track->plugin_set[j];
Plugin *plugin = plugins->get_first_plugin();
- while(plugin)
- {
- if(load_mode == LOADMODE_REPLACE ||
- load_mode == LOADMODE_REPLACE_CONCATENATE)
- {
- if(plugin->plugin_type == PLUGIN_STANDALONE &&
- plugin->show)
- {
+ while(plugin) {
+ if( load_mode == LOADMODE_REPLACE ||
+ load_mode == LOADMODE_REPLACE_CONCATENATE ) {
+ if( plugin->plugin_type == PLUGIN_STANDALONE &&
+ plugin->show ) {
show_plugin(plugin);
}
}
edl->local_session->loop_playback = 0;
edl->local_session->set_selectionstart(0);
edl->local_session->set_selectionend(0);
+ edl->local_session->unset_inpoint();
+ edl->local_session-> unset_outpoint();
set_brender_active(0, 0);
fit_selection();
goto_start();
gui->unlock_window(); // to update progress bar
int ret = render_proxy(orig_idxbls);
gui->lock_window("MWindow::load_filenames");
- if( ret >= 0 && edl->session->proxy_beep ) {
+ float gain = edl->session->proxy_beep;
+ if( ret >= 0 && gain > 0 ) {
if( ret > 0 )
- beep(2000., 1.5, 0.5);
+ beep(2000., 1.5, gain);
else
- beep(4000., 0.25, 0.5);
+ beep(4000., 0.25, gain);
}
}
// need to update undo before project, since mwindow is unlocked & a new load
// can begin here. Should really prevent loading until we're done.
if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
- undo->update_undo_after(_("load"), LOAD_ALL);
+ undo_after(_("load"), LOAD_ALL);
for(int i = 0; i < new_edls.size(); i++)
{
Asset *format_asset = new Asset;
format_asset->format = FILE_FFMPEG;
format_asset->load_defaults(defaults, "PROXY_", 1, 1, 0, 0, 0);
- ProxyRender proxy_render(this, format_asset);
int new_scale = edl->session->proxy_scale;
- int use_scaler = edl->session->proxy_use_scaler;
+ ProxyRender proxy_render(this, format_asset, new_scale);
for( int i=0; i<new_idxbls.size(); ++i ) {
Indexable *orig = new_idxbls.get(i);
// render needed proxies
int result = proxy_render.create_needed_proxies(new_scale);
if( !result ) {
- add_proxy(use_scaler,
- &proxy_render.orig_idxbls, &proxy_render.orig_proxies);
+ add_proxy(&proxy_render.orig_idxbls, &proxy_render.orig_proxies);
}
format_asset->remove_user();
return !result ? proxy_render.needed_proxies.size() : -1;
edl->session->proxy_disabled_scale != 1 ) {
int new_scale = edl->session->proxy_disabled_scale;
int new_use_scaler = edl->session->proxy_use_scaler;
- edl->session->proxy_disabled_scale = 1;
Asset *asset = new Asset;
asset->format = FILE_FFMPEG;
asset->load_defaults(defaults, "PROXY_", 1, 1, 0, 0, 0);
ret = to_proxy(asset, new_scale, new_use_scaler);
asset->remove_user();
- if( ret > 0 )
- beep(2000., 1.5, 0.5);
+ if( ret > 0 ) {
+ float gain = edl->session->proxy_beep;
+ beep(2000., 1.5, gain);
+ }
+ edl->session->proxy_disabled_scale = 1;
+ gui->lock_window("MWindow::to_proxy");
+ update_project(LOADMODE_REPLACE);
+ gui->unlock_window();
}
return 1;
}
{
if( edl->session->proxy_scale != 1 &&
edl->session->proxy_disabled_scale == 1 ) {
- int new_scale = 1;
+ int old_scale = edl->session->proxy_scale, new_scale = 1;
int new_use_scaler = edl->session->proxy_use_scaler;
- edl->session->proxy_disabled_scale = edl->session->proxy_scale;
Asset *asset = new Asset;
asset->format = FILE_FFMPEG;
asset->load_defaults(defaults, "PROXY_", 1, 1, 0, 0, 0);
to_proxy(asset, new_scale, new_use_scaler);
asset->remove_user();
+ edl->session->proxy_disabled_scale = old_scale;
+ gui->lock_window("MWindow::to_proxy");
+ update_project(LOADMODE_REPLACE);
+ gui->unlock_window();
}
return 1;
}
edl->Garbage::add_user();
save_backup();
- undo->update_undo_before(_("proxy"), this);
- ProxyRender proxy_render(this, asset);
+ undo_before(_("proxy"), this);
+ int asset_scale = new_scale == 1 ? 0 :
+ !new_use_scaler ? 1 : new_scale;
+ ProxyRender proxy_render(this, asset, asset_scale);
// revert project to original size from current size
// remove all session proxy assets at the at the current proxy_scale
edl->set_proxy(new_scale, new_use_scaler,
&proxy_render.orig_idxbls, &proxy_render.orig_proxies);
- undo->update_undo_after(_("proxy"), LOAD_ALL);
+ undo_after(_("proxy"), LOAD_ALL);
edl->Garbage::remove_user();
restart_brender();
- gui->lock_window("MWindow::to_proxy");
- update_project(LOADMODE_REPLACE);
- gui->unlock_window();
-
return !result ? proxy_render.needed_proxies.size() : -1;
}
init_render();
if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference());
+ init_shuttle();
init_brender();
init_exportedl();
init_commercials();
if(debug) printf("MWindow::create_objects %d total_time=%d\n", __LINE__, (int)timer.get_difference());
- plugin_guis = new ArrayList<PluginServer*>;
+ plugin_guis = new PluginGUIs(this);
dead_plugins = new ArrayList<PluginServer*>;
keyframe_threads = new ArrayList<KeyFrameThread*>;
gui->show_window();
gui->raise_window();
gui->unlock_window();
-
+ cwindow->gui->lock_window("MWindow::create_objects 1");
+ cwindow->gui->tool_panel->raise_tool();
+ cwindow->gui->unlock_window();
if(debug) PRINT_TRACE
if(preferences->use_tipwindow)
BC_WindowBase::get_resources()->vframe_shm = 1;
}
+int MWindow::uses_opengl()
+{
+ if( !playback_3d || !playback_3d->running() ) return 0;
+ PlaybackConfig *playback_config = edl->session->playback_config;
+ return playback_config->vconfig->driver == PLAYBACK_X11_GL ? 1 : 0;
+}
void MWindow::show_splash()
{
gui->mainmenu->show_lwindow->set_checked(1);
}
+void MWindow::restore_windows()
+{
+ if( !session->show_vwindow ) {
+ for( int i=0, n=vwindows.size(); i<n; ++i ) {
+ VWindow *vwindow = vwindows[i];
+ if( !vwindow || !vwindow->is_running() ) continue;
+ vwindow->gui->lock_window("MWindow::restore_windows");
+ vwindow->gui->close(1);
+ vwindow->gui->unlock_window();
+ }
+ }
+ else
+ show_vwindow();
+
+ if( !session->show_awindow && !awindow->gui->is_hidden() ) {
+ awindow->gui->lock_window("MWindow::restore_windows");
+ awindow->gui->close_event();
+ awindow->gui->unlock_window();
+ }
+ else if( session->show_awindow && awindow->gui->is_hidden() )
+ show_awindow();
+
+ if( !session->show_cwindow && !cwindow->gui->is_hidden() ) {
+ cwindow->gui->lock_window("MWindow::restore_windows");
+ cwindow->hide_window();
+ cwindow->gui->unlock_window();
+ }
+ else if( session->show_cwindow && cwindow->gui->is_hidden() )
+ cwindow->show_window();
+
+ if( !session->show_gwindow && !gwindow->gui->is_hidden() ) {
+ gwindow->gui->lock_window("MWindow::restore_windows");
+ gwindow->gui->close_event();
+ gwindow->gui->unlock_window();
+ }
+ else if( session->show_gwindow && gwindow->gui->is_hidden() )
+ show_gwindow();
+
+ if( !session->show_lwindow && !lwindow->gui->is_hidden() ) {
+ lwindow->gui->lock_window("MWindow::restore_windows");
+ lwindow->gui->close_event();
+ lwindow->gui->unlock_window();
+ }
+ else if( session->show_lwindow && lwindow->gui->is_hidden() )
+ show_lwindow();
+
+ gui->focus();
+}
+
+void MWindow::load_layout(const char *layout)
+{
+ char path[BCTEXTLEN];
+ snprintf(path, sizeof(path), "%s/%s", File::get_config_path(), layout);
+ session->load_file(path);
+ restore_windows();
+ gui->default_positions();
+ save_defaults();
+}
+
+void MWindow::save_layout(const char *layout)
+{
+ char path[BCTEXTLEN];
+ snprintf(path, sizeof(path), "%s/%s", File::get_config_path(), layout);
+ session->save_file(path);
+}
+
+void MWindow::delete_layout(const char *layout)
+{
+ char path[BCTEXTLEN];
+ snprintf(path, sizeof(path), "%s/%s", File::get_config_path(), layout);
+ unlink(path);
+}
+
int MWindow::tile_windows(int window_config)
{
int need_reload = 0;
screens = value;
}
-void MWindow::set_auto_keyframes(int value, int lock_mwindow, int lock_cwindow)
+void MWindow::set_auto_keyframes(int value)
{
- if(lock_mwindow) gui->lock_window("MWindow::set_auto_keyframes");
edl->session->auto_keyframes = value;
gui->mbuttons->edit_panel->keyframe->update(value);
gui->flush();
- if(lock_mwindow) gui->unlock_window();
-
- if(lock_cwindow) cwindow->gui->lock_window("MWindow::set_auto_keyframes");
+ cwindow->gui->lock_window("MWindow::set_auto_keyframes");
cwindow->gui->edit_panel->keyframe->update(value);
cwindow->gui->flush();
- if(lock_cwindow) cwindow->gui->unlock_window();
+ cwindow->gui->unlock_window();
+}
+
+void MWindow::set_span_keyframes(int value)
+{
+ edl->session->span_keyframes = value;
+ 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();
}
void MWindow::set_auto_visibility(Autos *autos, int value)
else
return;
- gui->update(0, 1, 0, 0, 0, 0, 0);
+ gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
gui->mainmenu->update_toggles(1);
gui->unlock_window();
gwindow->gui->update_toggles(1);
gui->unlock_window();
}
-int MWindow::set_editing_mode(int new_editing_mode, int lock_mwindow, int lock_cwindow)
+int MWindow::set_editing_mode(int new_editing_mode)
{
- if(lock_mwindow) gui->lock_window("MWindow::set_editing_mode");
edl->session->editing_mode = new_editing_mode;
gui->mbuttons->edit_panel->editing_mode = edl->session->editing_mode;
gui->mbuttons->edit_panel->update();
gui->set_editing_mode(1);
- if(lock_mwindow) gui->unlock_window();
-
- if(lock_cwindow) cwindow->gui->lock_window("MWindow::set_editing_mode");
+ cwindow->gui->lock_window("MWindow::set_editing_mode");
cwindow->gui->edit_panel->update();
cwindow->gui->edit_panel->editing_mode = edl->session->editing_mode;
- if(lock_cwindow) cwindow->gui->unlock_window();
+ cwindow->gui->unlock_window();
return 0;
}
{
int mode = edl->session->editing_mode;
if( mode == EDITING_ARROW )
- set_editing_mode(EDITING_IBEAM, 0, 1);
+ set_editing_mode(EDITING_IBEAM);
else
- set_editing_mode(EDITING_ARROW, 0, 1);
+ set_editing_mode(EDITING_ARROW);
}
void MWindow::toggle_camera_xyz()
void MWindow::set_labels_follow_edits(int value)
{
- gui->lock_window("MWindow::set_labels_follow_edits");
edl->session->labels_follow_edits = value;
gui->mbuttons->edit_panel->locklabels->update(value);
gui->mainmenu->labels_follow_edits->set_checked(value);
gui->flush();
- gui->unlock_window();
}
void MWindow::sync_parameters(int change_type)
if( in_destructor ) return;
// Sync engines which are playing back
- if(cwindow->playback_engine->is_playing_back)
- {
- if(change_type == CHANGE_PARAMS)
- {
+ if( cwindow->playback_engine->is_playing_back ) {
+ if( change_type == CHANGE_PARAMS ) {
// TODO: block keyframes until synchronization is done
cwindow->playback_engine->sync_parameters(edl);
}
- else
+ else {
// Stop and restart
- {
int command = cwindow->playback_engine->command->command;
- cwindow->playback_engine->que->send_command(STOP,
- CHANGE_NONE,
- 0,
- 0);
// Waiting for tracking to finish would make the restart position more
// accurate but it can't lock the window to stop tracking for some reason.
// Not waiting for tracking gives a faster response but restart position is
// only as accurate as the last tracking update.
- cwindow->playback_engine->interrupt_playback(0);
- cwindow->playback_engine->que->send_command(command,
- change_type,
- edl,
- 1,
- 0);
+ cwindow->playback_engine->transport_stop(0);
+ cwindow->playback_engine->next_command->realtime = 1;
+ cwindow->playback_engine->transport_command(command, change_type, edl, 0);
}
}
- else
- {
+ else {
cwindow->refresh_frame(change_type);
}
}
}
-
-
-
void MWindow::show_plugin(Plugin *plugin)
{
int done = 0;
}
}
plugin_gui_lock->unlock();
+// update show/gui_id
+ sync_parameters(CHANGE_PARAMS);
//printf("MWindow::show_plugin %d\n", __LINE__);
SET_TRACE
//sleep(1);
plugin->show = 0;
// Update the toggle
gui->lock_window("MWindow::hide_plugin");
- gui->update(0, 1, 0, 0, 0, 0, 0);
+ gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
gui->unlock_window();
if(lock) plugin_gui_lock->lock("MWindow::hide_plugin");
}
}
if(lock) plugin_gui_lock->unlock();
+// update show/gui_id
+ sync_parameters(CHANGE_PARAMS);
}
void MWindow::delete_plugin(PluginServer *plugin)
keyframe_gui_lock->unlock();
}
+int MWindow::get_hash_color(Edit *edit)
+{
+ Indexable *idxbl = edit->asset ?
+ (Indexable*)edit->asset : (Indexable*)edit->nested_edl;
+ if( !idxbl ) return 0;
+ char path[BCTEXTLEN];
+ if( !edit->asset || edit->track->data_type != TRACK_VIDEO ||
+ edl->session->proxy_scale == 1 ||
+ ProxyRender::from_proxy_path(path, idxbl, edl->session->proxy_scale) )
+ strcpy(path, idxbl->path);
+ char *cp = strrchr(path, '/');
+ cp = !cp ? path : cp+1;
+ uint8_t *bp = (uint8_t*)cp;
+ int v = 0;
+ while( *bp ) v += *bp++;
+ return get_hash_color(v);
+}
+
+int MWindow::get_hash_color(int v)
+{
+ int hash = 0x303030;
+ if( v & 0x01 ) hash ^= 0x000040;
+ if( v & 0x02 ) hash ^= 0x004000;
+ if( v & 0x04 ) hash ^= 0x400000;
+ if( v & 0x08 ) hash ^= 0x080000;
+ if( v & 0x10 ) hash ^= 0x000800;
+ if( v & 0x20 ) hash ^= 0x000008;
+ if( v & 0x40 ) hash ^= 0x404040;
+ if( v & 0x80 ) hash ^= 0x080808;
+ return hash;
+}
+
+int MWindow::get_group_color(int v)
+{
+ int color = 0x606060;
+ if( v & 0x01 ) color ^= 0x000080;
+ if( v & 0x02 ) color ^= 0x008000;
+ if( v & 0x04 ) color ^= 0x800000;
+ if( v & 0x08 ) color ^= 0x100000;
+ if( v & 0x10 ) color ^= 0x001000;
+ if( v & 0x20 ) color ^= 0x000010;
+ if( v & 0x40 ) color ^= 0x080808;
+ if( v & 0x80 ) color ^= 0x909090;
+ return color;
+}
+
+int MWindow::get_title_color(Edit *edit)
+{
+ unsigned color = edit->color & 0xffffff;
+ unsigned alpha = (~edit->color>>24) & 0xff;
+ if( !color ) {
+ if( edit->group_id )
+ color = get_group_color(edit->group_id);
+ else if( preferences->autocolor_assets )
+ color = get_hash_color(edit);
+ else
+ return 0;
+ }
+ if( alpha == 0xff )
+ alpha = session->title_bar_alpha*255;
+ return color | (~alpha<<24);
+}
+
void MWindow::update_keyframe_guis()
{
// Send new configuration to keyframe GUI's
}
if(!got_it) plugin->show = 0;
-
plugin = (Plugin*)plugin->next;
}
}
if(do_keyframe_guis) update_keyframe_guis();
}
-int MWindow::plugin_gui_open(Plugin *plugin)
+void MWindow::stop_plugin_guis()
{
- int result = 0;
- plugin_gui_lock->lock("MWindow::plugin_gui_open");
- for(int i = 0; i < plugin_guis->total; i++)
- {
- if(plugin_guis->get(i)->plugin->identical_location(plugin))
- {
- result = 1;
- break;
+// Send new configuration to plugin GUI's
+ plugin_gui_lock->lock("MWindow::stop_plugin_guis");
+
+ for( int i=0; i<plugin_guis->size(); ++i ) {
+ PluginServer *ptr = plugin_guis->get(i);
+ if( edl->tracks->plugin_exists(ptr->plugin) ) {
+ ptr->render_stop();
}
}
+ plugin_gui_lock->unlock();
+}
+
+int MWindow::plugin_gui_open(Plugin *plugin)
+{
+ int gui_id = plugin->gui_id;
+ if( gui_id < 0 ) return 0;
+ plugin_gui_lock->lock("MWindow::plugin_gui_open");
+ PluginServer *plugin_server = plugin_guis->gui_server(gui_id);
+ int result = plugin_server ? 1 : 0;
plugin_gui_lock->unlock();
return result;
}
+
void MWindow::render_plugin_gui(void *data, Plugin *plugin)
{
- plugin_gui_lock->lock("MWindow::render_plugin_gui");
- for(int i = 0; i < plugin_guis->total; i++)
- {
- if(plugin_guis->get(i)->plugin->identical_location(plugin))
- {
- plugin_guis->get(i)->render_gui(data);
- break;
- }
- }
+ int gui_id = plugin->gui_id;
+ if( gui_id < 0 ) return;
+ plugin_gui_lock->lock("MWindow::render_plugin_gui 0");
+ PluginServer *plugin_server = plugin_guis->gui_server(gui_id);
+ if( plugin_server )
+ plugin_server->render_gui(data);
plugin_gui_lock->unlock();
}
void MWindow::render_plugin_gui(void *data, int size, Plugin *plugin)
{
- plugin_gui_lock->lock("MWindow::render_plugin_gui");
- for(int i = 0; i < plugin_guis->total; i++)
- {
- if(plugin_guis->get(i)->plugin->identical_location(plugin))
- {
- plugin_guis->get(i)->render_gui(data, size);
- break;
- }
- }
+ int gui_id = plugin->gui_id;
+ if( gui_id < 0 ) return;
+ plugin_gui_lock->lock("MWindow::render_plugin_gui 1");
+ PluginServer *plugin_server = plugin_guis->gui_server(gui_id);
+ if( plugin_server )
+ plugin_server->render_gui(data, size);
plugin_gui_lock->unlock();
}
+void MWindow::reset_plugin_gui_frames(Plugin *plugin)
+{
+ int gui_id = plugin->gui_id;
+ if( gui_id < 0 ) return;
+ plugin_gui_lock->lock("MWindow::reset_plugin_gui_frames");
+ PluginServer *plugin_server = plugin_guis->gui_server(gui_id);
+ if( plugin_server )
+ plugin_server->reset_plugin_gui_frames();
+ plugin_gui_lock->unlock();
+}
+
+void MWindow::render_plugin_gui_frames(PluginClientFrames *frames, Plugin *plugin)
+{
+ int gui_id = plugin->gui_id;
+ if( gui_id < 0 ) return;
+ plugin_gui_lock->lock("MWindow::render_plugin_gui_frames");
+ PluginServer *plugin_server = plugin_guis->gui_server(gui_id);
+ if( plugin_server )
+ plugin_server->render_plugin_gui_frames(frames);
+ plugin_gui_lock->unlock();
+}
+
+double MWindow::get_tracking_position()
+{
+ return edl->local_session->get_selectionstart(1);
+}
+
+int MWindow::get_tracking_direction()
+{
+ return cwindow->playback_engine->get_direction();
+}
void MWindow::update_plugin_states()
{
//printf("MWindow::asset_to_edl 4 %s\n", string);
if(debug) printf("MWindow::asset_to_edl %d\n", __LINE__);
+ new_edl->local_session->asset2edl = 1;
return 0;
}
gui->load_panes();
}
- gui->update(1, 1, 1, 1, 1, 1, 1);
+ gui->update(1, NORMAL_DRAW, 1, 1, 1, 1, 1);
if(debug) PRINT_TRACE
gui->unlock_window();
init_brender();
- cwindow->gui->lock_window("MWindow::update_project 1");
cwindow->update(0, 0, 1, 1, 1);
- cwindow->gui->unlock_window();
if(debug) PRINT_TRACE
zwindow->set_title(mixer->title);
zwindow->start();
}
+ cwindow->gui->canvas->set_zoom(edl, 0);
}
update_vwindow();
if(debug) PRINT_TRACE
cwindow->gui->lock_window("MWindow::update_project 2");
cwindow->gui->timebar->update(0);
+ Track *track = cwindow->calculate_affected_track();
+ cwindow->mask_track_id = track ? track->get_id() : -1;
+ cwindow->gui->tool_panel->raise_tool();
+ cwindow->gui->update_canvas(0);
cwindow->gui->unlock_window();
if(debug) PRINT_TRACE
if(debug) PRINT_TRACE
}
+void MWindow::stack_push(EDL *new_edl)
+{
+// needs gui lock
+ gui->lock_window("MWindow::stack_push");
+ if( stack.size() < 9 ) {
+ save_backup();
+ undo_before();
+ StackItem &item = stack.append();
+ item.edl = edl;
+ item.new_edl = new_edl;
+ item.undo = undo;
+ edl = new_edl;
+ edl->add_user();
+ strcpy(session->filename, edl->path);
+ undo = new MainUndo(this);
+ gui->stack_button->update();
+ update_project(LOADMODE_REPLACE);
+ }
+ gui->unlock_window();
+}
+
+void MWindow::stack_pop()
+{
+ if( !stack.size() ) return;
+// writes on config_path/backup%d.xml
+ save_backup();
+// already have gui lock
+ forget_nested_edl(edl);
+ StackItem &item = stack.last();
+// session edl replaced, overwrite and save clip data
+ if( item.new_edl != edl )
+ item.new_edl->overwrite_clip(edl);
+ edl->remove_user();
+ edl = item.edl;
+ delete undo;
+ undo = item.undo;
+ stack.remove();
+ strcpy(session->filename, edl->path);
+ update_project(LOADMODE_REPLACE);
+ undo_after(_("open edl"), LOAD_ALL);
+ gui->stack_button->update();
+}
+
+void MWindow::forget_nested_edl(EDL *nested)
+{
+ frame_cache->remove_item(nested);
+ wave_cache->remove_item(nested);
+ if( gui->render_engine &&
+ gui->render_engine_id == nested->id ) {
+ delete gui->render_engine;
+ gui->render_engine = 0;
+ }
+ if( gui->resource_thread->render_engine_id == nested->id ) {
+ gui->resource_thread->render_engine_id = -1;
+ delete gui->resource_thread->render_engine;
+ gui->resource_thread->render_engine = 0;
+ }
+}
+
+void MWindow::clip_to_media()
+{
+ if( edl->session->proxy_scale != 1 ) {
+ eprintf("Nesting not allowed when proxy scale != 1");
+ return;
+ }
+ undo_before();
+ int clips_total = session->drag_clips->total;
+ for( int i=0; i<clips_total; ++i ) {
+ EDL *clip = session->drag_clips->values[i];
+ time_t dt; time(&dt);
+ struct tm dtm; localtime_r(&dt, &dtm);
+ char path[BCTEXTLEN], *cp = path, *ep = cp+sizeof(path)-1;
+// path_basename = "Nested_<date>-<time>_<basename>"
+ cp += snprintf(cp, ep-cp, _("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);
+ char *bp = strrchr(clip->local_session->clip_title, '/');
+ bp = bp ? bp+1 : clip->local_session->clip_title;
+ cp += snprintf(cp, ep-cp, "%s", bp);
+ EDL *nested = edl->new_nested_edl(clip, path);
+ edl->clips.remove(clip);
+ clip->remove_user();
+ mainindexes->add_next_asset(0, nested);
+ }
+ undo_after(_("clip2media"), LOAD_ALL);
+ mainindexes->start_build();
+ awindow->gui->async_update_assets();
+}
+
+void MWindow::media_to_clip()
+{
+ undo_before();
+ int assets_total = session->drag_assets->total;
+ for( int i=0; i<assets_total; ++i ) {
+ Indexable *idxbl = session->drag_assets->values[i];
+ if( idxbl->is_asset ) {
+ eprintf(_("media is not EDL:\n%s"), idxbl->path);
+ continue;
+ }
+ char clip_title[BCSTRLEN];
+ int name_ok = 0;
+ while( !name_ok ) {
+ name_ok = 1;
+ sprintf(clip_title, _("Clip %d"), session->clip_number++);
+ for( int i=0; name_ok && i<edl->clips.size(); ++i ) {
+ char *title = edl->clips[i]->local_session->clip_title;
+ if( !strcasecmp(clip_title, title) ) name_ok = 0;
+ }
+ }
+ EDL *nested = (EDL *)idxbl;
+ EDL *clip = edl->add_clip(nested);
+ strcpy(clip->local_session->clip_title, clip_title);
+ snprintf(clip->local_session->clip_notes,
+ sizeof(clip->local_session->clip_notes),
+ _("From: %s"), nested->path);
+ }
+ undo_after(_("media2clip"), LOAD_ALL);
+ awindow->gui->async_update_assets();
+}
+
+void MWindow::update_preferences(Preferences *prefs)
+{
+ if( prefs != preferences )
+ preferences->copy_from(prefs);
+ if( cwindow->playback_engine )
+ cwindow->playback_engine->preferences->copy_from(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);
+ }
+ 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);
+ }
+}
+
void MWindow::update_vwindow()
{
for( int i=0; i<vwindows.size(); ++i ) {
//printf("MWindow::rebuild_indices 1 %s\n", indexable->path);
remove_indexfile(indexable);
// Schedule index build
- IndexState *index_state = indexable->index_state;
- index_state->index_status = INDEX_NOTTESTED;
+ indexable->index_state->remove_user();
+ indexable->index_state = new IndexState;
+ IndexFile::delete_index_files(preferences, indexable);
if( indexable->is_asset ) {
Asset *asset = (Asset *)indexable;
if( asset->format != FILE_PCM ) {
}
mainindexes->add_next_asset(0, indexable);
}
+// still in render engine
+ sync_parameters(CHANGE_ALL);
+ awindow->gui->async_update_assets();
mainindexes->start_build();
}
+void MWindow::get_backup_path(char *path, int len)
+{
+ char *cp = path, *ep = cp + len-1;
+ cp += snprintf(cp, ep-cp, "%s/", File::get_config_path());
+ int idx = stack.size();
+ cp += snprintf(cp, ep-cp, idx ? BACKUPn_FILE : BACKUP_FILE, idx);
+}
+
void MWindow::save_backup()
{
FileXML file;
edl->optimize();
edl->set_path(session->filename);
+
char backup_path[BCTEXTLEN], backup_path1[BCTEXTLEN];
- snprintf(backup_path, sizeof(backup_path), "%s/%s",
- File::get_config_path(), BACKUP_FILE);
snprintf(backup_path1, sizeof(backup_path1), "%s/%s",
File::get_config_path(), BACKUP_FILE1);
+ get_backup_path(backup_path, sizeof(backup_path));
rename(backup_path, backup_path1);
edl->save_xml(&file, backup_path);
file.terminate_string();
FileSystem fs;
fs.complete_path(backup_path);
- if(file.write_to_file(backup_path))
- {
+ if(file.write_to_file(backup_path)) {
char string2[256];
sprintf(string2, _("Couldn't open %s for writing."), backup_path);
gui->show_message(string2);
path_list.set_array_delete();
char *out_path;
char backup_path[BCTEXTLEN];
- snprintf(backup_path, sizeof(backup_path), "%s/%s",
- File::get_config_path(), BACKUP_FILE);
+ get_backup_path(backup_path, sizeof(backup_path));
FileSystem fs;
fs.complete_path(backup_path);
void MWindow::save_undo_data()
{
- undo->update_undo_before();
- undo->update_undo_after(_("perpetual session"), LOAD_ALL);
+ undo_before();
+ undo_after(_("perpetual session"), LOAD_ALL);
char perpetual_path[BCTEXTLEN];
snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s",
File::get_config_path(), PERPETUAL_FILE);
if( vwindow->playback_engine->video_cache )
vwindow->playback_engine->video_cache->delete_entry(asset);
}
+ for(int i = 0; i < zwindows.size(); i++) {
+ ZWindow *zwindow = zwindows[i];
+ if( !zwindow->is_running() ) continue;
+ if( zwindow->zgui->playback_engine->audio_cache )
+ zwindow->zgui->playback_engine->audio_cache->delete_entry(asset);
+ if( zwindow->zgui->playback_engine->video_cache )
+ zwindow->zgui->playback_engine->video_cache->delete_entry(asset);
+ }
}
-
-void MWindow::remove_assets_from_project(int push_undo, int redraw,
+void MWindow::remove_assets_from_project(int push_undo, int redraw, int delete_indexes,
ArrayList<Indexable*> *drag_assets, ArrayList<EDL*> *drag_clips)
{
- for(int i = 0; i < drag_assets->total; i++) {
- Indexable *indexable = drag_assets->get(i);
- if(indexable->is_asset) remove_asset_from_caches((Asset*)indexable);
- }
+ awindow->gui->close_view_popup();
// Remove from VWindow.
- for(int i = 0; i < session->drag_clips->total; i++) {
- for(int j = 0; j < vwindows.size(); j++) {
- VWindow *vwindow = vwindows[j];
- if( !vwindow->is_running() ) continue;
- if(session->drag_clips->get(i) == vwindow->get_edl()) {
- vwindow->gui->lock_window("MWindow::remove_assets_from_project 1");
- vwindow->delete_source(1, 1);
- vwindow->gui->unlock_window();
+ if( drag_clips ) {
+ for(int i = 0; i < drag_clips->total; i++) {
+ for(int j = 0; j < vwindows.size(); j++) {
+ VWindow *vwindow = vwindows[j];
+ if( !vwindow->is_running() ) continue;
+ if(drag_clips->get(i) == vwindow->get_edl()) {
+ vwindow->gui->lock_window("MWindow::remove_assets_from_project 1");
+ vwindow->delete_source(1, 1);
+ vwindow->gui->unlock_window();
+ }
}
}
}
- for(int i = 0; i < drag_assets->size(); i++) {
- for(int j = 0; j < vwindows.size(); j++) {
- VWindow *vwindow = vwindows[j];
- if( !vwindow->is_running() ) continue;
- if(drag_assets->get(i) == vwindow->get_source()) {
- vwindow->gui->lock_window("MWindow::remove_assets_from_project 2");
- vwindow->delete_source(1, 1);
- vwindow->gui->unlock_window();
+ if( drag_assets ) {
+ for(int i = 0; i < drag_assets->size(); i++) {
+ for(int j = 0; j < vwindows.size(); j++) {
+ VWindow *vwindow = vwindows[j];
+ if( !vwindow->is_running() ) continue;
+ if(drag_assets->get(i) == vwindow->get_source()) {
+ vwindow->gui->lock_window("MWindow::remove_assets_from_project 2");
+ vwindow->delete_source(1, 1);
+ vwindow->gui->unlock_window();
+ }
}
}
- }
- for(int i = 0; i < drag_assets->size(); i++) {
- Indexable *indexable = drag_assets->get(i);
- remove_indexfile(indexable);
+ for(int i = 0; i < drag_assets->total; i++) {
+ Indexable *indexable = drag_assets->get(i);
+ if(indexable->is_asset) remove_asset_from_caches((Asset*)indexable);
+ }
+
+ if( delete_indexes ) {
+ for(int i = 0; i < drag_assets->size(); i++) {
+ Indexable *indexable = drag_assets->get(i);
+ remove_indexfile(indexable);
+ }
+ }
}
//printf("MWindow::rebuild_indices 1 %s\n", indexable->path);
- if(push_undo) undo->update_undo_before();
+ if(push_undo) undo_before();
if(drag_assets) edl->remove_from_project(drag_assets);
if(drag_clips) edl->remove_from_project(drag_clips);
if(redraw) save_backup();
- if(push_undo) undo->update_undo_after(_("remove assets"), LOAD_ALL);
+ if(push_undo) undo_after(_("remove assets"), LOAD_ALL);
if(redraw) {
restart_brender();
gui->lock_window("MWindow::remove_assets_from_project 3");
- gui->update(1, 1, 1, 1, 0, 1, 0);
+ gui->update(1, NORMAL_DRAW, 1, 1, 0, 1, 0);
gui->unlock_window();
// Removes from playback here
void MWindow::remove_assets_from_disk()
{
+ remove_assets_from_project(1, 1, 1,
+ session->drag_assets, session->drag_clips);
+
// Remove from disk
for(int i = 0; i < session->drag_assets->total; i++)
{
remove(session->drag_assets->get(i)->path);
}
-
- remove_assets_from_project(1,
- 1,
- session->drag_assets,
- session->drag_clips);
}
void MWindow::dump_plugins(FILE *fp)
// Update GUIs
restart_brender();
gui->lock_window("MWindow::resync_guis");
- gui->update(1, 1, 1, 1, 1, 1, 0);
+ gui->update(1, NORMAL_DRAW, 1, 1, 1, 1, 0);
gui->unlock_window();
cwindow->gui->lock_window("MWindow::resync_guis");
lwindow->gui->panel->set_meters(channels, 1);
lwindow->gui->flush();
lwindow->gui->unlock_window();
-
+#ifdef GLx4
// Warn user
if(((edl->session->output_w % 4) ||
(edl->session->output_h % 4)) &&
_("This project's dimensions are not multiples of 4 so\n"
"it can't be rendered by OpenGL."));
}
-
+#endif
// Flash frame
sync_parameters(CHANGE_ALL);
session->auto_keyframes = 0;
int result = file->open_file(preferences, asset, 1, 0);
if( !result && delete_tracks > 0 )
- undo->update_undo_before();
+ undo_before();
int video_layers = asset->get_video_layers();
if( !result && asset->video_data && vstream < video_layers ) {
// try to get asset up to date, may fail
double framerate = asset->get_frame_rate();
int width = asset->get_w();
int height = asset->get_h();
+#ifdef GLx4
// must be multiple of 4 for opengl
width = (width+3) & ~3; height = (height+3) & ~3;
+#endif
int driver = session->playback_config->vconfig->driver;
int color_model = file->get_best_colormodel(asset, driver);
// color_model = BC_CModels::is_yuv(color_model) ?
session->auto_keyframes = old_auto_keyframes;
if( !result && delete_tracks > 0 ) {
save_backup();
- undo->update_undo_after(_("select asset"), LOAD_ALL);
+ undo_after(_("select asset"), LOAD_ALL);
}
resync_guis();
return result;